mlsanityData to 7 Oct 2026

ReAttention: Training-Free Infinite Context with Finite Attention Scope

arXiv 2407.15176 ↗First posted 21 Jul 2024cs.CL cs.AIcited by 13

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  3. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  4. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  5. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,175
  6. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  7. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
  8. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  9. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
  10. 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
  11. 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,270
  12. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
29 more
  1. 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 848
  2. 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Modelscited by 805
  3. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  4. 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
  5. 2023Model Tells You What to Discard: Adaptive KV Cache Compression for LLMscited by 466
  6. 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Timecited by 428
  7. 2024PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funnelingcited by 420
  8. 2024MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attentioncited by 375
  9. 2024∞Bench: Extending Long Context Evaluation Beyond 100K Tokenscited by 360
  10. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
  11. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 302
  12. 2023Effective Long-Context Scaling of Foundation Modelscited by 301
  13. 2024Long-context LLMs Struggle with Long In-context Learningcited by 285
  14. 2023L-Eval: Instituting Standardized Evaluation for Long Context Language Modelscited by 232
  15. 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystackcited by 211
  16. 2024PyramidInfer: Pyramid KV Cache Compression for High-throughput LLM Inferencecited by 148
  17. 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
  18. 2023Scaling Laws of RoPE-based Extrapolationcited by 124
  19. 2023SparQ Attention: Bandwidth-Efficient LLM Inferencecited by 119
  20. 2024Get More with LESS: Synthesizing Recurrence with KV Cache Compression for Efficient LLM Inferencecited by 75
  21. 2024Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matterscited by 73
  22. 2023Dynamic Context Pruning for Efficient and Interpretable Autoregressive Transformerscited by 67
  23. 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
  24. 2024Length Generalization of Causal Transformers without Position Encodingcited by 46
  25. 2023Latent Positional Information is in the Self-Attention Variance of Transformer Language Models Without Positional Embeddingscited by 23
  26. 2024SubGen: Token Generation in Sublinear Time and Memorycited by 21
  27. 2024LongHeads: Multi-Head Attention is Secretly a Long Context Processorcited by 16
  28. 2024BGE Landmark Embedding: A Chunking-Free Embedding Method For Retrieval Augmented Long-Context Large Language Modelscited by 15
  29. 2024LongWanjuan: Towards Systematic Measurement for Long Text Qualitycited by 11

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 8; 2026: 5.

13 papers.

Sort:

By area: