Wiki Home
Retrieval-augmented generation
Definition
Retrieval-augmented generation (RAG) augments a language model at inference time by fetching text relevant to the current query, from a search index, a vector store of embedded documents, or the open web, and placing that text in the model’s context window so the response is conditioned on it. It lets a model answer from up-to-date, private, or domain-specific sources it was never trained on, and underlies search-augmented chatbots and document assistants.
The retrieved text occupies the same context window as the developer’s instructions and the user’s query. The model has no built-in mechanism that marks one span as trusted instructions and another as inert data, which is the property that makes retrieved content a channel for attacks.
Papers that use this concept
- Not what you’ve signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection — retrieval is the delivery channel for indirect prompt injection.
- PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models — corrupts the retrieval corpus so the retrieved text steers the model to an attacker-chosen answer.