Abstract
Vision Transformers (ViTs) have achieved state-of-the-art performance across various computer vision tasks, yet their high computational demands hinder deployment on resource-constrained devices. While token pruning effectively reduces computation by removing redundant tokens, it often incurs significant information loss. We propose the Joint Token Pruning & Squeezing (TPS) module to address this. TPS first partitions tokens into reserved and pruned sets, then "squeezes" the information from pruned tokens into reserved "host" tokens through unidirectional nearest-neighbor matching and similarity-based fusion. Our method significantly outperforms existing pruning strategies, particularly under aggressive compression. For instance, at a 35% computational budget, TPS improves the accuracy of DeiT models by 1% to 6% on ImageNet. Furthermore, a TPS-optimized DeiT-small achieves higher throughput and 4.78% better accuracy than a standard DeiT-tiny.
1. Introduction
The primary bottleneck for Vision Transformers (ViTs) is their quadratic computational complexity with respect to the number of input tokens. To mitigate this, researchers have developed token pruning methods that identify and remove "unimportant" tokens (e.g., background patches). However, the binary nature of pruning—either keeping or deleting a token—often results in the loss of useful contextual information. Our research demonstrates that even tokens labeled as unimportant contribute to the model's predictive power. To bridge this gap, we introduce Token Pruning & Squeezing (TPS), a framework designed to retain the essence of discarded tokens while still achieving significant speedups.
2. The TPS Framework
The TPS module operates in two distinct phases: Pruning and Squeezing. This approach ensures that the model benefits from reduced token counts without the "steep drop" in performance typical of traditional pruning.
2.1 Token Pruning
TPS utilizes established scoring mechanisms, such as learnable prediction heads (dTPS) or attention-based importance metrics (eTPS), to rank tokens. Tokens are then divided into a reserved set (important) and a pruned set (less important) based on their importance scores.
2.2 Token Squeezing
The squeezing phase is the core innovation of our work. Rather than simply discarding the pruned set, TPS integrates their features into the reserved set:
- Unidirectional Nearest-Neighbor Matching: Each pruned token is matched to its most similar counterpart in the reserved set, which acts as a "host token."
- Similarity-Based Fusing: The features of the pruned tokens are merged into their respective host tokens using a weighted average based on cosine similarity. This ensures that the host tokens carry the "contextual footprint" of the background or redundant areas.
3. Experimental Analysis
3.1 The Value of "Unimportant" Tokens
To validate our hypothesis that pruned tokens contain vital information, we conducted a "reversed policy" experiment. By training a model to keep only the tokens typically discarded by pruning, we found it could still classify many images correctly. This confirms that discarded tokens provide complementary information that should be preserved rather than deleted.
3.2 Performance on ImageNet-1K and iNaturalist
We evaluated TPS across various architectures, including DeiT, LV-ViT, and hybrid models like PVT and CvT. TPS consistently outperformed state-of-the-art methods like DynamicViT and EViT. Notably, when the computational budget was reduced to 35%, TPS maintained significantly higher accuracy (1% to 6% improvement), demonstrating its robustness under aggressive compression.
3.3 Efficiency and Throughput
TPS allows larger models to operate with the efficiency of smaller ones. A DeiT-small model with TPS achieved a throughput of 1,745 images per second, surpassing the 1,686 images per second of the much smaller DeiT-tiny, while maintaining a 4.78% lead in accuracy. This proves that squeezing information is a more effective strategy than simply reducing model depth or width.
4. Conclusion and Future Work
TPS provides a more nuanced approach to ViT compression by treating token reduction as an information aggregation problem rather than a simple deletion task. By "squeezing" context into reserved tokens, TPS achieves superior accuracy-speed tradeoffs and exhibits higher resilience to pruning errors.
While highly effective for classification, future work will focus on extending TPS to dense prediction tasks like object detection and segmentation, where spatial relationships are even more critical. Additionally, we aim to explore pruning-aware training from scratch to further optimize the compression pipeline and reduce the need for extensive fine-tuning.
Summary updated