{
  "id": "context-window-extension",
  "code": "PTL-0259",
  "term": "Context Window Extension",
  "aliases": [
    "context extension",
    "long-context extension",
    "position interpolation",
    "YaRN",
    "RoPE scaling"
  ],
  "category": "foundations",
  "definition": "Context window extension is a family of methods for making a pre-trained transformer handle sequences longer than those it was trained on, typically by rescaling its position encoding and briefly fine-tuning on longer text.",
  "description": "Models using rotary position embeddings perform poorly beyond their training length. Chen et al. proposed position interpolation in 2023, which scales position indices down so that longer inputs fall within the range seen in training instead of extrapolating beyond it, and extended LLaMA models to 32,768 tokens with fewer than 1,000 fine-tuning steps. Peng et al.'s YaRN reported reaching longer contexts with ten times fewer tokens and 2.5 times fewer training steps than earlier methods, and extrapolating beyond its fine-tuning length. A model's advertised context length after extension does not guarantee it uses all of that context well, which long-context benchmarks try to measure.",
  "example": null,
  "broader": [
    "context-window"
  ],
  "narrower": [],
  "related": [
    "rotary-position-embedding",
    "ruler",
    "needle-in-a-haystack",
    "lost-in-the-middle"
  ],
  "introduced": 2023,
  "added": "2026-11-27",
  "sources": [
    {
      "title": "Extending Context Window of Large Language Models via Positional Interpolation",
      "authors": "Chen et al.",
      "year": 2023,
      "url": "https://arxiv.org/abs/2306.15595"
    },
    {
      "title": "YaRN: Efficient Context Window Extension of Large Language Models",
      "authors": "Peng et al.",
      "year": 2023,
      "url": "https://arxiv.org/abs/2309.00071"
    }
  ],
  "url": "https://protologue.com/t/context-window-extension/",
  "citation": "Protologue. (2026). Context Window Extension. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.9.1, PTL-0259). https://protologue.com/t/context-window-extension/"
}