Abstract
Vision Transformers (ViTs) have set new benchmarks in computer vision, yet their computational cost remains a significant barrier for dense prediction tasks. The self-attention mechanism's quadratic complexity relative to input resolution makes high-resolution processing slow and resource-intensive. We present the Token Adapter, a "plug-and-play" module designed to accelerate ViTs by up to 41% for tasks like semantic and instance segmentation. By strategically merging redundant rows and columns of tokens and reconstructing them post-inference, the method maintains high accuracy without requiring any model retraining.
Introduction
Dense prediction tasks, such as semantic segmentation, require high-resolution input to capture fine-grained spatial details. However, in standard Vision Transformers, this resolution comes with a heavy "attention tax." While various token reduction methods have been proposed, they typically suffer from two major drawbacks: the requirement for expensive retraining to adapt to missing data, and the use of sparse pruning which breaks the spatial grid, complicating both GPU batch processing and high-resolution reconstruction.
The Token Adapter Framework
The Token Adapter addresses these limitations through a structured approach to token reduction that preserves the image's inherent grid-like geometry. The framework consists of two core components:
Token Injector
Instead of selecting individual pixels for removal, the Token Injector evaluates the importance of entire rows and columns. It identifies "normal" tokens—those representing redundant background or repetitive textures—and "injects" (merges) them into representative tokens. "Unique" tokens, which typically contain critical edge or boundary information, are left untouched. This row-column operation ensures that the processed data retains a structured format compatible with standard transformer blocks.
Token Ejector
Following the transformer layers, the reduced token set must be restored to its original resolution for dense output. The Token Ejector utilizes a distance-based mapping to "eject" the compressed information back into the original spatial coordinates. This allows the model to generate the fine-grained masks necessary for accurate segmentation.
Preserving Spatial Structure
The efficacy of the Token Adapter stems from the observation that semantic information in natural images is often stored in contiguous blocks. Sparse pruning (removing random pixels) can be more disruptive to a model's contextual understanding than removing a structured row or column, provided the spatial relationships are maintained. Furthermore, this structured approach is more robust and faster on actual hardware compared to complex clustering-based reduction methods.
Experimental Results
The authors evaluated the Token Adapter across several standard benchmarks, including ADE20K, Cityscapes, PASCAL-Context, and COCO.
- Significant Speedups: On the ADE20K dataset using the Segmenter model, the Token Adapter achieved a 41% increase in Frames Per Second (FPS) while maintaining baseline performance levels.
- Superior Stability: Compared to existing methods like ToMe (Token Merging) and Expediting, Token Adapter demonstrated a better accuracy-to-speed trade-off. Under maximum acceleration, it outperformed Expediting by an average of 6.11% mIoU (mean Intersection over Union).
- Off-the-Shelf Versatility: The module proved effective across diverse architectures, including the ViT-based Segmenter and the Swin-Transformer-based MaskDINO, without requiring any weight updates or fine-tuning.
Conclusion
Token Adapter provides a practical solution for accelerating Vision Transformers in dense prediction scenarios. By leveraging row and column redundancy, it offers a zero-retraining path to significant efficiency gains, making high-resolution ViT applications more viable for real-time and resource-constrained environments.
Summary updated