Retrieval-Augmented Generation (RAG)
A technique that combines information retrieval with text generation, allowing LLMs to access external knowledge sources to produce more accurate and up-to-date responses.
Retrieval-Augmented Generation (RAG) is an architectural pattern that enhances LLMs by giving them access to external knowledge bases. Instead of relying solely on the model’s internal (potentially outdated) knowledge, RAG retrieves relevant documents from a database and includes them in the prompt context.
How RAG works:
- A user query is converted into an embedding vector
- The embedding is used to search a vector database for relevant documents
- Retrieved documents are added to the prompt as context
- The LLM generates a response grounded in the retrieved information
RAG addresses key limitations of LLMs: it reduces hallucinations, provides source attribution, and can access current information without retraining. It is commonly used for customer support, enterprise knowledge bases, legal research, and medical question answering.
Related Terms
Get smarter about AI
The sharpest AI news, curated daily. Delivered free to your inbox.