Spatial-Temporal Self-Attention for Asynchronous Spiking Neural Networks

Yuchen Wang, Kexin Shi, Chengzhuo Lu, Yuguo Liu, Malu Zhang, Hong QuIJCAI 2023

Abstract

Spiking Neural Networks (SNNs) are bio-inspired models that offer exceptional energy efficiency through event-driven, asynchronous processing. However, integrating powerful attention mechanisms—the backbone of modern Transformers—into SNNs often necessitates a "wait-and-see" approach that compromises their real-time benefits. This paper introduces the STS-Transformer, a framework featuring a novel Spatial-Temporal Self-Attention (STSA) mechanism. By utilizing synapses with temporal delays, STSA enables the modeling of complex spatial-temporal dependencies without sacrificing asynchronicity. The STS-Transformer achieves state-of-the-art performance on neuromorphic vision and speech datasets, maintaining low latency and high computational efficiency.

Introduction: The Dilemma of SNNs and Attention

SNNs communicate via discrete "spikes," performing calculations only when events occur. This sparsity makes them ideal for low-power edge devices. A significant challenge arises when applying Transformers to SNNs: standard temporal attention mechanisms typically require collecting data over an entire time window ($T$) before generating an output. This synchronous requirement introduces latency and negates the event-driven advantages of neuromorphic hardware.

Comparison between existing synchronous temporal attention SNNs and the proposed asynchronous approach.

The core problem is modeling dependencies across time and space while allowing the network to remain asynchronous—providing valid outputs at any given time step rather than just at the end of a sequence.

Methods: The STS-Transformer

The authors propose the STS-Transformer to bridge the gap between high-performance attention and asynchronous spiking. The architecture relies on two key innovations:

1. Spatial-Temporal Self-Attention (STSA)

Unlike previous methods that treat spatial and temporal attention separately or synchronously, STSA calculates feature dependencies across both domains simultaneously. It introduces "synapses with delays," allowing a neuron at time $t$ to interact with spikes from both the current and previous moments. This causal structure ensures that the model never needs to "see the future" to compute attention scores, preserving real-time inference capabilities.

Architecture of the Spatial-Temporal Spiking Transformer Encoder and the STSA mechanism.

2. Spatial-Temporal Relative Position Bias (STRPB)

To provide the model with structural awareness, the researchers implemented a 3D relative position bias. This mechanism accounts for the relative distance between spikes in both spatial (x, y) and temporal (t) coordinates, which is crucial for understanding the dynamics of moving objects or sequential audio signals.

Efficient Training

While inference is asynchronous, training such a model can be computationally expensive. The authors developed an equivalent parallel computation method using a masked matrix to simulate temporal delays efficiently on standard GPU hardware, enabling fast convergence without losing the underlying spiking dynamics.

Experimental Results

The STS-Transformer was evaluated against several benchmarks in neuromorphic vision and speech:

  • DVS128 Gesture: Reached 98.72% top-1 accuracy, surpassing existing SOTA models like Spikformer.
  • CIFAR10-DVS: Achieved a competitive 79.93% accuracy.
  • Google Speech Commands (GSC): On V1, the model reached 96.74%, outperforming both traditional SNNs and specialized RNN-based artificial neural networks.

Key Insights

  • Asynchronicity: The model can provide predictions at any time step, making it highly suitable for real-time robotics.
  • Joint Modeling: Ablation studies confirmed that joint spatial-temporal modeling (STSA) provides a significant accuracy boost (~1.5%) over purely spatial attention.
  • Temporal Efficiency: High accuracy was achieved with minimal time steps ($T=10$ or $16$), indicating superior information processing per spike compared to previous architectures.

Conclusion and Future Work

The STS-Transformer successfully integrates the power of self-attention into the asynchronous paradigm of SNNs. By achieving state-of-the-art results while maintaining event-driven characteristics, it paves the way for more sophisticated AI on neuromorphic hardware. Future research will focus on hardware-level power measurements on chips like Loihi and extending the architecture to complex tasks such as real-time object tracking and detection.

Summary updated

BibTeX
@inproceedings{wang2023spatial,
  author = {Yuchen Wang and Kexin Shi and Chengzhuo Lu and Yuguo Liu and Malu Zhang and Hong Qu},
  title = {{Spatial-Temporal Self-Attention for Asynchronous Spiking Neural Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/344},
}
Figure