Learned Thresholds Token Merging and Pruning for Vision Transformers

20 Jul 2023  ·  Maxim Bonnaerens, Joni Dambre ·

Vision transformers have demonstrated remarkable success in a wide range of computer vision tasks over the last years. However, their high computational costs remain a significant barrier to their practical deployment. In particular, the complexity of transformer models is quadratic with respect to the number of input tokens. Therefore techniques that reduce the number of input tokens that need to be processed have been proposed. This paper introduces Learned Thresholds token Merging and Pruning (LTMP), a novel approach that leverages the strengths of both token merging and token pruning. LTMP uses learned threshold masking modules that dynamically determine which tokens to merge and which to prune. We demonstrate our approach with extensive experiments on vision transformers on the ImageNet classification task. Our results demonstrate that LTMP achieves state-of-the-art accuracy across reduction rates while requiring only a single fine-tuning epoch, which is an order of magnitude faster than previous methods. Code is available at https://github.com/Mxbonn/ltmp .

PDF Abstract

Datasets


Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Efficient ViTs ImageNet-1K (with DeiT-S) LTMP (80%) Top 1 Accuracy 79.8 # 4
GFLOPs 3.8 # 37
Efficient ViTs ImageNet-1K (with DeiT-S) LTMP (45%) Top 1 Accuracy 78.6 # 34
GFLOPs 2.3 # 5
Efficient ViTs ImageNet-1K (with DeiT-S) LTMP (60%) Top 1 Accuracy 79.6 # 16
GFLOPs 3.0 # 23
Efficient ViTs ImageNet-1K (with DeiT-T) LTMP (45%) Top 1 Accuracy 69.8 # 21
GFLOPs 0.7 # 5
Efficient ViTs ImageNet-1K (with DeiT-T) LTMP (60%) Top 1 Accuracy 71.5 # 15
GFLOPs 0.8 # 8
Efficient ViTs ImageNet-1K (with DeiT-T) LTMP (80%) Top 1 Accuracy 72.0 # 11
GFLOPs 1.0 # 18

Methods