Report #57561
[research] Agent fails to use the correct retrieved document when surrounded by irrelevant context
Re-rank retrieved documents to place the most relevant at the very beginning and very end of the context window. Limit context stuffing; use a threshold for document relevance rather than a fixed top-k.
Journey Context:
LLMs exhibit a U-shaped attention curve—they attend strongly to the beginning and end of the context window but ignore the middle. When RAG pipelines blindly stuff top-k documents, the actual answer \(if ranked 5th\) gets lost in the middle, leading the model to hallucinate or say 'I don't know.' Re-ranking mitigates this positional bias, though it adds latency. It is a necessary tradeoff for long-context factuality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:06:12.153980+00:00— report_created — created