Skip to main content

SpikingJelly

中文 | English

PyPI Python Docs GitHub contributors repo size Visitors

SpikingJelly demo

Contents

Why SpikingJelly

SpikingJelly is a PyTorch-native framework for spiking neural networks (SNNs), with support for large-scale SNN training and inference.

  • Beginner-friendly API
  • ANN2SNN conversion
  • Event-based datasets
  • Automatic operator execution: Torch, Triton and optional native CUDA
  • Memory-efficient training, distributed execution, precision control
  • Hardware deployment and framework exchange

Installation

Use uv in an activated virtual environment: Python >=3.11, Torch >=2.6. First install PyTorch.

Install Command
PyPI release uv pip install spikingjelly
PyPI pre-release uv pip install --pre spikingjelly
Optional Triton (if missing) uv pip install "spikingjelly[triton]"
Latest development source uv pip install git+https://github.com/fangwei123456/spikingjelly.git

Native CUDA (requires a toolchain; available after the corresponding V2 PyPI release):

SJ_BUILD_NATIVE_CUDA=1 uv pip install \
  --no-build-isolation --no-binary spikingjelly \
  --reinstall-package spikingjelly --no-cache "spikingjelly>=2.0.0"

See the installation guide for prerequisites, decision diagrams, other extras and troubleshooting. Unreleased changes require the development source.

Quick Start

Define an SNN in the same way that you would define any PyTorch model:

from torch import nn
from spikingjelly.activation_based import layer, neuron, surrogate

net = nn.Sequential(
    layer.Flatten(),
    layer.Linear(28 * 28, 10, bias=False),
    neuron.LIFNode(tau=2.0, surrogate_function=surrogate.ATan())
)

Next steps:

Core Capabilities

Area What SpikingJelly provides
SNN modeling Activation-based SNN components: spiking neurons, surrogate gradients, stateful and stateless modules. Predefined SNN models.
Training workflows PyTorch-native training flows, online-learning utilities, and ANN2SNN conversion
Performance automatic Torch/Triton/native CUDA execution, FlexSN for customized neuron kernels, and mixed-precision training utilities (e.g., fp8)
Scaling Memory-efficient training, and distributed training
Datasets Neuromorphic datasets, and data preprocessing pipelines
Analysis FLOPs / SynOps / memory-access profiling, and inference energy estimation
Interchange and deployment NIR, Lava, and Lynxi-oriented exchange interfaces for neuromorphic workflows

Operator Execution

Neuron execution is selected automatically from tensor device and execution path: CPU uses Torch; CUDA eager prefers compatible native CUDA, while Inductor expansion prefers Triton. CUDA Graph retains its pre-capture choice. No public neuron backend argument and no CuPy dependency are required. Low-precision state profiles can use Torch reference execution.

Pure Python wheels include Torch reference and optional Triton execution. Optional native neuron, fused IF/LIF-Linear and packed/sparse projection builds are described under Installation. Missing extensions use Torch reference for projections; fused no-intermediate-spike performance requires the extension. Use ordinary Linear/Conv plus memopt instead of retired SpikeLinear/SpikeConv.

Large-Scale SNN Systems

For large-scale SNN systems, SpikingJelly provides:

  • Memory-efficient training with spike compression (memopt)
  • Experimental distributed execution for multi-GPU workloads
  • Precision policy tools for large-scale training and inference
  • Spiking transformer components

Datasets

SpikingJelly includes the following event-based and neuromorphic datasets:

Each dataset supports raw event access and frame representations. See the neuromorphic datasets tutorial for the full workflow.

Interchange and Deployment

Export SpikingJelly models to neuromorphic hardware or other frameworks:

Project Status and Version Notes

Development / release policy:

Starting from SpikingJelly V2, release versions follow PEP 440 compatible, SemVer-style MAJOR.MINOR.PATCH semantics. MAJOR marks compatibility generations, MINOR adds backward-compatible functionality, and PATCH fixes bugs. Python package pre-release spelling is used for V2 development releases, for example 2.0.0.dev0, 2.0.0a1, 2.0.0b1, and 2.0.0rc1.

See CHANGELOG.md for the V2 release changelog.

Compatibility, migration, and older docs
  • Before V2, SpikingJelly used a legacy 0.0.0.0.X scheme: odd X tracked development versions on GitHub / OpenI, and even X tracked stable releases published to PyPI.
  • If your project must stay on pre-V2 releases, pin dependencies with an upper bound such as spikingjelly<2.
  • From 0.0.0.0.14, modules including clock_driven and event_driven were renamed. See Migrate From Old Versions.
  • The default documentation points to the latest development version.
  • If you rely on an older release, check bugs.md and switch to the matching documentation version.

Historical documentation:

License

SpikingJelly's project license is Apache-2.0. Third-party attributions and license terms are collected in LICENSES/NOTICE. See the license guide for scope and historical licenses.

Acknowledgement

Maintainers

Current maintainers (since July 2024):

Previous core maintainers (before July 2024):

Contributors

The full contributor list is on the contributors page.

contributors

Institutes

The main institutions behind SpikingJelly are Multimedia Learning Group, Institute of Digital Media (NELVT), Peking University and Peng Cheng Laboratory.

PKU PCL

Star History Chart

Contributing

We welcome issues, pull requests, documentation improvements, and translations.

  • Read the Contributing Guide.
  • Check issues for ongoing work.
  • API docs are not fully bilingual yet; translation contributions are especially welcome.

Citation

Publications using SpikingJelly are listed on the documentation page. The source of truth in this repository is publications.json.

If you use SpikingJelly in your work, please cite:

@article{
doi:10.1126/sciadv.adi1480,
author = {Wei Fang and Yanqi Chen and Jianhao Ding and Zhaofei Yu and Timothee Masquelier and Ding Chen and Liwei Huang and Huihui Zhou and Guoqi Li and Yonghong Tian},
title = {SpikingJelly: An open-source machine learning infrastructure platform for spike-based intelligence},
journal = {Science Advances},
volume = {9},
number = {40},
pages = {eadi1480},
year = {2023},
doi = {10.1126/sciadv.adi1480},
url = {https://www.science.org/doi/abs/10.1126/sciadv.adi1480},
eprint = {https://www.science.org/doi/pdf/10.1126/sciadv.adi1480}
}

Metadata

Release files for spikingjelly 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spikingjelly 2.0.0
File Size Uploaded Provenance Actions
spikingjelly-2.0.0.tar.gz 903.2 kB With provenance Details for spikingjelly-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spikingjelly 2.0.0
File Interpreter ABI Platform Actions
spikingjelly-2.0.0-py3-none-any.whl Python 3 none any Details for spikingjelly-2.0.0-py3-none-any.whl

Total release size: 2.0 MB

Release files / spikingjelly-2.0.0.tar.gz

Download URL spikingjelly-2.0.0.tar.gz
Size 903.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9b9940c3675f9e7bf10484d37ecb27367aba8379233dc8c6e4d590fafac62ae
BLAKE2b-256 checksum
How to use checksums
6fda81164c4d56c88ebdcc67583bee2d36bb8d0eb4232971fb02bc025fa1c3cd
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 Oct 17, 2026.

Transparency log

Release files / spikingjelly-2.0.0-py3-none-any.whl

Download URL spikingjelly-2.0.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dee753bade33e8dca62e88fd4ba6e3c89e6bc56c6fdd9c8c151d5680222edac1
BLAKE2b-256 checksum
How to use checksums
88fc3616f5e16ba02818cff52c2daeb539dc88a265fc81ee08fc96ed16f7f3dc
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 Oct 17, 2026.

Transparency log

Security for spikingjelly 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spikingjelly-2.0.0.tar.gz

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 Oct 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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