protologue

Context Window Extension

Also called context extension, long-context extension, position interpolation, YaRN, RoPE scaling.

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.

Sources

  1. Chen et al. (2023). Extending Context Window of Large Language Models via Positional Interpolation.
  2. Peng et al. (2023). YaRN: Efficient Context Window Extension of Large Language Models.

Cite this entry

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/

BibTeX
@misc{protologue_context_window_extension,
  title = {Context Window Extension},
  author = {{Protologue}},
  year = {2026},
  howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.9.1},
  note = {Entry PTL-0259},
  url = {https://protologue.com/t/context-window-extension/}
}

Markdown JSON