TL;DR
Vision Transformers (ViTs) are highly effective but computationally expensive for dense prediction tasks due to their quadratic token complexity. This paper introduces SViT (Selective Vision Transformer), a token pruning framework tailored for object detection and instance segmentation that preserves and reactivates tokens on demand. SViT achieves up to a 46% backbone speedup on hardware with a negligible (~0.3 mAP) drop in accuracy, significantly outperforming prior classification-focused pruning methods.
What Problem Does This Paper Address?
Vision Transformers have revolutionized computer vision, but their global self-attention mechanism comes with a catch: computational cost scales quadratically with the number of tokens (patches) in an image. Token pruning—identifying and dropping uninformative tokens early—is a popular solution to accelerate inference.
However, existing token pruning methods were designed almost exclusively for image classification. In classification, uninformative tokens can be permanently discarded because the final prediction relies solely on a single global "class token." If you try this on dense prediction tasks like object detection or instance segmentation, performance plummets. Dense tasks require fine-grained spatial details across the entire image to locate and outline objects accurately; permanently throwing away tokens destroys this vital spatial structure.
Methods
The authors propose SViT (Selective Vision Transformer) to bridge the gap between token pruning and dense prediction.
Instead of using complex, multi-branch gating networks, SViT employs a lightweight 2-layer MLP combined with a Gumbel-Softmax activation to make discrete pruning decisions differentiable during training. The core architectural innovations are:
- Token Preserving: Pruned tokens are not discarded. Their last-computed features are kept statically in the feature map, ensuring the final detection head still receives a complete, high-resolution dense feature map.
- Token Reactivation: Tokens pruned in early layers can be reintroduced ("reactivated") into the backbone at later layers if the network determines they are needed.
- Dynamic Pruning Rate: SViT uses a batch-wide dynamic ratio loss during training. This allows the model to dynamically allocate more tokens to complex images and fewer tokens to simple ones during inference.
Datasets
The primary evaluation is conducted on the benchmark COCO 2017 dataset (118K training images, 5K validation images) for object detection and instance segmentation, using Mask R-CNN as the framework. The authors also validate their model on ImageNet-1K for image classification in the supplementary material to demonstrate its generalizability.
Key Insights and Ideas
- Preservation is Essential for Dense Tasks: Keeping the features of pruned tokens intact instead of zeroing them out or removing them allows end-to-end gradients to flow properly and retains background context necessary for bounding box regression.
- Layer-Wise Attention Shifts: ViT layers do not all focus on the same regions. Early layers might focus on broad background context, while middle layers zero in on objects. By allowing token reactivation, SViT accommodates these changing layer preferences, making the pruning process robust to early mistakes.
- Simplicity Wins: Prior classification methods relied on complex gating mechanisms. The authors prove that a simple 2-layer MLP performs just as well while simplifying model architecture.
Key Results
- Minimal Accuracy Loss: Compared to a dense baseline (DeiT-S), which uses 100% of its tokens, SViT-S reduces the performance drop to just 0.3 mAP for both boxes and masks. Previous state-of-the-art pruning methods suffered much harsher drops of 1.3 to 1.8 mAP.
- Significant Speedups: SViT-S achieves a 34% inference speedup for the entire network and a 46% speedup for the backbone on an NVIDIA A100 GPU.
- Intelligent Allocation: Qualitative heatmaps demonstrate that SViT automatically concentrates computation on complex, fine-grained object contours (like the legs of a zebra or the edges of donuts) while aggressively pruning uniform background areas like grass or floors.
Limitations and Future Work
- Isotropic Architectures Only: This work focuses strictly on isotropic vision transformers (where token counts and dimensions remain constant across blocks, like plain ViT or DeiT). It does not explore hierarchical or pyramidal architectures like Swin Transformers.
- Heuristic Pruning Rates: The target keeping ratios per layer were adopted from existing classification literature rather than being mathematically optimized for dense tasks.
- Training Overhead: Fine-tuning the sparse model requires additional training epochs, which increases energy consumption during the development phase, though this is amortized once deployed.
Summary updated