paper-with-me

홈 › Papers

SOFT: Softmax-free Transformer with Linear Complexity

2021-10-22 · NeurIPS 2021 12 · Jiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, Li Zhang

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.

📄 PDF Abstract BibTeX arXiv:2110.11945

Code (2)

fudan-zvg/SOFT_MindSpore_Ascend mindspore
fudan-zvg/soft pytorch

Tasks

Computational Efficiency

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…

Similar Papers 제목 키워드 기반

Softmax-free Linear Transformers

2022-07-05 · Jiachen Lu, Junge Zhang, Xiatian Zhu, Jianfeng Feng 외

Vision transformers (ViTs) have pushed the state-of-the-art for visual perception tasks. The self-attention mechanism underpinning the strength of ViTs has a quadratic complexity in both computation and memory usage. Thi…

Computational Efficiency

Superiority of Softmax: Unveiling the Performance Edge Over Linear Attention

2023-10-18 · Yichuan Deng, Zhao Song, Tianyi Zhou

Large transformer models have achieved state-of-the-art results in numerous natural language processing tasks. Among the pivotal components of the transformer architecture, the attention mechanism plays a crucial role in…

Degrees of Freedom for Linear Attention: Distilling Softmax Attention with Optimal Feature Efficiency

2025-07-04 · Naoki Nishikawa, Rei Higuchi, Taiji Suzuki arxiv

Linear attention has attracted interest as a computationally efficient approximation to softmax attention, especially for long sequences. Recent studies have explored distilling softmax attention in pre-trained Transform…

The Hedgehog & the Porcupine: Expressive Linear Attentions with Softmax Mimicry

2024-02-06 · Michael Zhang, Kush Bhatia, Hermann Kumbong, Christopher Ré

Linear attentions have shown potential for improving Transformer efficiency, reducing attention's quadratic complexity to linear in sequence length. This holds exciting promise for (1) training linear Transformers from s…

Cottention: Linear Transformers With Cosine Attention

2024-09-27 · Gabriel Mongaras, Trevor Dohm, Eric C. Larson

Attention mechanisms, particularly softmax attention, have been instrumental in the success of transformer-based models such as GPT. However, the quadratic memory complexity of softmax attention with respect to sequence …