RAG lesson 01 · Define the retrieval contract
Versioned evidence corpus · deterministic retrieval fixtures
Lighthouse Policy Evidence Assistant. A fictional support assistant answers questions from a versioned product-policy corpus. It must retrieve current, authorized evidence, cite exact source spans, and abstain when evidence is missing or conflicting.
Start here
Retrieval-augmented generation (RAG) is a pipeline that selects external evidence for a model at request time, then constrains or checks the generated answer against that evidence.
RAG is not automatically better than direct search, a database query, or a longer prompt. It adds value only when retrieval and generation jointly serve a defined evidence-backed answer contract.
01 · Smallest useful mechanism
A RAG system joins ingestion, search, ranking, context assembly, generation, and evidence validation. Each stage can fail independently, so the product contract must name the answer claim and the evidence needed to support it.
Retrieval changes the model context; it does not make the resulting answer true.
02 · Experiment
Deterministic retrieval fixture
This workbench uses inspectable ranking and evidence fixtures and injected failures. It does not make live calls or execute external effects.
Retrieval workbench · lighthouse-contract-v1
Question to consider
Complication
A stale 14-day policy ranks above the current 30-day clause; a marketing FAQ promises 60 days.
What would you do?
Choose the approach you would be prepared to defend in a design review.
Consider the trade-offs first.
Choose an answer, then run the scenario. You’ll see what the system checks, what happens under the complication, and where the control boundary holds or breaks.
03 · Implementation brief
Your learning artifact
Stored only in this browser. No account required; course reset does not delete it.
04 · Check your understanding
Primary sources · verified 2026-08-02
A polished answer may cite stale, unauthorized, merely topical, or contradictory text. Without a retrieval contract, no metric or vector database configuration can say whether the product succeeded.
Common mistake: If the top chunk is semantically similar, the answer is grounded. Similarity estimates topical relation. Grounding requires current, authorized evidence that supports each material claim under the product’s rules.
Transfer exercise: Compare a topical marketing FAQ, a stale policy, and the current authoritative clause for the same question; decide what the product may claim.
Next: A retrieval contract depends on a corpus whose parsing, chunking, identity, and deletion semantics preserve the source truth.