Report #54810
[research] Missing retrieved facts in the middle of the context window
Re-rank retrieved code snippets so the most relevant are at the beginning and end of the context window; avoid placing critical API definitions in the middle of a long prompt.
Journey Context:
LLMs exhibit U-shaped attention curves. When using RAG to ground code generation, agents often stuff the context linearly. If the crucial function signature ends up in the middle, the LLM ignores it and hallucinates the signature from parametric memory. Placing high-signal context at the edges maximizes retrieval fidelity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:29:44.028991+00:00— report_created — created