Why LLMs overlook important information in the middle of prompts
Lost in the Middle – the surprising phenomenon that LLMs forget information in the middle of long contexts. This visualization shows the attention distribution across different prompt regions and explains why position in context matters so much.
Part of the System Prompt analysis. Shows the limitations of long context windows and why "more context" isn't always better.
RAG systems with 20+ chunks suffer from this problem. The most important information should be at the beginning or end – never in the middle.
LLMs attend to the beginning and end of prompts with high attention, but the middle is neglected. System Prompt: 90% Attention. User Query (at the end): 85%. Middle info: only 20%!
Lost-in-the-Middle Paper (2023): Measurable U-shape in attention. Position 0: ~100%. Position 50% (middle): ~15%. Position 100%: ~95%. Affects all common models (GPT, Llama, Claude).
System Prompt is ALWAYS placed at the beginning → receives maximum attention. User Message at the end → also high attention. Context documents in the middle: Lose! RAG integration problematic.
1. Important info at start/end. 2. Repetition in the middle. 3. Hierarchical structure (summary at top). 4. Newer models (Claude 4.5+) show better middle attention, but U-curve remains.
When Retrieval positions 20 documents in the middle: quality suffers! Solution: Top-K Reranking based on attention patterns. Or: Most important documents at beginning/end.
Longer contexts (1M+) exacerbate the problem. Research shows: Transformer architecture is responsible for this pattern. New attention mechanisms (e.g., linear) show better middle-preserving.