RAG makes AI answer from your knowledge — if you govern the knowledge
Retrieval-augmented generation and knowledge systems
The question: How do we make an AI assistant answer from company knowledge rather than from generic memory?
RAG is the core enterprise pattern for knowledge assistants, policy bots, research copilots, and support — grounding, freshness, and access control. It fails without evaluation and document governance, and it fails confidently.
What the lesson covers
RAG in one sentence: retrieve the most relevant pieces of your own knowledge, inject them into the model's prompt, and generate an answer with citations. It reduces dependence on model memory, keeps answers fresh, enables access control, and cuts hallucination — none of it guaranteed, all of it designed.
The pipeline: ingest documents → chunk them → embed chunks into vectors → store in a vector database → at question time, retrieve the closest chunks (often hybrid: semantic + keyword, then reranked) → generate with the retrieved context → cite sources. Chunking and metadata decide what CAN be retrieved: chunk a policy mid-table and no model can answer correctly. Long-context models are an alternative for small corpora, but cost and permissioning usually bring you back to retrieval.
RAG does not guarantee truth. Retrieved text can be wrong, stale, contradictory, or malicious (indirect prompt injection hides instructions inside documents). The generator can ignore context, blend it with memory, or cite the wrong source. Permissions must be enforced at retrieval time — filtering what the UI shows while the index retrieves everything is a breach waiting to happen.
Evaluation is the difference between a demo and a system: a question set with expected answers and expected sources, faithfulness checks (does the answer follow from the retrieved text?), citation accuracy, coverage ("I don't know" when the corpus is silent — a feature, not a failure), latency, and user feedback loops. Refresh evaluation as documents change.
Knowledge governance completes it: document owners, freshness/review dates, retirement of stale versions, permissions mapping, and an escalation path to humans. The university case makes it visceral: an advising assistant is only as safe as its newest outdated policy.
Key points
- RAG = retrieve → inject → generate with citations; grounding is designed, not automatic.
- Chunking + metadata decide what can be retrieved; permissions must bind at retrieval time.
- Failure modes: stale docs, retrieval misses, unfaithful generation, false citations, indirect prompt injection.
- Evaluate faithfulness, citation accuracy, and coverage — "I don't know" is a feature.
- Document governance (owners, freshness, retirement) is half the system.
Framework — RAG Quality Loop
ingest → chunk → embed → retrieve → generate → cite → evaluate → refresh. Most teams stop at generate. The loop only closes with evaluation (faithfulness, citations, coverage) and refresh (document governance).
The lab
Design (or simulate) a mini-RAG, build its eval set, and red-team it.
Open this lesson, its lab and its quiz
Sources and further reading
- Retrieval-Augmented Generation (the original paper) — Lewis et al. (2020)
- OWASP Top 10 for LLM applications — OWASP
- NIST Generative AI Profile — NIST