Connectome-inspired sparse SNN: MNIST (96.83%) + Fashion-MNIST (87.07%) checkpoints, ~2 orders lower energy
Browse files- README.md +107 -0
- sparse_snn_fashion.pt +3 -0
- sparse_snn_mnist.pt +3 -0
- train_results.json +16 -0
README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- spiking-neural-network
|
| 4 |
+
- snn
|
| 5 |
+
- sparse
|
| 6 |
+
- brain-inspired
|
| 7 |
+
- connectome
|
| 8 |
+
- drosophila
|
| 9 |
+
- mnist
|
| 10 |
+
- fashion-mnist
|
| 11 |
+
- image-classification
|
| 12 |
+
- awareliquid
|
| 13 |
+
pipeline_tag: image-classification
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Sparse-SNN — connectome-inspired sparse spiking networks
|
| 17 |
+
|
| 18 |
+
**Sparse spiking neural networks whose structural masks are derived from the
|
| 19 |
+
statistical laws of the real *Drosophila* connectome** — matching dense MLP
|
| 20 |
+
accuracy at ~2 orders of magnitude lower energy.
|
| 21 |
+
|
| 22 |
+
Two trained classifiers: MNIST and Fashion-MNIST. Architecture: `784 → 800 → 10`
|
| 23 |
+
with 5% connection density, LIF neurons and surrogate-gradient training
|
| 24 |
+
(straight-through estimator with sigmoid gradient).
|
| 25 |
+
|
| 26 |
+
## Files
|
| 27 |
+
|
| 28 |
+
| File | Description |
|
| 29 |
+
|---|---|
|
| 30 |
+
| `sparse_snn_mnist.pt` | MNIST checkpoint — **96.83%** test accuracy (firing rate 7.9%) |
|
| 31 |
+
| `sparse_snn_fashion.pt` | Fashion-MNIST checkpoint — **87.07%** test accuracy (firing rate 8.2%) |
|
| 32 |
+
| `train_results.json` | Raw metrics from the training runs |
|
| 33 |
+
|
| 34 |
+
Each checkpoint contains the `state_dict` (weights + mask buffer), the E/I sign
|
| 35 |
+
matrix, the full config, and metrics.
|
| 36 |
+
|
| 37 |
+
## Measured results (these checkpoints)
|
| 38 |
+
|
| 39 |
+
| Task | Dense MLP (documented) | Sparse SNN (this checkpoint) | Gap | Energy saving* |
|
| 40 |
+
|---|---|---|---|---|
|
| 41 |
+
| MNIST | 98.32% | **96.83%** | 1.5 pts | **~112×** |
|
| 42 |
+
| Fashion-MNIST | 87.56% | **87.07%** | 0.5 pts | **~107×** |
|
| 43 |
+
|
| 44 |
+
\* Energy estimate using the repository's 45nm CMOS model (Horowitz 2014:
|
| 45 |
+
MAC = 3.7 pJ, addition = 0.9 pJ) with this checkpoint's measured firing rate —
|
| 46 |
+
event-driven spike ops are additions only. This is a **model-based estimate,
|
| 47 |
+
not measured on hardware**. The project's documented headline range across runs
|
| 48 |
+
is 105–106×.
|
| 49 |
+
|
| 50 |
+
## What the research found (and disproved)
|
| 51 |
+
|
| 52 |
+
1. **Disproved**: the MaleCNS connectome topology as a *static* structure
|
| 53 |
+
carries **no measurable advantage** over random / structured-sparse graphs
|
| 54 |
+
(5 experiments: classification, temporal, robustness, sample-efficiency,
|
| 55 |
+
plasticity — all indistinguishable).
|
| 56 |
+
2. **Extracted** — the topology's *statistical laws* that DO matter:
|
| 57 |
+
sparsity **0.09%**, long-tail degree distribution (scale-free, max/mean ≈ 75),
|
| 58 |
+
strong small-worldness (clustering 6.65× random, path length 2.39),
|
| 59 |
+
**E/I ratio 60/40**.
|
| 60 |
+
3. **Built**: a trainable sparse SNN from these laws → near-lossless accuracy
|
| 61 |
+
at ~105–112× energy savings.
|
| 62 |
+
|
| 63 |
+
## Usage
|
| 64 |
+
|
| 65 |
+
Requires the model code from the repository (the class is small and
|
| 66 |
+
self-contained):
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
import torch
|
| 70 |
+
from sparse_snn import SparseSNN # github.com/AwareLiquid/human-brain-simulation
|
| 71 |
+
|
| 72 |
+
ckpt = torch.load("sparse_snn_mnist.pt", map_location="cpu", weights_only=False)
|
| 73 |
+
cfg = ckpt["config"]
|
| 74 |
+
model = SparseSNN(cfg["in_dim"], cfg["hid_dim"], cfg["out_dim"],
|
| 75 |
+
ckpt["state_dict"]["mask"], ckpt["sign"],
|
| 76 |
+
T=cfg["T"], decay=cfg["decay"], threshold=cfg["threshold"])
|
| 77 |
+
model.load_state_dict(ckpt["state_dict"])
|
| 78 |
+
model.eval()
|
| 79 |
+
# inputs: flattened 28x28 grayscale in [0, 1]
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
Loading was verified to reproduce the saved accuracy bit-exactly
|
| 83 |
+
(`acc=0.9683` MNIST / `acc=0.8707` Fashion on reload).
|
| 84 |
+
|
| 85 |
+
## Honest boundaries
|
| 86 |
+
|
| 87 |
+
- The accuracy gap vs a dense MLP is small but real (1.5 pts MNIST, 0.5 pts
|
| 88 |
+
Fashion) — "near-lossless", not lossless.
|
| 89 |
+
- The connectome's *static topology* gave no advantage; only its statistical
|
| 90 |
+
laws transferred. Do not attribute the result to "copying the fly brain".
|
| 91 |
+
- Energy figures are analytic (45nm CMOS), not measured on neuromorphic
|
| 92 |
+
hardware.
|
| 93 |
+
- Recurrent spiking training remains an open problem in this line (sMNIST from
|
| 94 |
+
scratch reaches only ~70%; conversion methods do better but lose efficiency).
|
| 95 |
+
- Masks are generated with a fixed seed (`mask_seed=0`) — rerun the code in the
|
| 96 |
+
repository to regenerate the exact structure.
|
| 97 |
+
|
| 98 |
+
## Related
|
| 99 |
+
|
| 100 |
+
- Code & full experiment report: [AwareLiquid/human-brain-simulation](https://github.com/AwareLiquid/human-brain-simulation)
|
| 101 |
+
- [AwareLiquid/M1](https://github.com/AwareLiquid/M1) — MT-LNN liquid architecture
|
| 102 |
+
- [awareliquid.ai](https://awareliquid.ai) — benchmarks and retractions
|
| 103 |
+
|
| 104 |
+
## License
|
| 105 |
+
|
| 106 |
+
MIT. MaleCNS connectome data is CC-BY 4.0 (HHMI Janelia / Cambridge / Google
|
| 107 |
+
Research, male-cns.janelia.org) — not redistributed here.
|
sparse_snn_fashion.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c19547d6cfb35b0fd06f77b6c9e9a78d6854b062d3105a33d39b9fb1b0b34525
|
| 3 |
+
size 7561291
|
sparse_snn_mnist.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01c9ee1fb29fd831e049717dac6939ed70ab49c793db8546440a5e68a082471f
|
| 3 |
+
size 7561271
|
train_results.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"mnist": {
|
| 3 |
+
"test_acc": 0.9682999849319458,
|
| 4 |
+
"firing_rate": 0.07921598106622696,
|
| 5 |
+
"train_seconds": 51.9,
|
| 6 |
+
"train_samples": 60000,
|
| 7 |
+
"device": "cuda"
|
| 8 |
+
},
|
| 9 |
+
"fashion": {
|
| 10 |
+
"test_acc": 0.8707000017166138,
|
| 11 |
+
"firing_rate": 0.08240412175655365,
|
| 12 |
+
"train_seconds": 61.7,
|
| 13 |
+
"train_samples": 60000,
|
| 14 |
+
"device": "cuda"
|
| 15 |
+
}
|
| 16 |
+
}
|