Self-slimmed Vision Transformer

Zhuofan Zong, Kunchang Li, Guanglu Song, Yali Wang, Yu Qiao, Biao Leng, Yu Liu

Abstract

Vision Transformers (ViTs) have revolutionized computer vision but remain computationally intensive due to the quadratic complexity of their self-attention mechanisms. This paper introduces SiT (Self-slimmed Vision Transformer), a framework that optimizes ViTs by replacing traditional "hard token dropping" with a "soft slimming" approach. By aggregating redundant information into a smaller set of highly informative tokens, SiT achieves up to a 3.6× speedup while retaining approximately 97% of the original model's performance.

Introduction

While Vision Transformers have surpassed CNNs in various benchmarks, their "all-to-all" token comparisons create a massive computational bottleneck. Previous attempts to mitigate this often relied on "hard dropping"—simply deleting tokens deemed unimportant. However, this approach risks losing vital spatial information, leading to significant accuracy drops. SiT addresses this by proposing a method to reduce token counts without permanently discarding the information they contain.

Methodology

The SiT framework introduces two primary innovations to create a leaner, more efficient model:

  1. Token Slimming Module (TSM): Instead of a binary keep-or-kill decision, TSM uses a learnable, data-dependent weight matrix to aggregate tokens. It softly integrates redundant tokens into a smaller set of informative ones, acting as a dynamic pooling layer that focuses on critical image regions while distilling background information.
  2. Feature Recalibration Distillation (FRD): To train the slimmed model effectively, the authors use a Teacher-Student distillation strategy. A Reverse TSM (RTSM) is employed during training to project slimmed tokens back into the original token space. This allows for direct, block-by-block feature comparison between the full teacher model and the slimmed student model, ensuring the student retains structural knowledge.
The SiT framework utilizes a Teacher-Student architecture where the Token Slimming Module (TSM) reduces token count and the Reverse TSM (RTSM) enables intermediate feature distillation.

Key Insights and Results

The researchers evaluated SiT on the ImageNet-1K dataset using various ViT backbones, including DeiT and LV-ViT. Several key insights emerged from their analysis:

  • Redundancy and Aggregation: Token similarity increases significantly in deeper layers, making them ideal for aggregation. SiT's soft slimming prevents the "information cliff" seen in hard-dropping methods by maintaining a global view of the image.
  • Visual Fidelity: Visualizations demonstrate that while hard dropping can accidentally remove critical features (like a dog's ears), soft slimming preserves the overall structure, leading to more robust classifications.
  • Efficiency Gains: SiT can speed up a standard ViT by 1.7× with negligible accuracy loss. Under extreme compression, it reaches a 3.6× speedup while maintaining high performance. When applied to LV-ViT, SiT-L achieved a state-of-the-art 85.6% Top-1 accuracy on ImageNet.
Analysis of token redundancy across layers and a visual comparison showing how soft slimming preserves critical information that hard dropping might lose.

Conclusion

SiT provides a superior trade-off between throughput and accuracy compared to existing pruning and dropping methods. By shifting from deletion to aggregation, it allows ViTs to remain powerful yet efficient enough for real-world deployment. Future work may explore applying this soft slimming technique to hierarchical Transformers like Swin or extending it to dense prediction tasks like object detection and semantic segmentation.

Summary updated

BibTeX
@inproceedings{zong2022self,
  author = {Zhuofan Zong and Kunchang Li and Guanglu Song and Yali Wang and Yu Qiao and Biao Leng and Yu Liu},
  title = {{Self-slimmed Vision Transformer}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20083-0\_26},
}
Figure