RAG (retrieval-augmented generation)
RAG is a technique that retrieves relevant documents from an external store and places them in the prompt, so the model answers from that material rather than from memory.
RAG addresses two problems at once: knowledge the model was never trained on, and hallucination. It only works if the prompt instructs the model to answer strictly from the retrieved material and to say when the material does not contain the answer.
Related terms
- Grounding
- Grounding is constraining a model to answer only from supplied source material, rather than from its training data.
- Embedding
- An embedding is a list of numbers representing a piece of text’s meaning, so that texts with similar meanings sit close together in that numeric space.
- Chunking
- Chunking is splitting documents into smaller passages before embedding them, so retrieval returns a relevant section rather than an entire file.
- Citation
- A citation is a reference in model output pointing to the specific source passage that supports a claim.
More on retrieval and agents
See the full glossary, read the guides, or put it into practice in the prompt builder.