Skip to main content
QUICK REVIEW

[Paper Review] Shunted Self-Attention via Multi-Scale Token Aggregation

Sucheng Ren, Daquan Zhou|arXiv (Cornell University)|Nov 30, 2021
Advanced Neural Network ApplicationsComputer Science34 references10 citations
TL;DR

This paper proposes Shunted Self-Attention (SSA), a novel multi-scale token aggregation mechanism that enables Vision Transformers to simultaneously model fine-grained and coarse-grained features within a single attention layer by selectively merging tokens. SSA reduces computational cost while improving performance on image classification, object detection, and semantic segmentation, achieving 84.0% Top-1 accuracy on ImageNet with half the model size and FLOPs of the SOTA Focal Transformer, and surpassing it by 1.3 mAP on COCO and 2.9 mIOU on ADE20K under similar efficiency constraints.

ABSTRACT

Recent Vision Transformer~(ViT) models have demonstrated encouraging results across various computer vision tasks, thanks to their competence in modeling long-range dependencies of image patches or tokens via self-attention. These models, however, usually designate the similar receptive fields of each token feature within each layer. Such a constraint inevitably limits the ability of each self-attention layer in capturing multi-scale features, thereby leading to performance degradation in handling images with multiple objects of different scales. To address this issue, we propose a novel and generic strategy, termed shunted self-attention~(SSA), that allows ViTs to model the attentions at hybrid scales per attention layer. The key idea of SSA is to inject heterogeneous receptive field sizes into tokens: before computing the self-attention matrix, it selectively merges tokens to represent larger object features while keeping certain tokens to preserve fine-grained features. This novel merging scheme enables the self-attention to learn relationships between objects with different sizes and simultaneously reduces the token numbers and the computational cost. Extensive experiments across various tasks demonstrate the superiority of SSA. Specifically, the SSA-based transformer achieves 84.0\% Top-1 accuracy and outperforms the state-of-the-art Focal Transformer on ImageNet with only half of the model size and computation cost, and surpasses Focal Transformer by 1.3 mAP on COCO and 2.9 mIOU on ADE20K under similar parameter and computation cost. Code has been released at https://github.com/OliverRensu/Shunted-Transformer.

Motivation & Objective

  • To address the limitation of Vision Transformers in capturing multi-scale features due to uniform, static receptive fields across tokens in each attention layer.
  • To reduce computational cost and memory consumption while preserving fine-grained details in images with objects of varying scales.
  • To enable a single self-attention layer to attend to both large and small objects simultaneously, improving performance on downstream vision tasks.
  • To design a generic, plug-and-play mechanism that enhances existing ViT architectures without architectural overhaul.

Proposed method

  • Introduce a shunted self-attention mechanism that splits the attention computation into two branches: one for merged, coarse-grained tokens and one for unmerged, fine-grained tokens.
  • Apply a learnable token aggregation function that selectively merges spatially adjacent tokens based on feature similarity and spatial context, forming larger receptive fields for large objects.
  • Maintain separate attention maps for coarse and fine features, allowing the model to learn relationships across different scales within the same layer.
  • Integrate a detail-specific feed-forward network that enhances local feature representation by incorporating neighboring token context, improving feature refinement.
  • Use a multi-scale patch embedding head that preserves spatial resolution and reduces information loss during initial feature extraction.
  • Apply a hybrid computation strategy where merged tokens reduce sequence length and FLOPs, while unmerged tokens retain high-resolution details.

Experimental results

Research questions

  • RQ1Can a single self-attention layer effectively model features at multiple scales without relying on hierarchical feature maps?
  • RQ2Does selective token merging improve performance on dense prediction tasks like object detection and semantic segmentation while reducing computational cost?
  • RQ3Can a unified attention mechanism outperform models that use separate branches for different scales or down-sampling strategies?
  • RQ4How does the proposed token aggregation function compare to standard convolutional or linear reduction in terms of accuracy and efficiency?
  • RQ5To what extent does incorporating local detail information in the feed-forward layer improve feature representation in ViT-based models?

Key findings

  • The Shunted Transformer achieves 84.0% Top-1 accuracy on ImageNet, outperforming the SOTA Focal Transformer with 50% fewer parameters and 50% less FLOPs.
  • On COCO object detection, the model surpasses Focal Transformer by 1.3 mAP under similar parameter and computation budgets.
  • On ADE20K semantic segmentation, the model improves mIOU by 2.9 points over Focal Transformer under comparable efficiency constraints.
  • With the SegFormer framework, the proposed backbone achieves 48.3% mIoU on ADE20K, outperforming MiT-B2 by 1.8 mIoU with 25.1M parameters (vs. 27.5M).
  • The detail-specific feed-forward layer improves Top-1 accuracy by 0.2% over standard feed-forward layers in ViT and 0.3% in the Shunted Transformer, demonstrating its effectiveness in preserving local details.
  • The proposed patch embedding head improves ImageNet accuracy by 1.4% over non-overlapping patch embedding and 0.3% over overlapping patch embedding, with minimal increase in FLOPs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.