mlsanityData to 7 Oct 2026

Lightning Attention-2: A Free Lunch for Handling Unlimited Sequence Lengths in Large Language Models

arXiv 2401.04658 ↗First posted 9 Jan 2024cs.CL cs.AIcited by 57

Not on the map. Why?

Abstract (arXiv)

Linear attention is an efficient attention mechanism that has recently emerged as a promising alternative to conventional softmax attention. With its ability to process tokens in linear computational complexities, linear attention, in theory, can handle sequences of unlimited length without sacrificing speed, i.e., maintaining a constant training speed for various sequence lengths with a fixed memory consumption. However, due to the issue with cumulative summation (cumsum), current linear attention algorithms cannot demonstrate their theoretical advantage in a causal setting. In this paper, we present Lightning Attention-2, the first linear attention implementation that enables linear attention to realize its theoretical computational benefits. To achieve this, we leverage the thought of tiling, separately handling the intra-block and inter-block components in linear attention calculation. Specifically, we utilize the conventional attention computation mechanism for the intra-blocks and apply linear attention kernel tricks for the inter-blocks. A tiling technique is adopted through both forward and backward procedures to take full advantage of the GPU hardware. We implement our algorithm in Triton to make it IO-aware and hardware-friendly. Various experiments are conducted on different model sizes and sequence lengths. Lightning Attention-2 retains consistent training and inference speed regardless of input sequence length and is significantly faster than other attention mechanisms. The source code is available at https://github.com/OpenNLPLab/lightning-attention.

Key facts. Cited by 57 papers in the map (data through 7 Oct 2026). Builds on 42 of its 50 references that are in the map. First posted on arXiv 9 Jan 2024.

Builds on

42 of 50 references.

References · 42

  1. 2017Attention Is All You Needcited by 59,932
  2. 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  5. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  6. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  7. 2023Visual Instruction Tuningcited by 7,792
  8. 2020Measuring Massive Multitask Language Understandingcited by 7,768
  9. 2023BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Modelscited by 6,069
  10. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
  11. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  12. 2022BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generationcited by 4,310
30 more
  1. 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
  2. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  3. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
  4. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  5. 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
  6. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
  7. 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
  8. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
  9. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
  10. 2020Rethinking Attention with Performerscited by 1,584
  11. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  12. 2023RWKV: Reinventing RNNs for the Transformer Eracited by 814
  13. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  14. 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 594
  15. 2021Random Feature Attentioncited by 350
  16. 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
  17. 2022Transformer Quality in Linear Timecited by 189
  18. 2023Hierarchically Gated Recurrent Neural Network for Sequence Modelingcited by 100
  19. 2022The Devil in Linear Transformercited by 98
  20. 2023Toeplitz Neural Network for Sequence Modelingcited by 43
  21. 2022Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysiscited by 39
  22. 2023Multimodal Variational Auto-encoder based Audio-Visual Segmentationcited by 37
  23. 2023Improving Audio-Visual Segmentation with Bidirectional Generationcited by 36
  24. 2023TransNormerLLM: A Faster and Better Large Language Model with Improved TransNormercited by 34
  25. 2022Linear Complexity Randomized Self-attention Mechanismcited by 31
  26. 2023Efficient Attention via Control Variatescited by 23
  27. 2022Vicinity Vision Transformercited by 22
  28. 2023Fine-grained Audible Video Descriptioncited by 17
  29. 2023Linearized Relative Positional Encodingcited by 17
  30. 2023Exploring Transformer Extrapolationcited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 16; 2025: 23; 2026: 18.

57 papers.

Sort:

By area:

  1. 2024Gated Delta Networks: Improving Mamba2 with Delta Rulecited by 483
  2. 2024Parallelizing Linear Transformers with the Delta Rule over Sequence Lengthcited by 373
  3. 2025Memory in the Age of AI Agentscited by 285
  4. 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Freecited by 266
  5. 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 248
  6. 2024HGRN2: Gated Linear RNNs with State Expansioncited by 122
  7. 2025SageAttention3: Microscaling FP4 Attention for Inference and An Exploration of 8-Bit Trainingcited by 63
  8. 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
  9. 2025SLA: Beyond Sparsity in Diffusion Transformers via Fine-Tunable Sparse-Linear Attentioncited by 55
  10. 2024Linearizing Large Language Modelscited by 51
  11. 2026The MiniMax-M2 Series: Mini Activations Unleashing Max Real-World Intelligencecited by 50
  12. 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 44
38 more
  1. 2025Log-Linear Attentioncited by 39
  2. 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 32
  3. 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
  4. 2024Star Attention: Efficient LLM Inference over Long Sequencescited by 25
  5. 2025SageAttention2++: A More Efficient Implementation of SageAttention2cited by 21
  6. 2026SLA2: Sparse-Linear Attention with Learnable Routing and QATcited by 21
  7. 2024CO2: Efficient Distributed Training with Full Communication-Computation Overlapcited by 17
  8. 2025iFlame: Interleaving Full and Linear Attention for Efficient Mesh Generationcited by 13
  9. 2025Hybrid Architectures for Language Models: Systematic Analysis and Design Insightscited by 13
  10. 2025Tiled Flash Linear Attention: More Efficient Linear RNN and xLSTM Kernelscited by 12
  11. 2025Comba: Improving Bilinear RNNs with Closed-loop Controlcited by 12
  12. 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptationcited by 11
  13. 2026Prefill-as-a-Service: KVCache of Next-Generation Models Could Go Cross-Datacentercited by 11
  14. 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
  15. 2024You Only Scan Once: Efficient Multi-dimension Sequential Modeling with LightNetcited by 9
  16. 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understandingcited by 9
  17. 2025InfiniteVL: Synergizing Linear and Sparse Attention for Highly-Efficient, Unlimited-Input Vision-Language Modelscited by 9
  18. 2024Linear Attention Sequence Parallelismcited by 8
  19. 2025L2M: Mutual Information Scaling Law for Long-Context Language Modelingcited by 8
  20. 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AIcited by 8
  21. 2024Designing Large Foundation Models for Efficient Training and Inference: A Surveycited by 7
  22. 2024CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMscited by 7
  23. 2025Long Context Scaling: Divide and Conquer via Multi-Agent Question-driven Collaborationcited by 7
  24. 2025Linear-MoE: Linear Sequence Modeling Meets Mixture-of-Expertscited by 6
  25. 2026MDN: Parallelizing Stepwise Momentum for Delta Linear Attentioncited by 3
  26. 2026ThriftAttention: Selective Mixed Precision for Long-Context FP4 Attentioncited by 3
  27. 2025Higher-order Linear Attentioncited by 2
  28. 2026Morphing into Hybrid Attention Modelscited by 2
  29. 2024Unifying Linear-Time Attention via Latent Probabilistic Modellingcited by 1
  30. 2024Breaking the Attention Bottleneckcited by 1
  31. 2025Union of Experts: Adapting Hierarchical Routing to Equivalently Decomposed Transformercited by 1
  32. 2025Transformer Based Linear Attention with Optimized GPU Kernel Implementationcited by 1
  33. 2026When Perplexity Lies: Generation-Focused Distillation of Hybrid Sequence Modelscited by 1
  34. 2026DeltaLog: Deferred Materialization of Recurrent States for Linear Attention Decodingcited by 1
  35. 2025LIME: Link-based user-item Interaction Modeling with decoupled xor attention for Efficient test time scalingcited by 0
  36. 2026On The Application of Linear Attention in Multimodal Transformerscited by 0
  37. 2026Long-Context Aware Upcycling: A New Frontier for Hybrid LLM Scalingcited by 0
  38. 2026Adaptive Memory Decay for Log-Linear Attentioncited by 0

50 most cited of 57 All 57 (JSON)