Mental model
Module 13: Measure retrieval and answer quality separately- Build a labelled evaluation set and use retrieval metrics plus grounded-answer checks so improvements are measurable rather than anecdotal.
Build a labelled evaluation set and use retrieval metrics plus grounded-answer checks so improvements are measurable rather than anecdotal.
Engineering focus: Measure retrieval and answer quality separately
Build a labelled evaluation set and use retrieval metrics plus grounded-answer checks so improvements are measurable rather than anecdotal.
You are not expected to know the engineering vocabulary before using the idea. Formal terminology comes after the mental model.
Carry one evidence-grounded knowledge assistant through all 18 modules. Preserve source IDs, retrieval evidence, evaluation cases, authority decisions and security assumptions so every improvement is measurable.
Evaluation is a test bench with separate gauges. Retrieval, grounding and answer usefulness need different measurements so one score cannot hide the failing layer.
Measure components separately before combining them into a release decision.
If the correct passage was never retrieved, generation cannot fix that reliably. Measure retrieval before judging answer style.
For each query, check whether relevant evidence appears within the top k results.
Mean Reciprocal Rank is higher when the first relevant result appears near the top.
Faithfulness/groundedness, answer correctness, citation support and abstention behaviour belong to the generation layer.
Module 13: Measure retrieval and answer quality separatelyRetriever
Recall@5 0.91
MRR 0.84
Generator
Faithfulness 0.95
Abstention 0.88
Security
ACL leakage 0 failures / 120 testsA demo looks better, but nobody can prove the system improved.
Evaluation must be reproducible and diagnostic.
Goal: Compute Recall@3 and reciprocal rank on a tiny labelled retrieval set.
python3 - <<'PY2'
cases=[({'a'},['x','a','b']),({'c'},['c','d','e']),({'z'},['a','b','c'])]
hits=[]; rr=[]
for rel,ranked in cases:
positions=[i+1 for i,d in enumerate(ranked[:3]) if d in rel]
hits.append(bool(positions)); rr.append(1/min(positions) if positions else 0)
print('Recall@3=',sum(hits)/len(hits)); print('MRR=',sum(rr)/len(rr))
PY2Record the intermediate source IDs, ranks, metadata or state produced by the baseline. Explain which pipeline layer this evidence belongs to.
Create a no-answer case that retrieval cannot satisfy. Show why a good average MRR does not prove correct abstention behaviour.
Evaluation must be reproducible and diagnostic. State the failing layer, change only that layer, then repeat the verification checks.
Record: hypothesis → evidence → change → observed result → remaining limitation. Keep this note with the running Evidence Desk project.
Production RAG improves when every change can be traced to evidence at a specific pipeline layer. In production, retain the before/after evidence so the same failure can become a regression test.
Versioned labelled eval set
Retrieval and generation measured separately
Negative/adversarial slices included
Whether relevant evidence appears within the top k retrieved items.
Placing the first relevant result near the top.
To localize failures before blaming generation.
Real query types, difficult cases, no-answer cases and important risk scenarios.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.