Source-linked AI summary
SpikingJelly: An open-source machine learning infrastructure platform for spike-based intelligence
Wei Fang, Yanqi Chen, Jianhao Ding, Zhaofei Yu, Timothée Masquelier, Ding Chen, Liwei Huang, Huihui Zhou, Guoqi Li, Yonghong Tian
TL;DR
Existing neural-system frameworks do not integrate automatic differentiation, limiting infrastructure for spiking deep learning. SpikingJelly addresses this gap as an open-source framework and achieves state-of-the-art simulation speed.
Problem
Existing neural-system frameworks can provide high precision but do not integrate automatic differentiation for spiking deep learning.
Source: Introduction · p. 5Method
SpikingJelly is an open-source framework designed to support research on spiking deep learning.
Source: Introduction · p. 6, Discussion · p. 20Results
SpikingJelly achieves state-of-the-art simulation speed for deep SNN training.
Source: Discussion · p. 21Takeaways & Limitations
SpikingJelly is presented as infrastructure intended to promote research on spiking deep learning.
Source: Introduction · p. 6, Discussion · p. 22Timing-based SNN support remains an area for future development because timing-based SNNs advance more slowly than activation-based SNNs.
Source: Limitations and Future Development Plans · p. 113
Abstract
from arXiv · showhide
Spiking neural networks (SNNs) aim to realize brain-inspired intelligence on neuromorphic chips with high energy efficiency by introducing neural dynamics and spike properties. As the emerging spiking deep learning paradigm attracts increasing interest, traditional programming frameworks cannot meet the demands of the automatic differentiation, parallel computation acceleration, and high integration of processing neuromorphic datasets and deployment. In this work, we present the SpikingJelly framework to address the aforementioned dilemma. We contribute a full-stack toolkit for pre-processing neuromorphic datasets, building deep SNNs, optimizing their parameters, and deploying SNNs on neuromorphic chips. Compared to existing methods, the training of deep SNNs can be accelerated $11\times$, and the superior extensibility and flexibility of SpikingJelly enable users to accelerate custom models at low costs through multilevel inheritance and semiautomatic code generation. SpikingJelly paves the way for synthesizing truly energy-efficient SNN-based machine intelligence systems, which will enrich the ecology of neuromorphic computing.
Introduction
This section introduces SpikingJelly as an open-source, full-stack framework for developing and deploying spiking neural networks. It covers the framework’s tools for data processing, model building, training, acceleration, and neuromorphic deployment, with emphasis on flexible and efficient SNN development.
Emerging Spiking Deep Learning Methods
- 1000× greater power efficiency than ANNs is possible for SNNs on tailored neuromorphic chips through event-driven spike computation.SNNs transmit information using spikes and use nonlinear neuronal dynamics, supporting spatiotemporal processing and energy-efficient computation.Source: Introduction · pp. 2–3
- Primitive supervised SNN learning methods are limited by one-spike restrictions, single-layer training constraints, and applicability largely confined to MNIST-level classification.SpikeProp-based methods generally allow neurons to fire no more than one spike, whereas Tempotron, ReSume, and SPAN cannot train multilayer SNNs.Source: Introduction · p. 3
- Surrogate-gradient training and ANN-to-SNN conversion have enabled high-performance SNNs on CIFAR, DVS Gesture, and ImageNet.Surrogate-gradient SNNs achieve high performance on complex datasets with few simulation time steps, while converted SNNs attain almost the original ANN accuracy on ImageNet with dozens of steps.Source: Introduction · p. 4
Demands for Frameworks
- Existing SNN frameworks lack a mature combination of automatic differentiation and modern deep-learning capabilities, forcing researchers to implement, accelerate, process, and deploy systems manually.Some frameworks emphasize biologically detailed simulation without automatic differentiation, while others use simplified neurons but still lack modern deep-learning capabilities; these gaps create repetitive coding and deployment burdens.Source: Introduction · pp. 4–5
- A modern spiking deep-learning framework should accelerate spike-based operations, support CPU/GPU simulation and neuromorphic-chip deployment, and provide full-stack tools for building, training, and analyzing deep SNNs.The introduction identifies these three characteristics as requirements for improving research efficiency and reducing fragmented implementation efforts.Source: Introduction · pp. 5–6
SpikingJelly: A Modern Framework for Spiking Deep Learning
- SpikingJelly is presented as an open-source deep-learning framework that bridges deep learning and SNNs, with an architecture overview shown in Fig. 1a and PyTorch-based SNN simulation on both platforms.The supplied passage introduces SpikingJelly and states that it is based on PyTorch; the continuation of its platform support is outside this section part.Source: Introduction · p. 6
- SpikingJelly accelerates SNN simulation with semiautomatically generated CUDA kernels, reducing development costs through code generation.The approach combines low-level programming efficiency with easier extensibility and performance-oriented deep-learning support.Source: Introduction · p. 6
- Its Functions support SNN training, simulation, analysis, conversion, quantization, and deployment, while supporting both object-oriented and procedural programming.Functional formulations complement reusable Components such as spiking neurons and synapses.Source: Introduction · p. 6
- Its Networks package offers reusable classic and large-scale structures, including Spiking ResNet, alongside introductory SNN applications.Functions also provide low-bit weight quantization and exchange functions for deployment to neuromorphic chips.Source: Introduction · pp. 6–7
- The framework integrates neuromorphic-dataset downloading, unified data layouts, and NumPy-compatible reading interfaces for datasets from sensors such as ATIS, DAVIS, and DVS.These capabilities address common processing needs for neuromorphic datasets used in SNNs.Source: Introduction · p. 6
- SpikingJelly enables flexible SNN construction, efficient simulation, and deployment to edge AI devices through convenient APIs.It is presented as a full-stack framework for building, simulating, and deploying SNNs.Source: Introduction · p. 7
Results
The results examine SpikingJelly as a full-stack framework for spiking deep learning, spanning flexible SNN construction, accelerated simulation and training, neuromorphic data processing, and deployment. They also cover its application across neuromorphic classification, reinforcement-learning control, and biological visual-cortex modeling.
Convenient and Flexible SNN Construction
- SpikingJelly provides convenient PyTorch-style APIs for constructing sequential SNNs, processing T × N × C inputs with multi_step_forward, and accessing module-held hidden states.Hidden states must be reset before a new sample using reset_net.Source: Convenient and Flexible SNN Construction · p. 7
High-Performance Simulation
- SpikingJelly achieved up to 11× training speedup over Norse and SNNTorch for Spiking ResNet-18 at T = 32, with training evaluated at T = 2, 4, 8, 16, and 32.Source: Figure 1 · p. 8, High-Performance Simulation · p. 9
Neuromorphic Device Support
- SpikingJelly supports neuromorphic workflows by decoding multiple dataset formats, providing event-based and downsampled frame-based representations, and converting native modules for supported chips.The framework currently supports Intel Loihi and Tianjic-group Lynxi KA200, while other chips can be supported through specific exchange modules.Source: Neuromorphic Device Support · pp. 10–11
Ecological Niche
- SpikingJelly is presented within an ecosystem of SNN frameworks spanning biological simulation, neuroscience–computer science intersections, and GPU-compatible machine-learning frameworks.The comparison frames frameworks as occupying distinct ecological niches with different abstractions, neuron-model complexities, hardware support, and training algorithms.Source: Ecological Niche · p. 11
- SpikingJelly’s full-stack integration spans neuromorphic datasets and chips, ANN2SNN, surrogate gradients, biologically plausible learning rules, and optimized spike-based simulation.Compared with other frameworks, these capabilities define its ecological niche across performance, neuromorphic support, biology, deep-learning support, and community scale, as summarized in Fig. 1e.Source: Ecological Niche · p. 12
Adoptions by the Community
- Since its December 2019 open-source release, SpikingJelly has been widely adopted for diverse studies, including ANN2SNN, event-based vision, hardware design, neural architecture search, reinforcement learning, and semantic communication.Fig. 1f shows examples of these applications, and the paper characterizes SpikingJelly as one of the most commonly used spiking deep learning frameworks.Source: Adoptions by the Community · p. 13
Core Modules of SpikingJelly
- SpikingJelly’s modular design provides neuron dynamics, surrogate-gradient learning, encoders, propagation modes, ANN2SNN conversion, quantization, monitoring, STDP learning, and event-data processing.Single-step propagation favors recurrent connections and ANN2SNN with inference memory independent of time steps, whereas layer-by-layer propagation improves efficiency through batching and kernel fusion.Source: Core Modules of SpikingJelly · p. 16
Typical Applications
- SpikingJelly supports an end-to-end DVS Gesture workflow that preprocesses camera events, trains a deep convolutional SNN, and deploys it on Loihi for inference.The workflow uses the dataset, layer, neuron, and exchange subpackages to connect preprocessing, model construction, training, and neuromorphic-chip deployment.Source: Typical Applications · p. 18
- SpikingJelly provides a full-stack pipeline from DVS Gesture event preprocessing and deep SNN classification to inference deployment on the Loihi neuromorphic chip.The workflow converts raw events to tensors, trains the SNN, and deploys it for classification inference.Source: Figure 4 · p. 19
- For reinforcement learning and control, an encoder converts OpenAI Gym state observations into spike trains, while a decoder converts processed spikes into continuous actions.The network modules can be implemented with SpikingJelly’s layer and neuron subpackages.Source: Typical Applications · p. 18, Figure 4 · p. 19
- SpikingJelly enables modeling the biological visual cortex by comparing representations from the same visual stimuli in biological vision and pretrained ImageNet SNNs.Model brain-likeness is quantitatively assessed through representational similarity.Source: Typical Applications · p. 18, Figure 4 · p. 19
Discussion
SpikingJelly addresses the software-framework gap in spiking deep learning with convenient APIs, flexible module inheritance, and infrastructure for efficient simulation. Its full-stack capabilities extend deep SNNs toward practical applications and support continued growth alongside neuromorphic computing.
- SpikingJelly addresses the lack of frameworks focused on deep learning by supporting the growing interests of spiking deep learning.Classical frameworks focus on neuroscience rather than deep learning, creating a dilemma for the emerging field.Source: Discussion · p. 20
- Brief APIs, classic models, and training scripts let users build varied SNNs with few lines of code, without mastering underlying implementations.This reduces learning and usage costs and frees users from painstaking coding operations.Source: Discussion · p. 20
- SpikingJelly achieves state-of-the-art simulation speed through PyTorch-based CPU/GPU acceleration, fusion operations, generated CUDA kernels, and JIT compilation.These methods target the high computational complexity of deep SNNs, including their additional temporal dimension, and reduce waiting during training.Source: Discussion · p. 21
- SpikingJelly’s full-stack building, training, and deployment solution extends deep SNNs from toy classification to practical tasks, while its future development will track neuromorphic-computing advances.The discussion identifies human-level performance classification, network deployment, and event-data processing as practical utilities, and anticipates symbiotic growth with the community.Source: Discussion · pp. 21–22
Materials and Methods
This section presents SpikingJelly’s modular framework for constructing, training, processing, accelerating, and deploying spiking neural networks. It details neuron models, surrogate gradients, data and event processing, network conversion and monitoring, extensible execution, and CUDA-based acceleration, while noting associated operational trade-offs.
Materials and Methods
- SpikingJelly categorizes modules as component modules for defining SNNs and functional modules for simulation, acceleration, data recording, or variable modification.Source: Materials and Methods · p. 22
Component Modules
- SpikingJelly represents spiking neurons with charging, firing, and resetting equations, supporting hard resets for directly trained SNNs and soft resets for ANN2SNN conversion [164][50].Continuous-time dynamics are discretized using a low-cost first-order Eulerian method, while firing uses a threshold and resetting follows hard- or soft-reset rules.Source: Component Modules · pp. 22–23
- SpikingJelly defines neurons through shared discrete-time firing and resetting equations, then extends StepModule and MemoryModule into reusable BaseNode and LIFNode classes.Multilevel inheritance also extends optional CUDA forward and backward kernels with limited code changes, reducing the workload for developing new models.Source: Component Modules · pp. 23–24
- SpikingJelly packages surrogate gradients into spiking neurons to replace the nondifferentiable Heaviside derivative during backpropagation.Forward propagation generates binary spikes with Θ, while backward propagation uses the surrogate derivative σ′, including sigmoid surrogates controlled by α.Source: Component Modules · p. 25
- SpikingJelly provides latency and Poisson encoders plus weighted phase and Gaussian tuning encoders, with latency coding mapping larger inputs to earlier firing times.The Poisson encoder’s output spikes preserve most information from the original image, according to the illustrated example.Source: Component Modules · p. 26
- SpikingJelly supplies commonly used neuromorphic datasets, including ASL-DVS, CIFAR10-DVS, DVS Gesture, and SHD, while allowing new datasets through inheritance.New datasets can be integrated by inheriting the dataset base and completing processing functions.Source: Component Modules · pp. 26–27
- SpikingJelly processes neuromorphic datasets through decoding, NumPy-compatible representation, event-to-frame downsampling, and multithreaded extensibility for adding datasets.Users add datasets by inheriting a base class and implementing download, extract, and decode functions.Source: Component Modules · p. 27
Functional Modules
- Modules support single-step or multistep propagation, allowing users to switch between step-by-step and layer-by-layer graph traversal according to parallelism or recurrent-input requirements.Layer-by-layer execution can parallelize stateless time steps and fuse stateful operations, whereas step-by-step execution is preferred when future inputs depend on current inputs.Source: Functional Modules · pp. 27–29
- SpikingJelly’s Converter supports ANN-to-SNN conversion by normalizing weights, replacing ReLUs with IF neurons, and using VoltageHook feature scales plus optimized membrane initialization.The conversion assumes ReLU activations and average pooling, while IF firing rates approximate ANN activations.Source: Functional Modules · p. 29
- An 8-bit network has a 4× reduction in model size and memory-bandwidth requirements and up to 4× throughput compared with a 32-bit model; quantization-aware training can quantize weights.The quantizer uses a surrogate method to redefine gradients for the rounding function.Source: Functional Modules · p. 30
- Functional modules also provide monitors for recording layer data, an all-to-all trace-based STDP learner compatible with gradient optimizers, and predefined or custom event slicing and integration.Monitors can record forward/backward inputs, outputs, layer attributes, or firing rates; STDP exposes user-defined synaptic update amplitudes.Source: Functional Modules · pp. 30–31
- SpikingJelly supports fixed-time and fixed-frame-number event integration, while also allowing users to define custom slicing and integration functions.Fixed-time integration can produce different frame counts across samples, whereas fixed-frame integration requires all events to arrive before processing.Source: Functional Modules · p. 32
Acceleration Modules
- SpikingJelly accelerates stateless layers by merging time and batch dimensions for parallel execution, and accelerates stateful layers by fusing many small CUDA kernels.Stateless layers lack temporal dependence, while stateful layers require sequential updates and otherwise incur repeated kernel-launch overhead.Source: Acceleration Modules · pp. 33–34
- SJ is the best convolution implementation because its execution time increases much more slowly with time steps than RAW and 3D.Figure 5b compares SJ, the plain time-step loop, and treating time as the depth dimension for 2D convolution on sequential inputs.Source: Acceleration Modules · p. 34, Figure 5 · p. 36
- SJ is much faster than RAW for LIF neurons; during training, RAW execution time grows quadratically with T while SJ increases slowly.During inference, both methods’ execution times increase linearly with T.Source: Acceleration Modules · p. 34, Figure 5 · p. 36
- Layer-by-layer propagation is recommended for efficiency, but step-by-step inference is required when large T makes its O(T · N) spatial complexity exceed memory limits.Step-by-step propagation has spatial complexity O(N), which is not proportional to T.Source: Acceleration Modules · pp. 34–35
- SpikingJelly uses CuPy-based semi-automatic CUDA generation and inheritance-based neuron kernels to simplify custom CUDA development in Python.CuPy compiles and caches CUDA code written in Python strings, while neuron-specific forward and backward kernels extend a generic base class with relatively few changes.Source: Acceleration Modules · p. 35
- The framework generates CUDA code from neuron parameters, reset behavior, detach settings, and surrogate-gradient functions, reducing custom implementation to a few lines.For example, hard_reset and detach_reset alter the generated forward/backward code, while surrogate functions define dS[t]/dH[t].Source: Acceleration Modules · pp. 37–38
- Semiautomatically generated CUDA kernels fuse forward and backward computation across time steps, enabling accelerated spiking-neuron operations.CuPy compiles generated CUDA code into a CUDA library, where fusion operations accelerate computation within large kernels.Source: Acceleration Modules · pp. 37–38
- JIT compilation wraps simple neuronal firing and resetting operations into CUDA kernels while running, offering lower development cost but lower performance than manual CUDA optimization.SpikingJelly uses JIT for simple one-step neuronal dynamics and generated CUDA kernels for complex through-time operations with gradients.Source: Acceleration Modules · p. 38
- A representative workflow accelerates the “SJ” inference process with JIT compilation.The example illustrates JIT use for functions such as neuronal dynamics at one time step.Source: Acceleration Modules · p. 38
Funding
The work is supported by specified Chinese research grants, and the authors declare no competing interests. Source code and selected experiment materials are publicly available through GitHub and Zenodo.
Funding
- Funding comes from the National Natural Science Foundation of China, the Peng Cheng Laboratory major key project, and the Beijing Natural Science Fundation.The listed grants are 62027804, 61825101, 62088102, 62236009, 62176003, PCL2021A13, and JQ21015.Source: Funding · p. 61
Competing Interests
- The authors declare no competing interests.Source: Competing Interests · p. 62
Data and Materials Availability
- SpikingJelly source code is available on GitHub, while code for the Fig. 1d experiment and typical Fig. 4 applications is available on Zenodo.GitHub: https://github.com/fangwei123456/spikingjelly; Zenodo: https://doi.org/10.5281/zenodo.Source: Data and Materials Availability · p. 62
Supplementary Information · Subpackages of Deep Learning · Using Examples
SpikingJelly organizes deep-learning functionality into reusable subpackages and demonstrates SNN construction, recurrent architectures, and MNIST training through practical examples. The MNIST example achieves 92.9% test accuracy, while recurrent containers support hybrid propagation with a single-step limitation for recurrent modules.
Subpackages of Deep Learning
- Deep-learning functionality is divided into Components, Functions, Acceleration, and Networks to simplify use, coordinate programming styles, and support extensibility and code reuse.Table 1 lists the subpackages and their typical modules or functions.Source: Subpackages of Deep Learning · p. 63
- Components provide SNN building blocks such as spiking neurons, layers, encoders, and surrogate functions, including PLIF neurons with learnable τm.The PLIF neuron’s charging function uses a learnable parameter a controlling τm(a).Source: Subpackages of Deep Learning · p. 63
- Functions support SNN training, simulation, analysis, conversion, quantization, and deployment, while functional formulations permit forward-process changes without altering module definitions or loaded weights.This enables reuse such as modifying an ANN with trained weights into an SNN by overriding forward functions.Source: Subpackages of Deep Learning · p. 63
- Acceleration provides optional functions that accelerate SNN simulation through semiautomatically generated CUDA kernels, reducing development cost through code generation, while binary-characteristic optimized layers reduce memory consumption; Networks provide classic and large-scale network structures.Source: Subpackages of Deep Learning · pp. 63–64
Using Examples
- SpikingJelly’s examples show that building and training SNNs can be implemented directly, with additional examples available through its homepage tutorial.The recurrent and MNIST examples provide the demonstrated usage cases.Source: Using Examples · p. 64
Build a Recurrent SNN
- A recurrent SNN combines fully connected and LIF layers in an element-wise recurrent container whose combining function users can freely define.Feedforward layers are placed before and after the recurrent structure, as illustrated in Figure 6.Source: Build a Recurrent SNN · p. 66
- The recurrent container operates only in single-step mode, but surrounding modules can use multistep propagation and related acceleration methods such as fused CUDA kernels.The hybrid design uses step-by-step propagation inside the recurrent part and layer-by-layer propagation for feedforward modules.Source: Build a Recurrent SNN · p. 66
Train an SNN for the Classification Task
- 92.9% test accuracy is achieved by the simple SNN on MNIST using SpikingJelly’s example training pipeline.The example is a simplified version of the corresponding homepage tutorial.Source: Train an SNN for the Classification Task · p. 70
Design of the Step Module · Distinction of Step Modes and Propagation Patterns
This section describes SpikingJelly’s step modes and propagation patterns, focusing on how step-by-step and layer-by-layer execution differ in computational-graph order, complexity, and practical applicability. It also outlines when each pattern is suitable, including recurrent dependencies, online tasks, model characteristics, memory limits, and compatibility constraints.
Design of the Step Module
- StepModule controls single-step data shaped (N, ...) and multistep data shaped (T, N, ...), enabling flexible execution across modules.Stateless modules such as Conv2d support both modes, with multistep computation accelerated by merging time and batch dimensions; MemoryModule stores hidden states internally.Source: Design of the Step Module · p. 70, Figure 8 · p. 71
Distinction of Step Modes and Propagation Patterns
- Assigning all modules single-step or multistep produces step-by-step or layer-by-layer propagation patterns with distinct computation orders.For an SNN with L layers, T time steps, and batch size N, each layer has single-step latency ds[i] and multistep latency dm[i].Source: Distinction of Step Modes and… · p. 72
Memory Consumption
- O(N · L) is the step-by-step inference complexity, whereas O(N · T) is the layer-by-layer complexity.Step-by-step inference discards prior-time-step data and suits many time steps, while layer-by-layer inference discards previous-layer data and suits extremely deep SNNs; both training graphs require O(N · T · L) space.Source: Memory Consumption · pp. 72–73
Latency
- Multistep processing satisfies dm[i] ≤ T · ds[i] and yields Dm ≤ Ds, with GPU parallelism approaching dm[i] ≈ ds[i] for stateless layers.For stateful layers, fused CUDA kernels reduce calling overhead; measurements with T = 8 verify the latency advantage, while CuPy further reduces spiking-neuron latency.Source: Latency · pp. 73–74
Conclusions of Step Modes and Propagation Patterns
- Changing all module step modes switches propagation patterns without changing outputs, but affects speed, memory consumption, and latency.Multistep mode is generally recommended for speed; with limited inference memory, multistep suits large L, whereas single-step suits large T.Source: Conclusions of Step Modes and… · p. 77
- Some networks, tasks, and hardware support only layer-by-layer propagation, including time-to-first-spike coding, event-driven backpropagation, and attention SNNs.These cases operate on data at all time steps and therefore cannot use both propagation patterns.Source: Conclusions of Step Modes and… · p. 77
- Only step-by-step propagation can be used when recurrent connections require Y[t −1] at time t or online tasks require outputs as soon as X[t] arrives.These cases prevent obtaining input data at all time steps in advance.Source: Conclusions of Step Modes and… · p. 77
- Both propagation patterns are widely used in spiking deep learning and are supported by SpikingJelly.Most event-driven neuromorphic chips are closer to step-by-step processing, while some heterogeneous chips also use layer-by-layer propagation.Source: Conclusions of Step Modes and… · p. 77
- O(N · L) is the spatial complexity of step-by-step propagation, while layer-by-layer propagation requires O(N · T).With step-by-step inference, data from the previous time step can be freed; with layer-by-layer inference, data from the previous layer can be freed.Source: Figure 11 · p. 78
Examples of Implementing Complex Neurons
SpikingJelly uses multilevel inheritance to implement complex neurons with little effort, illustrated by ALIF and Izhikevich neuron examples. These implementations extend base neurons with additional dynamics, states, and parameters while reproducing adaptive and chattering behaviors.
Examples of Implementing Complex Neurons
- Multilevel inheritance enables users to define complex neurons based on base neurons with little effort.Source: Examples of Implementing Complex Neurons · p. 79
Implementation of the Adaptive-Leaky Integrate-and-Fire Neuron
- The ALIF neuron extends LIF threshold dynamics, implementing adaptive threshold updates in just 21 lines of code.Its threshold increases after firing and decreases exponentially, demonstrating adaptive dynamics that adjust firing rates.Source: Implementation of the Adaptive-Leaky… · pp. 79, 81, Figure 12 · p. 80
Implementation of the Izhikevich Neuron
- The Izhikevich neuron extends an adaptive base neuron with charging, recovery, resetting, and adaptation functions, completing the implementation in just 50 lines of code.The modeled chattering dynamic resembles pyramidal-neuron recordings and produces high-frequency repetitive bursts under constant input.Source: Implementation of the Izhikevich Neuron · p. 82, Figure 14 · p. 84
Examples of Implementing New Learning Rules
SpikingJelly demonstrates its extensibility and flexibility through examples implementing learnable neuronal dynamics, surrogate gradients, gradient-based optimizers, and local learning rules. These examples show how custom learning components integrate with its PyTorch-style infrastructure.
Examples of Implementing New Learning Rules
- SpikingJelly demonstrates extensibility and flexibility by supporting custom neuronal dynamics, surrogate functions, optimizers, and local learning rules.The section presents these implementations as examples of using SpikingJelly to create new learning rules.Source: Examples of Implementing New Learning… · p. 84
Neuronal Dynamics
- Learnable neuronal dynamics are implemented by inheriting a base neuron, defining Vth, α, and β as parameters, and constraining α to [0, 1].Forward and backward propagation verifies that the resulting neuron works normally with learnable parameters.Source: Neuronal Dynamics · pp. 84–85
Surrogate Functions
- The custom Straight Through Estimator (STE) [187] is wrapped as a module and used in an integrate-and-fire layer, whose checked gradients match the defined expression.The example runs for one time step with nine input elements.Source: Surrogate Functions · p. 86
Gradient-based Optimizers
- Gradient Rewiring (Grad R) [141] is implemented as a plug-and-play PyTorch optimizer, enabling researchers to prune SNNs during training through a direct optimizer replacement.The implementation adds target sparsity s and penalty α while preserving weight signs and updating sparse weights through hidden weights and ReLU mapping.Source: Gradient-based Optimizers · pp. 86, 88, 89
Local Learning Rules
- Local Hebbian learning is efficiently implemented with monitors that record input and output spikes, compute firing-rate-based ΔW in single- and multistep modes, and update weights.The implementation uses broadcasting and can add ΔW to the fully connected layer’s gradient or return ΔW directly; it operates without autograd.Source: Local Learning Rules · pp. 89, 91
Ablation Study of Acceleration Methods
The ablation study evaluates acceleration methods on Spiking ResNet-18 across surrogate-training and inference timestep settings. JIT benefits inference in the step-by-step pattern, while MergeTB and CuPy are central to layer-by-layer acceleration, with their combination maximizing training efficiency.
Ablation Study of Acceleration Methods
- JIT provides obvious inference acceleration for the step-by-step pattern, but its training acceleration is slight and varies across training conditions.The experiments use T = 2, 4, 8, 16, 32 for surrogate training and T = 128 for inference.Source: Ablation Study of Acceleration Methods · p. 91
- 10% acceleration is achieved by JIT in the layer-by-layer pattern when the time-step dimension is merged into the batch dimension for stateless layers.Without this merging, JIT can even slow the layer-by-layer pattern; CuPy is slower than JIT only at small T when tiny-kernel calling overhead is minor.Source: Ablation Study of Acceleration Methods · p. 93
- Using both “MergeTB” and “CuPy” in the layer-by-layer pattern achieves the fastest training simulation speed in most cases.MergeTB accelerates stateless layers, whereas CuPy accelerates stateful layers.Source: Ablation Study of Acceleration Methods · p. 93
- “LBL + MergeTB + CuPy” maximizes training efficiency when all modules use multistep mode with the CuPy backend.This configuration enables the layer-by-layer pattern with both MergeTB and CuPy.Source: Ablation Study of Acceleration Methods · p. 93
Comparison of SNN Frameworks
SpikingJelly is distinguished by CUDA-level acceleration, broad neuromorphic-dataset and chip support, biologically plausible learning rules, and deep-learning integration. Its stateful modules and switchable step modes also simplify SNN construction while enabling flexible propagation patterns.
Overview of Frameworks
- SpikingJelly combines CUDA-level CuPy acceleration, nine neuromorphic datasets, neuromorphic-chip subpackages, biologically plausible learning rules, surrogate learning, and ANN2SNN methods.These capabilities distinguish it across the framework comparison, while Nengo has the strongest Loihi compatibility and classical frameworks have larger established communities.Source: Overview of Frameworks · p. 95
- SpikingJelly’s community grew to 94+ publications within three years of its 2019 launch, approaching the publication count of classical frameworks.Its community remains smaller than those of classical frameworks but is described as growing rapidly with interest in spiking machine learning.Source: Overview of Frameworks · p. 96
Difference between SpikingJelly/Norse/SNNTorch
- SpikingJelly stores states such as membrane potential V[t] inside modules, making state management convenient for building and training SNNs.Unlike Norse, which treats states as module inputs and outputs, SpikingJelly’s stateful modules can be combined directly with stateless modules such as PyTorch sequential containers.Source: Difference between… · pp. 96–97
- SpikingJelly supports switchable single-step and multistep modes, deriving step-by-step or layer-by-layer propagation and using SeqToANNContainer for faster stateless-layer execution.Norse and SNNTorch do not explicitly define the same step-mode and propagation-pattern concepts; SpikingJelly merges time and batch dimensions for stateless layers.Source: Difference between… · p. 97
Details of the Neuron Kernel
SpikingJelly uses CuPy-based semiautomatic CUDA generation to reduce extension development costs while supporting modular kernels for elementwise, sequence, and neuron operations. Its inheritance-based design lets Python code generate and execute CUDA kernels directly, including IF-neuron BPTT kernels.
Details of the Neuron Kernel
- The CKernel hierarchy assembles CUDA code from declaration, head, core, and tail components, with CKernel1D supporting elementwise tensors and CKernel2D adding a time-step loop for sequence data.CKernel2D also supports pre_core and post_core sections for initializing temporary variables and adding code around the core.Source: Figure 22 · p. 98, Details of the Neuron Kernel · p. 102
- Python users define kernel arguments with add_param and CUDA operations through core, then execute CKernel1D kernels in a pure Python environment.The cfunction subpackage generates float and half2 variants by switching dtype, avoiding separate kernel implementations for each data type.Source: Figure 23 · p. 99, Details of the Neuron Kernel · p. 103
- CKernel2D enables spiking-neuron FPTT/BPTT kernels, with NeuronBPTTKernel defining shared CUDA structure and child classes filling neuron-specific gradient equations.For the IF neuron, IFNodeBPTTKernel completes dH[t+1] and dX[t] through grad_h_next_to_v and grad_h_to_v.Source: Figure 24 · p. 101, Details of the Neuron Kernel · p. 103
- SpikingJelly’s CuPy-based semiautomatic CUDA generation largely reduces the cost of developing and using CUDA extensions.Only CUDA code needs to be written; C++ wrappers, environment setup, and file-loading procedures can be discarded, while PyTorch tensors can call compiled CuPy kernels without data copying.Source: Details of the Neuron Kernel · p. 102
Exchange Modules
SpikingJelly defines exchange modules that run within the framework and convert to neuromorphic-chip toolchains while preserving target-module behavior. Separate exchange packages support Loihi and Lynxi KA200 deployment workflows.
Exchange modules
- Exchange modules run in SpikingJelly and convert to target chip toolchains, with packages such as lynxi_exhange for Lynxi KA200 and lava_exchange for Loihi.These modules address chip-specific deployment toolchains.Source: Exchange Modules · p. 104
- Identical behavior between exchange and target modules enables lossless conversion and deployment of SpikingJelly SNNs to the target toolchain.For example, lava_exchange.CubaLIFNode corresponds to Lava-DL’s slayer.neuron.cuba.Neuron.Source: Exchange Modules · p. 104
Loihi workflow
- For Loihi, SpikingJelly’s BlockContainer contains quantized synapses and neurons matching Lava-DL’s Block behavior, producing identical outputs for the same inputs after conversion.Lava-DL supports quantized SNNs with identical CPU/GPU and Loihi behavior when networks use Block modules.Source: Exchange Modules · p. 104
Lynxi KA200 workflow
- For Lynxi KA200, exchange modules simplify synapses and neurons by retaining core functions, removing GPU-only CuPy functions, and compiling model files containing network-shape JSON and weight BIN data.KA200 reconstructs the SNN from these model files for inference.Source: Exchange Modules · pp. 104–105
Neuromorphic Datasets · Details of Three Applications in Fig. 4
SpikingJelly integrates commonly used neuromorphic datasets and demonstrates full-stack workflows for processing data, building and training SNNs, and deploying them to neuromorphic platforms. Across three applications, it supports gesture recognition, robotic control, and brain-like visual modeling with reported accuracy, control-performance, and representational-similarity results.
Neuromorphic Datasets
- SpikingJelly integrates ASL-DVS[170], CIFAR10-DVS[171], DVS Gesture[55], ES-ImageNet[97], HARDVS[172], N-Caltech101[96], N-MNIST[96], Nav Gesture[173], and Spiking Heidelberg Digits[174].Figure 26 visualizes one downsampled eight-frame sample from each integrated neuromorphic vision dataset.Source: Neuromorphic Datasets · p. 105, Figure 26 · p. 107
Details of Three Applications in Fig. 4
- Events are integrated into T = 64 frames, binarized by setting non-zero values to 1, downsampled from 128 × 128 to 64 × 64, with batch size set to 16.The SNN inputs have shape (T, N, C, H, W) = (64, 16, 2, 64, 64).Source: Details of Three Applications in Fig. 4 · p. 105
- The DVS128 Gesture SNN achieved 85.42% test accuracy and could be converted through Lava-DL and HDF5 for execution on Loihi or its simulator.The application demonstrates dataset processing, SNN construction, training, and deployment rather than state-of-the-art accuracy.Source: Details of Three Applications in Fig. 4 · p. 108
- Application b encodes each OpenAI Gym state with learnable Gaussian receptive fields, maps spike trains through SAN and decoders, and trains the policy with TD3 [191].SAN is functionally equivalent to a deep actor network and is evaluated over ten random seeds, with each task trained for 1 million steps.Source: Details of Three Applications in Fig. 4 · pp. 108–109
- 88.45% APR was achieved by SpikingJelly’s SAN across Ant-v3, HalfCheetah-v3, Hopper-v3, and Walker2d-v3, versus 71.94% for PopSAN.The SAN also trained faster than PopSAN, demonstrating potential as an energy-efficient alternative for real-time robotic control.Source: Details of Three Applications in Fig. 4 · pp. 109–110
- Application c pretrains SEW ResNet models of depths 18, 34, 50, 101, and 152 for ImageNet, then compares their representations with biological visual responses.Networks use T = 4 simulation steps, 320 epochs, batch size 32, and SGD with momentum 0.9 before applying three similarity metrics.Source: Details of Three Applications in Fig. 4 · p. 110
- SEW ResNet achieved at least 63% ImageNet accuracy, while its representational similarity to biological visual systems exceeded CNN ResNet by an average of 6.6%.The comparison extracts representations from all network layers and evaluates them with three similarity metrics.Source: Details of Three Applications in Fig. 4 · p. 110
Performance Comparison on Recurrent Structure
SpikingJelly, Norse, and SNNTorch achieve similar training performance on fully recurrent SNNs, with Norse faster at small T and SpikingJelly faster at large T. For inference, SpikingJelly remains faster, requiring 0.57× Norse and SNNTorch execution time.
Experimental setup
- The benchmark uses recurrent SEW ResNet-18, with the same experiment options as Fig. 1d and execution times reported in Fig. 27.Because recurrent connections occur in all four stages, only single-step mode is available and SpikingJelly uses JIT as its sole speedup method.Source: Performance Comparison on Recurrent… · p. 111, Figure 27 · p. 112
Inference
- 0.57× execution time: SpikingJelly is faster than Norse and SNNTorch for inference on recurrent SEW ResNet-18.Figure 27 evaluates inference at T = 128; Norse and SNNTorch have close inference times.Source: Performance Comparison on Recurrent… · p. 111, Figure 27 · p. 112
Applicability
- For SNNs with partial recurrent connections, hybrid propagation permits multistep acceleration in the feedforward portion.This preserves access to SpikingJelly’s multistep acceleration methods where recurrence is partial.Source: Performance Comparison on Recurrent… · p. 111
Limitations and Future Development Plans · Statistical Trends
SpikingJelly remains mature but has limitations that motivate future work on timing-based SNN toolkits, sparse acceleration, and fully automatic CUDA generation. Statistical trends show rapidly increasing interest in spiking deep learning since 2019 and indicate that SpikingJelly meets researchers’ toolkit needs and accelerates the community.
Limitations and Future Development Plans
- The paper frames these limitations as ongoing development needs despite SpikingJelly’s maturity after three years of development.The limitations and future plans were summarized from developer experience and discussions with users.Source: Limitations and Future Development Plans · p. 113
- Timing-based SNNs offer sparser, memory-efficient representations with potential continuous-time operation, but SpikingJelly’s timing_based subpackage remains primitive because complex operations are difficult to implement.The paper identifies completing this subpackage and designing broader timing-based toolkits as worthwhile future work.Source: Limitations and Future Development Plans · p. 113
- Sparse spikes are stored in dense tensors, limiting exploitation of sparsity; sparse libraries can reduce memory consumption and accelerate simulation when firing rates are sufficiently low.SpikingJelly’s AutoSparseLinear layer selected sparse or dense multiplication using a measured critical sparsity, but sparse-acceleration exploration was later put on hold because of limited developer time and effort.Source: Limitations and Future Development Plans · p. 113
- Complex neuronal dynamics trigger many small PyTorch CUDA-kernel calls that slow SNN training, especially when T is large, even for the simplest IF neuron.A fused CuPy CUDA kernel addresses slow simulation, while semiautomatic generation only partly addresses the substantial effort required for forward and backward CUDA code.Source: Limitations and Future Development Plans · p. 114
- SpikingJelly’s future direction is fully automatic CUDA generation from Python-defined neuronal dynamics, extending the incomplete generator prototype introduced in version 0.0.0.0.14.The planned generator would construct a computational graph, analyze variable relationships, and generate CUDA code automatically.Source: Limitations and Future Development Plans · p. 114
Statistical Trends
- SpikingJelly was open-sourced in December 2019, and publications using it were counted annually from 2020 through March 1, 2023.These statistics demonstrate that the framework fulfills researchers’ need for a spiking deep learning toolkit and accelerates community development.Source: Statistical Trends · p. 115
- Since 2019, accepted papers on spiking deep learning at top AI conferences have increased dramatically, indicating rising research interest.The count covered AAAI, NeurIPS, CVPR, ICCV, ECCV, IJCAI, ICML, and ICLR; Figure 28 reports their summed conference totals.Source: Statistical Trends · p. 115, Figure 28 · p. 116
Related papers
This paper cites
- Attention Is All You Need2017
- ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION2014
- Very Deep Convolutional Networks for Large-Scale Image Recognition2014
- Neural Machine Translation by Jointly Learning to Align and Translate2014
- Sequence to Sequence Learning with Neural Networks2014
- SGDR: Stochastic Gradient Descent with Warm Restarts2016
Cited by
- The Dormant Spiking Neuron: A State-Driven Mechanism for Efficient Spiking Neural Networks2026
- MSGAT: Multi-Head Spiking Graph Attention with Similarity-Space Fusion for Image-Text Retrieval2026
- Syn2Logic: End-to-End Neuromorphic Design Automation2026
- Spiking Neural Networks for Continuous Control: Neuromorphic Reinforcement Learning in Conventional Computing2026
- rl-triton: High-Performance Triton GPU Kernels for Reinforcement Learning Credit Assignment2026