Skip to content

AI Glossary · Concepts

What is Lost in the Middle?

Lost in the Middle

Lost in the middle is the finding that language models often use information near the beginning or end of a long input more reliably than information buried in the middle. It was named in a 2023 study of long-context question answering and retrieval.

Also known as: lost-in-the-middle, lost in the middle effect, lost-in-the-middle problem

· Chain of Thought

Context Management

  • 2 explainers
  • 1 source

Give a model twenty retrieved documents and ask a question whose answer is in only one of them. Liu and colleagues ran this kind of test and found a U-shaped pattern: models answered best when the useful document came first or last, and noticeably worse when it sat in the middle, even models advertised for long inputs (Liu et al.). A bigger context window lets you fit more text in; it does not mean every part of that text gets equal attention.

The result is from specific 2023 models and tasks. Newer models have improved on long-context tests, and the size of the effect varies by model and by how the input is arranged, so treat it as a known risk to test for rather than a fixed law.

It matters most in retrieval-augmented generation and long agent sessions. Practical responses follow from the finding: send fewer, better documents using reranking; put the most relevant material and the key instructions near the start or end; split long documents with sensible chunking; and remove stale or irrelevant text, which also reduces context poisoning. Context engineering is the broader practice of deciding what goes into the model’s input and where. To check your own system, plant a known fact at different positions in a realistic long input and measure whether answers change.

Sources

Go deeper