Efficient Length-Generalizable Attention via Causal Retrieval for Long-Context Language Modeling
Not on the map. Why?
Abstract (arXiv)
Despite the success of Transformers, handling long contexts remains challenging due to the limited length generalization and quadratic complexity of self-attention. Thus Transformers often require post-training with a larger attention window, significantly increasing computational and memory costs. In this paper, we propose a novel attention mechanism based on dynamic context, Grouped Cross Attention (GCA), which can generalize to 1000 times the pre-training context length while maintaining the ability to access distant information with a constant attention window size. For a given input sequence, we split it into chunks and use each chunk to retrieve top-k relevant past chunks for subsequent text generation. Specifically, unlike most previous works that use an off-the-shelf retriever, our key innovation allows the retriever to learn how to retrieve past chunks that better minimize the auto-regressive loss of subsequent tokens in an end-to-end manner. Such a mechanism accommodates retrieved chunks with a fixed-size attention window to achieve long-range information access, significantly reducing computational and memory costs during training and inference. Experiments show that GCA-based models achieve near-perfect accuracy in passkey retrieval for 16M context lengths, which is 1000 times the training length.
Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Builds on 35 of its 45 references that are in the map. First posted on arXiv 2 Oct 2024.
Builds on
35 of 45 references.
References · 35
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
23 more
- 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,336
- 2018Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarizationcited by 1,317
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2021Unsupervised Dense Information Retrieval with Contrastive Learningcited by 1,216
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2016Abstractive Text Summarization Using Sequence-to-Sequence RNNs and Beyondcited by 812
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
- 2019Compressive Transformers for Long-Range Sequence Modellingcited by 726
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2024xLSTM: Extended Long Short-Term Memorycited by 327
- 2022Memorizing Transformerscited by 226
- 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 213
- 2024Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attentioncited by 200
- 2022Block-Recurrent Transformerscited by 110
- 2024Long-Context Language Modeling with Parallel Context Encodingcited by 84
- 2020Memory Transformercited by 76
- 2024Length Generalization of Causal Transformers without Position Encodingcited by 47
- 2023Retrieval-Pretrained Transformer: Long-range Language Modeling with Self-retrievalcited by 20
- 2021R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Modelingcited by 19
- 2022Fast-R2D2: A Pretrained Recursive Neural Network based on Pruned CKY for Grammar Induction and Text Representationcited by 15
- 2024Generative Pretrained Structured Transformers: Unsupervised Syntactic Language Models at Scalecited by 10
- 2023Augmenting Transformers with Recursively Composed Multi-grained Representationscited by 5
Built on by
Citing papers per year: 2025: 4; 2026: 5.
9 papers.
- 2025Long-Context Generalization with Sparse Attentioncited by 21
- 2026Hierarchical Sparse Attention Done Right: Toward Infinite Context Modelingcited by 12
- 2025Hardware-aligned Hierarchical Sparse Attention for Efficient Long-term Memory Accesscited by 9
- 2025Understanding and Improving Length Generalization in Hierarchical Sparse Attention Modelscited by 6
- 2025Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Modelscited by 3
- 2026Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scalecited by 2
- 2026S3-Attention:Attention-Aligned Endogenous Retrieval for Memory-Bounded Long-Context Inferencecited by 1
- 2026Superlinear Multi-Step Attentioncited by 0
- 2026FreeSolo: Linear-time Sparse Attention with Zero-Shot Length Extrapolationcited by 0
- 2026FreeSolo: Linear-time Sparse Attention with Zero-Shot Length Extrapolation12 Oct 2026
- 2026Hierarchical Sparse Attention Done Right: Toward Infinite Context Modeling3 Jul 2026
- 2026Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scale1 Jul 2026
- 2026Superlinear Multi-Step Attention26 Jan 2026
- 2026S3-Attention:Attention-Aligned Endogenous Retrieval for Memory-Bounded Long-Context Inference25 Jan 2026
- 2025Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models28 Nov 2025
- 2025Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models20 Oct 2025
- 2025Long-Context Generalization with Sparse Attention19 Jun 2025
- 2025Hardware-aligned Hierarchical Sparse Attention for Efficient Long-term Memory Access23 Apr 2025