RAG (Retrieval-Augmented Generation)
Executive Definition: RAG (Retrieval-Augmented Generation) — An architectural framework that improves language model outputs by retrieving relevant factual information from an external database before generating a response.
By dynamically fetching contextual information relevant to the user’s query, RAG mitigates the limitations of static training data. When a prompt is submitted, a retrieval system searches a structured or vector database for pertinent documents. These documents are appended to the language model’s context window, forcing the model to generate its response based on specific, verifiable data.
Frequently Asked Questions
Why use RAG instead of fine-tuning?
Fine-tuning alters a model’s internal weights and requires retraining to update knowledge. RAG accesses external data at runtime, ensuring responses are based on the most up-to-date information without retraining.
What components are required for RAG?
A typical RAG pipeline requires an embedding model to convert documents into vectors, a vector database to store and query these vectors, and a language model to synthesize the retrieved text.
Does RAG eliminate hallucinations?
While RAG drastically reduces hallucinations by grounding the model’s response in explicit reference text, it does not completely eliminate them. Errors can still occur during retrieval or synthesis.