Report #96863
[agent\_craft] Agent misses critical information from RAG retrieval placed in the middle of the context window
When assembling retrieved context, place the most critical chunks at the beginning and end of the context window. Re-rank retrieved chunks and position the top-ranked at context start, second-ranked at context end, with lower-ranked items in the middle.
Journey Context:
LLMs exhibit a U-shaped attention pattern: they attend most strongly to the beginning and end of their context window, with a significant performance drop for information in the middle. This is empirically demonstrated across multiple model families and context lengths. The common mistake is to append retrieved context in simple relevance order, which can bury the most important information in the middle if there's a system prompt before and conversation history after. The fix is counterintuitive but well-validated: sacrifice some relevance ordering for better positional attention. If you have 5 retrieved chunks ranked by relevance, order them as \[1, 3, 5, 4, 2\] to put the best at the edges rather than \[1, 2, 3, 4, 5\] which puts 3 in the attention dead zone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:10:00.247205+00:00— report_created — created