Report #42423
[research] Agent Ignores Retrieved Documentation and Reverts to Outdated Parametric Memory
Structure the RAG prompt to place the most critical instructions and retrieved context at the very beginning and end of the prompt, and explicitly instruct the agent: 'If the provided documentation contradicts your internal knowledge, strictly follow the documentation.'
Journey Context:
LLMs suffer from the 'lost in the middle' phenomenon where they ignore information in the center of long contexts. When generating code, if the retrieved API doc is buried or placed mid-prompt, the model defaults to its pre-trained weights \(which may be outdated\). The fix requires careful prompt engineering and context ordering to force the model's attention mechanism to prioritize the retrieved grounding over its parametric memory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:40:36.410919+00:00— report_created — created