Skip to main content

spikeforge

CI Discord Status: pre-1.0 License: BSD-3-Clause Python 3.10–3.13 Ruff PRs Welcome Docs

spikeforge dashboard

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.
  • Topologiesfc_legacy, fc_small, conv_net, recurrent_net, plus the sequence presets sequence_mlp and sequence_attn.
  • Datasets — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST, CIFAR-10, and (via the events extra) 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, and lava_loihi2 backends.
  • 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

spikeforge_targets-0.1.3.tar.gz (63.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spikeforge_targets-0.1.3-py3-none-any.whl (81.3 kB view details)

Uploaded Python 3

File details

Details for the file spikeforge_targets-0.1.3.tar.gz.

File metadata

  • Download URL: spikeforge_targets-0.1.3.tar.gz
  • Upload date:
  • Size: 63.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spikeforge_targets-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5a021a020b4bea1b335c39e9f45bd674b635a355c4e220727b200d4c6f99315c
MD5 fc489626b737c5227b07e1eb696de353
BLAKE2b-256 a7855dafe8fea33062529872a4ea4330e51bc5085c44a539cd1c2df51efe594e

See more details on using hashes here.

Provenance

The following attestation bundles were made for spikeforge_targets-0.1.3.tar.gz:

Publisher: release.yml on Capsize-Games/spikeforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spikeforge_targets-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for spikeforge_targets-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7b593c6d5b05f099a6860511e7de1f37ccd90c1ab03c5b8de3c8bdde9d7b8142
MD5 1d2b6046c182c913b6c4977e3b4892eb
BLAKE2b-256 0843f893296c36d9fe153d098b37c195407164c6bffc8c24cf77d1184c9b0484

See more details on using hashes here.

Provenance

The following attestation bundles were made for spikeforge_targets-0.1.3-py3-none-any.whl:

Publisher: release.yml on Capsize-Games/spikeforge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page