Bridging the Divide: Reconsidering Softmax and Linear Attention
Dongchen Han, Yifan Pu, Zhuofan Xia, Yizeng Han, Xuran Pan, Xiu Li, Jiwen Lu, Shiji Song, Gao Huang
摘要
Widely adopted in modern Vision Transformer designs, Softmax attention can effectively capture long-range visual information; however, it incurs excessive computational cost when dealing with high-resolution inputs. In contrast, linear attention naturally enjoys linear complexity and has great potential to scale up to higher-resolution images. Nonetheless, the unsatisfactory performance of linear attention greatly limits its practical application in various scenarios. In this paper, we take a step forward to close the gap between the linear and Softmax attention with novel theoretical analyses, which demystify the core factors behind the performance deviations. Specifically, we present two key perspectives to understand and alleviate the limitations of linear attention: the injective property and the local modeling ability. Firstly, we prove that linear attention is not injective, which is prone to assign identical attention weights to different query vectors, thus adding to severe semantic confusion since different queries correspond to the same outputs. Secondly, we confirm that effective local modeling is essential for the success of Softmax attention, in which linear attention falls short. The aforementioned two fundamental differences significantly contribute to the disparities between these two attention paradigms, which is demonstrated by our substantial empirical validation in the paper. In addition, more experiment results indicate that linear attention, as long as endowed with these two properties, can outperform Softmax attention across various tasks while maintaining lower computation complexity. Code is available at https://github.com/LeapLabTHU/InLine.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 26 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Rectifying Magnitude Neglect in Linear Attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Rectifying Magnitude Neglect in Linear Attention 引用了 A ConvNet for the 2020s
- Rectifying Magnitude Neglect in Linear Attention 引用了 Demystify Mamba in Vision: A Linear Attention Perspective
- Rectifying Magnitude Neglect in Linear Attention 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Rectifying Magnitude Neglect in Linear Attention 引用了 Training data-efficient image transformers & distillation through attention
- A ConvNet for the 2020s 引用了 CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features
- A ConvNet for the 2020s 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- A ConvNet for the 2020s 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- A ConvNet for the 2020s 引用了 Training data-efficient image transformers & distillation through attention
- Demystify Mamba in Vision: A Linear Attention Perspective 引用了 CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features
- Demystify Mamba in Vision: A Linear Attention Perspective 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Demystify Mamba in Vision: A Linear Attention Perspective 引用了 A ConvNet for the 2020s
- Demystify Mamba in Vision: A Linear Attention Perspective 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Demystify Mamba in Vision: A Linear Attention Perspective 引用了 ENAT: Rethinking Spatial-temporal Interactions in Token-based Image Synthesis
- ENAT: Rethinking Spatial-temporal Interactions in Token-based Image Synthesis 引用了 Demystify Mamba in Vision: A Linear Attention Perspective
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 Training data-efficient image transformers & distillation through attention
- Training data-efficient image transformers & distillation through attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
引用它的顶会 Paper26
- Demystify Mamba in Vision: A Linear Attention PerspectiveDongchen Han, Ziyi Wang, Zhuofan Xia, Yizeng Han 等NeurIPS 2024 · 287 次引用
- Real-world Image Dehazing with Coherence-based Pseudo Labeling and Cooperative Unfolding NetworkChengyu Fang, Chunming He, Fengyang Xiao, Yulun Zhang 等NeurIPS 2024 · 46 次引用
- ENAT: Rethinking Spatial-temporal Interactions in Token-based Image SynthesisZanlin Ni, Yulin Wang, Renping Zhou, Yizeng Han 等NeurIPS 2024 · 15 次引用
- Rectifying Magnitude Neglect in Linear AttentionQihang Fan, Huaibo Huang, Yuang Ai, Ran HeICCV 2025 · 14 次引用
- Massive Memorization with Hundreds of Trillions of Parameters for Sequential Transducer Generative RecommendersZhimin Chen, Chenyu Zhao, Ka Chun Mo, Yunjiang Jiang 等ICLR 2026 · 13 次引用
它引用的 Paper26
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu 等ICCV 2021 · 31,683 次引用
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa 等ICML 2021 · 8,974 次引用
- A ConvNet for the 2020sZhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer 等CVPR 2022 · 6,782 次引用
- CutMix: Regularization Strategy to Train Strong Classifiers With Localizable FeaturesSangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh 等ICCV 2019 · 5,843 次引用
相关 Paper
- Breaking the Low-Rank Dilemma of Linear AttentionQihang Fan, Huaibo Huang, Ran HeCVPR 2025
- FLatten Transformer: Vision Transformer using Focused Linear AttentionDongchen Han, Xuran Pan, Yizeng Han, Shiji Song 等ICCV 2023 · 358 次引用
- ZeroS: Zero-Sum Linear Attention for Efficient TransformersJiecheng Lu, Xu Han, Yan Sun, Viresh Pati 等NeurIPS 2025 · 4 次引用
- ELFATT: Efficient Linear Fast Attention for Vision TransformersChong Wu, Maolin Che, Renjie Xu, Zhuoheng Ran 等ACM MM 2025 · 3 次引用
- cosFormer: Rethinking Softmax In AttentionZhen Qin, Weixuan Sun, Hui Deng, Dongxu Li 等ICLR 2022 · 303 次引用
