Report #8271
[research] RAG system fails to use relevant documents placed in the middle of the context window
Re-rank retrieved documents to place the most relevant ones at the very beginning and very end of the prompt context. Do not rely on linear document insertion by retrieval score.
Journey Context:
LLMs exhibit a U-shaped attention curve over long contexts. They attend strongly to the system prompt \(primacy\) and the end of the prompt \(recency\), but suffer severe degradation in the middle. If a RAG system naively chunks and inserts documents by order of retrieval, middle-ranked \(but still highly relevant\) chunks will be ignored, leading to hallucinations based on the less relevant but better-attended chunks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:08:23.824023+00:00— report_created — created