Glossary
Retrieval augmented generation
Retrieval augmented generation (RAG) is a method where an AI model first looks up the documents relevant to a question in a knowledge source, then writes its answer from them. The answer rests on your own, current data rather than only on what the model learned in training.
How retrieval augmented generation works
The documents are split into passages and indexed for search, usually by meaning rather than exact words. When a question comes in, the system finds the closest passages and gives them to the model with the question. The method was described by researchers at Facebook AI in 2020.
An example of RAG
An employee asks "what is our refund policy for annual plans". The system finds the current policy and the latest decision about it, and the model answers from those two passages, ideally pointing to them. Without retrieval, the model would guess a typical policy instead of yours.
RAG vs fine-tuning
Fine-tuning changes the model itself by training it further on your examples; it teaches style and patterns but goes stale as facts change. RAG leaves the model as it is and feeds it current documents at answer time. For company knowledge that changes weekly, retrieval from an AI knowledge base is usually the better fit.