Token Cropr: Faster ViTs for Quite a Few Tasks

Benjamin Bergner, Christoph Lippert, Aravindh Mahendran

Abstract

The adoption of Vision Transformers (ViTs) in resource-constrained applications necessitates improvements in inference throughput. To this end, several token pruning and merging approaches have been proposed that improve efficiency by successively reducing the number of tokens. However, it remains an open problem to design a token reduction method that is fast, maintains high performance, and is applicable to various vision tasks. In this work, we present a token pruner that uses auxiliary prediction heads that learn to select tokens end-to-end based on task relevance. These auxiliary heads can be removed after training, leading to throughput close to that of a random pruner. We evaluate our method on image classification, semantic segmentation, object detection, and instance segmentation, and show speedups of 1.5 to 4x with small drops in performance. As a best case, on the ADE20k semantic segmentation benchmark, we observe a 2x speedup relative to the no-pruning baseline, with a negligible performance penalty of 0.1 median mIoU across 5 seeds.

Introduction

Vision Transformers (ViTs) have established themselves as a cornerstone of modern computer vision. However, their widespread deployment is often hindered by the quadratic computational complexity of the self-attention mechanism relative to the number of input tokens. While token pruning—the process of discarding less informative image patches—offers a path toward efficiency, existing methods often struggle with two primary challenges. First, many rely on heuristic-based selection (such as internal attention scores) that may not align with the final task's requirements. Second, "dense" tasks like semantic segmentation and object detection suffer when spatial information is permanently discarded early in the network, as they require high-resolution feature maps for accurate localization.

Methodology: Task-Aware Pruning and Last Layer Fusion

The proposed Token Cropr framework addresses these limitations by introducing a learnable, task-aware pruning mechanism. The core of the method is the Cropr module, which is strategically inserted between ViT blocks.

Task-Aware Scoring

Unlike heuristic methods, Cropr utilizes an auxiliary prediction head during training. This head attempts to solve the target task using only a summary of the current tokens, forcing the "router" to learn which specific tokens are most critical for the final objective. To ensure that the auxiliary task does not interfere with the primary backbone's feature representation, a stop-gradient is applied between the backbone and the Cropr module.

Last Layer Fusion (LLF)

To support dense prediction tasks, the authors introduce Last Layer Fusion. Instead of permanently deleting pruned tokens, Cropr "skips" them past the intermediate transformer layers. These tokens are then re-inserted just before the final ViT block. This allows the model to operate on a significantly reduced sequence length for the bulk of its computation while retaining the full spatial context necessary for high-resolution outputs in segmentation or detection tasks.

Figure 1: The Cropr architecture overview. Tokens are pruned based on task-relevance and re-inserted at the final layer (Last Layer Fusion) to maintain spatial resolution for dense tasks.

Hardware-Friendly Optimization

At inference time, the auxiliary heads and aggregators are discarded. The scoring mechanism is simplified into a single vector-matrix multiplication, achieving throughput comparable to random pruning. Furthermore, the authors optimize for GPU memory alignment by ensuring the number of kept tokens remains a multiple of 8.

Key Results

The effectiveness of Cropr was validated across a variety of benchmarks, including ImageNet-1k (classification), ADE20k (segmentation), and COCO (detection).

  • Image Classification: On ImageNet-1k, a ViT-L model equipped with Cropr achieved a 2.1x speedup with a marginal 0.2% drop in top-1 accuracy.
  • Semantic Segmentation: On ADE20k, the method achieved a 2x speedup with a negligible performance penalty of 0.1 median mIoU, demonstrating the power of the Last Layer Fusion technique.
  • Object Detection: For COCO, Cropr delivered a 1.9x overall speedup while maintaining competitive mAP scores.

Scaling and Efficiency

A key finding is that Cropr's benefits scale with model size. Larger models, such as ViT-Huge, exhibit more redundancy, allowing for more aggressive pruning with even smaller relative performance penalties compared to ViT-Base.

Figure 6: Accuracy vs. Throughput across different ViT model sizes. Cropr (purple) consistently provides a better efficiency-accuracy trade-off than the no-pruning baseline (grey).

Conclusion and Future Work

Token Cropr represents a significant step toward making large-scale ViTs practical for real-time applications. By shifting from heuristic to task-aware pruning and introducing Last Layer Fusion, the method overcomes the traditional trade-off between efficiency and spatial resolution. While currently optimized for NVIDIA GPUs, future work may explore automated pruning schedules and the application of this task-aware logic to other modalities like long-form text or audio processing.

Summary updated

Abstract

The adoption of Vision Transformers (ViTs) in resource-constrained applications necessitates improvements in inference throughput. To this end several token pruning and merging approaches have been proposed that improve efficiency by successively reducing the number of tokens. However, it remains an open problem to design a token reduction method that is fast, maintains high performance, and is applicable to various vision tasks. In this work, we present a token pruner that uses auxiliary prediction heads that learn to select tokens end-to-end based on task relevance. These auxiliary heads can be removed after training, leading to throughput close to that of a random pruner. We evaluate our method on image classification, semantic segmentation, object detection, and instance segmentation, and show speedups of 1.5 to 4x with small drops in performance. As a best case, on the ADE20k semantic segmentation benchmark, we observe a 2x speedup relative to the no-pruning baseline, with a negligible performance penalty of 0.1 median mIoU across 5 seeds.
BibTeX
@inproceedings{bergner2025token,
  author = {Benjamin Bergner and Christoph Lippert and Aravindh Mahendran},
  title = {{Token Cropr: Faster ViTs for Quite a Few Tasks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00910},
}
Figure