Introduction
Vision Transformers (ViTs) have established themselves as state-of-the-art backbones for semantic segmentation. However, their standard self-attention mechanism processes every image token through every layer, leading to high computational costs. This is particularly inefficient for dense prediction tasks where large portions of an image (e.g., sky, road) may be semantically simple and require less processing than complex object boundaries.
The DoViT Framework
The proposed Dynamic Token-Pass Transformers (DoViT) introduce a "data-aware" strategy. Unlike traditional token pruning, which discards information, DoViT utilizes a "token-passing" mechanism. This allows the model to maintain the full spatial resolution required for segmentation while skipping redundant computations for "easy" regions.
Core Components
- Semantic Early-Probe: Lightweight auxiliary heads evaluate feature confidence at intermediate blocks. Tokens with high-confidence predictions are marked as "easy" and stopped from further heavy processing.
- Separate Self-Attention: The model bifurcates the token stream. "Hard" tokens continue through standard Multi-Head Self-Attention (MSA) layers, while "stopped" tokens bypass these layers, significantly reducing FLOPs.
- Token Reconstruction: To handle the varying processing speeds of different tokens, this module reorders and reassembles all tokens into their original spatial grid for the final decoder.
- Self-Distillation: A teacher-student framework ensures that the dynamic paths maintain high accuracy by learning from a full-depth ViT teacher.
Experimental Results
DoViT was evaluated on the Cityscapes and ADE20K benchmarks across various ViT scales (Large, Base, and Small).
The results demonstrate a substantial improvement in efficiency:
- Computational Efficiency: A reduction in FLOPs by 40% to 60%.
- Throughput Gains: Real-world speedups of over 2x (FPS) on standard hardware like the NVIDIA V100.
- Accuracy Preservation: The mean Intersection over Union (mIoU) drop was restricted to less than 0.8%, outperforming previous dynamic methods that often saw drops exceeding 5%.
Conclusion
DoViT proves that dense prediction tasks can benefit from dynamic computation without sacrificing spatial integrity. By focusing resources on "hard" pixels and preserving object boundaries, it offers a practical path toward deploying high-performance Transformers in resource-constrained environments. Future work includes combining this data-aware approach with parameter-aware methods like quantization for further optimization.
Summary updated