The Devil in Linear Transformer
Zhen Qin, Xiaodong Han, Weixuan Sun, Dongxu Li, Lingpeng Kong, Nick Barnes, Yiran Zhong
摘要
Linear transformers aim to reduce the quadratic space-time complexity of vanilla transformers. However, they usually suffer from degraded performances on various tasks and corpus. In this paper, we examine existing kernel-based linear transformers and identify two key issues that lead to such performance gaps: 1) unbounded gradients in the attention computation adversely impact the convergence of linear transformer models; 2) attention dilution which trivially distributes attention scores over long sequences while neglecting neighbouring structures. To address these issues, we first identify that the scaling of attention matrices is the devil in unbounded gradients, which turns out unnecessary in linear attention as we show theoretically and empirically. To this end, we propose a new linear attention that replaces the scaling operation with a normalization to stabilize gradients. For the issue of attention dilution, we leverage a diagonal attention to confine attention to only neighbouring tokens in early layers. Benefiting from the stable gradients and improved attention, our new linear transformer model, transNormer, demonstrates superior performance on text classification and language modeling tasks, as well as on the challenging Long-Range Arena benchmark, surpassing vanilla transformer and existing linear variants by a clear margin while being significantly more space-time efficient. The code is available at https://github.com/OpenNLPLab/Transnormer .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 54 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention 引用了 Reformer: The Efficient Transformer
- Long Range Arena : A Benchmark for Efficient Transformers 引用了 Big Bird: Transformers for Longer Sequences
- Long Range Arena : A Benchmark for Efficient Transformers 引用了 Reformer: The Efficient Transformer
- Big Bird: Transformers for Longer Sequences 引用了 Reformer: The Efficient Transformer
- Random Feature Attention 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Random Feature Attention 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Random Feature Attention 引用了 Big Bird: Transformers for Longer Sequences
- Random Feature Attention 引用了 Reformer: The Efficient Transformer
- Simple linear attention language models balance the recall-throughput tradeoff 引用了 Reformer: The Efficient Transformer
- Simple linear attention language models balance the recall-throughput tradeoff 引用了 Gated Linear Attention Transformers with Hardware-Efficient Training
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Simple linear attention language models balance the recall-throughput tradeoff
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Big Bird: Transformers for Longer Sequences
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Random Feature Attention
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Simple linear attention language models balance the recall-throughput tradeoff
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Reformer: The Efficient Transformer
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Hierarchically Gated Recurrent Neural Network for Sequence Modeling
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Gated Linear Attention Transformers with Hardware-Efficient Training
- Parallelizing Linear Transformers with the Delta Rule over Sequence Length 引用了 Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
- Hierarchically Gated Recurrent Neural Network for Sequence Modeling 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Hierarchically Gated Recurrent Neural Network for Sequence Modeling 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Hierarchically Gated Recurrent Neural Network for Sequence Modeling 引用了 Random Feature Attention
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Big Bird: Transformers for Longer Sequences
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Reformer: The Efficient Transformer
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Hierarchically Gated Recurrent Neural Network for Sequence Modeling
- Gated Linear Attention Transformers with Hardware-Efficient Training 引用了 Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality 引用了 Gated Linear Attention Transformers with Hardware-Efficient Training
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality 引用了 Random Feature Attention
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality 引用了 Simple linear attention language models balance the recall-throughput tradeoff
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality 引用了 Hierarchically Gated Recurrent Neural Network for Sequence Modeling
引用它的顶会 Paper54
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space DualityTri Dao, Albert GuICML 2024 · 1,407 次引用
- Parallelizing Linear Transformers with the Delta Rule over Sequence LengthSonglin Yang, Bailin Wang, Yu Zhang, Yikang Shen 等NeurIPS 2024 · 412 次引用
- Gated Linear Attention Transformers with Hardware-Efficient TrainingSonglin Yang, Bailin Wang, Yikang Shen, Rameswar Panda 等ICML 2024 · 390 次引用
- Simple linear attention language models balance the recall-throughput tradeoffSimran Arora, Sabri Eyuboglu, Michael Zhang, Aman Timalsina 等ICML 2024 · 154 次引用
- Hierarchically Gated Recurrent Neural Network for Sequence ModelingZhen Qin, Songlin Yang, Yiran ZhongNeurIPS 2023 · 152 次引用
它引用的 Paper11
- Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie 等NeurIPS 2020 · 3,159 次引用
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 次引用
- Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
- Long Range Arena : A Benchmark for Efficient TransformersYi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen 等ICLR 2021 · 881 次引用
- Random Feature AttentionHao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz 等ICLR 2021 · 425 次引用
相关 Paper
- cosFormer: Rethinking Softmax In AttentionZhen Qin, Weixuan Sun, Hui Deng, Dongxu Li 等ICLR 2022 · 303 次引用
- Various Lengths, Constant Speed: Efficient Language Modeling with Lightning AttentionZhen Qin, Weigao Sun, Dong Li, Xuyang Shen 等ICML 2024 · 26 次引用
- Linear Log-Normal Attention with Unbiased ConcentrationYury Nahshan, Joseph Kampeas, Emir HalevaICLR 2024 · 13 次引用
- Long-Short Transformer: Efficient Transformers for Language and VisionChen Zhu, Wei Ping, Chaowei Xiao, Mohammad Shoeybi 等NeurIPS 2021 · 180 次引用
- Luna: Linear Unified Nested AttentionXuezhe Ma, Xiang Kong, Sinong Wang, Chunting Zhou 等NeurIPS 2021 · 145 次引用
