ReAttention: Training-Free Infinite Context with Finite Attention Scope
Not on the map. Why?
Abstract (arXiv)
The long-context capability of the Large Language Models (LLM) has made significant breakthroughs, but the maximum supported context length in length extrapolation remains a critical bottleneck limiting their practical applications. The constraint of context length in LLMs arises from the self-attention mechanism, which cannot effectively and efficiently capture the semantic relationships within infinitely long contexts via the limited pre-trained positional information and attention scope. In this work, we propose ReAttention, a training-free approach enabling LLM based on the self-attention mechanism to support an infinite context with a finite attention scope under sufficient memory resources. ReAttention performs the position-agnostic top-k attention before the ordinary position-aware self-attention, freeing LLMs from the length extrapolation issue. We validate the performance of ReAttention on the LongBench, L-Eval, and InfiniteBench and demonstrate that it is on par with traditional methods. Furthermore, we also apply ReAttention on mainstream LLMs, including LLaMA3.1-8B and Mistral-v0.3-7B, enabling them to support context lengths of at least 1M and even expanding the context length of LLaMA3.2-3B-chat by 128× to 4M without any further training in Needle-In-A-Haystack tests. We also improve the efficiency of ReAttention with Triton and achieve an efficient extrapolation without additional overhead. The code is available at https://github.com/OpenMOSS/ReAttention.
Key facts. Cited by 13 papers in the map (data through 7 Oct 2026). Builds on 41 of its 64 references that are in the map. First posted on arXiv 21 Jul 2024.
Builds on
41 of 64 references.
References · 41
- 2017Attention Is All You Needcited by 59,932
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,175
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,270
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
29 more
- 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 848
- 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Modelscited by 805
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2023Model Tells You What to Discard: Adaptive KV Cache Compression for LLMscited by 466
- 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Timecited by 428
- 2024PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funnelingcited by 420
- 2024MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attentioncited by 375
- 2024∞Bench: Extending Long Context Evaluation Beyond 100K Tokenscited by 360
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 302
- 2023Effective Long-Context Scaling of Foundation Modelscited by 301
- 2024Long-context LLMs Struggle with Long In-context Learningcited by 285
- 2023L-Eval: Instituting Standardized Evaluation for Long Context Language Modelscited by 232
- 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystackcited by 211
- 2024PyramidInfer: Pyramid KV Cache Compression for High-throughput LLM Inferencecited by 148
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
- 2023Scaling Laws of RoPE-based Extrapolationcited by 124
- 2023SparQ Attention: Bandwidth-Efficient LLM Inferencecited by 119
- 2024Get More with LESS: Synthesizing Recurrence with KV Cache Compression for Efficient LLM Inferencecited by 75
- 2024Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matterscited by 73
- 2023Dynamic Context Pruning for Efficient and Interpretable Autoregressive Transformerscited by 67
- 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
- 2024Length Generalization of Causal Transformers without Position Encodingcited by 46
- 2023Latent Positional Information is in the Self-Attention Variance of Transformer Language Models Without Positional Embeddingscited by 23
- 2024SubGen: Token Generation in Sublinear Time and Memorycited by 21
- 2024LongHeads: Multi-Head Attention is Secretly a Long Context Processorcited by 16
- 2024BGE Landmark Embedding: A Chunking-Free Embedding Method For Retrieval Augmented Long-Context Large Language Modelscited by 15
- 2024LongWanjuan: Towards Systematic Measurement for Long Text Qualitycited by 11
Built on by
Citing papers per year: 2025: 8; 2026: 5.
13 papers.
Sort:
By area:
- 2025LongLLaDA: Unlocking Long Context Capabilities in Diffusion LLMscited by 38
- 2025The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMscited by 28
- 2025CommonKV: Compressing KV Cache with Cross-layer Parameter Sharingcited by 8
- 2025Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generationcited by 7
- 2025Scale-invariant Attentioncited by 5
- 2025Compress, Gather, and Recompute: REFORMing Long-Context Processing in Transformerscited by 3
- 2025Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMscited by 2
- 2025Mixture of Weight-shared Heterogeneous Group Attention Experts for Dynamic Token-wise KV Optimizationcited by 1
- 2026AttentionRetriever: Attention Layers are Secretly Long Document Retrieverscited by 0
- 2026WAND: Windowed Attention and Knowledge Distillation for Efficient Autoregressive Text-to-Speech Modelscited by 0
- 2026KV-Fold: One-Step KV-Cache Recurrence for Long-Context Inferencecited by 0
- 2026SANE: State Anomaly Neutralization for Stable Extreme-Context Delta-Rule Modelscited by 0
- 2026SANE: State Anomaly Neutralization for Stable Extreme-Context Delta-Rule Models23 Aug 2026
- 2026Boosting Deepresearch and LongContext Ability with Self-Generated Deepresearch Rollouts Traces5 Aug 2026
- 2026KV-Fold: One-Step KV-Cache Recurrence for Long-Context Inference12 May 2026
- 2026WAND: Windowed Attention and Knowledge Distillation for Efficient Autoregressive Text-to-Speech Models17 Mar 2026
- 2026AttentionRetriever: Attention Layers are Secretly Long Document Retrievers12 Feb 2026
- 2025Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMs8 Dec 2025
- 2025CommonKV: Compressing KV Cache with Cross-layer Parameter Sharing22 Aug 2025
- 2025Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generation23 Jun 2025
- 2025LongLLaDA: Unlocking Long Context Capabilities in Diffusion LLMs17 Jun 2025
- 2025Mixture of Weight-shared Heterogeneous Group Attention Experts for Dynamic Token-wise KV Optimization16 Jun 2025
- 2025Compress, Gather, and Recompute: REFORMing Long-Context Processing in Transformers1 Jun 2025
- 2025Scale-invariant Attention20 May 2025
1 more
- 2025CommonKV: Compressing KV Cache with Cross-layer Parameter Sharingcited by 8
- 2025Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generationcited by 7
- 2025Compress, Gather, and Recompute: REFORMing Long-Context Processing in Transformerscited by 3
- 2026KV-Fold: One-Step KV-Cache Recurrence for Long-Context Inferencecited by 0
- 2026KV-Fold: One-Step KV-Cache Recurrence for Long-Context Inference12 May 2026
- 2025CommonKV: Compressing KV Cache with Cross-layer Parameter Sharing22 Aug 2025
- 2025Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generation23 Jun 2025
- 2025Compress, Gather, and Recompute: REFORMing Long-Context Processing in Transformers1 Jun 2025
- 2025The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMscited by 28
- 2025Scale-invariant Attentioncited by 5
- 2025Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMscited by 2
- 2026WAND: Windowed Attention and Knowledge Distillation for Efficient Autoregressive Text-to-Speech Modelscited by 0
- 2026SANE: State Anomaly Neutralization for Stable Extreme-Context Delta-Rule Modelscited by 0
- 2026Boosting Deepresearch and LongContext Ability with Self-Generated Deepresearch Rollouts Tracescited by 0
- 2026SANE: State Anomaly Neutralization for Stable Extreme-Context Delta-Rule Models23 Aug 2026
- 2026Boosting Deepresearch and LongContext Ability with Self-Generated Deepresearch Rollouts Traces5 Aug 2026
- 2026WAND: Windowed Attention and Knowledge Distillation for Efficient Autoregressive Text-to-Speech Models17 Mar 2026
- 2025Beyond Real: Imaginary Extension of Rotary Position Embeddings for Long-Context LLMs8 Dec 2025
- 2025Scale-invariant Attention20 May 2025
- 2025The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMs24 Apr 2025