Uncovering the Representation of Spiking Neural Networks Trained with Surrogate Gradient

Yuhang Li, Youngeun Kim, Hyoungseob Park, Priyadarshini Panda

Abstract

Spiking Neural Networks (SNNs) are recognized as the candidate for the next-generation neural networks due to their bio-plausibility and energy efficiency. Recently, researchers have demonstrated that SNNs are able to achieve nearly state-of-the-art performance in image recognition tasks using surrogate gradient training. However, some essential questions exist pertaining to SNNs that are little studied: Do SNNs trained with surrogate gradient learn different representations from traditional Artificial Neural Networks (ANNs)? Does the time dimension in SNNs provide unique representation power? In this paper, we aim to answer these questions by conducting a representation similarity analysis between SNNs and ANNs using Centered Kernel Alignment (CKA). We start by analyzing the spatial dimension of the networks, including both the width and the depth. Furthermore, our analysis of residual connections shows that SNNs learn a periodic pattern, which rectifies the representations in SNNs to be ANN-like. We additionally investigate the effect of the time dimension on SNN representation, finding that deeper layers encourage more dynamics along the time dimension. We also investigate the impact of input data such as event-stream data and adversarial attacks. Our work uncovers a host of new findings of representations in SNNs. We hope this work will inspire future research to fully comprehend the representation power of SNNs.

Introduction

Spiking Neural Networks (SNNs) represent a paradigm shift in computational modeling, offering a biologically inspired alternative to traditional Artificial Neural Networks (ANNs). By utilizing discrete spikes over time rather than continuous activation values, SNNs promise significant gains in energy efficiency and neuromorphic hardware compatibility.

Recent advancements in Surrogate Gradient (SG) training have allowed SNNs to achieve performance levels competitive with ANNs on complex image recognition tasks. However, this success raises a fundamental question: are SNNs trained with SG simply mimicking the representational logic of ANNs, or do they leverage their unique temporal dynamics to learn distinct features? Understanding this is crucial for designing hardware and architectures that truly leverage the strengths of neuromorphic computing.

Methodology: Centered Kernel Alignment

To investigate these internal representations, the researchers employed Centered Kernel Alignment (CKA). CKA is a robust similarity metric that enables the comparison of feature representations across different neural network architectures, regardless of variations in width or depth. By calculating the similarity between the activation patterns of SNNs and ANNs, the study quantifies how closely the "third generation" of neural networks aligns with its predecessor.

The Spatial Dimension: Width, Depth, and the "ResNet Rectifier"

The study's spatial analysis reveals a complex relationship between network architecture and representation, particularly concerning how we structure modern deep networks.

The Impact of Residual Connections

One of the most striking findings is the role of residual (skip) connections. In architectures like ResNet, these connections act as a "rectifier," consistently pulling SNN representations back toward an ANN-like state. At every junction where a skip connection merges with the main branch, the CKA similarity between the SNN and its ANN counterpart restores to nearly 1.0. This suggests that standard architectural blocks designed for ANNs may inadvertently suppress the unique representational potential of SNNs, forcing them to behave like "leaky" versions of traditional models.

Width vs. Depth

The researchers observed that increasing the width of an SNN (the number of channels) tends to make it more representationally similar to an ANN. In wider networks (e.g., ResNet-20 8×), the accuracy gap between the two architectures shrinks to nearly zero (0.30%). Conversely, increasing depth allows SNNs to diverge. Deeper layers in SNNs exhibit features that are significantly different from those found in corresponding ANN layers, suggesting that the spiking nature of the network has more room to manifest as the signal propagates through more stages.

The Temporal Dimension

Unlike ANNs, SNNs process information over multiple time steps. The study investigated whether this temporal dimension provides unique representational power. Interestingly, in shallow layers, the representation remains almost static across time steps. However, as the signal moves into deeper layers, the temporal dynamics become increasingly diverse. This indicates that the unique advantages of SNNs—specifically their ability to process information temporally—are primarily realized in the later stages of the network.

Robustness and Neuromorphic Data

The study also explored how SNNs handle non-standard inputs, specifically adversarial attacks and event-based data.

Adversarial Stability

SNNs demonstrate a natural resilience to adversarial attacks, such as the Projected Gradient Descent (PGD) attack. CKA analysis shows that while an ANN's internal representations shift drastically when under attack (leading to a 43% drop in accuracy), SNN representations remain remarkably "sticky" or close to their clean state. This stability results in a much smaller accuracy degradation (22%), highlighting an inherent advantage of spiking dynamics in security-critical applications.

Neuromorphic Advantage

When trained on event-based datasets (like CIFAR10-DVS or N-Caltech 101), SNNs show significantly lower similarity to ANNs. These datasets, which consist of asynchronous "events" (changes in brightness) rather than static frames, are the natural input for neuromorphic systems. The lower CKA scores suggest that SNNs truly develop unique, non-ANN-like representations when they are not forced to process static, frame-based data.

Conclusion

This research provides a critical look into the "black box" of Spiking Neural Networks. While current training techniques and architectures (like ResNet) tend to bias SNNs toward ANN-like behavior, the study uncovers clear evidence of unique SNN characteristics in deeper layers, under adversarial pressure, and when processing neuromorphic data.

Future research should focus on developing SNN-specific architectures that avoid the "rectifying" effect of standard residual blocks and exploring bio-plausible learning rules that move beyond the limitations of surrogate gradients. By doing so, we may finally unlock the full representational power of neuromorphic computing.

Summary updated

BibTeX
@article{li2023uncovering,
  author = {Yuhang Li and Youngeun Kim and Hyoungseob Park and Priyadarshini Panda},
  title = {{Uncovering the Representation of Spiking Neural Networks Trained with Surrogate Gradient}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=s9efQF3QW1},
}
Figure