Abstract
Vision Transformers (ViTs) have achieved remarkable success in computer vision but face significant computational challenges due to the quadratic complexity of self-attention. This paper introduces Partial Attention, a mechanism designed to mitigate attention redundancy by partitioning image tokens into a small "foreground" set for intensive processing and a larger "background" set handled via efficient single-query attention. The resulting PartialFormer architecture achieves state-of-the-art performance, outperforming models like Swin and Focal Transformers while significantly reducing GFLOPs.
Introduction
Standard self-attention in ViTs scales quadratically ($O(N^2)$) with the number of tokens, leading to a "computational explosion" at higher resolutions. While existing methods like window attention or spatial reduction attempt to address this, they often overlook attention redundancy. Empirical observations show that attention maps for different pixels are frequently nearly identical, indicating that the model performs redundant calculations. Partial Attention addresses this by isolating unique information and simplifying the processing of redundant background regions.
The Partial Attention Mechanism
The proposed Partial Attention module consists of three core components designed to balance global modeling with computational efficiency.
- Token Separation: Tokens are assigned a "context score" and sorted. A small subset of high-priority tokens forms the Foreground set ($N_F$), while the remaining tokens form the Background set ($N_B$).
- Mixed Multi-Head Self-Attention (MMSA): Full self-attention is restricted to the foreground tokens. To enhance feature diversity, a HeadMLP is introduced, allowing communication between different attention heads.
- Single-Query Attention (SQA): The background tokens are processed using a single "abstract token" query derived from the foreground. This reduces the complexity for the background set from quadratic to linear ($O(N_B)$).
- Information Exchange: A learnable token acts as a bridge, facilitating information flow between foreground and background features.
These modules are integrated into PartialFormer, a hierarchical backbone following a standard four-stage design.
Experimental Results
PartialFormer was evaluated on ImageNet-1K, MS-COCO, and ADE20K, demonstrating a superior accuracy-to-efficiency trade-off.
On ImageNet-1K, PartialFormer-B3 achieves 83.0% Top-1 accuracy with only 3.4 GFLOPs, surpassing Swin-T (+1.7% accuracy) and Focal-T (+0.8% accuracy) while using 25-30% fewer GFLOPs. In downstream tasks, it maintains this lead, outperforming Swin-T by 2.0% mIoU on ADE20K semantic segmentation.
Beyond the standalone architecture, the Partial Attention block is highly versatile. Replacing the standard attention in a Swin Transformer with Partial Attention reduced GFLOPs by 0.6 while simultaneously increasing accuracy by 1.3%, proving the method is broadly applicable.
Conclusion
Partial Attention effectively addresses the computational bottlenecks of ViTs by leveraging token-level redundancy. By treating foreground and background tokens differently, PartialFormer achieves high performance with reduced complexity. Future work may involve optimizing token sorting for hardware and extending this "partial" processing paradigm to video and multi-modal data.
Summary updated