Secure Systems Group
Menu×

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

See also