A Truly Sparse and General Implementation of Gradient-Based Synaptic Plasticity

Jamie Lohoff, Emre Neftci

Introduction

Training Spiking Neural Networks (SNNs) presents a significant challenge for modern machine learning. The standard approach, Backpropagation Through Time (BPTT), is computationally demanding and unsuitable for real-time applications because its memory requirements scale linearly with sequence length. While Real-Time Recurrent Learning (RTRL) offers an "online" alternative with constant memory, its $O(n^4)$ computational complexity for $n$ neurons makes it prohibitive for large-scale models.

Biologically inspired rules like e-prop attempt to bridge this gap by approximating gradients. However, these rules typically require manual derivation for every new neuron model, hindering the flexibility and ease of use found in standard deep learning frameworks. This paper introduces Synaptax, a custom automatic differentiation (AD) pipeline that automates the implementation of sparse, online gradient-based rules, achieving high efficiency without sacrificing generality.

The Synaptax Framework

Synaptax is built as an AD interpreter on top of JAX and the Graphax library. Its primary innovation is the automated exploitation of Jacobian sparsity. In many common neuron models, such as the Leaky Integrate-and-Fire (LIF) model, a neuron's state at a given time step primarily influences its own state at the next. This dynamic results in Jacobians that are largely diagonal.

Synaptax exploits diagonal structures in Jacobians to replace expensive tensor contractions with efficient element-wise operations.

Instead of executing standard $O(n^3)$ or $O(n^4)$ matrix multiplications, Synaptax performs vertex elimination on the computational graph to identify these sparse structures. It then replaces heavy tensor contractions with simple, element-wise multiplications. This allows the system to automatically derive efficient "e-prop-like" rules for arbitrary neuron models, such as those with adaptive thresholds (ALIF), without requiring manual mathematical derivation.

Experimental Evaluation

The researchers evaluated Synaptax using synthetic tasks to verify gradient accuracy and the Spiking Heidelberg Digits (SHD) dataset, a standard benchmark for audio speech classification in SNNs. The framework was compared against standard BPTT, RTRL, and "naïve" implementations of e-prop.

Key Results

Synaptax demonstrates several key advantages over existing training methods:

  1. Gradient Accuracy: The gradients produced by Synaptax match those of BPTT to within machine precision ($10^{-6}$), ensuring that efficiency gains do not compromise training quality.
  2. Computational Efficiency: Synaptax significantly outperforms naïve e-prop and RTRL. As sequence lengths increase, it even surpasses standard BPTT in speed.
  3. Constant Memory Scaling: By utilizing forward-mode AD, Synaptax maintains a constant memory profile regardless of the input sequence length, making it ideal for processing indefinitely long data streams.
Synaptax (Ours) maintains a constant, low computation time per step regardless of sequence length, outperforming BPTT and RTRL.

Conclusion and Future Work

Synaptax provides a general and highly efficient framework for online SNN training by leveraging the inherent sparsity of synaptic plasticity. While current work focuses on single-layer recurrent structures, the authors identify the generalization of this sparse AD approach to multi-layer architectures as a critical next step. Furthermore, while optimized for GPUs, Synaptax is uniquely positioned to benefit from future neuromorphic hardware that can natively exploit fine-grained sparsity.

Summary updated

Abstract

Online synaptic plasticity rules derived from gradient descent achieve high accuracy on a wide range of practical tasks. However, their software implementation often requires tediously hand-derived gradients or using gradient backpropagation which sacrifices the online capability of the rules. In this work, we present a custom automatic differentiation (AD) pipeline for sparse and online implementation of gradient-based synaptic plasticity rules that generalizes to arbitrary neuron models. Our work combines the programming ease of backpropagation-type methods for forward AD while being memory-efficient. To achieve this, we exploit the advantageous compute and memory scaling of online synaptic plasticity by providing an inherently sparse implementation of AD where expensive tensor contractions are replaced with simple element-wise multiplications if the tensors are diagonal. Gradient-based synaptic plasticity rules such as eligibility propagation (e-prop) have exactly this property and thus profit immensely from this feature. We demonstrate the alignment of our gradients with respect to gradient backpropagation on an synthetic task where e-prop gradients are exact, as well as audio speech classification benchmarks. We demonstrate how memory utilization scales with network size without dependence on the sequence length, as expected from forward AD methods.
BibTeX
@misc{lohoff2025truly,
  author = {Jamie Lohoff and Emre Neftci},
  title = {{A Truly Sparse and General Implementation of Gradient-Based Synaptic Plasticity}},
  year = {2025},
  eprint = {2501.11407},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.11407},
}
Figure