Tensor decomposition based attention module for spiking neural networks

Haoyu Deng, Ruijie Zhu, Xuerui Qiu, Yule Duan, Malu Zhang, Liang-Jian Deng

TL;DR

The Projected-Full Attention (PFA) module reimagines Spiking Neural Network (SNN) attention through the lens of tensor decomposition. By allowing the "rank" of attention maps to be adjustable rather than fixed, PFA achieves state-of-the-art accuracy across static and neuromorphic datasets while effectively mitigating the common SNN problem of overfitting.

What Problem Does This Paper Address?

Spiking Neural Networks (SNNs) are the "brain-inspired" cousins of traditional deep learning, prized for their extreme energy efficiency on neuromorphic hardware. However, they are notoriously difficult to train and prone to overfitting, especially when dealing with noisy data from event-based (DVS) cameras.

While attention mechanisms (which help models focus on important features) have been ported from traditional networks to SNNs, the authors identify a mathematical bottleneck: existing SNN attention modules are essentially "rank-1" methods. In the language of linear algebra, they try to describe complex, multi-dimensional spike data using the simplest possible mathematical structure. This lack of flexibility limits the model's ability to capture nuanced patterns across time, channels, and space.

Methods

The authors propose Projected-Full Attention (PFA), which treats the generation of an attention map as an inverse CP (CANDECOMP/PARAFAC) decomposition problem.

The module consists of two main stages:

  1. Linear Projection of Spike Tensor (LPST): The 4D input spike tensor (Height × Width × Channel × Time) is "squeezed" into three separate 2D matrices representing the temporal, channel, and spatial dimensions. This is done using lightweight fully connected layers and convolutions.
  2. Attention Map Composing (AMC): This is the core innovation. Instead of just multiplying these three components together once (rank-1), PFA generates $R$ sets of these components and sums their outer products.

The variable $R$ (the connecting factor) represents the mathematical rank. By adjusting $R$, researchers can control how much detail the attention map captures. Crucially, the parameter count of PFA grows only linearly with the data scale, keeping it computationally efficient.

Datasets

The researchers evaluated PFA on a diverse mix of benchmarks:

  • Static Image Datasets: CIFAR-10, CIFAR-100, and Fashion-MNIST (converted to spikes).
  • Neuromorphic (Dynamic) Datasets: CIFAR10-DVS and NCaltech-101 (captured via event-based sensors).
  • Generative Tasks: They also integrated PFA into a Fully Spiking Variational Autoencoder (FSVAE) using the MNIST, Fashion-MNIST, and CIFAR-10 datasets.

Key Insights and Ideas

  • The "Rank-1" Revelation: The authors prove that previous SNN attention methods (like TA-SNN or TCJA) are actually just special cases of PFA where the rank $R$ is locked at 1.
  • Less is More (Anti-Overfitting): Interestingly, the authors found that you don't want a perfect reconstruction of the input tensor. By using a lower-rank approximation (e.g., $R=8$ for DVS data), the PFA module acts as a filter that ignores noise and focuses on the "signal," significantly reducing the gap between training and validation accuracy.
  • Spatial Dominance: Through ablation studies, they discovered that while temporal and channel attention are important, spatial attention is the most critical factor for performance in these architectures.
  • Temporal Efficiency: PFA allows SNNs to perform exceptionally well even with very few "time steps" (the iterations an SNN uses to process data). On CIFAR-10, PFA achieved 95.6% accuracy with only 2 time steps.

Key Results

  • State-of-the-Art Accuracy: PFA outperformed existing SNN models across the board.
  • On CIFAR-10, it reached 95.7%, surpassing the popular TET and Spikformer models.
  • On CIFAR10-DVS, it achieved 84.0%, a 3.1% improvement over previous binary spike methods.
  • On NCaltech-101, it hit 80.5% top-1 accuracy.
  • Generative Prowess: When used in image generation (FSVAE), PFA improved the Inception Score (IS) and lowered the Frechet Inception Distance (FID), meaning it produced higher quality, more diverse images than previous SNN-based generators.
  • Efficiency: Despite the performance boost, the computational load of a PFA module is smaller than that of a single standard convolution layer.

Limitations and Future Work

The authors acknowledge that finding the absolute "optimal" rank $R$ for a given tensor is an NP-hard problem. Currently, they rely on a gradient-descent-based heuristic and empirical testing to find the best $R$ (suggesting $R \approx T/2$ for dynamic data).

Moving forward, the team plans to:

  1. Test PFA on more complex, real-world "intelligent applications."
  2. Deploy the module onto physical neuromorphic chips to measure actual hardware power savings.
  3. Explore more automated ways to determine the optimal connecting factor $R$ for different tasks.

Summary updated

BibTeX
@article{deng2024tensor,
  author = {Haoyu Deng and Ruijie Zhu and Xuerui Qiu and Yule Duan and Malu Zhang and Liang-Jian Deng},
  title = {{Tensor decomposition based attention module for spiking neural networks}},
  journal = {Knowledge-Based Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=7jlYm00enT},
}
Figure