Robots Atlas>ROBOTS ATLAS
Inference

Lost in the Middle

2023ActivePublished: 10 September 2026Updated: 10 September 2026Published
Key innovation
Empirically showed that an LLM’s ability to use long context depends strongly on where the relevant information sits, producing a U-shaped accuracy curve — highest at the start and end of the input and markedly lower in the middle.
Category
Inference
Abstraction level
Pattern
Operation level
InferenceModelEvaluation (runtime)
Use cases
Designing RAG systems (document order and position)Reranking and limiting the number of context passagesEvaluating long-context modelsBuilding information-retrieval benchmarks (needle-in-a-haystack)Prompt engineering for long context

How it works

The phenomenon is studied by systematically moving the position of relevant information within a long input while keeping context length fixed. In multi-document QA the model receives a question and many passages, only one of which contains the answer; accuracy is measured as a function of that passage’s position. Similarly, in key–value retrieval the model must read the value for a given key from a long list. The results form a U-shaped curve: high accuracy for edge positions, a minimum for middle positions. The causes are linked to attention distribution and positional encoding (primacy/recency bias) in the Transformer architecture, and to the distribution of context length and information placement in training data.

Problem solved

It refutes the tacit assumption that a model “sees” the whole context window uniformly. It names and characterizes a previously under-examined limitation of long-context LLMs: merely making information available in the context does not guarantee it will be used, because the position of that information strongly affects the outcome. This provides a basis for designing RAG and prompting systems that deliberately place key content at the edges of the context.

Implementation

Implementation pitfalls
Placing key documents in the middle of the contextHigh

In RAG systems, relevant passages that land in the middle of a long context are often ignored, lowering answer quality.

Fix:Place the most important documents at the beginning or end of the context; use reranking so the most relevant passages land at the edges.
Assuming “larger window = better utilization”High

Enlarging the context window does not remove the U-curve; the model may still fail to use middle information.

Fix:Measure position sensitivity (needle-in-a-haystack tests) and do not overfill the context just because it “fits”.
Overloading the context with too many passagesMedium

A larger number of competing passages intensifies the effect — relevant information gets “lost” in the noise.

Fix:Limit the context to the most relevant passages (top-k) and filter out irrelevant content before feeding the model.

Evolution

Original paper · 2023 · Transactions of the Association for Computational Linguistics (TACL), vol. 12, 2024 (arXiv preprint, 2023) · Nelson F. Liu
Lost in the Middle: How Language Models Use Long Contexts
Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, Percy Liang
2023
Publication of the “Lost in the Middle” preprint (Liu et al.)
Inflection point

The paper describes the U-shaped performance curve as a function of the relevant information’s position in a long context, on multi-document QA and key–value retrieval tasks.

2024
Publication in TACL (vol. 12, MIT Press)

The peer-reviewed version appeared in the Transactions of the Association for Computational Linguistics, cementing “Lost in the Middle” as a standard term in long-context research.

2024
Growth of long-context benchmarks (e.g. RULER)

The “Lost in the Middle” findings inspired benchmarks measuring the real usable length of long context (e.g. needle-in-a-haystack tests and RULER).

Hyperparameters (configurable axes)

Position of relevant informationCritical

Where the relevant information sits within the context (beginning, middle, end). The key factor producing the U-shaped curve.

początek / beginHighest accuracy (primacy effect).
środek / middleLowest accuracy (bottom of the U-curve).
koniec / endHigh accuracy (recency effect).
Context length / number of passagesHigh

Input length and the number of competing documents. The longer the context, the stronger the drop for middle positions.

10 / 20 / 30 dokumentówSettings from the multi-document QA experiments.
Model long-context capabilityMedium

The model’s nominal context window and architecture. The effect appears even in large-context models (extending the window does not remove it).

modele standardowe vs długokontekstoweThe U-curve persists in both cases.

Computational complexity

Compute bottleneck

Effective attention allocation over long context

The bottleneck is not compute throughput but the model’s ability to actually focus attention on a relevant passage located far from the edges of the input. As context length and the number of competing passages grow, middle-positioned information is used increasingly poorly.

Execution paradigm

Primary mode
Dense

The phenomenon is observed in dense self-attention models, where all input positions are processed but not used equally.

Activation pattern
All paths active