Report #42747
[gotcha] Stuffing the LLM context with unbounded RAG results without prioritizing system instructions
Limit the size and number of retrieved documents. Ensure system instructions are placed at the very beginning AND the very end of the prompt \(bookending\), as LLMs pay more attention to the start and end of the context. Use retrieval re-ranking to filter out suspiciously large documents.
Journey Context:
RAG systems often retrieve top-K documents and stuff them into the prompt. If an attacker can manipulate the retrieval \(e.g., SEO poisoning\) to return massive documents, the LLM's attention mechanism may 'forget' the original system instructions \(the 'Lost in the Middle' phenomenon\). The malicious document becomes the dominant context, effectively overriding the system prompt without a direct 'ignore instructions' command.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:13:09.480461+00:00— report_created — created