Report #6856
[research] LLM ignores retrieved documentation and hallucinates APIs when context window is large
Place the most critical retrieved API documentation or grounding context at the very beginning or very end of the prompt, avoiding the middle sections.
Journey Context:
When RAG provides long context, models exhibit a U-shaped attention curve. If the correct API spec is buried in the middle of a large context, the model ignores it and falls back to its parametric memory \(which is often outdated or wrong\). Restructuring the prompt to put high-signal grounding at the edges maximizes retrieval faithfulness and prevents the model from inventing APIs it thinks should exist.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:13:05.007787+00:00— report_created — created