What Is Lost in the Middle?
What lost in the middle means, why facts buried in the middle of a long AI input get missed, and what to do about it, explained simply for your AI interview.
In short
Lost in the middle is when an AI model uses facts well if they sit near the start or end of a long input, but misses or underuses them when they sit in the middle. Researchers measured it in 2023. Test where your key facts land before you trust a long prompt.
11 min readIntermediateCommon · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Lost in the middle is when a model uses facts well if they sit near the start or end of a long input, but misses them when they sit in the middle. Researchers measured it in 2023, on questions over many documents, and on finding one value in a list. So I don't assume a big window is enough. I put key text at the start or end, send fewer and better sections, and test with the same fact moved to different places before anyone relies on the answer.
Lost in the middle is a name for a pattern in long AI inputs. When the fact an answer needs sits near the start or the end, a model tends to use it well. When the same fact sits in the middle, the model is more likely to miss it or use it weakly. The name comes from a 2023 research paper that tested two jobs: answering questions over many documents, and finding one value in a list of key-value pairs.
The paper found that performance can degrade significantly when the position of the relevant information changes. The effect showed up even in models built for long inputs. So a bigger context window does not solve it on its own. Anthropic makes a related point: as the input grows, accuracy and recall degrade, a problem it calls context rot. More text is not automatically better.
In an interview, say what you would do. Put the key text at the start or end, and the question last. Send fewer, better sections instead of the whole file. Then plant one fact at the start, the middle and the end, and score the answers. OpenAI's guide describes a test that hid one fact at varying depths in long-context documents, and that is the habit I would bring to the job.
Keep the claim honest. The paper measured this effect in its own tests, so test your own model and your own documents before you promise anything. The fixes lower the risk, and testing shows how much risk is left.
What is lost in the middle, in plain words?
A model reads a long input as one stream of text. Lost in the middle describes a pattern: when the fact an answer needs sits near the start or the end, the model tends to use it well. When that same fact sits in the middle, the model is more likely to miss it or use it weakly.
Think of a hospital triage nurse taking over a 40-page handover note. The first lines and the last lines stick, and the middle gets skimmed. An AI contract assistant can behave the same way. If the liability cap sits on page 21 of a supplier agreement, the assistant may skip it, although the cap is on the page.
Key words
- Long input
- Many pages, messages or tool results sent to the model in one request.
- Position
- Where a fact sits in that input, from the first line to the last.
- Retrieval
- A search step that finds and sends only the few sections that match the question.
- Needle test
- A check that hides one fact at set depths in a long text, then asks for it back.
- Context rot
- The name Anthropic uses for recall getting weaker as the input grows.
What did the 2023 study find?
The paper is titled Lost in the Middle: How Language Models Use Long Contexts, and it was first posted in July 2023. It tested two jobs. One was answering questions over many documents. The other was finding one value in a list of key-value pairs, which is a simple lookup.
“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.”
The Lost in the Middle paper, abstract
“An LLM's tendency to use information from the start and end of a long context window more effectively than information from the middle.”
Google's machine learning glossary
Here is a worked case. A made-up logistics firm loads a 40-page supplier agreement and asks what the liability cap is. The clause "Liability is capped at 2 times the annual fees." sits on page 1, where a model would usually quote it. Move the same clause to page 21, change nothing else, and the answer would often guess, or say the cap was missing.
Same clause, two places
Clause on page 1
near the start, used well
Clause on page 21
in the middle of 40 pages
Cap often found
answer often quotes the cap
Cap often missed
answer often guesses
- 1The clause near the start is used well, so the answer usually finds it.
- 2The same clause in the middle is used less well, so the answer often misses it.
Why does it happen, and is it solved?
OpenAI's guide puts it this way: a model can't pay equal attention to every token it gets at one time. The paper shows the effect in its own tests. In an interview, I would avoid claiming one settled cause. I would say the sources describe the pattern and stop short of a full explanation.
Context rot is a related idea. Anthropic says that as token count grows, accuracy and recall degrade, and it calls this context rot. Lost in the middle is narrower. It is about where a fact sits in the input.
Tip
Asked whether a bigger window fixes it? Say no. A bigger window can hold more text, and the position of a fact can still change the answer. Then say how you would test it.
How do you work around it?
You cannot rely on a model to ignore position, so lower the risk and then measure. Four habits do most of the work.
- 1
Put key text at an edge
The paper found answers were often best when the key text sat at the start or end of a long input. So move the clause to one of those edges.
- 2
Send fewer, better sections
Retrieval, the search part of RAG (retrieval-augmented generation), picks the few sections that match the question. Less text means less for the model to skim past.
- 3
Put the question last
Anthropic's guide says queries at the end can improve response quality, so the question comes after the documents.
- 4
Test with the fact moved
Plant one fact at the start, the middle and the end, then score the answers. OpenAI's guide describes a test that hid one fact at varying depths in long-context documents.
Fixes that lower the risk
Things you control
Key text at the start
the clause at an edge, like page 1
Send fewer sections
only the sections that match
Question last
after the text it asks about
Model answer
reads a shorter, better-placed input
Checked answer
tested at several depths
- 1Put the clause at the start or end, where the paper found answers often did best.
- 2Fewer sections mean less text for the model to search through.
- 3The question comes after the text it asks about, as Anthropic suggests.
- 4Then the answer is tested with the fact moved to other places.
Here is the test idea in plain Python. It builds three versions of one 40-page input, with the same clause at the start, the middle and the end. A team would send each version to its model and compare the answers. This script calls no model, so its output only shows where the clause landed.
# Build the test inputs for one 40-page supplier contract. No model runs here:
# the liability cap is planted at three depths, so each input can be checked.
CAP = "Liability is capped at 2 times the annual fees."
pages = [f"Page {n}: standard notices and terms." for n in range(1, 41)]
QUESTION = "What is the liability cap?"
for name, spot in [("start", 0), ("middle", 20), ("end", 39)]:
doc = list(pages)
doc[spot] = f"Page {spot + 1}: {CAP}"
prompt = "\n".join(doc) + "\n\nQuestion: " + QUESTION
line = next(i for i, p in enumerate(doc, 1) if CAP in p)
print(f"{name}: cap on line {line} of {len(doc)}, prompt {len(prompt)} characters")Output
start: cap on line 1 of 40, prompt 1528 characters middle: cap on line 21 of 40, prompt 1528 characters end: cap on line 40 of 40, prompt 1528 characters
How would you test for it before launch?
Build a small set of test documents, each with one known fact. This is a needle test: hide the fact at set depths, then ask for it back. Plant the fact at the start, the middle and the end. Ask the questions, score each answer against the planted fact, and compare the three positions.
Then run the same check on real documents, since made-up text can flatter a model. Run it again after each change to the prompt, how the text is split, or the model, so a drop shows up in the tests before users see it.
Tip
Asked how you would catch it? Plant facts at known depths, score the answers, and repeat after every change.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: a fact in the middle of a long input is often used less well.
- The 2023 paper and the two tasks it tested.
- Why a bigger context window does not fix it on its own.
- How you would test position: plant a fact at the start, middle and end.
- Fixes that lower the risk: key text first, fewer sections, question last.
- Honesty: the sources describe the pattern, and your own data decides.
Common traps
Trap"Models read the whole input equally well."
BetterThey often use the start and end better. Position matters, so measure it.
Trap"A bigger context window solves it."
BetterA bigger window holds more text, but a buried fact can still be missed. Test it.
Trap"Adding more instructions will fix it."
BetterA generic instruction does not move a buried fact. Ask the model to quote the relevant parts first, move the key text, then test.
Can you spot the warning sign?
Spot the warning sign
A team plants one fact at three depths in a 40-page file. Which result shows lost in the middle?
Quick check
A bank's policy assistant keeps missing the fee rule on page 22 of a 40-page document. What is the first thing to try?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 26 November 2026
Building an assistant over long contracts or policies?
I design and build AI products and agents, including the interface and the system behind it. Book a short call and tell me what your documents and questions look like.