Report #11335
[research] RAG system fails to retrieve the correct answer even when the relevant document is present in the context window, specifically when placed in the middle of the prompt
Re-rank retrieved documents to place the most relevant chunks at the very beginning and very end of the context window. Do not rely on default chronological or relevance-score ordering that clusters high-relevance items together in the middle.
Journey Context:
LLMs exhibit a U-shaped attention curve over long contexts. They attend strongly to the beginning \(primacy\) and end \(recency\) but drop performance significantly for information in the middle. Simply increasing context window size does not solve this; it often exacerbates the 'lost in the middle' effect by spreading attention thinner.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:08:38.484096+00:00— report_created — created