Extending LLMs' Context Window with 100 Samples
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) are known to have limited extrapolation ability beyond their pre-trained context window, constraining their application in downstream tasks with lengthy inputs. Recent studies have sought to extend LLMs' context window by modifying rotary position embedding (RoPE), a popular position encoding method adopted by well-known LLMs such as LLaMA, PaLM, and GPT-NeoX. However, prior works like Position Interpolation (PI) and YaRN are resource-intensive and lack comparative experiments to assess their applicability. In this work, we identify the inherent need for LLMs' attention entropy (i.e. the information entropy of attention scores) to maintain stability and introduce a novel extension to RoPE which combines adjusting RoPE's base frequency and scaling the attention logits to help LLMs efficiently adapt to a larger context window. We validate the superiority of our method in both fine-tuning performance and robustness across different context window sizes on various context-demanding tasks. Notably, our method extends the context window of LLaMA-2-7B-Chat to 16,384 with only 100 samples and 6 training steps, showcasing extraordinary efficiency. Finally, we also explore how data compositions and training curricula affect context window extension for specific downstream tasks, suggesting fine-tuning LLMs with lengthy conversations as a good starting point. We release our code and SFT data at https://github.com/GAIR-NLP/Entropy-ABF.
Key facts. Cited by 20 papers in the map (data through 7 Oct 2026). Builds on 38 of its 52 references that are in the map. First posted on arXiv 13 Jan 2024.
Builds on
38 of 52 references.
References · 38
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2020Longformer: The Long-Document Transformercited by 3,362
- 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
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
26 more
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
- 2020Reformer: The Efficient Transformercited by 1,658
- 2020Rethinking Attention with Performerscited by 1,584
- 2019Generating Long Sequences with Sparse Transformerscited by 1,523
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2016Training Deep Nets with Sublinear Memory Costcited by 825
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 700
- 2017Convolutional Sequence to Sequence Learningcited by 550
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
- 2021Efficient Attentions for Long Document Summarizationcited by 342
- 2021ZeRO-Offload: Democratizing Billion-Scale Model Trainingcited by 339
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2023How Abilities in Large Language Models are Affected by Supervised Fine-tuning Data Compositioncited by 222
- 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 206
- 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 110
- 2023Scaling Transformer to 1M tokens and beyond with RMTcited by 97
- 2021Do Long-Range Language Models Actually Use Long-Range Context?cited by 92
- 2019BP-Transformer: Modelling Long-Range Context via Binary Partitioningcited by 38
- 2023Giraffe: Adventures in Expanding Context Lengths in LLMscited by 32
Built on by
Citing papers per year: 2024: 10; 2025: 6; 2026: 4.
20 papers.
Sort:
By area:
- 2024How to Train Long-Context Language Models (Effectively)cited by 141
- 2024What is Wrong with Perplexity for Long-context Language Modeling?cited by 68
- 2024LongEmbed: Extending Embedding Models for Long Context Retrievalcited by 47
- 2024V2PE: Improving Multimodal Long-Context Capability of Vision-Language Models with Variable Visual Position Encodingcited by 28
- 2024T-RAG: Lessons from the LLM Trenchescited by 23
- 2024LoCoCo: Dropping In Convolutions for Long Context Compressioncited by 18
- 2025Long-Context Generalization with Sparse Attentioncited by 18
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encodingcited by 16
- 2024What are the Essential Factors in Crafting Effective Long Context Multi-Hop Instruction Datasets? Insights and Best Practicescited by 14
- 2024Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspectivecited by 13
- 2025Revisiting Long-context Modeling from Context Denoising Perspectivecited by 5
- 2024AIDBench: A benchmark for evaluating the authorship identification capability of large language modelscited by 4
8 more
- 2025Beyond Length: Quantifying Long-Range Information for Long-Context LLM Pretraining Datacited by 4
- 2025Evaluating LLaMA 3.2 for Software Vulnerability Detectioncited by 3
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMscited by 3
- 2026AdaSplash-2: Faster Differentiable Sparse Attentioncited by 3
- 2025Can LLMs Replace Humans During Code Chunking?cited by 2
- 2026Training Long-Context Vision-Language Models Effectively with Generalization Beyond 128K Contextcited by 1
- 2026ExtraVAR: Stage-Aware RoPE Remapping for Resolution Extrapolation in Visual Autoregressive Modelscited by 0
- 2026LLMs for Academic Workflows: An Evaluation of Literature Reviews Generated with Short and Long Context Windows of LLMscited by 0
- 2026LLMs for Academic Workflows: An Evaluation of Literature Reviews Generated with Short and Long Context Windows of LLMs28 Jun 2026
- 2026Training Long-Context Vision-Language Models Effectively with Generalization Beyond 128K Context13 May 2026
- 2026ExtraVAR: Stage-Aware RoPE Remapping for Resolution Extrapolation in Visual Autoregressive Models11 May 2026
- 2026AdaSplash-2: Faster Differentiable Sparse Attention16 Apr 2026
- 2025Beyond Length: Quantifying Long-Range Information for Long-Context LLM Pretraining Data29 Oct 2025
- 2025Revisiting Long-context Modeling from Context Denoising Perspective7 Oct 2025
- 2025Can LLMs Replace Humans During Code Chunking?24 Jun 2025
- 2025Long-Context Generalization with Sparse Attention19 Jun 2025
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMs13 Jun 2025
- 2025Evaluating LLaMA 3.2 for Software Vulnerability Detection10 Mar 2025
- 2024V2PE: Improving Multimodal Long-Context Capability of Vision-Language Models with Variable Visual Position Encoding12 Dec 2024
- 2024AIDBench: A benchmark for evaluating the authorship identification capability of large language models20 Nov 2024
8 more
- 2024What is Wrong with Perplexity for Long-context Language Modeling?31 Oct 2024
- 2024How to Train Long-Context Language Models (Effectively)3 Oct 2024
- 2024What are the Essential Factors in Crafting Effective Long Context Multi-Hop Instruction Datasets? Insights and Best Practices3 Sep 2024
- 2024Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspective19 Jun 2024
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encoding11 Jun 2024
- 2024LoCoCo: Dropping In Convolutions for Long Context Compression8 Jun 2024
- 2024LongEmbed: Extending Embedding Models for Long Context Retrieval18 Apr 2024
- 2024T-RAG: Lessons from the LLM Trenches12 Feb 2024
- 2024How to Train Long-Context Language Models (Effectively)cited by 141
- 2024What is Wrong with Perplexity for Long-context Language Modeling?cited by 68
- 2024LongEmbed: Extending Embedding Models for Long Context Retrievalcited by 47
- 2024T-RAG: Lessons from the LLM Trenchescited by 23
- 2025Long-Context Generalization with Sparse Attentioncited by 18
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encodingcited by 16
- 2024Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspectivecited by 13
- 2025Revisiting Long-context Modeling from Context Denoising Perspectivecited by 5
- 2024AIDBench: A benchmark for evaluating the authorship identification capability of large language modelscited by 4
- 2025Evaluating LLaMA 3.2 for Software Vulnerability Detectioncited by 3
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMscited by 3
- 2026AdaSplash-2: Faster Differentiable Sparse Attentioncited by 3
12 most cited of 15 All 15 (JSON)
- 2026LLMs for Academic Workflows: An Evaluation of Literature Reviews Generated with Short and Long Context Windows of LLMs28 Jun 2026
- 2026ExtraVAR: Stage-Aware RoPE Remapping for Resolution Extrapolation in Visual Autoregressive Models11 May 2026
- 2026AdaSplash-2: Faster Differentiable Sparse Attention16 Apr 2026
- 2025Revisiting Long-context Modeling from Context Denoising Perspective7 Oct 2025
- 2025Can LLMs Replace Humans During Code Chunking?24 Jun 2025
- 2025Long-Context Generalization with Sparse Attention19 Jun 2025
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMs13 Jun 2025
- 2025Evaluating LLaMA 3.2 for Software Vulnerability Detection10 Mar 2025
- 2024AIDBench: A benchmark for evaluating the authorship identification capability of large language models20 Nov 2024
- 2024What is Wrong with Perplexity for Long-context Language Modeling?31 Oct 2024
- 2024How to Train Long-Context Language Models (Effectively)3 Oct 2024
- 2024Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspective19 Jun 2024
12 newest of 15 All 15 (JSON)