Spiking Neural Networks (SNNs) represent a paradigm shift toward energy-efficient, brain-inspired computing. Unlike traditional Artificial Neural Networks (ANNs) that communicate via continuous activation values, SNNs process information using discrete, binary events called spikes (0 or 1). This allows neuromorphic hardware to save massive amounts of energy by performing computations only when a spike occurs.
However, this biological realism introduces a severe mathematical challenge: the non-differentiability problem. Standard deep learning relies on gradient descent and backpropagation to update weights. In an SNN, a neuron fires a spike when its internal membrane potential crosses a specific threshold. This behavior is modeled by a Heaviside step function. The derivative of a step function is zero everywhere, except at the threshold itself, where it becomes infinite.
If you try to compute gradients through this function, the mathematical signal dies instantly. As noted by Hananel Hazan et al. in BindsNET: A machine learning-oriented spiking neural networks library in Python, this non-differentiability prevents standard automatic differentiation frameworks from natively optimizing spiking networks.
Surrogate gradient learning resolves this contradiction by splitting the network's behavior into two distinct modes: a discrete forward pass and a continuous backward pass.
The Core Mechanism: Forward vs. Backward Relaxation
The intuition behind surrogate gradients is simple: use the exact, discrete spiking threshold to compute the network's outputs, but swap it for a smooth, differentiable approximation when calculating gradients.
Forward Pass (Discrete Step) Backward Pass (Smooth Surrogate)
^ ^
| |
1 ___|____ | _/\_
| | / \
0 ___|______> |__/______>
Threshold Threshold
During the forward pass, the network retains its sparse, energy-efficient spiking dynamics. But during the backward pass, the non-differentiable step function's derivative (which is a useless Dirac delta function) is replaced with the derivative of a smooth function, such as a sigmoid, tanh, or piecewise-linear curve.
As reviewed by Amirhossein Tavanaei et al. in Deep Learning in Spiking Neural Networks, this substitution provides a meaningful, continuous error signal. It allows standard backpropagation algorithms to estimate how a small change in a synaptic weight will affect the downstream network state, bypassing the mathematical dead-end of binary spikes.
Spatio-Temporal Backpropagation
Because spikes occur over time, an error at time $t$ can depend on neural states from previous time steps. To train these networks effectively, gradients must flow across two dimensions simultaneously:
- Space: From deeper layers back to earlier layers.
- Time: From the current time step back to previous states of the neuron's membrane potential.
Yujie Wu et al. formalized this in Spatio-Temporal Backpropagation for Training High-performance Spiking Neural Networks. By treating the Leaky Integrate-and-Fire (LIF) neuron as an iterative state equation, the authors showed that combining Backpropagation Through Time (BPTT) with surrogate gradients allows SNNs to be optimized as unified spatio-temporal systems.
Directly training models from scratch using this method enables the discovery of spiking patterns natively optimized for the underlying data geometry, outperforming traditional methods that simply convert pre-trained ANNs into SNNs (Qiaoyun Wu et al. in Point-to-Spike Residual Learning for Energy-Efficient 3D Point Cloud Classification). Furthermore, Saima Sharmin et al. demonstrated that direct spatio-temporal training preserves complex temporal dynamics that fundamentally alter the network's adversarial robustness profile (A Comprehensive Analysis on Adversarial Robustness of Spiking Neural Networks).
Managing the Forward-Backward Mismatch
While surrogate gradients make training possible, they introduce a fundamental challenge: the forward-backward mismatch. Because the mathematical model used for optimization (the smooth curve) deviates from the actual execution model (the binary spike), the calculated gradients are only approximations. As argued by Yingyezhe Jin et al. in Hybrid Macro/Micro Level Backpropagation for Training Deep Spiking Neural Networks., this discrepancy can introduce noise and lead to suboptimal training outcomes.
To mitigate this mismatch, researchers have developed several sophisticated strategies to tune the shape and behavior of surrogate functions:
- Widening the Gradient Window: In deep networks, many neurons may remain silent or far below their firing threshold, causing gradients to vanish. Jesse Hagenaars et al. demonstrated that using a wider surrogate gradient function provides a learning signal even to sub-threshold, inactive layers, ensuring robust gradient flow through deep architectures (Self-Supervised Learning of Event-Based Optical Flow with Spiking Neural Networks).
- Asymmetric Steepness: To balance spike fidelity and training stability, Wanjin Feng et al. proposed using different steepness parameters for different passes: a steeper function in the forward pass for high-fidelity spike matching, and a shallower function in the backward pass to prevent gradient explosion (Efficient Parallel Training Methods for Spiking Neural Networks with Constant Time Complexity).
- Localized and Differentiable Tuning: Rather than applying a fixed global surrogate function, Kaiwei Che et al. introduced a method to dynamically optimize surrogate gradients during training (Differentiable hierarchical and surrogate gradient search for spiking neural networks). By evaluating multiple candidate functions and mixing them via a softmax-weighted gradient descent, the network learns the optimal gradient smoothness and temperature for specific layers, significantly stabilizing deep architectures.
Hybrid and Proxy Training Paradigms
Beyond direct surrogate optimization, several frameworks combine surrogate gradients with auxiliary continuous models to stabilize training or handle complex environments.
Tandem Learning
Instead of calculating gradients directly on the spiking architecture, tandem learning couples the SNN with an auxiliary ANN that shares the same weights. The differentiable nature of the auxiliary network allows for clean, exact error gradient calculations via standard backpropagation. These gradients are then used to update the spiking network's parameters, after which the auxiliary model is discarded. Emre Yilmaz 0001 et al. utilized this approach to achieve high-accuracy, energy-efficient keyword spotting (Deep Convolutional Spiking Neural Networks for Keyword Spotting).
Proxy Targets for Reinforcement Learning
In continuous control tasks (such as robotics), standard reinforcement learning algorithms often fail with SNNs because small weight changes cause discontinuous, abrupt jumps in spike output. To bridge this gap, Zijie Xu et al. introduced a continuous ANN to act as a "proxy target" during training (Proxy Target: Bridging the Gap Between Discrete Spiking Neural Networks and Continuous Control). This proxy provides smooth, differentiable target values that stabilize the reinforcement learning process without altering the discrete nature of the final deployed model.
Hardware-in-the-Loop Integration
The ultimate goal of surrogate gradient learning is deployment on physical neuromorphic hardware. Frameworks like hxtorch.snn, developed by Philipp Spilger, implement hardware-in-the-loop training (hxtorch.snn: Machine-learning-inspired Spiking Neural Network Modeling on BrainScaleS-2).
In this setup, the forward pass is executed directly on physical analog neuromorphic chips to capture real-world hardware dynamics and constraints. The measured physical states (such as membrane voltages) are then injected into a software-based automatic differentiation engine. By applying surrogate gradients to these real-time physical measurements during the backward pass, researchers can train highly accurate, robust models that are natively optimized for the quirks of physical analog hardware.