Decentralized, Byzantine-robust swarm learning.
Thousands of tiny models each learn from their own local data and gossip knowledge peer-to-peer over a real P2P network. No central server. No gradient sharing. No raw data ever leaves the device — and the swarm keeps converging even while malicious nodes try to poison it.
AGPL-3.0 · Python 3.10+ · v0.1 (research prototype) · 81 tests passing
Federated learning that averages neural-net weights is fragile and usually needs a central coordinator. swarmint removes both: order-invariant prototype merging eliminates the averaging problem, and gossip over a DHT eliminates the coordinator.
Each node sees only a slice of the classes; gossip pools them so every node approaches full-task accuracy — validated on synthetic and two real datasets.
| Setting | Solo baseline | Swarm | Notes |
|---|---|---|---|
| Synthetic · 100 nodes · 5% malicious | 0.20 | 0.96 | stable, Byzantine-robust |
| Real digits · 10-class | 0.20 | 0.78 → 0.88 | 0.88 with a shared genesis embedding |
| Real faces · 40-class, few-shot | 0.05 | 0.51 | 10× solo on a brutal dataset |
| Distributed inference · 30% liars | 0.20 | 0.79 | mixture-of-experts across peers |
Centralized full-nearest-neighbor ceilings are 0.93 (digits) / 0.83 (faces) — the swarm reaches these while staying decentralized and poison-resistant.
Push-based prototype gossip with corroboration — each node learns classes it never saw locally, pooled from the swarm.
Reputation + merge-rollback + majority corroboration. Poisoned updates are rejected; attackers' trust collapses.
UDP transport, Kademlia DHT discovery, peer-exchange, Ed25519-signed messages with replay protection, and NAT hole-punching.
Trust-weighted mixture-of-experts: a node answers queries about classes it never learned by consulting the swarm.
Each node keeps a signed, append-only hash-chain of its model checkpoints — auditable and non-repudiable, no consensus required.
Encoder-free late fusion across modalities, plus an optional shared genesis embedding that lifts accuracy toward centralized.
Runs on numpy alone. See gossip beat solo in one command.
# install (core is numpy-only; extras add real P2P + real-data validation) git clone https://github.com/shaswata56/swarmint cd swarmint && pip install -e ".[dev]" # smallest end-to-end: specialists gossip into a full-task model python examples/quickstart.py # each node sees only 2 of 6 classes (solo ceiling ~ 0.33) # solo node (no gossip) : 0.333 # swarm node (gossip) : 0.855 # real data, and real UDP + DHT across OS processes python -m swarmint.sim.run_digits python -m swarmint.sim.run_multiproc