What is retrieval augmented generation?
Retrieval-augmented generation (RAG) is a method that combines information retrieval with a generative language model. Instead of relying only on the model’s internal, parameterized knowledge, a RAG system searches an external knowledge source at inference time, selects relevant documents or passages, adds them to the model’s input, and generates an answer conditioned on that retrieved context. Its core components are therefore a retriever, which finds evidence, and a generator, which uses that evidence to produce fluent text [citation_10xdba] [citation_1167z0].
A typical workflow is: (1) split and index documents, often using lexical, vector, or hybrid representations; (2) convert the user’s question into a search query; (3) retrieve and sometimes rerank relevant passages; and (4) place the selected passages in the prompt for answer generation. Because the external collection can be updated independently of the model, RAG can provide fresher, domain-specific information without retraining the language model [citation_10xdba]. Iterative variants retrieve more information during generation when the model encounters uncertainty or needs evidence for later parts of a long answer [citation_1qsmtn].
RAG can improve factual grounding, relevance, and access to private or specialized documents, but it is not a guarantee of truth. If retrieval returns irrelevant, incomplete, or misleading passages, the generator may still produce an inaccurate answer; performance therefore depends on retrieval quality, context selection, and verification as well as on the language model itself [citation_1qsmto] [citation_1qsmtq]. In simple terms, ordinary generation asks, “What does the model remember?” RAG asks, “What relevant evidence can be retrieved now, and how should the model explain it?”