Retrieval-Augmented Generation
Retrieval-augmented generation (RAG) combines a language model with external documents retrieved at query time. The model generates from both the query and retrieved evidence.
A simple RAG pipeline is:
where is a query, is the document collection, and is the retrieved subset.
RAG has two separable quality gates:
Good retrieval can still produce an unsupported answer if generation ignores or distorts evidence.
In practical systems, retrieval often includes query rewriting, chunking, hybrid retrieval, reranking, and context packing.
Checks
- Are retrieved documents relevant, current, and source-attributed?
- What is the retrieval unit: document, section, paragraph, chunk, table, or code block?
- Is query rewriting improving recall without changing intent?
- Is retrieval evaluated separately from generation?
- Are untrusted retrieved documents protected against prompt injection?
- Does the answer cite or link the evidence it used?
- Is the corpus public, private, or mixed?
- Are unsupported generated claims marked or removed?