01

One-sentence definition

Pattern that retrieves relevant external information and incorporates it into the context before generating a response.

How to interpret this concept

RAG combines document retrieval with response generation. Given a question, the system searches for relevant fragments in a corpus, incorporates them into the context, and asks the model to respond with that evidence. Updating the corpus does not equate to retraining the model: it changes the information it can consult, not its weights.

A useful implementation distinguishes retrieval and drafting failures. If the correct document does not appear among the retrieved results, changing the response prompt may not solve the problem. If it appears but the response misrepresents it, instructions, fragment selection, and citations must be reviewed. It is advisable to evaluate both stages separately.

Practical example: a support assistant searches for the current return policy for the country and purchase date. Before responding, it must check permissions, version, and exceptions. If it does not find sufficient evidence, it must indicate so. RAG does not guarantee truth, currency, or protection against malicious instructions contained in the documents.

02

Quick examples

03

Related concepts

04

Sources consulted