Effective vs Nominal Context Length
The advertised context window and the length a model actually uses well are different numbers, often by a large factor, and the gap between them has several distinct, measurable causes.
A model card advertises a 128000-token context window. Place one specific, checkable fact at 40 percent depth inside a 100000-token document and ask a question about it, and retrieval accuracy can fall well short of the accuracy on the same fact placed at the very start or the very end. The number on the box and the length the model actually uses well are different numbers, and the gap between them is often large enough to change how you should design a prompt.
Two different definitions
Nominal length is the maximum sequence length a model accepts without erroring or producing degenerate output, set by the positional scheme's training or scaling configuration, whether that is a RoPE base and scaling factor, an ALiBi design range, or the row count of a learned position table.
Effective length is the length up to which performance on some actual task, retrieval, multi-hop reasoning, instruction-following that references distant content, stays close to short-context performance. It is task-dependent by nature; a single model can have a long effective length for simple copy or lookup and a much shorter one for reasoning that has to combine several distant spans.
Four independent causes of the gap
- Positional scaling degradation. Even a well-executed RoPE scaling method (see RoPE scaling: NTK-aware and YaRN) trades some resolution for reach; the signal at extreme lengths is a blurrier version of what the model trained on, not an identical one.
- Attention dilution. Softmax normalises over every visible key, so as context grows, the attention mass available for any single relevant token is spread across thousands of competitors unless the model has learned unusually sharp, specific attention patterns.
- Training data distribution. Most pretraining and fine-tuning documents are far shorter than a model's nominal context window, so the model receives comparatively little gradient signal teaching it what to do with genuinely long, sparse-signal inputs.
- "Lost in the middle." Empirically, information near the very start or very end of a context is retrieved more reliably than information placed in the middle, a pattern observed across many models and positional schemes, thought to relate to how recency effects and early-position anchoring interact with training data structure.
How it is measured
The standard diagnostic is a needle-in-a-haystack sweep: vary total context length and the depth at which a target fact is inserted independently, and plot retrieval accuracy as a two-dimensional heatmap over both. A single-number metric like perplexity at length L is necessary but not sufficient (see length extrapolation), because a model can hold low perplexity at long lengths while still failing targeted retrieval; perplexity is an average over the whole sequence and cannot distinguish "used the context well" from "mostly ignored the middle and got lucky".
The practical takeaway
Do not treat an advertised context window as a budget to fill uniformly. When possible, place the information a task most depends on near the start or end of a long prompt rather than buried in the middle. And treat retrieval-augmented approaches, chunking and ranking relevant passages before they ever reach the model (see embeddings and semantic search), as complementary to raw long context rather than obsolete because of it; a shorter, curated context frequently outperforms a longer, noisier one at the same effective token budget.
When it falls down
- Effective length is not a fixed property of a model. It shifts with prompt format, instruction phrasing, and even which part of the context contains the query, so any single reported number is an approximation.
- Vendors have an incentive to report the largest defensible nominal figure. Independent needle-in-a-haystack results for models claiming the same nominal context length vary substantially in practice.
- Better positional scaling does not automatically improve reasoning quality. Gains from NTK-aware scaling or YaRN address positional stability; multi-hop reasoning over long context depends at least as much on training data and objective.
- "Lost in the middle" is a robust pattern, not a law. Specific fine-tuning regimes and architectural choices, including attention-sink and windowing strategies, can shift or partially flatten it, so it is worth measuring per model rather than assuming it applies uniformly.
Further reading
- Chen et al., 2023, Extending Context Window of Large Language Models via Positional Interpolation - one of the clearest illustrations of nominal-versus-effective gaps under naive scaling.
- Peng et al., 2023, YaRN: Efficient Context Window Extension of Large Language Models - reports task-based long-context evaluation alongside perplexity, illustrating the gap this concept describes.
5 flashcards for this concept
Click a card to reveal the answer.