Skip to content

Why AI misses things in the middle of a long document

The short answer

Where a fact sits inside a long input changes how likely the model is to use it. In the published measurements below, accuracy is highest when the answer is at the very start or the very end and lowest in the middle — the same question, the same amount of text, only the position moved. The middle is not skipped on purpose; it is simply where retrieval is weakest.

the same fact, three places in one document

the start — retrieval is strongest

fact here → found ✓

the middle — retrieval is weakest

fact here → often missed — same question, same document

the end — strong again

fact here → found ✓

In the published measurements only one thing moved between runs: the position of the answer. The middle is not skipped on purpose — it is where retrieval is weakest.
Accuracy by position in the context

Published numbers from Lost in the Middle. With 20 documents in the context, GPT-3.5-Turbo answered 75.8% of the questions when the document holding the answer came first, 53.8% when it sat tenth, and 63.2% when it came last — the same questions, the same amount of text, only the position changed.

What’s actually happening

A long input is not read the way you read: there is no cursor moving from line to line, and no point at which the model has “got to page 40”. The whole input is available at once, and the model weighs all of it while producing each word. Availability, though, is not the same as use.

The clearest measurement of the gap is Lost in the Middle, published in TACL in 2023. The setup is deliberately simple: give the model a set of documents where exactly one contains the answer, ask the question, and then move the answer document to a different position and ask again. Nothing else changes — not the question, not the number of documents, not the amount of text.

The result, in the authors’ words:

performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts, even for explicitly long-context models
Lost in the Middle: How Language Models Use Long Contexts (TACL 2023)

The demo above is those published numbers redrawn, not a picture of the paper. With twenty documents, the same model answered 75.8% correctly when the answer sat first and 53.8% when it sat tenth — a gap of twenty-two points produced entirely by moving one paragraph.

Two things follow that are worth separating. First, the effect is about position, and it is not a bug that a vendor patch removes. Independent testing by Chroma across eighteen newer models found that:

models do not use their context uniformly; instead, their performance grows increasingly unreliable as input length grows
Chroma — Context Rot: How Increasing Input Tokens Impacts LLM Performance

Second, the vendors now name the phenomenon themselves. Anthropic’s own documentation states that “as token count grows, accuracy and recall degrade, a phenomenon known as context rot”, and that this “makes curating what’s in context just as important as how much space is available”.

That is the practical shape of it. A long document does fit. Fitting is the easy part.

What to do about it

Ask about one section at a time. Paste chapter four and ask about chapter four. A short input where everything is relevant beats a long one where the relevant part is buried at position seventeen.

Put the question next to the material. If the answer must come from a particular passage, quote that passage in the message. You are choosing the position instead of hoping.

Do not trust a single sweep. “Find every clause about termination” over eighty pages is exactly the task the measurements above say is unreliable. Run it section by section, or run it twice and compare the two lists — the differences are where to look.

Ask it to quote before it concludes. Requiring the exact sentence it is relying on turns an unverifiable summary into something you can check in ten seconds, and it fails loudly when there is nothing to quote.

Know the size you are working with. Context fit measures a document, including a PDF, in tokens and against each model’s window — useful less for the limit than for seeing how much material the question is competing with.

Common questions

1 Are these numbers about the model I use today?
No, and we will not pretend otherwise. The measurements are from 2023 models on a multi-document question-answering task. What survives is the shape: position inside a long input affects whether the information gets used. Later independent testing across eighteen newer models found the same kind of unevenness, without the numbers being transferable.
2 Does splitting the document into several messages help?
It changes nothing by itself. The messages are concatenated into one request, so the material ends up in the same input in the same order. What helps is sending less of it, or putting the part that matters where you are asking the question.
3 Is this the same as the chat forgetting the beginning?
No. There, the early messages are not in the request at all. Here everything fits and is present — it is simply used unevenly depending on where it sits.

Related

Sources

Last checked: