Skip to main content
Interactive 3D/Long Context: Lost in the Middle
View
Parameters
Context Length33k
Fact Position50%
Model Size
HUD
Accuracy: 44.0%
Position: Middle (50%)
Context: 33k tokens
Model: 13B
128k tokens ≈ 100,000 words. Facts in the middle of long contexts are frequently missed (Liu et al., 2023).

Long Context: Lost in the Middle - Interactive Visualization

LLMs struggle to retrieve facts placed in the middle of long contexts - showing strong primacy and recency effects but poor middle recall. This 'lost in the middle' phenomenon means simply extending context windows doesn't solve retrieval. This demo shows how position affects retrieval accuracy and compares context compression strategies.

  • Position vs accuracy curve - see how retrieval accuracy changes as the target fact moves from position 0 to position N in a long context
  • Primacy and recency effects - visualize the U-shaped accuracy curve where first and last positions score highest
  • Needle-in-a-haystack test - drop a specific fact at different positions and see if the model can retrieve it
  • Context compression comparison - evaluate reranking, summarization, and selective retrieval at reducing the lost-in-the-middle effect
  • Understand why 128k context window does not equal 128k reliable retrieval and when RAG is still necessary

Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.