Retrieval-Augmented Generation (RAG)

Retrieval-augmented generation, or RAG, combines retrieving external information with generating an output from a model. In a document assistant, retrieved passages become context for answering the current question. Lewis and colleagues' RAG paper is an early research formulation combining retrieval with generation.

Preparation and a live question do different work

A shop prepares its policy documents by extracting text, dividing it into useful passages, and organizing them for search. When a customer asks about returns, the service finds relevant permitted passages, includes them with the question, and asks the model for an answer. It can then check the answer and present supporting references.

The retriever might use keywords, embeddings, or a combination. A vector database is not required by the general pattern. At ordinary request time, adding retrieved text to context does not itself update model weights. Training or fine-tuning changes learned parameters and is a separate operation.

Grounding creates checks, not certainty

If retrieval misses an exception about opened products, the model may give an incomplete answer. Even when the correct passage is retrieved, generation can misread it or add unsupported claims. Evaluate retrieval coverage and answer support separately.

Keep source versions, index freshness, and access control aligned. Retrieved documents are evidence to interpret, not instructions allowed to override the application's rules. When available material does not support an answer, the application needs an appropriate response, such as stating the gap rather than inventing a policy.

Reference: Lewis et al.: Retrieval-Augmented Generation.


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.