lost-in-the-middle names the U-shaped accuracy curve LLMs show across context position: good at the start, good at the end, weak in the middle.
Imagine handing a friend a 50-page printed report and asking, somewhere in there is one paragraph about Tuesday's meeting, what did it say? Most people will skim the first few pages, flip to the last few pages, and shrug at the middle. Their attention is naturally pulled to the edges. Long-context language models behave the same way. Drop the answer in the first page or the last page and they nail it. Bury it on page 25 of 50 and they often miss it, even though every word was right there in front of them. The curve of their hit rate against where the answer sits looks like a U: high on the left, low in the middle, high on the right.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 minutes: define the effect, sketch the U-curve, cite the 2023 paper, name two 2026 benchmarks that still show the dip, list two mitigations.
Real products, models, and research that use this idea.
- Liu et al. 2023, Lost in the Middle: How Language Models Use Long Contexts. The paper that named the effect on a 20-document retrieval QA setup.
- RULER (Hsieh et al. 2024) extends needle-in-a-haystack to multi-needle and multi-hop variants; midcontext positions still underperform on Claude Opus 4.7 and GPT-5.5 in 2026 runs.
- BABILong tests 1M+ token recall across the bAbI tasks and shows interior-position dips on every frontier model tested through 2026.
- Anthropic's published needle-in-a-haystack charts for Claude Opus 4.7 show the same primacy and recency advantage even at 200k tokens.
- Gemini 3.1 Pro's 2M-token reports include position-stratified accuracy where the midcontext band still trails the head and tail bands.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does increasing the context window from 32k to 200k not flatten the curve?
QHow would you design a retrieval layout that exploits the U-curve on purpose?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming a bigger context window fixes it. Frontier 2026 models with 200k-plus windows still show the U-curve on RULER and BABILong.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.