spikeforge
A spiking-neural-network (SNN) toolkit built on snnTorch and PyTorch. Loads MNIST-style and neuromorphic event datasets, encodes them into rate, latency, delta, and random spikes, and trains, validates, exports, and deploys LIF networks — with a live browser dashboard served over WebSockets.
Pre-1.0. Before trusting any number this produces, read Implications and boundaries.
Quickstart
No clone, no Docker — five lines of Python:
pip install spikeforge
from spikeforge import TrainingEngine
engine = TrainingEngine(dataset="mnist", hidden=32, epochs=1, num_steps=5)
for metrics in engine.train():
last = metrics
print(last) # {'loss': ..., 'train_accuracy': ..., 'test_accuracy': ...}
That finishes in seconds — about 3 s on a 12-thread desktop CPU, nearer 14 s
on a laptop — and lands in the mid-80s for accuracy. The snippet sets no seed,
so the exact figure moves between runs, and the test_accuracy it prints is
the engine's fast progress probe rather than the whole test split. For numbers
measured on the complete held-out split, with the command that reproduces
each one, see Benchmarks.
The first run downloads MNIST; later runs are offline.
TrainingEngine is the entry point for new code — it owns the training loop,
topology selection, encoding, checkpointing, and evaluation. (SNNTrainer,
also exported, is the older MNIST rate-coding helper behind the tutorial demo;
reach for TrainingEngine.) spikeforge-verify, spikeforge-benchmark, and
the NIR/deployment/energy pieces live in
Usage.
On a machine with no GPU, install the CPU torch wheels first so pip does not pull the entire CUDA stack in behind them:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install spikeforge
That is a ~1.1 GB environment instead of ~5.5 GB, and it is the same flow the
Dockerfile and CI use. The order matters: with --extra-index-url pip still
prefers the CUDA build from PyPI.
Want the live browser dashboard instead? That's the richer, second path:
git clone https://github.com/Capsize-Games/spikeforge.git
cd spikeforge
docker compose up --build
Open http://localhost:8877 — the dashboard connects to the WebSocket on the same host and port. No separate backend or proxy to run.
See Usage and Quickstart
for every path (./install.sh, local dev with Vite, examples/, and the
spikeforge-* console scripts).
Why not just snnTorch, Norse, Lava, or SpikingJelly?
spikeforge doesn't replace those — it trains through snnTorch and can deploy to Norse and Lava. The question is what it adds on top: a NIR-described interpreter spine with an independent interpreter that re-executes every exported graph and reports numerical drift against the original model (not just export — snnTorch and Norse both export NIR too; Lava-DL currently only reads it, not writes it), a deployment-capability matrix that reports per-target op support and availability instead of just declaring support, an event-driven energy estimator, and a live training/ introspection dashboard. None of the other libraries ship the latter two as part of the library itself, to our knowledge — file an issue if that's stale.
| snnTorch | Norse | Lava | SpikingJelly | spikeforge | |
|---|---|---|---|---|---|
| Surrogate-gradient training in PyTorch | ✅ | ✅ | ✅ (Lava-DL) | ✅ | ✅ (via snnTorch) |
| NIR export (write) | ✅ | ✅ | import-only (Lava-DL reads NIR, doesn't write it) | not part of NIR's official framework list | ✅ |
| Independent re-execution + drift check of the exported graph | — | — | — | — | ✅ |
| Per-target deployment capability matrix (op support, honest availability) | — | — | Loihi-focused | — | ✅ (reference/Norse/Lava/SpiNNaker2/Speck/Xylo) |
| Built-in event-driven energy estimator (SOP/MAC/AC) | — | — | — | — | ✅ (labelled estimate, not hardware-measured) |
| Pretrained model zoo | — | — | — | ✅ (some vision tasks) | small: six of this project's own reference checkpoints with published accuracy, plus untrained preset shapes (details) |
| Live browser training/introspection dashboard | — | — | — | — | ✅ |
If you already have a training loop in snnTorch/Norse/Lava/SpikingJelly and don't need interop, deployment reporting, energy estimates, or the dashboard, you may not need spikeforge on top of it — that's a fair "obviously no," and better than an uninformed "obviously yes."
Features
- Encoding — rate, latency, delta, and random spike coders.
- Training — fully-connected and convolutional LIF networks with surrogate-gradient cross-entropy, checkpointing, and opt-in AMP / gradient checkpointing / truncated BPTT / multi-GPU.
- Topologies —
fc_legacy,fc_small,conv_net,recurrent_net, plus the sequence presetssequence_mlpandsequence_attn. - Datasets — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST,
CIFAR-10, and (via the
eventsextra) N-MNIST, DVS128 Gesture, CIFAR10-DVS, and Spiking Speech Commands. - Interpreter spine — NIR export, an independent NIR interpreter, and numerical drift validation.
- Introspection — educational-mode
U[t]/I[t]/S[t]traces, trajectory metrics, and surrogate-derivative curves. - Deployment — a capability matrix, weight quantization with a drift
check that can simulate activation/membrane rounding, energy accounting,
and executable
reference,norse, andlava_loihi2backends. - Model hub — a curated, offline-first catalog carrying this project's own trained reference checkpoints (with the accuracy each scores), plus optional live Hugging Face search.
- Dashboard — a React + TypeScript UI with training, introspection, analysis, targets, energy, and hub panels, and seven guided walkthroughs.
What's implemented vs. experimental vs. spec-only
The features list above spans very different levels of maturity. This is the ten-second version; each row links to the honest detail.
| Capability | Status | Detail |
|---|---|---|
| Training, encoding, topologies, checkpointing | Shipped | Features |
| NIR export + independent-interpreter drift validation | Shipped | Interpreter spine |
Deployment — reference target |
Shipped, always available | Backend execution |
Deployment — norse, lava_loihi2 targets |
Shipped, gated on an SDK extra (pip install spikeforge-targets[norse] or [lava]) |
Targets and interop |
Deployment — spinnaker2, speck, xylo targets |
Spec-only — registered in the capability matrix, no installable SDK integration yet | Targets and interop |
| Energy accounting (SOP/MAC/AC) | Shipped as an explicit estimate, not hardware-measured |
Event runtime and energy |
| Model hub catalog, CLI, dashboard panel, opt-in live HF search | Shipped | Model hub |
| Model hub catalog content | Six trained reference checkpoints with published accuracy, alongside untrained preset shapes — not a large zoo | Benchmarks |
Sequence/attention topologies (sequence_mlp, sequence_attn) |
Experimental — research scope, not production sequence training | Sequence primitives |
| ONNX interop | Shipped, single-step export/import only | Interop fold-ins |
| Production use-case toolkit: streaming time-series (UC-1) | Shipped | UC-1 |
| Production use-case toolkit: UC-2 through UC-10 | Spec-only (design docs behind issues #13–#21) | plans/index.md |
| Live browser dashboard | Shipped | Dashboard |
What it scores
Reference configurations on the datasets and topologies that ship, each measured on the complete held-out test split, with the command that reproduces it:
| Dataset | Topology | Test accuracy | Train time (CPU) |
|---|---|---|---|
| MNIST | conv_net |
97.13% | 249 s |
| MNIST | fc_legacy |
94.29% | 50 s |
| MNIST | recurrent_net |
92.46% | 55 s |
| MNIST | fc_small |
92.16% | 40 s |
| Fashion-MNIST | fc_legacy |
75.55% | 62 s |
| KMNIST | fc_legacy |
70.79% | 49 s |
Every figure is the complete held-out test split, on a 12-thread x86-64 CPU with no GPU. The full table — epochs, time steps, hardware, seed, and the one command that reproduces each row — is in Benchmarks.
These are reference configurations with stock hyperparameters and a single
seed, not tuned attempts at state of the art; read them as a floor the
shipped defaults reach, not as a ceiling. The checkpoints they produce are the
trained entries in the model hub (spikeforge-hub list --trained).
Packages
This repository is a single workspace that publishes seven distributions, each versioned independently:
| Distribution | Import root | Purpose |
|---|---|---|
spikeforge |
spikeforge |
Core package: encoders, topologies, training, simulator, NIR bridge, tracking |
spikeforge-targets |
spikeforge_targets |
Deployment targets, quantization, energy accounting, sparse event runtime |
spikeforge-hub |
spikeforge_hub |
Curated model hub and optional Hugging Face access |
spikeforge-server |
server |
FastAPI + WebSocket server and dashboard hosting |
spikeforge-serve |
spikeforge_serve |
Headless REST/WebSocket inference service for a deployment bundle |
spikeforge-clients |
spikeforge_clients |
Python/TypeScript/CLI clients for spikeforge-serve (no torch dependency) |
spikeforge-io |
spikeforge_io |
Recorded-stream I/O adapters and windowing |
The satellites sit at lower version numbers than core by design, not neglect —
each package is versioned independently and moves only when it changes, and
compatibility.json is the source of truth for which
satellite versions go with which core release. If you're pinning versions by
hand, read that file rather than assuming semver alignment across packages.
Documentation
This README covers first contact and positioning; it deliberately doesn't
go deeper. documentation/ is the full reference — install
paths, the CLI tools, architecture, module layout, and the dev workflow —
written for contributors and coding agents alike. Also see
COOKBOOK.md for copy-pasteable recipes,
examples/ for runnable end-to-end scripts, and
plans/ for design documents and the roadmap.
See CONTRIBUTING.md and rules.md before opening a pull request.
Citing
If spikeforge is useful in your research, please cite it — see CITATION.cff (GitHub renders a "Cite this repository" button from it automatically).
License
Released under the BSD 3-Clause License — see LICENSE and AUTHORS.
Metadata
Release files for spikeforge 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spikeforge-0.5.0.tar.gz | 234.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spikeforge-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 560.8 kB
Release files / spikeforge-0.5.0.tar.gz
| Download URL | spikeforge-0.5.0.tar.gz |
|---|---|
| Size | 234.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c4e475b2aa65a06920dd53b680912f6ddf42d3c6a2d00da21f4e5538c075e9b
|
|
BLAKE2b-256 checksum How to use checksums |
9e34b692057519ccdcb10f7cae106f2bb0fa73c47f41bab57a2eee1a04f44433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / spikeforge-0.5.0-py3-none-any.whl
| Download URL | spikeforge-0.5.0-py3-none-any.whl |
|---|---|
| Size | 326.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b45b42bcfd47f19587c06f22e33c65193f3b118d89c1cb2481d6807392bb9f01
|
|
BLAKE2b-256 checksum How to use checksums |
f66969596cd0c5166d24a4b827fa69f173d6dd8a35b1992dc847a9d4d9c61490
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log