Retrieval-augmented generation, or RAG, retrieves information from an external collection and supplies it to a language model while it answers. It can connect an answer to current or private documents without retraining the model.
How the pipeline works
- Ingest documents with identifiers, versions, access rules, and useful metadata.
- Search for passages relevant to the question using the retrieval strategy appropriate to the corpus.
- Filter retrieved records using the authenticated user’s permissions.
- Provide selected passages and source references to the model.
- Check whether the final answer is supported and whether the question should instead be escalated.
Example: a policy question
A customer asks whether an opened item can be returned. The retrieval step should find the policy for the correct product, region, and purchase date. A fluent answer based on a different region’s policy is still a failure even if it includes a working citation.
Measure retrieval separately from generation
First check whether a valid supporting document was present in the collection. Then inspect whether retrieval found it, whether ranking kept it, and whether the model used it correctly. This separates missing evidence from an answer-generation error.
Common failure modes
Stale documents, weak chunk boundaries, duplicate passages, permission mistakes, and adversarial instructions can all enter the context. RAG does not eliminate hallucinations or prompt injection. Treat retrieved text as evidence to evaluate, rather than authority to execute instructions.
What to keep for an investigation
Record document references and versions, retrieval settings, prompt version, model identifier, and the review outcome. Use access and retention controls appropriate to the source material. Never expose a private document through a citation that bypasses its permissions.
References and further reading
Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.