Introduction
Spiking Neural Networks (SNNs) represent a promising "green" alternative to traditional artificial neural networks (ANNs) by utilizing sparse, binary pulses (spikes) to achieve significant energy savings. While recent research has successfully adapted Transformer architectures for SNNs, these models often suffer from a critical limitation: they focus almost exclusively on spatial-only attention. By treating each timestep as an independent spatial snapshot, standard Spiking Transformers ignore the rich temporal dependencies inherent in spiking data. While full spatial-temporal attention mechanisms exist in the ANN domain, their direct application to SNNs typically results in a quadratic explosion in computational complexity ($O(T^2)$), undermining the inherent efficiency of spiking systems.
The STAtten Architecture
To address this gap, we introduce STAtten (Spatial-Temporal Attention), a novel "plug-and-play" module designed to replace standard Spiking Self-Attention (SSA). STAtten captures temporal dynamics without increasing the computational burden.
The core of STAtten is a block-wise computation strategy:
- Temporal Partitioning: The temporal dimension ($T$) is divided into small blocks of size $B$ (typically 2 or 4 timesteps).
- Local Correlation: Attention is computed across all tokens within these temporal blocks, capturing local dynamics—such as object motion—while filtering out distant temporal noise.
- Efficient Reordering: By reordering matrix multiplications (calculating $K^\top V$ first), STAtten maintains a complexity of $O(TND^2)$, matching that of spatial-only models.
- Non-Softmax Design: It leverages the binary nature of spikes for normalization, avoiding the high power consumption of the Softmax function.
Experimental Evaluation
STAtten was evaluated across a diverse set of benchmarks:
- Static Image Datasets: CIFAR-10, CIFAR-100, and ImageNet-1K.
- Sequential Datasets: Sequential CIFAR-10/100, where images are processed column-by-column to test long-term temporal learning.
- Neuromorphic Datasets: CIFAR10-DVS and N-Caltech101, featuring native event-based spike streams.
Key Results and Insights
STAtten consistently outperforms spatial-only baselines. On Sequential CIFAR100, it achieved a +3.22% accuracy improvement. On ImageNet, integrated with Spike-driven Transformer-V2, it reached 79.85% top-1 accuracy. Notably, on the neuromorphic CIFAR10-DVS dataset, it set a new state-of-the-art with 83.90% accuracy. Importantly, this performance boost comes at virtually zero additional energy cost; on ImageNet, inference consumed 12.36 mJ, nearly identical to the 12.42 mJ of the spatial-only version.
Analysis: The Entropy-Accuracy Link
A key insight from this work is the relationship between attention focus and model performance. Using Shannon entropy to measure the "concentration" of attention, we observed that spatial-only models exhibit higher entropy, indicating a more "distracted" attention mechanism. In contrast, STAtten produces lower entropy maps, suggesting that incorporating temporal information allows the model to focus more effectively on relevant features, directly correlating with higher accuracy.
Limitations and Future Work
While STAtten offers significant advantages, its block-wise approach requires "layer-by-layer" processing across multiple timesteps. This differs from the "step-by-step" processing favored by current neuromorphic hardware like Loihi, potentially requiring architectural adjustments in future chips. Additionally, the optimal block size ($B$) may vary depending on the input data's temporal dynamics. Future research will explore integrating parallel Leaky Integrate-and-Fire (LIF) neurons to further enhance hardware acceleration.
Summary updated