Abstract
Vision Transformers (ViTs) have achieved state-of-the-art performance in computer vision but suffer from high computational costs due to the quadratic complexity of self-attention relative to the number of input tokens. This paper presents AS-ViT (Adaptive Sparse ViT), a framework designed to accelerate ViTs by adaptively pruning redundant tokens. Unlike previous methods that rely on fixed pruning ratios or expensive auxiliary modules, AS-ViT utilizes learnable thresholds and importance scores derived directly from multi-head self-attention. Our approach achieves a 50% throughput increase on DeiT-S with only a 0.2% drop in accuracy on ImageNet-1K.
Introduction
The computational overhead of Vision Transformers is largely driven by processing non-informative image regions, such as background patches. Efficiently identifying and discarding these "redundant" tokens is critical for real-world deployment. Current token pruning strategies typically fall into two camps: static pruning, which uses a fixed ratio regardless of image complexity, and dynamic pruning, which often requires additional predictor modules that add their own overhead.
AS-ViT addresses these limitations by introducing a sample-adaptive pruning mechanism that is both computationally efficient and learnable. By exploiting the inherent information in self-attention layers, AS-ViT adjusts the pruning intensity based on the specific content of each input image.
Methodology
The AS-ViT framework incorporates several innovations to enable efficient, adaptive pruning:
Head Importance Weighting
Rather than simply averaging attention scores across all heads, AS-ViT calculates an importance score for each head based on the $L_2$-norm of its context vector. This weighted approach recognizes that different attention heads focus on different semantic features, providing a more accurate metric for token importance.
Learnable Thresholds and Budget-Aware Training
Instead of manual pruning ratios, AS-ViT employs learnable parameters ($\theta$) as thresholds at specific stages of the network. Tokens with importance scores below these thresholds are pruned. To optimize these thresholds, a specialized loss function ($\mathcal{L}_{FLOPs}$) penalizes the model when the average computational cost exceeds a target budget. The Straight-Through Estimator (STE) is used to handle the non-differentiable nature of the pruning step during training.
Knowledge Distillation
To mitigate accuracy loss during the pruning process, the model undergoes fine-tuning with knowledge distillation. A pre-trained, unpruned ViT serves as a teacher, guiding the pruned "student" model to retain critical features.
Experiments and Key Results
AS-ViT was evaluated on the ImageNet-1K dataset using backbones such as DeiT-S, LV-ViT-S, and LV-ViT-M.
As shown in Figure 1, AS-ViT consistently outperforms existing pruning and architecture-based methods. For instance, AS-ViT achieves a 50% increase in throughput on DeiT-S (from 770 to 1192 images per second) with a negligible 0.2% accuracy drop. On the larger LV-ViT-M backbone, throughput improved by 153% while maintaining 83.9% accuracy.
Discussion and Insights
A key advantage of AS-ViT is its ability to handle "easy" versus "hard" samples differently. In "easy" images with simple backgrounds, the model can discard a large majority of tokens early in the network. Conversely, "hard" images with complex textures or camouflaged objects require the retention of more tokens to ensure accurate classification.
Figure 4 illustrates this adaptive behavior on a complex scene. By reusing existing Multi-Head Self-Attention (MHSA) outputs for scoring, AS-ViT avoids the computational burden of extra modules while maintaining high sensitivity to informative image regions.
Limitations and Future Work
Currently, pruning is restricted to specific stages to maintain training stability and memory efficiency. Future research will explore layer-wise pruning and the application of this adaptive framework to downstream tasks such as object detection and semantic segmentation. Additionally, combining dynamic token pruning with static weight pruning could yield even greater hardware acceleration.
Summary updated