# Lost in the Middle

> Models miss facts in the middle of a long text more often.

**Field:** Artificial Intelligence  
**Category:** LLMs  
**Also known as:** Lost-in-the-Middle Effect, Middle Context Problem

## Think of it like

Think of it like a long list read out loud. You remember the start and the end, but not the middle.

## Definition

Lost in the middle is the finding that language models use facts at the start or end of a long input better than facts in the middle. When the key fact sits in the middle of many pages, the model misses it more often. A 2023 study showed the drop clearly, with a U-shaped curve. Newer models handle long inputs better, but the effect still shows up. Putting the key text near the start or end helps.

## Example

Jack pastes 20 documents and asks a question whose answer is in document 10. The model misses it, but finds it when that document is moved to the top.

## Why it matters

A big context window does not mean every part of it is read just as well.

## Common mistake

Dumping everything into the prompt and trusting it all gets used. Put the most important part first or last.

## Three principles

- **Start and end win.** Middle is weaker.
- **A U-shaped curve.** Found in a 2023 study.
- **Order your input.** Key text first or last.

## Related terms

- [Context Window](https://learn.benibix.com/term/ai/context-window)
- [Attention Mechanism](https://learn.benibix.com/term/ai/attention-mechanism)
- [Hallucination (AI)](https://learn.benibix.com/term/ai/hallucination)
- [Context Rot](https://learn.benibix.com/term/ai/context-rot)
- [Needle in a Haystack Test](https://learn.benibix.com/term/ai/needle-in-a-haystack)

## Told apart from

- [Context Rot vs Lost in the Middle](https://learn.benibix.com/compare/context-rot-vs-lost-in-the-middle): People think context rot and lost in the middle are one problem, and they are not. Lost in the middle is about where a fact sits. The model misses facts in the middle of a long input more than ones at the start or the end. Context rot is about how much text there is. The more you add, the worse the model does, wherever the fact sits.

## Taught in

- [Long Context Problems](https://learn.benibix.com/learn/ai-llms/long-context-problems): LLMs, 15/15
- [Context Engineering](https://learn.benibix.com/learn/ai-working-with-ai/context-engineering): Prompt Engineering, 9/16

![A U-shaped curve. When the key fact is at the start or the end of a long input, the model finds it most of the time. When it is in the middle, the model finds it less often.](https://learn.benibix.com/diagrams/llm-lost-in-the-middle.svg)

---

Source: https://learn.benibix.com/term/ai/lost-in-the-middle
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
