Abstract
Spiking Neural Networks (SNNs) represent a promising frontier in artificial intelligence, offering the potential for ultra-low-power, event-driven computation inspired by the biological brain. However, a significant gap exists between biologically realistic simulation frameworks and high-performance deep learning libraries. This paper introduces SpikingJelly, a full-stack, open-source framework built on PyTorch that resolves this conflict. By providing a modular architecture, specialized CUDA acceleration, and comprehensive support for neuromorphic datasets, SpikingJelly enables researchers to train and deploy SNNs with unprecedented efficiency, achieving up to an 11× acceleration in training speed compared to existing state-of-the-art frameworks.
Introduction
Traditional Artificial Neural Networks (ANNs) have achieved remarkable success but are increasingly constrained by high computational costs and energy consumption. Spiking Neural Networks (SNNs) offer a compelling alternative by utilizing discrete, asynchronous "spikes" for communication, mirroring the energy efficiency of biological neural systems. Despite their potential, the development of SNNs has been hindered by a fundamental dilemma: neuroscience-focused simulators (e.g., NEURON, NEST) prioritize biological fidelity over the automatic differentiation required for deep learning, while standard machine learning frameworks (e.g., PyTorch, TensorFlow) are not natively optimized for the temporal dynamics and non-differentiable nature of spiking neurons.
SpikingJelly was developed to bridge this gap, providing a mature infrastructure that balances biological plausibility with the high-throughput requirements of modern deep learning workflows.
System Architecture and Methods
SpikingJelly is organized into a hierarchical, four-tier architecture designed for modularity and performance:
- Components: This layer provides the fundamental building blocks of SNNs, including various spiking neuron models such as Leaky Integrate-and-Fire (LIF), Parametric LIF (PLIF), and Adaptive LIF (ALIF), alongside synaptic structures.
- Functions: This tier includes essential tools for modern SNN training, such as surrogate gradient descent (to overcome the non-differentiable nature of spikes), ANN-to-SNN conversion algorithms, and quantization tools.
- Acceleration: The core performance engine of SpikingJelly. It utilizes CUDA kernel fusion via CuPy to merge multiple small operations into larger, more efficient kernels. This significantly reduces the overhead associated with GPU kernel launches, which is a common bottleneck in temporal simulations.
- Networks: A collection of pre-defined, high-level architectures, including Spiking ResNet and Spiking VGG, allowing researchers to apply SNNs to complex computer vision tasks immediately.
Propagation Patterns
A key technical innovation in SpikingJelly is its support for dual propagation modes, allowing users to optimize for different hardware constraints:
- Step-by-step (Single-step): This mode processes one time step at a time across all layers. It is highly flexible and necessary for models with complex recurrent connections.
- Layer-by-layer (Multi-step): This mode processes all time steps for a single layer before moving to the next. By merging the temporal and batch dimensions, this approach enables massive parallelization on GPUs, leading to significant speedups.
Neuromorphic Data Integration
SpikingJelly simplifies the use of neuromorphic datasets, which are captured by event-based sensors (such as Dynamic Vision Sensors) that record changes in light intensity rather than static frames. The framework provides a standardized "event-to-frame" pre-processing pipeline for several major benchmarks, including:
- N-MNIST and N-Caltech101
- DVS Gesture (Action recognition)
- CIFAR10-DVS and ES-ImageNet (Large-scale object recognition)
- ASL-DVS and SHD (Spiking Heidelberg Digits)
Key Results and Performance
Empirical evaluations demonstrate that SpikingJelly significantly outperforms existing SNN libraries in both training and inference speeds:
- Training Speed: SpikingJelly achieves an 11× acceleration on Spiking ResNet-18 compared to other frameworks like Norse or SNNTorch.
- Inference Efficiency: The framework provides up to a 2× speedup in inference tasks.
- Accuracy: Researchers using SpikingJelly have achieved competitive results, including 92.9% accuracy on MNIST and robust performance on large-scale benchmarks like ImageNet and reinforcement learning tasks (OpenAI Gym).
- Hardware Deployment: The framework supports a seamless "full-stack" workflow, enabling models trained in PyTorch to be deployed directly onto specialized neuromorphic hardware, such as the Intel Loihi and Lynxi KA200 chips.
Discussion and Future Work
While SpikingJelly represents a major step forward, the authors identify two primary areas for future development. First, the framework currently relies on binary tensors to represent spikes; integrating "timing-based" representations (using exact firing times) could further improve biological accuracy and efficiency, though it presents challenges for convolutional operations. Second, the authors aim to incorporate sparse computation libraries (e.g., cuSPARSE) to better exploit the inherent sparsity of spiking activity, potentially reducing memory consumption and increasing speed by skipping computations for "silent" neurons.
In conclusion, SpikingJelly provides a powerful, flexible, and high-performance platform that empowers the research community to explore the full potential of spike-based intelligence.
Summary updated