Sparsespikformer: A Co-Design Framework for Token and Weight Pruning in Spiking Transformer

Yue Liu, Shanlin Xiao, Bo Li, Zhiyi Yu

TL;DR

SparseSpikformer is a novel co-design framework that drastically reduces the computational and storage overhead of Spiking Transformers. By combining dynamic token pruning (removing unimportant image patches based on spike rates) and weight pruning (identifying "winning ticket" subnetworks), the authors achieved a 90% reduction in parameters and a 20% cut in GFLOPs while maintaining near-original accuracy.

What Problem Does This Paper Address?

Spiking Neural Networks (SNNs) are the "green" alternative to traditional Artificial Neural Networks (ANNs), mimicking biological neurons to process information using energy-efficient discrete spikes. Recently, the Spikformer—which blends SNNs with the powerful self-attention mechanism of Transformers—has set new performance records.

However, Spikformers come with a heavy "tax": they utilize large Multi-Layer Perceptron (MLP) layers with massive parameter counts and process every part of an image equally, even "boring" background patches. This makes them difficult to deploy on resource-constrained edge devices (like drones or IoT sensors). The authors set out to find a way to prune both the data (tokens) and the model (weights) without breaking the network's performance.

Methods

The authors introduce SparseSpikformer, which employs a two-pronged "co-design" strategy:

  1. Dynamic Token Pruning (The Spiking Token Selector): Not all image patches are created equal. The framework uses a lightweight module called the Spiking Token Selector (STS). It calculates the average spike firing rate for each image token. Since important foreground objects typically trigger more neural activity, the STS prunes tokens with low firing rates. To keep the process end-to-end trainable, they use the Gumbel-Softmax trick, allowing the model to "learn" which tokens to drop.

  2. Weight Parameter Pruning (Lottery Ticket Hypothesis): The authors apply the Lottery Ticket Hypothesis (LTH) to the SNN domain. LTH suggests that within a large, dense network, there exists a tiny subnetwork (a "winning ticket") that, when trained in isolation, can match the performance of the original. They use Iterative Magnitude Pruning (IMP) to find these sparse subnetworks, focusing heavily on the redundant MLP layers.

Datasets

The framework was evaluated on a diverse mix of four datasets:

  • Static Image Datasets: CIFAR-10 and CIFAR-100 (standard computer vision benchmarks).
  • Neuromorphic (Event-based) Datasets: CIFAR10-DVS and DVS-128. These datasets consist of "event streams" from specialized cameras, which are the natural input format for SNNs.

Key Insights and Ideas

  • Spikes as an Importance Metric: One of the most elegant insights is using the firing rate as a natural proxy for information density. In an SNN, if a patch of an image isn't causing neurons to spike, it’s likely not contributing much to the final classification.
  • MLP Redundancy: The study confirms that the MLP layers in Spikformers are significantly over-parameterized. This is where the bulk of the 90% weight pruning occurs.
  • The Power of Co-design: Pruning tokens (spatial sparsity) and weights (structural sparsity) simultaneously provides a synergistic effect. Token pruning reduces the "GFLOPs" (computational effort), while weight pruning reduces the "storage" (memory footprint).
  • Winning Tickets in SNNs: The research proves that LTH is highly effective for Spiking Transformers, discovering that even with only 10% of weights remaining, the model's "representation ability" remains intact.

Key Results

The results demonstrate that efficiency doesn't have to come at the cost of intelligence:

  • Parameter Reduction: The model successfully pruned 90% of its parameters.
  • Computational Efficiency: GFLOPs were reduced by over 20%, and inference throughput (speed) increased significantly (e.g., from ~950 to ~1586 images/sec on CIFAR-10).
  • Accuracy Retention: On CIFAR-10, the original Spikformer scored 94.95% accuracy. The SparseSpikformer, even with a 0.5 token keep ratio, maintained a high 94.77%.
  • Superiority over Randomness: The Spiking Token Selector consistently outperformed random token pruning, proving that the spike-rate-based selection is capturing meaningful semantic information.

Limitations and Future Work

While the results are impressive, the paper leaves a few stones unturned:

  • Training Overhead: Finding "winning tickets" via Iterative Magnitude Pruning is computationally expensive during the training phase, even if the resulting inference model is tiny.
  • Hardware Realization: The experiments were conducted on NVIDIA V100 GPUs. While the authors claim the model is "hardware-friendly," the true test will be deploying it on specialized neuromorphic hardware (like Intel's Loihi or SynSense's chips) to measure actual power savings in Watts.
  • Scaling Up: The study focused on CIFAR-scale datasets. Future work could explore how this pruning holds up on much larger datasets like ImageNet.

Summary updated

BibTeX
@inproceedings{liu2024sparsespikformer,
  author = {Yue Liu and Shanlin Xiao and Bo Li and Zhiyi Yu},
  title = {{Sparsespikformer: A Co-Design Framework for Token and Weight Pruning in Spiking Transformer}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2024},
  doi = {10.1109/icassp48485.2024.10446631},
}
Figure