Spiking Wavelet Transformer

Yuetong Fang, Ziqing Wang, Lingfeng Zhang, Jiahang Cao, Honglei Chen, Renjing Xu

Abstract

Spiking Neural Networks (SNNs) offer a promising path toward energy-efficient artificial intelligence by mimicking the discrete, event-driven nature of biological brains. However, traditional SNN architectures, including recent Spiking Transformers, often struggle to capture high-frequency visual information due to the low-pass filtering nature of self-attention mechanisms. This paper introduces the Spiking Wavelet Transformer (SWformer), an attention-free architecture that utilizes a Frequency-Aware Token Mixer (FATM) based on the Haar wavelet transform. By incorporating ternary spike dynamics and a multi-branch learning approach, SWformer achieves state-of-the-art performance on both static and neuromorphic datasets while maintaining superior parameter efficiency and low power consumption.

Introduction

While deep learning has seen massive success with Artificial Neural Networks (ANNs), the high energy cost of continuous-value processing remains a barrier for edge computing. SNNs address this by using binary spikes, but they have historically lagged behind ANNs in accuracy. Recent attempts to integrate Transformer architectures into the spiking domain have faced a significant hurdle: the self-attention mechanism tends to act as a low-pass filter, smoothing out fine-grained details. This is particularly problematic for event-based vision, where high-frequency changes in brightness are the primary signal.

Methods: The SWformer Architecture

The SWformer replaces standard self-attention with the Frequency-Aware Token Mixer (FATM). This module is designed to be multiplication-free and computationally efficient, adhering to the constraints of neuromorphic hardware.

The SWformer architecture featuring Spiking Patch Splitting and the Frequency-Aware Token Mixer (FATM).

The FATM operates through three parallel branches:

  1. Frequency Learner (FL): Employs a Spiking Wavelet Transform (Haar wavelet) to decompose signals into various frequency bands. To handle the negative coefficients inherent in wavelet math, the authors introduced negative spike dynamics, allowing for ternary spikes ({-1, 0, 1}).
  2. Spatial Learner (SL): Uses 3×3 spiking convolutions to extract local spatial features.
  3. Channel Mixer (CM): Utilizes 1×1 spiking pointwise convolutions for cross-channel information fusion.

Additional optimizations include a Modularized Weight Matrix to reduce parameter counts and Membrane Shortcuts to facilitate gradient flow by connecting internal neuron voltages across layers.

Experimental Results

The SWformer was evaluated on a diverse set of benchmarks, ranging from static image classification (ImageNet-1K) to neuromorphic event-based datasets (CIFAR10-DVS, N-Caltech101).

Comparison of SWformer against other SNN models on ImageNet, showing accuracy vs. energy consumption and model size.

Performance on ImageNet

On the ImageNet-1K dataset, SWformer achieved a top-1 accuracy of 75.29%. This represents a 2.52% improvement over the previous state-of-the-art, SpikFormer, while utilizing 22.03% fewer parameters. The model demonstrates a superior trade-off between accuracy, energy efficiency, and model size compared to existing spiking and direct-training methods.

Neuromorphic Data Efficiency

The architecture's focus on high-frequency features proved particularly effective for event-based data. On CIFAR10-DVS, SWformer reached 83.9% accuracy, significantly outperforming competing SNN models. Ablation studies confirmed that the inclusion of high-frequency components via the wavelet transform was critical for these gains.

Discussion and Key Insights

The transition from binary to ternary spikes is a pivotal innovation in this work. By allowing neurons to represent subtraction through negative spikes, the model can perform wavelet transforms without resorting to floating-point arithmetic. This makes the SWformer highly compatible with next-generation neuromorphic chips like Intel's Loihi 2. Furthermore, the attention-free design eliminates the $O(N^2)$ complexity of standard Transformers, making it an ideal candidate for low-power edge AI applications.

Conclusion

The Spiking Wavelet Transformer successfully addresses the "low-pass filter" limitation of previous spiking transformers. By leveraging the multi-resolution properties of wavelets and the efficiency of ternary spike dynamics, SWformer sets a new standard for SNN performance and efficiency. Future research will explore more complex wavelet types and the application of this frequency-aware approach to temporal sequence processing in Spiking RNNs.

Summary updated

BibTeX
@inproceedings{fang2024spiking,
  author = {Yuetong Fang and Ziqing Wang and Lingfeng Zhang and Jiahang Cao and Honglei Chen and Renjing Xu},
  title = {{Spiking Wavelet Transformer}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73116-7\_2},
}
Figure