Lune

NeurIPS2021Top-tier venue

Twins: Revisiting the Design of Spatial Attention in Vision Transformers

Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, Chunhua Shen

Abstract

Very recently, a variety of vision transformer architectures for dense prediction tasks have been proposed and they show that the design of spatial attention is critical to their success in these tasks. In this work, we revisit the design of the spatial attention and demonstrate that a carefully-devised yet simple spatial attention mechanism performs favourably against the state-of-the-art schemes. As a result, we propose two vision transformer architectures, namely, Twins-PCPVT and Twins-SVT. Our proposed architectures are highly-efficient and easy to implement, only involving matrix multiplications that are highly optimized in modern deep learning frameworks. More importantly, the proposed architectures achieve excellent performance on a wide range of visual tasks, including image level classification as well as dense detection and segmentation. The simplicity and strong performance suggest that our proposed architectures may serve as stronger backbones for many vision tasks. Our code is released at https://github.com/Meituan-AutoML/Twins .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

190 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Uformer: A General U-Shaped Transformer for Image Restoration cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Uformer: A General U-Shaped Transformer for Image Restoration cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Uformer: A General U-Shaped Transformer for Image Restoration cites CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
  • Uformer: A General U-Shaped Transformer for Image Restoration cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites Training data-efficient image transformers & distillation through attention
  • YOLOv12: Attention-Centric Real-Time Object Detectors cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites Uformer: A General U-Shaped Transformer for Image Restoration
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites Training data-efficient image transformers & distillation through attention
  • AdaptFormer: Adapting Vision Transformers for Scalable Visual Recognition cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Training data-efficient image transformers & distillation through attention
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows cites Training data-efficient image transformers & distillation through attention
  • CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites Training data-efficient image transformers & distillation through attention
  • Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • Training data-efficient image transformers & distillation through attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Swin Transformer V2: Scaling Up Capacity and Resolution cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Swin Transformer V2: Scaling Up Capacity and Resolution cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Swin Transformer V2: Scaling Up Capacity and Resolution cites CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
  • Swin Transformer V2: Scaling Up Capacity and Resolution cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
  • Swin Transformer V2: Scaling Up Capacity and Resolution cites Training data-efficient image transformers & distillation through attention
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers190

  1. YOLOv12: Attention-Centric Real-Time Object DetectorsYunjie Tian, Qixiang Ye, David S. DoermannNeurIPS 2025 · 2,652 citations
  2. Swin Transformer V2: Scaling Up Capacity and ResolutionZe Liu, Han Hu, Yutong Lin, Zhuliang Yao et al.CVPR 2022 · 2,138 citations
  3. Uformer: A General U-Shaped Transformer for Image RestorationZhendong Wang, Xiaodong Cun, Jianmin Bao, Wengang Zhou et al.CVPR 2022 · 1,970 citations
  4. AdaptFormer: Adapting Vision Transformers for Scalable Visual RecognitionShoufa Chen, Chongjian Ge, Zhan Tong, Jiangliu Wang et al.NeurIPS 2022 · 1,291 citations
  5. CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped WindowsXiaoyi Dong, Jianmin Bao, Dongdong Chen, Weiming Zhang et al.CVPR 2022 · 1,207 citations

Builds on19

  1. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  2. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  3. Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa et al.ICML 2021 · 8,974 citations
  4. Deformable DETR: Deformable Transformers for End-to-End Object DetectionXizhou Zhu, Weijie Su, Lewei Lu, Bin Li et al.ICLR 2021 · 7,353 citations
  5. Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without ConvolutionsWenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan et al.ICCV 2021 · 4,909 citations

Related papers

  1. Vision Transformer with Deformable AttentionZhuofan Xia, Xuran Pan, Shiji Song, Li Erran Li et al.CVPR 2022 · 835 citations
  2. Vision Transformer with Sparse Scan PriorYuguang Zhang, Qihang Fan, Huaibo HuangACM MM 2025 · 2 citations
  3. RMT: Retentive Networks Meet Vision TransformersQihang Fan, Huaibo Huang, Mingrui Chen, Hongmin Liu et al.CVPR 2024
  4. Less Is More: Pay Less Attention in Vision TransformersZizheng Pan, Bohan Zhuang, Haoyu He, Jing Liu et al.AAAI 2022 · 109 citations
  5. When Shift Operation Meets Vision Transformer: An Extremely Simple Alternative to Attention MechanismGuangting Wang, Yucheng Zhao, Chuanxin Tang, Chong Luo et al.AAAI 2022 · 92 citations
Dusk over the sea between two cliffs drawn in fine vertical lines