Retrieval-augmented generation, explained
RAG helps an AI application answer from selected documents instead of relying only on patterns learned during model training.
Retrieval-augmented generation, or RAG, searches an outside knowledge source for relevant material and gives that material to an AI model before it generates an answer.
Retrieval happens before generation
The process starts with a question. A retriever searches a knowledge base and returns material related to that question. The application adds that material to the model's prompt.
The model then writes an answer using the question and retrieved context. Some applications also show citations so a person can inspect the source.
Better sources do not remove every error
RAG can bring current policies, internal guides, or specialized records into an answer without retraining the model. Its quality still depends on what the knowledge base contains and what the retriever finds.
The model can misread useful material or write beyond it. Important answers still need a direct check against the underlying source.
RAG terms
- Knowledge base
- The documents or records the system can search for relevant information.
- Retriever
- The part of the system that finds material related to the request.
- Grounding
- Giving the model source material that supports the answer it is asked to produce.
What determines answer quality
The source material
The knowledge base must contain accurate and current information for the question.
The search
The retriever must find the passages that actually address the request.
The final check
A person should still verify important claims against the cited source.
Questions about retrieval-augmented generation
It gives a model relevant outside information at the time of a request. This can support answers about current or organization-specific material.
No. RAG retrieves information for a prompt. Training or fine-tuning changes the model itself.
No. It can reduce unsupported answers by supplying source material, but the retrieval and generated response can still be wrong.
Related glossary terms
Put your business knowledge to work
Caffeine apps run on the Internet Computer, a public network built for this.