An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encoding
Not on the map. Why?
Abstract (arXiv)
Recently, many methods have been developed to extend the context length of pre-trained large language models (LLMs), but they often require fine-tuning at the target length (gg4K) and struggle to effectively utilize information from the middle part of the context. To address these issues, we propose Continuity-Relativity indExing with gAussian Middle (textttCREAM), which interpolates positional encodings by manipulating position indices. Apart from being simple, textttCREAM is training-efficient: it only requires fine-tuning at the pre-trained context window (e.g., Llama 2-4K) and can extend LLMs to a much longer target context length (e.g., 256K). To ensure that the model focuses more on the information in the middle, we introduce a truncated Gaussian to encourage sampling from the middle part of the context during fine-tuning, thus alleviating the "Lost-in-the-Middle" problem faced by long-context LLMs. Experimental results show that textttCREAM successfully extends LLMs to the target length for both Base and Chat versions of textttLlama2-7B with "Never Miss A Beat". Our code is publicly available at https://github.com/bigai-nlco/cream.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Builds on 33 of its 42 references that are in the map. First posted on arXiv 11 Jun 2024.
Builds on
33 of 42 references.
References · 33
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,355
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
21 more
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2019Compressive Transformers for Long-Range Sequence Modellingcited by 699
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2021Efficient Attentions for Long Document Summarizationcited by 342
- 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
- 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 206
- 2023LooGLE: Can Long-Context Language Models Understand Long Contexts?cited by 200
- 2024Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attentioncited by 194
- 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 188
- 2023Focused Transformer: Contrastive Training for Context Scalingcited by 133
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2023PoSE: Efficient Context Window Extension of LLMs via Positional Skip-wise Trainingcited by 109
- 2024Can Mamba Learn How to Learn? A Comparative Study on In-Context Learning Taskscited by 104
- 2024Can Perplexity Reflect Large Language Model's Ability in Long Text Understanding?cited by 45
- 2023Giraffe: Adventures in Expanding Context Lengths in LLMscited by 32
- 2024Long Context Alignment with Short Instructions and Synthesized Positionscited by 22
- 2024Extending LLMs' Context Window with 100 Samplescited by 20
- 2024LLoCO: Learning Long Contexts Offlinecited by 16
Built on by
Citing papers per year: 2025: 10; 2026: 6.
16 papers.
Sort:
By area:
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddingscited by 23
- 2025LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillationcited by 14
- 2025Native Parallel Reasoner: Reasoning in Parallelism via Self-Distilled Reinforcement Learningcited by 12
- 2025ReflectEvo: Improving Meta Introspection of Small LLMs by Learning Self-Reflectioncited by 11
- 2025SoLoPO: Unlocking Long-Context Capabilities in LLMs via Short-to-Long Preference Optimizationcited by 10
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generationcited by 4
- 2025Lost-in-the-Middle in Long-Text Generation: Synthetic Dataset, Evaluation Framework, and Mitigationcited by 3
- 2025DSAS: A Universal Plug-and-Play Framework for Attention Optimization in Multi-Document Question Answeringcited by 3
- 2025Context-aware Biases for Length Extrapolationcited by 2
- 2025CCF: A Context Compression Framework for Efficient Long-Sequence Language Modelingcited by 1
- 2026RRAttention: Dynamic Block Sparse Attention via Per-Head Round-Robin Shifts for Long-Context Inferencecited by 1
- 2026Randomized YaRN Improves Length Generalization for Long-Context Reasoningcited by 1
4 more
- 2026Shuffle the Context: RoPE-Perturbed Self-Distillation for Long-Context Adaptationcited by 0
- 2026AgentGR: Semantic-aware Agentic Group Decision-Making Simulator for Group Recommendationcited by 0
- 2026GeoRoPE: Ground-Aware Rotary Adaptation for Remote Sensing Foundation Modelscited by 0
- 2026Learning how to Forget: Fine-tuning for Long-Context Sparse Attentioncited by 0
- 2026Learning how to Forget: Fine-tuning for Long-Context Sparse Attention20 Aug 2026
- 2026Randomized YaRN Improves Length Generalization for Long-Context Reasoning22 Jun 2026
- 2026GeoRoPE: Ground-Aware Rotary Adaptation for Remote Sensing Foundation Models8 Jun 2026
- 2026AgentGR: Semantic-aware Agentic Group Decision-Making Simulator for Group Recommendation11 May 2026
- 2026Shuffle the Context: RoPE-Perturbed Self-Distillation for Long-Context Adaptation15 Apr 2026
- 2026RRAttention: Dynamic Block Sparse Attention via Per-Head Round-Robin Shifts for Long-Context Inference5 Feb 2026
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddings13 Dec 2025
- 2025Native Parallel Reasoner: Reasoning in Parallelism via Self-Distilled Reinforcement Learning8 Dec 2025
- 2025DSAS: A Universal Plug-and-Play Framework for Attention Optimization in Multi-Document Question Answering14 Oct 2025
- 2025CCF: A Context Compression Framework for Efficient Long-Sequence Language Modeling11 Sep 2025
- 2025ReflectEvo: Improving Meta Introspection of Small LLMs by Learning Self-Reflection22 May 2025
- 2025SoLoPO: Unlocking Long-Context Capabilities in LLMs via Short-to-Long Preference Optimization16 May 2025
4 more
- 2025Context-aware Biases for Length Extrapolation11 Mar 2025
- 2025Lost-in-the-Middle in Long-Text Generation: Synthetic Dataset, Evaluation Framework, and Mitigation10 Mar 2025
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation26 Feb 2025
- 2025LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillation11 Feb 2025
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddingscited by 23
- 2025LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillationcited by 14
- 2025ReflectEvo: Improving Meta Introspection of Small LLMs by Learning Self-Reflectioncited by 11
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generationcited by 4
- 2025DSAS: A Universal Plug-and-Play Framework for Attention Optimization in Multi-Document Question Answeringcited by 3
- 2025Context-aware Biases for Length Extrapolationcited by 2
- 2026RRAttention: Dynamic Block Sparse Attention via Per-Head Round-Robin Shifts for Long-Context Inferencecited by 1
- 2026GeoRoPE: Ground-Aware Rotary Adaptation for Remote Sensing Foundation Modelscited by 0
- 2026Learning how to Forget: Fine-tuning for Long-Context Sparse Attentioncited by 0
- 2026Learning how to Forget: Fine-tuning for Long-Context Sparse Attention20 Aug 2026
- 2026GeoRoPE: Ground-Aware Rotary Adaptation for Remote Sensing Foundation Models8 Jun 2026
- 2026RRAttention: Dynamic Block Sparse Attention via Per-Head Round-Robin Shifts for Long-Context Inference5 Feb 2026
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddings13 Dec 2025
- 2025DSAS: A Universal Plug-and-Play Framework for Attention Optimization in Multi-Document Question Answering14 Oct 2025
- 2025ReflectEvo: Improving Meta Introspection of Small LLMs by Learning Self-Reflection22 May 2025
- 2025Context-aware Biases for Length Extrapolation11 Mar 2025
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation26 Feb 2025
- 2025LongReD: Mitigating Short-Text Degradation of Long-Context Large Language Models via Restoration Distillation11 Feb 2025