Back to articles

Myths and limits

A larger context window does not always mean a better answer

What is known, and what varies by model and by task.

A context window of a million tokens says how much fits. It does not say how well the model uses what fit.

Phenomenon

You paste a huge document because "it fits now" and the answer ignores the very paragraph that mattered. Or the model gets it right with 10 pages and fails with 200 on the same subject.

Mechanism

Anthropic's documentation says a larger window lets you handle longer prompts, but that more context is not automatically better: as the token count grows, accuracy and recall degrade, a phenomenon called context rot. That is why, according to the docs, choosing what enters the context matters as much as the space available. An engineering post from Anthropic offers an explanation: the transformer lets every token attend to every other token, which creates n² pairwise relations for n tokens, and the model would have an attention budget that each new token spends. That is an explanation proposed by the authors, not a law demonstrated in this article. There are also independent measurements: Liu et al. (TACL, 2024) tested questions about several documents and key-value retrieval. Performance dropped sharply when the relevant information changed position, worse in the middle of the context and better at the beginning and the end. Hsieh et al. (RULER, 2024) showed that the simple needle-in-a-haystack test scores nearly 100%, but that almost all of the 17 models they evaluated had large drops as the context grew. All of them claimed 32 thousand tokens of context or more, and only half kept satisfactory performance at 32 thousand.

What this does not prove

Those studies are from 2023 and 2024, with the models of that time. They do not prove that a current model, with a 1-million-token window, degrades the same way on your task. They also do not prove that larger windows are useless: they make tasks possible that used to be impossible. What the data supports is narrower: the ability to fit is not the ability to use well, and the result varies with the model, the task, and the position of the information.

A check you can run

Run a position test with your model and your kind of document. 1. Pick a fact that exists in only one place in the text, and a question whose answer is that fact. 2. Build three versions of the same document, with the fact at the start, in the middle, and at the end. 3. Do that at two sizes, for example 10 thousand and 100 thousand tokens, filling the rest with irrelevant text. 4. Ask the question in a new conversation for each of the six versions and note the hits. Repeat a few times. The documentation itself recommends, for long texts, putting the documents at the top of the prompt and the question at the end (it says this can improve answer quality by up to 30% in Anthropic's tests), and asking the model to quote the relevant passages before answering. You can include those two variations in your test and see whether they make a difference for your case. Sources: Anthropic, Context windows: https://platform.claude.com/docs/en/build-with-claude/context-windows (opens in a new tab) Anthropic, Effective context engineering for AI agents: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents (opens in a new tab) Anthropic, Prompting best practices (Long context prompting): https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices (opens in a new tab) Liu et al., Lost in the Middle: How Language Models Use Long Contexts, TACL 12, 2024: https://aclanthology.org/2024.tacl-1.9/ (opens in a new tab) Hsieh et al., RULER: What's the Real Context Size of Your Long-Context Language Models?, 2024: https://arxiv.org/abs/2404.06654 (opens in a new tab)

Comments

Loading comments…