Giraffe: Adventures in Expanding Context Lengths in LLMs
Not on the map. Why?
Abstract (arXiv)
Modern large language models (LLMs) that rely on attention mechanisms are typically trained with fixed context lengths which enforce upper limits on the length of input sequences that they can handle at evaluation time. To use these models on sequences longer than the train-time context length, one might employ techniques from the growing family of context length extrapolation methods -- most of which focus on modifying the system of positional encodings used in the attention mechanism to indicate where tokens or activations are located in the input sequence. We conduct a wide survey of existing methods of context length extrapolation on a base LLaMA or LLaMA 2 model, and introduce some of our own design as well -- in particular, a new truncation strategy for modifying the basis for the position encoding. We test these methods using three new evaluation tasks (FreeFormQA, AlteredNumericQA, and LongChat-Lines) as well as perplexity, which we find to be less fine-grained as a measure of long context performance of LLMs. We release the three tasks publicly as datasets on HuggingFace. We discover that linear scaling is the best method for extending context length, and show that further gains can be achieved by using longer scales at evaluation time. We also discover promising extrapolation capabilities in the truncated basis. To support further research in this area, we release three new 13B parameter long-context models which we call Giraffe: 4k and 16k context models trained from base LLaMA-13B, and a 32k context model trained from base LLaMA2-13B. We also release the code to replicate our results.
Key facts. Cited by 32 papers in the map (data through 7 Oct 2026). Builds on 14 of its 25 references that are in the map. First posted on arXiv 21 Aug 2023.
Builds on
14 of 25 references.
References · 14
- 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
- 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
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 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
2 more
Built on by
Citing papers per year: 2023: 8; 2024: 19; 2025: 4; 2026: 1.
32 papers.
Sort:
By area:
- 2024A Survey on the Memory Mechanism of Large Language Model based Agentscited by 622
- 2024Large Language Models: A Surveycited by 506
- 2024LLM Inference Unveiled: Survey and Roofline Model Insightscited by 147
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
- 2024A Survey on Large Language Model Acceleration based on KV Cache Managementcited by 125
- 2023Scaling Laws of RoPE-based Extrapolationcited by 124
- 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QAcited by 121
- 2024Optimus-1: Hybrid Multimodal Memory Empowered Agents Excel in Long-Horizon Taskscited by 83
- 2023Advancing Transformer Architecture in Long-Context Large Language Models: A Comprehensive Surveycited by 71
- 2023RCAgent: Cloud Root Cause Analysis by Autonomous Agents with Tool-Augmented Large Language Modelscited by 62
- 2025Evaluating LLM-based Agents for Multi-Turn Conversations: A Surveycited by 56
- 2023BAMBOO: A Comprehensive Benchmark for Evaluating Long Text Modeling Capacities of Large Language Modelscited by 53
20 more
- 2023CLEX: Continuous Length Extrapolation for Large Language Modelscited by 43
- 2023Data Contamination Through the Lens of Timecited by 39
- 2024TokenSelect: Efficient Long-Context Inference and Length Extrapolation for LLMs via Dynamic Token-Level KV Cache Selectioncited by 38
- 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encodingcited by 32
- 2024The What, Why, and How of Context Length Extension Techniques in Large Language Models -- A Detailed Surveycited by 32
- 2024Long2RAG: Evaluating Long-Context & Long-Form Retrieval-Augmented Generation with Key Point Recallcited by 32
- 2024Is It Really Long Context if All You Need Is Retrieval? Towards Genuinely Difficult Long Context NLPcited by 27
- 2024Pruning for Protection: Increasing Jailbreak Resistance in Aligned LLMs Without Fine-Tuningcited by 24
- 2024Extending LLMs' Context Window with 100 Samplescited by 20
- 2023BTLM-3B-8K: 7B Parameter Performance in a 3B Parameter Modelcited by 19
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encodingcited by 16
- 2025Large Language Models for Computer-Aided Design: A Surveycited by 16
- 2024Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Modelscited by 15
- 2024Taxonomy-Guided Zero-Shot Recommendations with LLMscited by 15
- 2024LongWanjuan: Towards Systematic Measurement for Long Text Qualitycited by 11
- 2025HeadInfer: Memory-Efficient LLM Inference by Head-wise Offloadingcited by 9
- 2024XL3M: A Training-free Framework for LLM Length Extension Based on Segment-wise Inferencecited by 8
- 2024Evaluating Multilingual Long-Context Models for Retrieval and Reasoningcited by 8
- 2025Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"cited by 5
- 2026DeepEdu-v1: Efficient and Scalable Agentic LLMs for Vietnamese Educationcited by 0
- 2026DeepEdu-v1: Efficient and Scalable Agentic LLMs for Vietnamese Education25 Sep 2026
- 2025Large Language Models for Computer-Aided Design: A Survey13 May 2025
- 2025Evaluating LLM-based Agents for Multi-Turn Conversations: A Survey28 Mar 2025
- 2025HeadInfer: Memory-Efficient LLM Inference by Head-wise Offloading18 Feb 2025
- 2025Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"9 Feb 2025
- 2024A Survey on Large Language Model Acceleration based on KV Cache Management27 Dec 2024
- 2024TokenSelect: Efficient Long-Context Inference and Length Extrapolation for LLMs via Dynamic Token-Level KV Cache Selection5 Nov 2024
- 2024Long2RAG: Evaluating Long-Context & Long-Form Retrieval-Augmented Generation with Key Point Recall30 Oct 2024
- 2024Evaluating Multilingual Long-Context Models for Retrieval and Reasoning26 Sep 2024
- 2024Optimus-1: Hybrid Multimodal Memory Empowered Agents Excel in Long-Horizon Tasks7 Aug 2024
- 2024Is It Really Long Context if All You Need Is Retrieval? Towards Genuinely Difficult Long Context NLP29 Jun 2024
- 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QA25 Jun 2024
20 more
- 2024Taxonomy-Guided Zero-Shot Recommendations with LLMs20 Jun 2024
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encoding11 Jun 2024
- 2024Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models28 May 2024
- 2024XL3M: A Training-free Framework for LLM Length Extension Based on Segment-wise Inference28 May 2024
- 2024A Survey on the Memory Mechanism of Large Language Model based Agents21 Apr 2024
- 2024LLM Inference Unveiled: Survey and Roofline Model Insights26 Feb 2024
- 2024LongWanjuan: Towards Systematic Measurement for Long Text Quality21 Feb 2024
- 2024Large Language Models: A Survey9 Feb 2024
- 2024Pruning for Protection: Increasing Jailbreak Resistance in Aligned LLMs Without Fine-Tuning19 Jan 2024
- 2024The What, Why, and How of Context Length Extension Techniques in Large Language Models -- A Detailed Survey15 Jan 2024
- 2024Extending LLMs' Context Window with 100 Samples13 Jan 2024
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning2 Jan 2024
- 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encoding28 Dec 2023
- 2023Advancing Transformer Architecture in Long-Context Large Language Models: A Comprehensive Survey21 Nov 2023
- 2023CLEX: Continuous Length Extrapolation for Large Language Models25 Oct 2023
- 2023RCAgent: Cloud Root Cause Analysis by Autonomous Agents with Tool-Augmented Large Language Models25 Oct 2023
- 2023Data Contamination Through the Lens of Time16 Oct 2023
- 2023Scaling Laws of RoPE-based Extrapolation8 Oct 2023
- 2023BAMBOO: A Comprehensive Benchmark for Evaluating Long Text Modeling Capacities of Large Language Models23 Sep 2023
- 2023BTLM-3B-8K: 7B Parameter Performance in a 3B Parameter Model20 Sep 2023
- 2024Optimus-1: Hybrid Multimodal Memory Empowered Agents Excel in Long-Horizon Taskscited by 83
- 2023RCAgent: Cloud Root Cause Analysis by Autonomous Agents with Tool-Augmented Large Language Modelscited by 62
- 2025Evaluating LLM-based Agents for Multi-Turn Conversations: A Surveycited by 56
- 2026DeepEdu-v1: Efficient and Scalable Agentic LLMs for Vietnamese Educationcited by 0
- 2026DeepEdu-v1: Efficient and Scalable Agentic LLMs for Vietnamese Education25 Sep 2026
- 2025Evaluating LLM-based Agents for Multi-Turn Conversations: A Survey28 Mar 2025
- 2024Optimus-1: Hybrid Multimodal Memory Empowered Agents Excel in Long-Horizon Tasks7 Aug 2024
- 2023RCAgent: Cloud Root Cause Analysis by Autonomous Agents with Tool-Augmented Large Language Models25 Oct 2023
- 2024Large Language Models: A Surveycited by 506
- 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
- 2023Scaling Laws of RoPE-based Extrapolationcited by 124
- 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QAcited by 121
- 2023Advancing Transformer Architecture in Long-Context Large Language Models: A Comprehensive Surveycited by 71
- 2023BAMBOO: A Comprehensive Benchmark for Evaluating Long Text Modeling Capacities of Large Language Modelscited by 53
- 2023CLEX: Continuous Length Extrapolation for Large Language Modelscited by 43
- 2023Data Contamination Through the Lens of Timecited by 39
- 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encodingcited by 32
- 2024The What, Why, and How of Context Length Extension Techniques in Large Language Models -- A Detailed Surveycited by 32
- 2024Is It Really Long Context if All You Need Is Retrieval? Towards Genuinely Difficult Long Context NLPcited by 27
- 2024Extending LLMs' Context Window with 100 Samplescited by 20
12 most cited of 20 All 20 (JSON)
- 2025Large Language Models for Computer-Aided Design: A Survey13 May 2025
- 2025Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"9 Feb 2025
- 2024Is It Really Long Context if All You Need Is Retrieval? Towards Genuinely Difficult Long Context NLP29 Jun 2024
- 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QA25 Jun 2024
- 2024Taxonomy-Guided Zero-Shot Recommendations with LLMs20 Jun 2024
- 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encoding11 Jun 2024
- 2024Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models28 May 2024
- 2024XL3M: A Training-free Framework for LLM Length Extension Based on Segment-wise Inference28 May 2024
- 2024LongWanjuan: Towards Systematic Measurement for Long Text Quality21 Feb 2024
- 2024Large Language Models: A Survey9 Feb 2024
- 2024The What, Why, and How of Context Length Extension Techniques in Large Language Models -- A Detailed Survey15 Jan 2024
- 2024Extending LLMs' Context Window with 100 Samples13 Jan 2024
12 newest of 20 All 20 (JSON)