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, 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spikeforge_io-0.1.1.tar.gz.
File metadata
- Download URL: spikeforge_io-0.1.1.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86d78fb8fd5b9f2acf6a5c1d152d8af4d731ccd41c8d2ab754402299793dcaeb
|
|
| MD5 |
f50cc064324ab372df083c40373fe83e
|
|
| BLAKE2b-256 |
485f1390fc4e9376b930328c3989f0a0cad4fc5b711e21351b73447562650d53
|
Provenance
The following attestation bundles were made for spikeforge_io-0.1.1.tar.gz:
Publisher:
release.yml on Capsize-Games/spikeforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spikeforge_io-0.1.1.tar.gz -
Subject digest:
86d78fb8fd5b9f2acf6a5c1d152d8af4d731ccd41c8d2ab754402299793dcaeb - Sigstore transparency entry: 2837981002
- Sigstore integration time:
-
Permalink:
Capsize-Games/spikeforge@349f610498c45199dea257446d3276dbbcf0abb8 -
Branch / Tag:
refs/tags/spikeforge-io-v0.1.1 - Owner: https://github.com/Capsize-Games
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@349f610498c45199dea257446d3276dbbcf0abb8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spikeforge_io-0.1.1-py3-none-any.whl.
File metadata
- Download URL: spikeforge_io-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
296661d367a6c4b7208c691744b7ccb45b8e2e3576aedc9e0ef71e8092ff5e37
|
|
| MD5 |
f7eb0a407a5127c86022be66a925bd50
|
|
| BLAKE2b-256 |
8ea09e3f482aef39561c66f757de486193d0e96b8775a0084f5b1b7d02bf11ff
|
Provenance
The following attestation bundles were made for spikeforge_io-0.1.1-py3-none-any.whl:
Publisher:
release.yml on Capsize-Games/spikeforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spikeforge_io-0.1.1-py3-none-any.whl -
Subject digest:
296661d367a6c4b7208c691744b7ccb45b8e2e3576aedc9e0ef71e8092ff5e37 - Sigstore transparency entry: 2837981050
- Sigstore integration time:
-
Permalink:
Capsize-Games/spikeforge@349f610498c45199dea257446d3276dbbcf0abb8 -
Branch / Tag:
refs/tags/spikeforge-io-v0.1.1 - Owner: https://github.com/Capsize-Games
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@349f610498c45199dea257446d3276dbbcf0abb8 -
Trigger Event:
push
-
Statement type: