Lune

NeurIPS2021Top-tier venue

SOFT: Softmax-free Transformer with Linear Complexity

Jiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, Li Zhang

Abstract

Vision transformers (ViTs) have pushed the state-of-the-art for various visual recognition tasks by patch-wise image tokenization followed by self-attention. However, the employment of self-attention modules results in a quadratic complexity in both computation and memory usage. Various attempts on approximating the self-attention computation with linear complexity have been made in Natural Language Processing. However, an in-depth analysis in this work shows that they are either theoretically flawed or empirically ineffective for visual recognition. We further identify that their limitations are rooted in keeping the softmax self-attention during approximations. Specifically, conventional self-attention is computed by normalizing the scaled dot-product between token feature vectors. Keeping this softmax operation challenges any subsequent linearization efforts. Based on this insight, for the first time, a softmax-free transformer or SOFT is proposed. To remove softmax in self-attention, Gaussian kernel function is used to replace the dot-product similarity without further normalization. This enables a full self-attention matrix to be approximated via a low-rank matrix decomposition. The robustness of the approximation is achieved by calculating its Moore-Penrose inverse using a Newton-Raphson method. Extensive experiments on ImageNet show that our SOFT significantly improves the computational efficiency of existing ViT variants. Crucially, with a linear complexity, much longer token sequences are permitted in SOFT, resulting in superior trade-off between accuracy and complexity.

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.

55 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

  • FLatten Transformer: Vision Transformer using Focused Linear Attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • FLatten Transformer: Vision Transformer using Focused Linear Attention cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • FLatten Transformer: Vision Transformer using Focused Linear Attention cites Training data-efficient image transformers & distillation through attention
  • FLatten Transformer: Vision Transformer using Focused Linear Attention cites Deformable DETR: Deformable Transformers for End-to-End Object Detection
  • FasterViT: Fast Vision Transformers with Hierarchical Attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • FasterViT: Fast Vision Transformers with Hierarchical Attention cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • FasterViT: Fast Vision Transformers with Hierarchical Attention cites Training data-efficient image transformers & distillation through attention
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • Demystify Mamba in Vision: A Linear Attention Perspective cites FLatten Transformer: Vision Transformer using Focused Linear Attention
  • Demystify Mamba in Vision: A Linear Attention Perspective cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Demystify Mamba in Vision: A Linear Attention Perspective cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Demystify Mamba in Vision: A Linear Attention Perspective cites Bridging the Divide: Reconsidering Softmax and Linear Attention
  • Bridging the Divide: Reconsidering Softmax and Linear Attention cites Demystify Mamba in Vision: A Linear Attention Perspective
  • 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
  • Training data-efficient image transformers & distillation through attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Bridging the Divide: Reconsidering Softmax and Linear Attention cites FLatten Transformer: Vision Transformer using Focused Linear Attention
  • Bridging the Divide: Reconsidering Softmax and Linear Attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Bridging the Divide: Reconsidering Softmax and Linear Attention cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Bridging the Divide: Reconsidering Softmax and Linear Attention cites Training data-efficient image transformers & distillation through attention
  • Flowformer: Linearizing Transformers with Conservation Flows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Flowformer: Linearizing Transformers with Conservation Flows cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Flowformer: Linearizing Transformers with Conservation Flows cites Language Models are Few-Shot Learners
  • Flowformer: Linearizing Transformers with Conservation Flows 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 papers55

  1. FLatten Transformer: Vision Transformer using Focused Linear AttentionDongchen Han, Xuran Pan, Yizeng Han, Shiji Song et al.ICCV 2023 · 358 citations
  2. Demystify Mamba in Vision: A Linear Attention PerspectiveDongchen Han, Ziyi Wang, Zhuofan Xia, Yizeng Han et al.NeurIPS 2024 · 287 citations
  3. FasterViT: Fast Vision Transformers with Hierarchical AttentionAli Hatamizadeh, Greg Heinrich, Hongxu Yin, Andrew Tao et al.ICLR 2024 · 132 citations
  4. Flowformer: Linearizing Transformers with Conservation FlowsHaixu Wu, Jialong Wu, Jiehui Xu, Jianmin Wang et al.ICML 2022 · 130 citations
  5. Bridging the Divide: Reconsidering Softmax and Linear AttentionDongchen Han, Yifan Pu, Zhuofan Xia, Yizeng Han et al.NeurIPS 2024 · 69 citations

Builds on26

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  3. 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
  4. Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa et al.ICML 2021 · 8,974 citations
  5. 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

  1. QT-ViT: Improving Linear Attention in ViT with Quadratic Taylor ExpansionYixing Xu, Chao Li, Dong Li, Xiao Sheng et al.NeurIPS 2024 · 7 citations
  2. Breaking the Low-Rank Dilemma of Linear AttentionQihang Fan, Huaibo Huang, Ran HeCVPR 2025
  3. LaplacianFormer: Rethinking Linear Attention with Laplacian KernelZhe Feng, Sen Lian, Changwei Wang, Muyang Zhang et al.ICLR 2026 · 3 citations
  4. You Only Need Less Attention at Each Stage in Vision TransformersShuoxi Zhang, Hanpeng Liu, Stephen Lin, Kun HeCVPR 2024 · 19 citations
  5. Scalable Vision Transformers with Hierarchical PoolingZizheng Pan, Bohan Zhuang, Jing Liu, Haoyu He et al.ICCV 2021 · 154 citations
Dusk over the sea between two cliffs drawn in fine vertical lines