mlsanityData to 7 Oct 2026

Giraffe: Adventures in Expanding Context Lengths in LLMs

arXiv 2308.10882 ↗First posted 21 Aug 2023cs.AI cs.CLcited by 32

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

  1. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  2. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  4. 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  6. 2020Measuring Massive Multitask Language Understandingcited by 7,768
  7. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  8. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
  9. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
  10. 2018Self-Attention with Relative Position Representationscited by 1,112
  11. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  12. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
2 more
  1. 2020How Neural Networks Extrapolate: From Feedforward to Graph Neural Networkscited by 218
  2. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 8; 2024: 19; 2025: 4; 2026: 1.

32 papers.

Sort:

By area:

  1. 2024A Survey on the Memory Mechanism of Large Language Model based Agentscited by 622
  2. 2024Large Language Models: A Surveycited by 506
  3. 2024LLM Inference Unveiled: Survey and Roofline Model Insightscited by 147
  4. 2024LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuningcited by 133
  5. 2024A Survey on Large Language Model Acceleration based on KV Cache Managementcited by 125
  6. 2023Scaling Laws of RoPE-based Extrapolationcited by 124
  7. 2024Leave No Document Behind: Benchmarking Long-Context LLMs with Extended Multi-Doc QAcited by 121
  8. 2024Optimus-1: Hybrid Multimodal Memory Empowered Agents Excel in Long-Horizon Taskscited by 83
  9. 2023Advancing Transformer Architecture in Long-Context Large Language Models: A Comprehensive Surveycited by 71
  10. 2023RCAgent: Cloud Root Cause Analysis by Autonomous Agents with Tool-Augmented Large Language Modelscited by 62
  11. 2025Evaluating LLM-based Agents for Multi-Turn Conversations: A Surveycited by 56
  12. 2023BAMBOO: A Comprehensive Benchmark for Evaluating Long Text Modeling Capacities of Large Language Modelscited by 53
20 more
  1. 2023CLEX: Continuous Length Extrapolation for Large Language Modelscited by 43
  2. 2023Data Contamination Through the Lens of Timecited by 39
  3. 2024TokenSelect: Efficient Long-Context Inference and Length Extrapolation for LLMs via Dynamic Token-Level KV Cache Selectioncited by 38
  4. 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encodingcited by 32
  5. 2024The What, Why, and How of Context Length Extension Techniques in Large Language Models -- A Detailed Surveycited by 32
  6. 2024Long2RAG: Evaluating Long-Context & Long-Form Retrieval-Augmented Generation with Key Point Recallcited by 32
  7. 2024Is It Really Long Context if All You Need Is Retrieval? Towards Genuinely Difficult Long Context NLPcited by 27
  8. 2024Pruning for Protection: Increasing Jailbreak Resistance in Aligned LLMs Without Fine-Tuningcited by 24
  9. 2024Extending LLMs' Context Window with 100 Samplescited by 20
  10. 2023BTLM-3B-8K: 7B Parameter Performance in a 3B Parameter Modelcited by 19
  11. 2024An Efficient Recipe for Long Context Extension via Middle-Focused Positional Encodingcited by 16
  12. 2025Large Language Models for Computer-Aided Design: A Surveycited by 16
  13. 2024Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Modelscited by 15
  14. 2024Taxonomy-Guided Zero-Shot Recommendations with LLMscited by 15
  15. 2024LongWanjuan: Towards Systematic Measurement for Long Text Qualitycited by 11
  16. 2025HeadInfer: Memory-Efficient LLM Inference by Head-wise Offloadingcited by 9
  17. 2024XL3M: A Training-free Framework for LLM Length Extension Based on Segment-wise Inferencecited by 8
  18. 2024Evaluating Multilingual Long-Context Models for Retrieval and Reasoningcited by 8
  19. 2025Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"cited by 5
  20. 2026DeepEdu-v1: Efficient and Scalable Agentic LLMs for Vietnamese Educationcited by 0