mlsanityData to 14 Oct 2026

Various Lengths, Constant Speed: Efficient Language Modeling with Lightning Attention

arXiv 2405.17381 ↗First posted 27 May 2024cs.CLcited by 31

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  3. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  4. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  5. 2020Measuring Massive Multitask Language Understandingcited by 7,963
  6. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
  7. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
  8. 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,100
  9. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  10. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,883
  11. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  12. 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
32 more
  1. 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,183
  2. 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,164
  3. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  4. 2019Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelismcited by 1,868
  5. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,786
  6. 2020Rethinking Attention with Performerscited by 1,601
  7. 2017Mixed Precision Trainingcited by 1,156
  8. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  9. 2022GLM-130B: An Open Bilingual Pre-trained Modelcited by 843
  10. 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
  11. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 713
  12. 2023Baichuan 2: Open Large-scale Language Modelscited by 670
  13. 2023PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallelcited by 660
  14. 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 499
  15. 2022On the Parameterization and Initialization of Diagonal State Space Modelscited by 424
  16. 2023Resurrecting Recurrent Neural Networks for Long Sequencescited by 408
  17. 2021Pay Attention to MLPscited by 368
  18. 2022Long Range Language Modeling via Gated State Spacescited by 265
  19. 2019A Study of BFLOAT16 for Deep Learning Trainingcited by 232
  20. 2020Synthesizer: Rethinking Self-Attention in Transformer Modelscited by 205
  21. 2022Transformer Quality in Linear Timecited by 191
  22. 2022SCROLLS: Standardized CompaRison Over Long Language Sequencescited by 170
  23. 2023Hierarchically Gated Recurrent Neural Network for Sequence Modelingcited by 102
  24. 2022The Devil in Linear Transformercited by 98
  25. 2023Simple Hardware-Efficient Long Convolutions for Sequence Modelingcited by 62
  26. 2023Toeplitz Neural Network for Sequence Modelingcited by 43
  27. 2022Linear Complexity Randomized Self-attention Mechanismcited by 31
  28. 2023Efficient Attention via Control Variatescited by 23
  29. 2022Neural Architecture Search on Efficient Transformers and Beyondcited by 17
  30. 2023Linearized Relative Positional Encodingcited by 17
  31. 2023Exploring Transformer Extrapolationcited by 8
  32. 2016A Cheap Linear Attention Mechanism with Fast Lookups and Fixed-Size Representationscited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 2; 2025: 18; 2026: 11.

31 papers.

Sort:

By area:

  1. 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Freecited by 283
  2. 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 263
  3. 2025A Survey of Efficient Reasoning for Large Reasoning Models: Language, Multimodality, and Beyondcited by 132
  4. 2025Test-Time Training Done Rightcited by 130
  5. 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 47
  6. 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 33
  7. 2025Efficient Attention Mechanisms for Large Language Models: A Surveycited by 22
  8. 2024MetaLA: Unified Optimal Linear Approximation to Softmax Attention Mapcited by 21
  9. 2024Scaling Laws for Linear Complexity Language Modelscited by 19
  10. 2026Hybrid Linear Attention Done Right: Efficient Distillation and Effective Architectures for Extremely Long Contextscited by 18
  11. 2025Comba: Improving Bilinear RNNs with Closed-loop Controlcited by 15
  12. 2025Pandora3D: A Comprehensive Framework for High-Quality 3D Shape and Texture Generationcited by 14
19 more
  1. 2025Native Hybrid Attention for Efficient Sequence Modelingcited by 10
  2. 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understandingcited by 9
  3. 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AIcited by 8
  4. 2025TNT: Improving Chunkwise Training for Test-Time Memorizationcited by 8
  5. 2026MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modelingcited by 5
  6. 2025Autoregressive Image Generation with Linear Complexity: A Spatial-Aware Decay Perspectivecited by 4
  7. 2025The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architecturescited by 4
  8. 2026Effective Distillation to Hybrid xLSTM Architecturescited by 3
  9. 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attentioncited by 2
  10. 2026LazyAttention: Efficient Retrieval-Augmented Generation with Deferred Positional Encodingcited by 2
  11. 2025Elucidating the Design Space of Decay in Linear Attentioncited by 1
  12. 2026Kaczmarz Linear Attentioncited by 1
  13. 2026Training Hybrid Block Diffusion Language Models with Partial Bidirectionalitycited by 1
  14. 2025Enhancing Linear Attention with Residual Learningcited by 0
  15. 2026MirrorLA: Reflecting Feature Map for Vision Linear Attentioncited by 0
  16. 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix Itcited by 0
  17. 2026Block-Sparse Attention with Semantic-Geometric Decoupled Routingcited by 0
  18. 2026Empowering Hybrid Attention Models on NPUscited by 0
  19. 2026Mechanics of Long-Context Hybrid Models Part 1.1: From Hybrid Attention to Hybrid Positioncited by 0