Near Lossless Transfer Learning for Spiking Neural Networks

Zhanglu Yan, Jun Zhou, Weng-Fai Wong

Introduction

Spiking Neural Networks (SNNs) represent a promising frontier for edge AI due to their exceptional energy efficiency. By mimicking the human brain's use of discrete "spikes" rather than continuous values, SNNs replace computationally expensive floating-point multiplications with simple additions. However, training deep SNNs remains a significant challenge. The non-differentiable nature of spike functions prevents the direct application of standard backpropagation.

A common solution is ANN-to-SNN conversion, where a pre-trained Convolutional Neural Network (CNN) is transformed into an SNN. Unfortunately, this process typically suffers from a "conversion loss"—a drop in accuracy that intensifies as networks grow deeper. Tiny approximation errors at each layer accumulate, often rendering deep SNNs ineffective for complex tasks.

The CQ Training Framework

To address the conversion loss, researchers have introduced CQ Training (Clamped and Quantized training). This framework constrains a CNN during its initial training phase to ensure its learned weights are natively compatible with the discrete, restricted nature of SNNs.

Comparison of CNN and SNN forward passes.

The core of CQ Training involves several key modifications to the standard CNN pipeline:

  1. Activation Clamping and Quantization: While standard CNNs use ReLU activations with unbounded positive outputs, SNNs represent data as spike rates within a fixed time window $T$. CQ training applies a clamp (limiting values to $[0, 1]$) and a quantization function to CNN activations to match these discrete steps.
  2. Straight-Through Estimator (STE): To overcome the zero-gradient problem of quantization functions, STE is used during the backward pass, allowing gradients to flow and weights to update effectively.
  3. SNN-Compatible Batch Normalization: Batch Normalization parameters are folded directly into the SNN's weights and biases, preserving normalization benefits post-conversion.
  4. Deterministic Input Spikes: Instead of noisy Poisson spike trains, a deterministic "spike layer" produces evenly distributed spikes, further minimizing approximation error.
The CQ training and SNN conversion pipeline.

Key Insights and Results

The primary breakthrough of CQ training is identifying accumulated residual error as the main barrier to deep SNN scaling. By introducing a quantization term into the CNN's forward pass that mirrors the SNN's residual, the models are mathematically aligned, nullifying error accumulation.

The method was evaluated on MNIST, CIFAR-10, and CIFAR-100 benchmarks with remarkable results:

  • Near-Lossless Conversion: Conversion loss was kept below 0.1% across various architectures. For instance, a VGG-16 on CIFAR-10 achieved 92.48% accuracy with only a 0.08% drop.
  • Deep Scaling: In stress tests, a 21-layer VGG-19 maintained a tiny 0.01% conversion loss on MNIST, whereas naive conversion methods failed completely.
  • Hardware Resilience: CQ-trained models proved robust to weight quantization, maintaining high accuracy with 8-bit or 9-bit weights without retraining—a critical feature for deployment on FPGAs and ASICs.

Discussion and Limitations

While CQ Training significantly advances SNN performance, some constraints remain. The current implementation relies on Average Pooling or Strided Convolutions because Max Pooling is difficult to implement in SNNs without waiting for the entire time window to conclude. Additionally, while the framework excels on static image datasets, future work is needed to extend these principles to temporal data like video or Dynamic Vision Sensor (DVS) streams. Finally, while theoretically efficient, empirical power consumption benchmarks on neuromorphic hardware like Intel’s Loihi remain a subject for future study.

Summary updated

BibTeX
@inproceedings{yan2021near,
  author = {Zhanglu Yan and Jun Zhou and Weng-Fai Wong},
  title = {{Near Lossless Transfer Learning for Spiking Neural Networks}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i12.17265},
}
Figure