Lightning Attention-2: A Free Lunch for Handling Unlimited Sequence Lengths in Large Language Models
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
- 2017Attention Is All You Needcited by 59,932
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2023Visual Instruction Tuningcited by 7,792
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2023BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Modelscited by 6,069
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generationcited by 4,310
30 more
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2020Rethinking Attention with Performerscited by 1,584
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 814
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 594
- 2021Random Feature Attentioncited by 350
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2022Transformer Quality in Linear Timecited by 189
- 2023Hierarchically Gated Recurrent Neural Network for Sequence Modelingcited by 100
- 2022The Devil in Linear Transformercited by 98
- 2023Toeplitz Neural Network for Sequence Modelingcited by 43
- 2022Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysiscited by 39
- 2023Multimodal Variational Auto-encoder based Audio-Visual Segmentationcited by 37
- 2023Improving Audio-Visual Segmentation with Bidirectional Generationcited by 36
- 2023TransNormerLLM: A Faster and Better Large Language Model with Improved TransNormercited by 34
- 2022Linear Complexity Randomized Self-attention Mechanismcited by 31
- 2023Efficient Attention via Control Variatescited by 23
- 2022Vicinity Vision Transformercited by 22
- 2023Fine-grained Audible Video Descriptioncited by 17
- 2023Linearized Relative Positional Encodingcited by 17
- 2023Exploring Transformer Extrapolationcited by 8
Built on by
Citing papers per year: 2024: 16; 2025: 23; 2026: 18.
57 papers.
Sort:
By area:
- 2024Gated Delta Networks: Improving Mamba2 with Delta Rulecited by 483
- 2024Parallelizing Linear Transformers with the Delta Rule over Sequence Lengthcited by 373
- 2025Memory in the Age of AI Agentscited by 285
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Freecited by 266
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 248
- 2024HGRN2: Gated Linear RNNs with State Expansioncited by 122
- 2025SageAttention3: Microscaling FP4 Attention for Inference and An Exploration of 8-Bit Trainingcited by 63
- 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
- 2025SLA: Beyond Sparsity in Diffusion Transformers via Fine-Tunable Sparse-Linear Attentioncited by 55
- 2024Linearizing Large Language Modelscited by 51
- 2026The MiniMax-M2 Series: Mini Activations Unleashing Max Real-World Intelligencecited by 50
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 44
38 more
- 2025Log-Linear Attentioncited by 39
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 32
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2024Star Attention: Efficient LLM Inference over Long Sequencescited by 25
- 2025SageAttention2++: A More Efficient Implementation of SageAttention2cited by 21
- 2026SLA2: Sparse-Linear Attention with Learnable Routing and QATcited by 21
- 2024CO2: Efficient Distributed Training with Full Communication-Computation Overlapcited by 17
- 2025iFlame: Interleaving Full and Linear Attention for Efficient Mesh Generationcited by 13
- 2025Hybrid Architectures for Language Models: Systematic Analysis and Design Insightscited by 13
- 2025Tiled Flash Linear Attention: More Efficient Linear RNN and xLSTM Kernelscited by 12
- 2025Comba: Improving Bilinear RNNs with Closed-loop Controlcited by 12
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptationcited by 11
- 2026Prefill-as-a-Service: KVCache of Next-Generation Models Could Go Cross-Datacentercited by 11
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2024You Only Scan Once: Efficient Multi-dimension Sequential Modeling with LightNetcited by 9
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understandingcited by 9
- 2025InfiniteVL: Synergizing Linear and Sparse Attention for Highly-Efficient, Unlimited-Input Vision-Language Modelscited by 9
- 2024Linear Attention Sequence Parallelismcited by 8
- 2025L2M: Mutual Information Scaling Law for Long-Context Language Modelingcited by 8
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AIcited by 8
- 2024Designing Large Foundation Models for Efficient Training and Inference: A Surveycited by 7
- 2024CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMscited by 7
- 2025Long Context Scaling: Divide and Conquer via Multi-Agent Question-driven Collaborationcited by 7
- 2025Linear-MoE: Linear Sequence Modeling Meets Mixture-of-Expertscited by 6
- 2026MDN: Parallelizing Stepwise Momentum for Delta Linear Attentioncited by 3
- 2026ThriftAttention: Selective Mixed Precision for Long-Context FP4 Attentioncited by 3
- 2025Higher-order Linear Attentioncited by 2
- 2026Morphing into Hybrid Attention Modelscited by 2
- 2024Unifying Linear-Time Attention via Latent Probabilistic Modellingcited by 1
- 2024Breaking the Attention Bottleneckcited by 1
- 2025Union of Experts: Adapting Hierarchical Routing to Equivalently Decomposed Transformercited by 1
- 2025Transformer Based Linear Attention with Optimized GPU Kernel Implementationcited by 1
- 2026When Perplexity Lies: Generation-Focused Distillation of Hybrid Sequence Modelscited by 1
- 2026DeltaLog: Deferred Materialization of Recurrent States for Linear Attention Decodingcited by 1
- 2025LIME: Link-based user-item Interaction Modeling with decoupled xor attention for Efficient test time scalingcited by 0
- 2026On The Application of Linear Attention in Multimodal Transformerscited by 0
- 2026Long-Context Aware Upcycling: A New Frontier for Hybrid LLM Scalingcited by 0
- 2026Adaptive Memory Decay for Log-Linear Attentioncited by 0
50 most cited of 57 All 57 (JSON)
- 2026IronLLM: Forging Compact Edge-Native Language Models for Real-Time Embodied Intelligence29 Sep 2026
- 2026Multilinguality in Hybrid Attention LLMs28 Sep 2026
- 2026SpectralShift: Effective Context Window Extension of Gated DeltaNet via Spectral Reparameterization13 Sep 2026
- 2026TuringLLM: Efficiently Scaling Foundation Models Toward Physical AI31 Aug 2026
- 2026DeltaLog: Deferred Materialization of Recurrent States for Linear Attention Decoding16 Aug 2026
- 2026Ring-Zero: Scaling Zero RL to a Trillion Parameters for Emergent Reasoning14 Jul 2026
- 2026Morphing into Hybrid Attention Models29 Jun 2026
- 2026Architecture-Aware Reinforcement Learning Makes Sliding-Window Attention Competitive in Math Reasoning10 Jun 2026
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix It9 Jun 2026
- 2026The MiniMax-M2 Series: Mini Activations Unleashing Max Real-World Intelligence26 May 2026
- 2026ThriftAttention: Selective Mixed Precision for Long-Context FP4 Attention21 May 2026
- 2026Adaptive Memory Decay for Log-Linear Attention7 May 2026
38 more
- 2026MDN: Parallelizing Stepwise Momentum for Delta Linear Attention7 May 2026
- 2026Long-Context Aware Upcycling: A New Frontier for Hybrid LLM Scaling27 Apr 2026
- 2026Prefill-as-a-Service: KVCache of Next-Generation Models Could Go Cross-Datacenter16 Apr 2026
- 2026On The Application of Linear Attention in Multimodal Transformers11 Apr 2026
- 2026When Perplexity Lies: Generation-Focused Distillation of Hybrid Sequence Models27 Mar 2026
- 2026SLA2: Sparse-Linear Attention with Learnable Routing and QAT13 Feb 2026
- 2025Memory in the Age of AI Agents15 Dec 2025
- 2025InfiniteVL: Synergizing Linear and Sparse Attention for Highly-Efficient, Unlimited-Input Vision-Language Models9 Dec 2025
- 2025Higher-order Linear Attention31 Oct 2025
- 2025Transformer Based Linear Attention with Optimized GPU Kernel Implementation24 Oct 2025
- 2025LIME: Link-based user-item Interaction Modeling with decoupled xor attention for Efficient test time scaling21 Oct 2025
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AI19 Oct 2025
- 2025Hybrid Architectures for Language Models: Systematic Analysis and Design Insights6 Oct 2025
- 2025SLA: Beyond Sparsity in Diffusion Transformers via Fine-Tunable Sparse-Linear Attention28 Sep 2025
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understanding3 Jul 2025
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention16 Jun 2025
- 2025Log-Linear Attention5 Jun 2025
- 2025Comba: Improving Bilinear RNNs with Closed-loop Control3 Jun 2025
- 2025SageAttention2++: A More Efficient Implementation of SageAttention227 May 2025
- 2025Long Context Scaling: Divide and Conquer via Multi-Agent Question-driven Collaboration27 May 2025
- 2025SageAttention3: Microscaling FP4 Attention for Inference and An Exploration of 8-Bit Training16 May 2025
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free10 May 2025
- 2025iFlame: Interleaving Full and Linear Attention for Efficient Mesh Generation20 Mar 2025
- 2025Tiled Flash Linear Attention: More Efficient Linear RNN and xLSTM Kernels18 Mar 2025
- 2025Linear-MoE: Linear Sequence Modeling Meets Mixture-of-Experts7 Mar 2025
- 2025L2M: Mutual Information Scaling Law for Long-Context Language Modeling6 Mar 2025
- 2025Union of Experts: Adapting Hierarchical Routing to Equivalently Decomposed Transformer4 Mar 2025
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structures3 Mar 2025
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memories19 Feb 2025
- 2024Gated Delta Networks: Improving Mamba2 with Delta Rule9 Dec 2024
- 2024Star Attention: Efficient LLM Inference over Long Sequences26 Nov 2024
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptation17 Oct 2024
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolation7 Oct 2024
- 2024CritiPrefill: A Segment-wise Criticality-based Approach for Prefilling Acceleration in LLMs19 Sep 2024
- 2024Designing Large Foundation Models for Efficient Training and Inference: A Survey3 Sep 2024
- 2024Breaking the Attention Bottleneck16 Jun 2024
- 2024Parallelizing Linear Transformers with the Delta Rule over Sequence Length10 Jun 2024
- 2024You Only Scan Once: Efficient Multi-dimension Sequential Modeling with LightNet31 May 2024
50 newest of 57 All 57 (JSON)
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attentioncited by 248
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptationcited by 11
- 2025LIME: Link-based user-item Interaction Modeling with decoupled xor attention for Efficient test time scalingcited by 0
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix Itcited by 0
- 2026Architecture-Aware Reinforcement Learning Makes Sliding-Window Attention Competitive in Math Reasoningcited by 0
- 2026Ring-Zero: Scaling Zero RL to a Trillion Parameters for Emergent Reasoningcited by 0
- 2026Ring-Zero: Scaling Zero RL to a Trillion Parameters for Emergent Reasoning14 Jul 2026
- 2026Architecture-Aware Reinforcement Learning Makes Sliding-Window Attention Competitive in Math Reasoning10 Jun 2026
- 2026Attention Amnesia in Hybrid LLMs: When CoT Fine-Tuning Breaks Long-Range Recall, and How to Fix It9 Jun 2026
- 2025LIME: Link-based user-item Interaction Modeling with decoupled xor attention for Efficient test time scaling21 Oct 2025
- 2025MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention16 Jun 2025
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptation17 Oct 2024
- 2025Memory in the Age of AI Agentscited by 285
- 2026The MiniMax-M2 Series: Mini Activations Unleashing Max Real-World Intelligencecited by 50
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AIcited by 8
- 2025Long Context Scaling: Divide and Conquer via Multi-Agent Question-driven Collaborationcited by 7
- 2026Multilinguality in Hybrid Attention LLMscited by 0
- 2026Multilinguality in Hybrid Attention LLMs28 Sep 2026
- 2026The MiniMax-M2 Series: Mini Activations Unleashing Max Real-World Intelligence26 May 2026
- 2025Memory in the Age of AI Agents15 Dec 2025
- 2025Beyond Pipelines: A Survey of the Paradigm Shift toward Model-Native Agentic AI19 Oct 2025
- 2025Long Context Scaling: Divide and Conquer via Multi-Agent Question-driven Collaboration27 May 2025
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Freecited by 266
- 2025Linear-MoE: Linear Sequence Modeling Meets Mixture-of-Expertscited by 6
- 2025Union of Experts: Adapting Hierarchical Routing to Equivalently Decomposed Transformercited by 1
- 2026TuringLLM: Efficiently Scaling Foundation Models Toward Physical AIcited by 0
- 2026TuringLLM: Efficiently Scaling Foundation Models Toward Physical AI31 Aug 2026
- 2025Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free10 May 2025
- 2025Linear-MoE: Linear Sequence Modeling Meets Mixture-of-Experts7 Mar 2025
- 2025Union of Experts: Adapting Hierarchical Routing to Equivalently Decomposed Transformer4 Mar 2025
- 2024Gated Delta Networks: Improving Mamba2 with Delta Rulecited by 483
- 2024Parallelizing Linear Transformers with the Delta Rule over Sequence Lengthcited by 373
- 2024HGRN2: Gated Linear RNNs with State Expansioncited by 122
- 2025SageAttention3: Microscaling FP4 Attention for Inference and An Exploration of 8-Bit Trainingcited by 63
- 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
- 2024Linearizing Large Language Modelscited by 51
- 2025MoM: Linear Sequence Modeling with Mixture-of-Memoriescited by 44
- 2025Log-Linear Attentioncited by 39
- 2025Liger: Linearizing Large Language Models to Gated Recurrent Structurescited by 32
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2025SageAttention2++: A More Efficient Implementation of SageAttention2cited by 21
- 2024CO2: Efficient Distributed Training with Full Communication-Computation Overlapcited by 17
12 most cited of 34 All 34 (JSON)
- 2026IronLLM: Forging Compact Edge-Native Language Models for Real-Time Embodied Intelligence29 Sep 2026
- 2026SpectralShift: Effective Context Window Extension of Gated DeltaNet via Spectral Reparameterization13 Sep 2026
- 2026Morphing into Hybrid Attention Models29 Jun 2026
- 2026ThriftAttention: Selective Mixed Precision for Long-Context FP4 Attention21 May 2026
- 2026Adaptive Memory Decay for Log-Linear Attention7 May 2026
- 2026MDN: Parallelizing Stepwise Momentum for Delta Linear Attention7 May 2026
- 2026Long-Context Aware Upcycling: A New Frontier for Hybrid LLM Scaling27 Apr 2026
- 2026When Perplexity Lies: Generation-Focused Distillation of Hybrid Sequence Models27 Mar 2026
- 2025Higher-order Linear Attention31 Oct 2025
- 2025Transformer Based Linear Attention with Optimized GPU Kernel Implementation24 Oct 2025
- 2025AuroraLong: Bringing RNNs Back to Efficient Open-Ended Video Understanding3 Jul 2025
- 2025Log-Linear Attention5 Jun 2025
12 newest of 34 All 34 (JSON)