Bridging the Divide: Reconsidering Softmax and Linear Attention

Dongchen Han, Yifan Pu, Zhuofan Xia, Yizeng Han, Xuran Pan +4 more
2/3/2026

No official code found. Best implementation: LeapLabTHU/InLine (60 stars, last commit 2024-12-22).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

LeapLabTHU/InLineCommunity100%

[NeurIPS 2024] Official repository of InLine attention

601PythonNov 12, 20241 years ago

Similar Papers

Cite this paper

@article{han2026bridging,
  title  = {Bridging the Divide: Reconsidering Softmax and Linear Attention},
  author = {Dongchen Han and Yifan Pu and Zhuofan Xia and Yizeng Han and Xuran Pan and Xiu Li and Jiwen Lu and Shiji Song and Gao Huang},
  year   = {2026},
  eprint = {2412.06590},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2412.06590},
  url    = {https://arxiv.org/abs/2412.06590},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2412.06590.svg)](https://codeofpaper.com/paper/2412.06590)

Discussion