Joint Token Pruning and Squeezing Towards More Aggressive Compression of Vision Transformers

CVPR 2023  ยท  Siyuan Wei, Tianzhu Ye, Shen Zhang, Yao Tang, Jiajun Liang ยท

Although vision transformers (ViTs) have shown promising results in various computer vision tasks recently, their high computational cost limits their practical applications. Previous approaches that prune redundant tokens have demonstrated a good trade-off between performance and computation costs. Nevertheless, errors caused by pruning strategies can lead to significant information loss. Our quantitative experiments reveal that the impact of pruned tokens on performance should be noticeable. To address this issue, we propose a novel joint Token Pruning & Squeezing module (TPS) for compressing vision transformers with higher efficiency. Firstly, TPS adopts pruning to get the reserved and pruned subsets. Secondly, TPS squeezes the information of pruned tokens into partial reserved tokens via the unidirectional nearest-neighbor matching and similarity-based fusing steps. Compared to state-of-the-art methods, our approach outperforms them under all token pruning intensities. Especially while shrinking DeiT-tiny&small computational budgets to 35%, it improves the accuracy by 1%-6% compared with baselines on ImageNet classification. The proposed method can accelerate the throughput of DeiT-small beyond DeiT-tiny, while its accuracy surpasses DeiT-tiny by 4.78%. Experiments on various transformers demonstrate the effectiveness of our method, while analysis experiments prove our higher robustness to the errors of the token pruning policy. Code is available at https://github.com/megvii-research/TPS-CVPR2023.

PDF Abstract CVPR 2023 PDF CVPR 2023 Abstract

Datasets


Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Efficient ViTs ImageNet-1K (with DeiT-S) dTPS Top 1 Accuracy 80.1 # 1
GFLOPs 3.0 # 23
Efficient ViTs ImageNet-1K (with DeiT-S) eTPS Top 1 Accuracy 79.7 # 13
GFLOPs 3.0 # 23
Efficient ViTs ImageNet-1K (with DeiT-T) dTPS Top 1 Accuracy 72.9 # 1
GFLOPs 0.8 # 8
Efficient ViTs ImageNet-1K (with DeiT-T) eTPS Top 1 Accuracy 72.3 # 4
GFLOPs 0.8 # 8
Efficient ViTs ImageNet-1K (With LV-ViT-S) dTPS Top 1 Accuracy 82.6 # 13
GFLOPs 3.8 # 17
Efficient ViTs ImageNet-1K (With LV-ViT-S) eTPS Top 1 Accuracy 82.5 # 16
GFLOPs 3.8 # 17

Methods