Lost in the middle

Lost in the middle is the tendency of language models to use information at the start or end of a long input better than information buried in the middle, named after a 2023 research paper.

The name comes from Lost in the Middle: How Language Models Use Long Contexts, posted in July 2023 by Nelson Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni and Percy Liang, and published in the journal Transactions of the Association for Computational Linguistics. The researchers gave models two tasks that required finding one relevant item in a long input: answering questions from a set of documents and retrieving a value from a long list of key-value pairs.

Moving the relevant item changed the results sharply. Accuracy was usually highest when the information sat at the very beginning or very end of the input and dropped when it was in the middle, giving a U-shaped curve. This held even for models built specifically for long contexts. The model could take in the whole input; it just did not use all of it equally.

The finding matters most for retrieval-augmented generation, where a system pastes many retrieved passages into a prompt. Suppose the passage that answers a question lands halfway down a list of twenty: by this research, the model is more likely to miss it than if it came first. The same applies to long contracts, transcripts and chat histories.

The practical responses are simple. Put the most important material at the start or the end, rank retrieved passages so the best come first, and retrieve fewer, better passages rather than more. Anthropic's prompting guidance recommends placing long documents at the top of a prompt and the question at the end, which it says improved response quality by up to 30% in its tests, especially with complex inputs made of several documents.

Later work has broadened the picture. A July 2025 report from Chroma tested 18 more recent models, including GPT-4.1, Claude Opus 4 and Gemini 2.5 Pro, and found that they still do not use their context uniformly and become less reliable as inputs grow, a wider problem now often called context rot. Position is one part of it; sheer length is another.

Common questions

What is the lost in the middle problem?

It is the finding that language models tend to use information at the start and end of a long input more reliably than information in the middle. It was described in a 2023 paper by Nelson Liu and colleagues, who found accuracy followed a U-shaped curve depending on where the relevant information was placed.

Do newer models still get lost in the middle?

Long-context performance is still uneven. Chroma's 2025 study of 18 recent models found they do not use their context uniformly and become less reliable as inputs grow. Test your own model on inputs of the length and structure you will actually use.

Where should I put important information in a long prompt?

At the beginning or the end, not buried in the middle. Anthropic recommends placing long documents first and the question or instructions last, and if you are retrieving passages, ordering them so the most relevant come first.

How does lost in the middle affect RAG systems?

Retrieval-augmented generation often places many passages into one prompt, and the passage with the answer may land in the middle, where it is more likely to be overlooked. Reranking passages by relevance and keeping the number of passages small both reduce the risk.

Finding more

Search for "lost in the middle", "long-context position bias" or "long-context evaluation" to find the original paper and later studies. The paper on arXiv and the journal version are the primary source, and model makers' prompting guides give practical advice on ordering long inputs. Be cautious with single needle-in-a-haystack scores in model announcements, which test simple retrieval rather than how well a model uses information spread across a long input.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.