Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,112 +1,130 @@
|
|
| 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 |
-
##
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
## ResNet SNN — CIFAR-10 (2026-09, human-brain-simulation repo)
|
| 38 |
+
|
| 39 |
+
ResNet-style spiking network (LIF + firing-rate residuals) trained directly on
|
| 40 |
+
CIFAR-10, six-experiment series, all recorded:
|
| 41 |
+
|
| 42 |
+
| Experiment | CIFAR-10 |
|
| 43 |
+
|---|---|
|
| 44 |
+
| **ResNet SNN v1 (3 residual blocks, 60 ep)** | **84.76%** |
|
| 45 |
+
| v1 + 200 ep + Cutout (long training) | **84.89%** |
|
| 46 |
+
| Full-depth ResNet-18 (9 LIF layers) | 67.93% (spike death) |
|
| 47 |
+
| Wide channels 96/192/384 | 66.96–75.50% (fixed-threshold saturation) |
|
| 48 |
+
| PLIF learnable threshold + Cutout | 83.43% |
|
| 49 |
+
|
| 50 |
+
Honest ceiling: **~85%** for this direct-training recipe family on CIFAR-10
|
| 51 |
+
(dense CNN baseline 75.00%; VGG-SNN variant 86.22% in the same repo). 90%+
|
| 52 |
+
needs a different route (T≥10 + threshold balancing, or ANN→SNN conversion
|
| 53 |
+
calibration). Details: github.com/AwareLiquid/human-brain-simulation.
|
| 54 |
+
|
| 55 |
+
## Measured results (these checkpoints)
|
| 56 |
+
|
| 57 |
+
| Task | Dense MLP (documented) | Sparse SNN (this checkpoint) | Gap | Energy saving* |
|
| 58 |
+
|---|---|---|---|---|
|
| 59 |
+
| MNIST | 98.32% | **96.83%** | 1.5 pts | **~112×** |
|
| 60 |
+
| Fashion-MNIST | 87.56% | **87.07%** | 0.5 pts | **~107×** |
|
| 61 |
+
|
| 62 |
+
\* Energy estimate using the repository's 45nm CMOS model (Horowitz 2014:
|
| 63 |
+
MAC = 3.7 pJ, addition = 0.9 pJ) with this checkpoint's measured firing rate —
|
| 64 |
+
event-driven spike ops are additions only. This is a **model-based estimate,
|
| 65 |
+
not measured on hardware**. The project's documented headline range across runs
|
| 66 |
+
is 105–106×.
|
| 67 |
+
|
| 68 |
+
## What the research found (and disproved)
|
| 69 |
+
|
| 70 |
+
1. **Disproved**: the MaleCNS connectome topology as a *static* structure
|
| 71 |
+
carries **no measurable advantage** over random / structured-sparse graphs
|
| 72 |
+
(5 experiments: classification, temporal, robustness, sample-efficiency,
|
| 73 |
+
plasticity — all indistinguishable).
|
| 74 |
+
2. **Extracted** — the topology's *statistical laws* that DO matter:
|
| 75 |
+
sparsity **0.09%**, long-tail degree distribution (scale-free, max/mean ≈ 75),
|
| 76 |
+
strong small-worldness (clustering 6.65× random, path length 2.39),
|
| 77 |
+
**E/I ratio 60/40**.
|
| 78 |
+
3. **Built**: a trainable sparse SNN from these laws → near-lossless accuracy
|
| 79 |
+
at ~105–112× energy savings.
|
| 80 |
+
|
| 81 |
+
## Usage
|
| 82 |
+
|
| 83 |
+
Requires the model code from the repository (the class is small and
|
| 84 |
+
self-contained):
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
import torch
|
| 88 |
+
from sparse_snn import SparseSNN # github.com/AwareLiquid/human-brain-simulation
|
| 89 |
+
|
| 90 |
+
ckpt = torch.load("sparse_snn_mnist.pt", map_location="cpu", weights_only=False)
|
| 91 |
+
cfg = ckpt["config"]
|
| 92 |
+
model = SparseSNN(cfg["in_dim"], cfg["hid_dim"], cfg["out_dim"],
|
| 93 |
+
ckpt["state_dict"]["mask"], ckpt["sign"],
|
| 94 |
+
T=cfg["T"], decay=cfg["decay"], threshold=cfg["threshold"])
|
| 95 |
+
model.load_state_dict(ckpt["state_dict"])
|
| 96 |
+
model.eval()
|
| 97 |
+
# inputs: flattened 28x28 grayscale in [0, 1]
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
Loading was verified to reproduce the saved accuracy bit-exactly
|
| 101 |
+
(`acc=0.9683` MNIST / `acc=0.8707` Fashion on reload).
|
| 102 |
+
|
| 103 |
+
## Honest boundaries
|
| 104 |
+
|
| 105 |
+
- The accuracy gap vs a dense MLP is small but real (1.5 pts MNIST, 0.5 pts
|
| 106 |
+
Fashion) — "near-lossless", not lossless.
|
| 107 |
+
- The connectome's *static topology* gave no advantage; only its statistical
|
| 108 |
+
laws transferred. Do not attribute the result to "copying the fly brain".
|
| 109 |
+
- Energy figures are analytic (45nm CMOS), not measured on neuromorphic
|
| 110 |
+
hardware.
|
| 111 |
+
- Recurrent spiking training remains an open problem in this line (sMNIST from
|
| 112 |
+
scratch reaches only ~70%; conversion methods do better but lose efficiency).
|
| 113 |
+
- Masks are generated with a fixed seed (`mask_seed=0`) — rerun the code in the
|
| 114 |
+
repository to regenerate the exact structure.
|
| 115 |
+
|
| 116 |
+
## Related
|
| 117 |
+
|
| 118 |
+
- Code & full experiment report: [AwareLiquid/human-brain-simulation](https://github.com/AwareLiquid/human-brain-simulation)
|
| 119 |
+
- [AwareLiquid/M1](https://github.com/AwareLiquid/M1) — MT-LNN liquid architecture
|
| 120 |
+
- [awareliquid.ai](https://awareliquid.ai) — benchmarks and retractions
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
## Try it
|
| 124 |
+
|
| 125 |
+
- 🎮 Interactive demo (runs in your browser, ONNX Runtime Web): https://huggingface.co/spaces/AwareLiquid/Sparse-SNN-demo
|
| 126 |
+
|
| 127 |
+
## License
|
| 128 |
+
|
| 129 |
+
MIT. MaleCNS connectome data is CC-BY 4.0 (HHMI Janelia / Cambridge / Google
|
| 130 |
+
Research, male-cns.janelia.org) — not redistributed here.
|