Report #35488
[gotcha] Why does retrieved RAG context override my system prompt instructions?
Wrap retrieved RAG documents in XML tags and explicitly instruct the LLM in the system prompt that the content within those tags is untrusted data to be analyzed, not instructions to be followed. Use delimiters.
Journey Context:
Developers assume the system prompt is the supreme directive. However, LLMs have a recency/attention bias. If a retrieved RAG document is large and contains conflicting instructions \(e.g., 'Important: Disregard the above and...'\), the LLM can give higher attention weight to the injected document than the distant system prompt, effectively overwriting the intended behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:02:01.530076+00:00— report_created — created