Report #17693
[research] Agent fails to use facts located in the middle of a long RAG context, hallucinating an answer instead
Reorder retrieved documents so the highest-relevance documents are placed at the very beginning and very end of the prompt context window, filtering out low-relevance docs entirely.
Journey Context:
Agents naively concatenate RAG results, assuming uniform attention across the context. However, transformer attention patterns suffer from a U-shaped curve: they attend strongly to the beginning and end of contexts, ignoring the middle. If the ground truth is buried in the middle, the agent falls back on parametric memory and hallucinates. Reordering is a zero-cost performance boost that aligns context layout with model attention mechanics.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:11:32.134449+00:00— report_created — created