SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
Abdelrahman M. Shaker, Muhammad Maaz, Hanoona Abdul Rasheed, Salman H. Khan, Ming-Hsuan Yang, Fahad Shahbaz Khan
Abstract
Self-attention has become a defacto choice for capturing global context in various vision applications. However, its quadratic computational complexity with respect to image resolution limits its use in real-time applications, especially for deployment on resource-constrained mobile devices. Although hybrid approaches have been proposed to combine the advantages of convolutions and self-attention for a better speed-accuracy trade-off, the expensive matrix multiplication operations in self-attention remain a bottleneck. In this work, we introduce a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations with linear element-wise multiplications. Our design shows that the key-value interaction can be replaced with a linear layer without sacrificing any accuracy. Unlike previous state-of-the-art methods, our efficient formulation of self-attention enables its usage at all stages of the network. Using our proposed efficient additive attention, we build a series of models called "SwiftFormer" which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Our small variant achieves 78.5% top-1 ImageNet-1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2× faster compared to MobileViT-v2. Our code and models: https://tinyurl.com/5ft8v46w
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.
16 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- MobileCLIP: Fast Image-Text Models through Multi-Modal Reinforced Training cites Searching for MobileNetV3
- MobileCLIP: Fast Image-Text Models through Multi-Modal Reinforced Training cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- MobileCLIP: Fast Image-Text Models through Multi-Modal Reinforced Training cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- MobileCLIP: Fast Image-Text Models through Multi-Modal Reinforced Training cites Training data-efficient image transformers & distillation through attention
- 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 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
- Rep ViT: Revisiting Mobile CNN From ViT Perspective cites Searching for MobileNetV3
- Rep ViT: Revisiting Mobile CNN From ViT Perspective cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Rep ViT: Revisiting Mobile CNN From ViT Perspective cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Rep ViT: Revisiting Mobile CNN From ViT Perspective cites Training data-efficient image transformers & distillation through attention
- Spike-driven Transformer cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Spike-driven Transformer cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Spike-driven Transformer cites Training data-efficient image transformers & distillation through attention
- Training data-efficient image transformers & distillation through attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design cites Searching for MobileNetV3
- SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design cites Training data-efficient image transformers & distillation through attention
Cited by top-tier papers16
- Rep ViT: Revisiting Mobile CNN From ViT PerspectiveAo Wang, Hui Chen, Zijia Lin, Jungong Han et al.CVPR 2024 · 500 citations
- Spike-driven TransformerMan Yao, Jiakui Hu, Zhaokun Zhou, Li Yuan et al.NeurIPS 2023 · 368 citations
- SHViT: Single-Head Vision Transformer with Memory Efficient Macro DesignSeokju Yun, Youngmin RoCVPR 2024 · 117 citations
- MobileCLIP: Fast Image-Text Models through Multi-Modal Reinforced TrainingPavan Kumar Anasosalu Vasu, Hadi Pouransari, Fartash Faghri, Raviteja Vemulapalli et al.CVPR 2024 · 29 citations
- SfPUEL: Shape from Polarization under Unknown Environment LightYouwei Lyu, Heng Guo, Kailong Zhang, Si Li et al.NeurIPS 2024 · 18 citations
Builds on26
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
- 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
- Searching for MobileNetV3Andrew Howard, Ruoming Pang, Hartwig Adam, Quoc V. Le et al.ICCV 2019 · 9,163 citations
- Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa et al.ICML 2021 · 8,974 citations
- Deformable DETR: Deformable Transformers for End-to-End Object DetectionXizhou Zhu, Weijie Su, Lewei Lu, Bin Li et al.ICLR 2021 · 7,353 citations
Related papers
- Iformer: Integrating ConvNet and Transformer for Mobile ApplicationChuanyang ZhengICLR 2025
- EfficientFormer: Vision Transformers at MobileNet SpeedYanyu Li, Geng Yuan, Yang Wen, Ju Hu et al.NeurIPS 2022 · 742 citations
- Efficient Modulation for Vision NetworksXu Ma, Xiyang Dai, Jianwei Yang, Bin Xiao et al.ICLR 2024 · 30 citations
- EfficientViT: Lightweight Multi-Scale Attention for High-Resolution Dense PredictionHan Cai, Junyan Li, Muyan Hu, Chuang Gan et al.ICCV 2023 · 265 citations
- MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision TransformerSachin Mehta, Mohammad RastegariICLR 2022 · 2,162 citations
