Lost in the middle
Definition
Lost in the middle is the tendency of AI language models to miss information placed in the middle of a long input while using information at the start or end more reliably. The name comes from a 2023 research paper by Liu and colleagues.
By Ronan Liedmeier, fractional head of growth and course author · Published 17 October 2026 · Last updated 17 October 2026
Also called: lost-in-the-middle effect
It matters whenever someone pastes a long contract or a stack of reports into a chat and asks about one detail.
How it works
Liu et al. (2023) gave models a question plus 10, 20 or 30 short Wikipedia passages, only one of which held the answer, and moved that passage to different positions. Accuracy formed a U shape: highest when the answer passage came first or last, lowest when it sat in the middle. For GPT-3.5-Turbo, the worst middle positions in the 20- and 30-passage tests scored below the same model answering with no passages at all.
The models tested were 2023 models, including GPT-3.5-Turbo, Claude 1.3 and MPT-30B-Instruct. Newer models with larger context windows may show a smaller effect, so treat it as a risk to test on your own documents.
Example
A paralegal at a property firm pastes an 80-page lease into a chat and asks whether the tenant can sublet. The sublet clause is in section 14, about halfway through. The answer comes back that the lease doesn't address subletting. Pasting only sections 12 to 16, or asking the model to list tenant-rights clauses section by section first, finds it.
Common mistake
Treating "it fits in the context window" as "it will be read carefully". Structure the request instead: split the document into parts, pull the answer from each part, then combine the results.
Learn it in AI Academy
- Working With Long ContextAdvanced · 14 min
Related terms
- Context window
- A context window is the maximum amount of text an AI model can take into account at once, measured in tokens. It holds your messages, any files you add, its instructions and its own replies, and whatever doesn't fit is left out.
- Retrieval-augmented generation (RAG)
- Retrieval-augmented generation (RAG) is a way of getting an AI model to answer from your own documents. A search step first finds the passages that match the question, then the model writes its answer using those passages.
- Chunking
- Chunking is splitting long documents into smaller pieces before they go into a RAG system, so a search can find and return just the relevant part. Where you cut the text decides whether each piece still makes sense on its own.
- Context engineering
- Context engineering is the practice of deciding what information an AI model sees each time it works: the instructions, documents, tool descriptions, memory and conversation history. It extends prompt engineering from the wording of one request to everything loaded around it.