LongRecipe: Recipe for Efficient Long Context Generalization in Large Language Models
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) face significant challenges in handling long-context tasks because of their limited effective context window size during pretraining, which restricts their ability to generalize over extended sequences. Meanwhile, extending the context window in LLMs through post-pretraining is highly resource-intensive. To address this, we introduce LongRecipe, an efficient training strategy for extending the context window of LLMs, including impactful token analysis, position index transformation, and training optimization strategies. It simulates long-sequence inputs while maintaining training efficiency and significantly improves the model's understanding of long-range dependencies. Experiments on three types of LLMs show that LongRecipe can utilize long sequences while requiring only 30% of the target context window size, and reduces computational training resource over 85% compared to full sequence training. Furthermore, LongRecipe also preserves the original LLM's capabilities in general tasks. Ultimately, we can extend the effective context window of open-source LLMs from 8k to 128k, achieving performance close to GPT-4 with just one day of dedicated training using a single GPU with 80G memory. Our code is released at https://github.com/zhiyuanhubj/LongRecipe.
Key facts. Cited by 23 papers in the map (data through 7 Oct 2026). Builds on 38 of its 46 references that are in the map. First posted on arXiv 31 Aug 2024.
Builds on
38 of 46 references.
References · 38
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 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
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2024Qwen2 Technical Reportcited by 2,076
- 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
26 more
- 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,096
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2024Yi: Open Foundation Models by 01.AIcited by 706
- 2023WizardMath: Empowering Mathematical Reasoning for Large Language Models via Reinforced Evol-Instructcited by 618
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 448
- 2022DeepSpeed Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scalecited by 403
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
- 2024Model Merging in LLMs, MLLMs, and Beyond: Methods, Theories, Applications and Opportunitiescited by 247
- 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 239
- 2023LooGLE: Can Long-Context Language Models Understand Long Contexts?cited by 200
- 2024Data Engineering for Scaling Language Models to 128K Contextcited by 183
- 2021Hurdles to Progress in Long-form Question Answeringcited by 166
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
- 2022A Length-Extrapolatable Transformercited by 123
- 2023LM-Infinite: Zero-Shot Extreme Length Generalization for Large Language Modelscited by 120
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2023PoSE: Efficient Context Window Extension of LLMs via Positional Skip-wise Trainingcited by 109
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2022An Empirical Survey on Long Document Summarization: Datasets, Models and Metricscited by 74
- 2024Training-Free Long-Context Scaling of Large Language Modelscited by 61
- 2024Contextual Position Encoding: Learning to Count What's Importantcited by 53
- 2024With Greater Text Comes Greater Necessity: Inference-Time Training Helps Long Text Generationcited by 36
- 2024Resonance RoPE: Improving Context Length Generalization of Large Language Modelscited by 25
- 2024Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Modelscited by 15
Built on by
Citing papers per year: 2024: 6; 2025: 12; 2026: 5.
23 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
- 2024Why Does the Effective Context Length of LLMs Fall Short?cited by 60
- 2024AIM: Adaptive Inference of Multi-Modal LLMs via Token Merging and Pruningcited by 43
- 2024V2PE: Improving Multimodal Long-Context Capability of Vision-Language Models with Variable Visual Position Encodingcited by 28
- 2025LongProc: Benchmarking Long-Context Language Models on Long Procedural Generationcited by 28
- 2025LongRoPE2: Near-Lossless LLM Context Window Scalingcited by 21
- 2025QFFT, Question-Free Fine-Tuning for Adaptive Reasoningcited by 15
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2025WildLong: Synthesizing Realistic Long-Context Instruction Data at Scalecited by 9
- 2026FOREVER: Forgetting Curve-Inspired Memory Replay for Language Model Continual Learningcited by 7
- 2025Scale-invariant Attentioncited by 5
11 more
- 2025AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learningcited by 4
- 2025ConTextual: Improving Clinical Text Summarization in LLMs with Context-preserving Token Filtering and Knowledge Graphscited by 3
- 2025Improving Alignment in LVLMs with Debiased Self-Judgmentcited by 3
- 2025Spotlight Attention: Towards Efficient LLM Generation via Non-linear Hashing-based KV Cache Retrievalcited by 2
- 2026DySCO: Dynamic Attention-Scaling Decoding for Long-Context Language Modelscited by 2
- 2025Classic4Children: Adapting Chinese Literary Classics for Children with Large Language Modelcited by 1
- 2025CacheFocus: Dynamic Cache Re-Positioning for Efficient Retrieval-Augmented Generationcited by 0
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalizationcited by 0
- 2026UT-ACA: Uncertainty-Triggered Adaptive Context Allocation for Long-Context Inferencecited by 0
- 2026Shuffle the Context: RoPE-Perturbed Self-Distillation for Long-Context Adaptationcited by 0
- 2026Cracks in the Foundation: Seemingly Minor Architectural Choices Impact Long Context Extensioncited by 0
- 2026Cracks in the Foundation: Seemingly Minor Architectural Choices Impact Long Context Extension10 Aug 2026
- 2026Shuffle the Context: RoPE-Perturbed Self-Distillation for Long-Context Adaptation15 Apr 2026
- 2026UT-ACA: Uncertainty-Triggered Adaptive Context Allocation for Long-Context Inference19 Mar 2026
- 2026DySCO: Dynamic Attention-Scaling Decoding for Long-Context Language Models25 Feb 2026
- 2026FOREVER: Forgetting Curve-Inspired Memory Replay for Language Model Continual Learning7 Jan 2026
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalization5 Oct 2025
- 2025AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learning22 Sep 2025
- 2025Improving Alignment in LVLMs with Debiased Self-Judgment28 Aug 2025
- 2025Spotlight Attention: Towards Efficient LLM Generation via Non-linear Hashing-based KV Cache Retrieval27 Aug 2025
- 2025QFFT, Question-Free Fine-Tuning for Adaptive Reasoning15 Jun 2025
- 2025Scale-invariant Attention20 May 2025
- 2025ConTextual: Improving Clinical Text Summarization in LLMs with Context-preserving Token Filtering and Knowledge Graphs23 Apr 2025
11 more
- 2025LongRoPE2: Near-Lossless LLM Context Window Scaling27 Feb 2025
- 2025WildLong: Synthesizing Realistic Long-Context Instruction Data at Scale23 Feb 2025
- 2025CacheFocus: Dynamic Cache Re-Positioning for Efficient Retrieval-Augmented Generation16 Feb 2025
- 2025Classic4Children: Adapting Chinese Literary Classics for Children with Large Language Model3 Feb 2025
- 2025LongProc: Benchmarking Long-Context Language Models on Long Procedural Generation9 Jan 2025
- 2024V2PE: Improving Multimodal Long-Context Capability of Vision-Language Models with Variable Visual Position Encoding12 Dec 2024
- 2024AIM: Adaptive Inference of Multi-Modal LLMs via Token Merging and Pruning4 Dec 2024
- 2024What is Wrong with Perplexity for Long-context Language Modeling?31 Oct 2024
- 2024Why Does the Effective Context Length of LLMs Fall Short?24 Oct 2024
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolation7 Oct 2024
- 2024How to Train Long-Context Language Models (Effectively)3 Oct 2024
- 2025QFFT, Question-Free Fine-Tuning for Adaptive Reasoningcited by 15
- 2025QFFT, Question-Free Fine-Tuning for Adaptive Reasoning15 Jun 2025
- 2024How to Train Long-Context Language Models (Effectively)cited by 141
- 2024What is Wrong with Perplexity for Long-context Language Modeling?cited by 68
- 2024Why Does the Effective Context Length of LLMs Fall Short?cited by 60
- 2025LongProc: Benchmarking Long-Context Language Models on Long Procedural Generationcited by 28
- 2025LongRoPE2: Near-Lossless LLM Context Window Scalingcited by 21
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2025WildLong: Synthesizing Realistic Long-Context Instruction Data at Scalecited by 9
- 2026FOREVER: Forgetting Curve-Inspired Memory Replay for Language Model Continual Learningcited by 7
- 2025Scale-invariant Attentioncited by 5
- 2025AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learningcited by 4
- 2025ConTextual: Improving Clinical Text Summarization in LLMs with Context-preserving Token Filtering and Knowledge Graphscited by 3
- 2026DySCO: Dynamic Attention-Scaling Decoding for Long-Context Language Modelscited by 2
12 most cited of 16 All 16 (JSON)
- 2026Cracks in the Foundation: Seemingly Minor Architectural Choices Impact Long Context Extension10 Aug 2026
- 2026UT-ACA: Uncertainty-Triggered Adaptive Context Allocation for Long-Context Inference19 Mar 2026
- 2026DySCO: Dynamic Attention-Scaling Decoding for Long-Context Language Models25 Feb 2026
- 2026FOREVER: Forgetting Curve-Inspired Memory Replay for Language Model Continual Learning7 Jan 2026
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalization5 Oct 2025
- 2025AIMMerging: Adaptive Iterative Model Merging Using Training Trajectories for Language Model Continual Learning22 Sep 2025
- 2025Scale-invariant Attention20 May 2025
- 2025ConTextual: Improving Clinical Text Summarization in LLMs with Context-preserving Token Filtering and Knowledge Graphs23 Apr 2025
- 2025LongRoPE2: Near-Lossless LLM Context Window Scaling27 Feb 2025
- 2025WildLong: Synthesizing Realistic Long-Context Instruction Data at Scale23 Feb 2025
- 2025Classic4Children: Adapting Chinese Literary Classics for Children with Large Language Model3 Feb 2025
- 2025LongProc: Benchmarking Long-Context Language Models on Long Procedural Generation9 Jan 2025
12 newest of 16 All 16 (JSON)