Various Lengths, Constant Speed: Efficient Language Modeling with Lightning Attention
Not on the map. Why?
Abstract (arXiv)
We present Lightning Attention, the first linear attention implementation that maintains a constant training speed for various sequence lengths under fixed memory consumption. Due to the issue with cumulative summation operations (cumsum), previous linear attention implementations cannot achieve their theoretical advantage in a casual setting. However, this issue can be effectively solved by utilizing different attention calculation strategies to compute the different parts of attention. Specifically, we split the attention calculation into intra-blocks and inter-blocks and use conventional attention computation for intra-blocks and linear attention kernel tricks for inter-blocks. This eliminates the need for cumsum in the linear attention calculation. Furthermore, a tiling technique is adopted through both forward and backward procedures to take full advantage of the GPU hardware. To enhance accuracy while preserving efficacy, we introduce TransNormerLLM (TNL), a new architecture that is tailored to our lightning attention. We conduct rigorous testing on standard and self-collected datasets with varying model sizes and sequence lengths. TNL is notably more efficient than other language models. In addition, benchmark results indicate that TNL performs on par with state-of-the-art LLMs utilizing conventional transformer structures. The source code is released at github.com/OpenNLPLab/TransnormerLLM.
Key facts. Cited by 31 papers in the map (data through 14 Oct 2026). Builds on 44 of its 57 references that are in the map. First posted on arXiv 27 May 2024.
Builds on
44 of 57 references.
References · 44
- 2017Attention Is All You Needcited by 60,361
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,100
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,883
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
32 more
- 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,183
- 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,164
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2019Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelismcited by 1,868
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,786
- 2020Rethinking Attention with Performerscited by 1,601
- 2017Mixed Precision Trainingcited by 1,156
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2022GLM-130B: An Open Bilingual Pre-trained Modelcited by 843
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 713
- 2023Baichuan 2: Open Large-scale Language Modelscited by 670
- 2023PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallelcited by 660
- 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 499
- 2022On the Parameterization and Initialization of Diagonal State Space Modelscited by 424
- 2023Resurrecting Recurrent Neural Networks for Long Sequencescited by 408
- 2021Pay Attention to MLPscited by 368
- 2022Long Range Language Modeling via Gated State Spacescited by 265
- 2019A Study of BFLOAT16 for Deep Learning Trainingcited by 232
- 2020Synthesizer: Rethinking Self-Attention in Transformer Modelscited by 205
- 2022Transformer Quality in Linear Timecited by 191
- 2022SCROLLS: Standardized CompaRison Over Long Language Sequencescited by 170
- 2023Hierarchically Gated Recurrent Neural Network for Sequence Modelingcited by 102
- 2022The Devil in Linear Transformercited by 98
- 2023Simple Hardware-Efficient Long Convolutions for Sequence Modelingcited by 62
- 2023Toeplitz Neural Network for Sequence Modelingcited by 43
- 2022Linear Complexity Randomized Self-attention Mechanismcited by 31
- 2023Efficient Attention via Control Variatescited by 23
- 2022Neural Architecture Search on Efficient Transformers and Beyondcited by 17
- 2023Linearized Relative Positional Encodingcited by 17
- 2023Exploring Transformer Extrapolationcited by 8
- 2016A Cheap Linear Attention Mechanism with Fast Lookups and Fixed-Size Representationscited by 3
Built on by
Citing papers per year: 2024: 2; 2025: 18; 2026: 11.
31 papers.
Sort:
By area:
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Freecited by 283
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 263
- 2025A Survey of Efficient Reasoning for Large Reasoning Models: Language, Multimodality, and Beyondcited by 132
- 2025Test-Time Training Done Rightcited by 130
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 47
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 33
- 2025Efficient Attention Mechanisms for Large Language Models: A Surveycited by 22
- 2024MetaLA: Unified Optimal Linear Approximation to Softmax Attention Mapcited by 21
- 2024Scaling Laws for Linear Complexity Language Modelscited by 19
- 2026Hybrid Linear Attention Done Right: Efficient Distillation and Effective Architectures for Extremely Long Contextscited by 18
- 2025Comba: Improving Bilinear RNNs with Closed-loop Controlcited by 15
- 2025Pandora3D: A Comprehensive Framework for High-Quality 3D Shape and Texture Generationcited by 14
19 more
- 2025Native Hybrid Attention for Efficient Sequence Modelingcited by 10
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understandingcited by 9
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AIcited by 8
- 2025TNT: Improving Chunkwise Training for Test-Time Memorizationcited by 8
- 2026MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modelingcited by 5
- 2025Autoregressive Image Generation with Linear Complexity: A Spatial-Aware Decay Perspectivecited by 4
- 2025The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architecturescited by 4
- 2026Effective Distillation to Hybrid xLSTM Architecturescited by 3
- 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attentioncited by 2
- 2026LazyAttention: Efficient Retrieval-Augmented Generation with Deferred Positional Encodingcited by 2
- 2025Elucidating the Design Space of Decay in Linear Attentioncited by 1
- 2026Kaczmarz Linear Attentioncited by 1
- 2026Training Hybrid Block Diffusion Language Models with Partial Bidirectionalitycited by 1
- 2025Enhancing Linear Attention with Residual Learningcited by 0
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attentioncited by 0
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix Itcited by 0
- 2026Block-Sparse Attention with Semantic-Geometric Decoupled Routingcited by 0
- 2026Empowering Hybrid Attention Models on NPUscited by 0
- 2026Mechanics of Long-Context Hybrid Models Part 1.1: From Hybrid Attention to Hybrid Positioncited by 0
- 2026Mechanics of Long-Context Hybrid Models Part 1.1: From Hybrid Attention to Hybrid Position7 Oct 2026
- 2026Empowering Hybrid Attention Models on NPUs26 Sep 2026
- 2026Block-Sparse Attention with Semantic-Geometric Decoupled Routing19 Sep 2026
- 2026Training Hybrid Block Diffusion Language Models with Partial Bidirectionality2 Jul 2026
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix It9 Jun 2026
- 2026LazyAttention: Efficient Retrieval-Augmented Generation with Deferred Positional Encoding3 Jun 2026
- 2026Kaczmarz Linear Attention9 May 2026
- 2026Effective Distillation to Hybrid xLSTM Architectures16 Mar 2026
- 2026MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modeling12 Feb 2026
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attention4 Feb 2026
- 2026Hybrid Linear Attention Done Right: Efficient Distillation and Effective Architectures for Extremely Long Contexts29 Jan 2026
- 2025TNT: Improving Chunkwise Training for Test-Time Memorization10 Nov 2025
19 more
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AI19 Oct 2025
- 2025Native Hybrid Attention for Efficient Sequence Modeling8 Oct 2025
- 2025The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures6 Oct 2025
- 2025Enhancing Linear Attention with Residual Learning24 Sep 2025
- 2025Elucidating the Design Space of Decay in Linear Attention5 Sep 2025
- 2025Efficient Attention Mechanisms for Large Language Models: A Survey25 Jul 2025
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understanding3 Jul 2025
- 2025Autoregressive Image Generation with Linear Complexity: A Spatial-Aware Decay Perspective2 Jul 2025
- 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attention26 Jun 2025
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention16 Jun 2025
- 2025Comba: Improving Bilinear RNNs with Closed-loop Control3 Jun 2025
- 2025Test-Time Training Done Right29 May 2025
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free10 May 2025
- 2025A Survey of Efficient Reasoning for Large Reasoning Models: Language, Multimodality, and Beyond27 Mar 2025
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structures3 Mar 2025
- 2025Pandora3D: A Comprehensive Framework for High-Quality 3D Shape and Texture Generation20 Feb 2025
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memories19 Feb 2025
- 2024MetaLA: Unified Optimal Linear Approximation to Softmax Attention Map16 Nov 2024
- 2024Scaling Laws for Linear Complexity Language Models24 Jun 2024
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 263
- 2025A Survey of Efficient Reasoning for Large Reasoning Models: Language, Multimodality, and Beyondcited by 132
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix Itcited by 0
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix It9 Jun 2026
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention16 Jun 2025
- 2025A Survey of Efficient Reasoning for Large Reasoning Models: Language, Multimodality, and Beyond27 Mar 2025
- 2025Test-Time Training Done Rightcited by 130
- 2026Training Hybrid Block Diffusion Language Models with Partial Bidirectionalitycited by 1
- 2026Training Hybrid Block Diffusion Language Models with Partial Bidirectionality2 Jul 2026
- 2025Test-Time Training Done Right29 May 2025
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 47
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 33
- 2025Efficient Attention Mechanisms for Large Language Models: A Surveycited by 22
- 2024MetaLA: Unified Optimal Linear Approximation to Softmax Attention Mapcited by 21
- 2024Scaling Laws for Linear Complexity Language Modelscited by 19
- 2026Hybrid Linear Attention Done Right: Efficient Distillation and Effective Architectures for Extremely Long Contextscited by 18
- 2025Comba: Improving Bilinear RNNs with Closed-loop Controlcited by 15
- 2025Pandora3D: A Comprehensive Framework for High-Quality 3D Shape and Texture Generationcited by 14
- 2025Native Hybrid Attention for Efficient Sequence Modelingcited by 10
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understandingcited by 9
- 2025TNT: Improving Chunkwise Training for Test-Time Memorizationcited by 8
- 2026MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modelingcited by 5
12 most cited of 23 All 23 (JSON)
- 2026Mechanics of Long-Context Hybrid Models Part 1.1: From Hybrid Attention to Hybrid Position7 Oct 2026
- 2026Empowering Hybrid Attention Models on NPUs26 Sep 2026
- 2026Block-Sparse Attention with Semantic-Geometric Decoupled Routing19 Sep 2026
- 2026Kaczmarz Linear Attention9 May 2026
- 2026Effective Distillation to Hybrid xLSTM Architectures16 Mar 2026
- 2026MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modeling12 Feb 2026
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attention4 Feb 2026
- 2026Hybrid Linear Attention Done Right: Efficient Distillation and Effective Architectures for Extremely Long Contexts29 Jan 2026
- 2025TNT: Improving Chunkwise Training for Test-Time Memorization10 Nov 2025
- 2025Native Hybrid Attention for Efficient Sequence Modeling8 Oct 2025
- 2025The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures6 Oct 2025
- 2025Enhancing Linear Attention with Residual Learning24 Sep 2025
12 newest of 23 All 23 (JSON)