Level 9 project
Evidence-Backed RAG
Start from the canonical project files, validate the result, and keep the evidence you need to explain what you built.
There is no upload or grading service. Run the documented validator or checks where applicable, keep the results, and score your own evidence against the rubric below. A passing check by itself does not mean the project is complete. Suggested strong-evidence target: 16/20. Critical-criterion rule: A 16/20 total is not sufficient if any criterion the rubric marks as critical scores zero.
Start here
Launch lesson: RAG System Integration Workshop
Prerequisite project: Adapt a Small LLM
Prerequisites
Python help for this project:
Complete Level 9 through RAG System Integration Workshop. The cumulative project dependency is Adapt a Small LLM.
Goal
Build a retrieval-augmented workflow whose evidence path is inspectable:
source snapshot
→ chunk/source identity
→ eligibility filter
→ retrieval ranking
→ supplied evidence
→ grounded output
→ citation/provenance validation
→ retrieval + answer evaluation
→ release decisionTask
token_overlapeligible_source_idsretrievevalidate_grounded_outputvalidate_run
Stuck on a TODO?
Choose one function at a time. Hint 1 offers direction, hint 2 offers pseudocode, and hint 3 reveals only that function's reference implementation after confirmation.
rag.py: token_overlap()
Try the starter function and run its validator before revealing the reference.
Hints for this TODO
rag.py: eligible_source_ids()
Try the starter function and run its validator before revealing the reference.
Hints for this TODO
rag.py: retrieve()
Try the starter function and run its validator before revealing the reference.
Hints for this TODO
rag.py: validate_grounded_output()
Try the starter function and run its validator before revealing the reference.
Hints for this TODO
rag.py: validate_run()
Try the starter function and run its validator before revealing the reference.
Hints for this TODO
Validation
Run these commands from the downloaded Project folder or the public materials repository root.
python projects/tests/l09/validate_submission.py \
projects/starters/l09/rag.py \
path/to/your/rag-run.jsonCompare with a reference
First complete your own TODOs and run the submission validator above. Then open the published reference solution. Reference acceptance tests check the completed reference, not your submission:
python projects/tests/l09/test_reference.pyRubric
Score each criterion from 0–4. A submission should score at least 16/20 overall and must not score 0 on access/provenance or evaluation.
| Criterion | 4 — Strong evidence | 3 — Meets | 2 — Partial | 1 — Weak | 0 — Missing |
|---|---|---|---|---|---|
| Corpus/chunk/index lineage | Source snapshot, chunker, embedding/retrieval identity, updates, and IDs are traceable and reproducible | Clear lineage with minor gaps | Core IDs exist but version/update evidence is incomplete | Mostly an unversioned document dump | No trustworthy corpus/index identity |
| Retrieval and reranking | Candidate retrieval, exact/semantic trade-offs, cutoff, reranking, and failure slices are measured under fixed cases | Reproducible retrieval with minor gaps | Retrieval works but diagnostics or slices are shallow | Only a few anecdotal queries | No coherent retrieval system |
| Access and provenance | Eligibility is enforced before ranking; supplied sources are authorized; supported answers cite supplied evidence | Correct boundaries with minor gaps | Some provenance checks but one important boundary is missing | Prompt wording is the main security control | Unauthorized/unsupplied evidence can be accepted |
| RAG evaluation and failure analysis | Retrieval metrics + grounded-answer metrics + abstention + earliest-boundary debug trace are all present | Complete evaluation with minor gaps | Final-answer evaluation present but retrieval diagnosis weak | Cherry-picked answer samples only | No fixed evaluation |
| Reproducibility and communication | Corpus/retriever/reranker/prompt/generator/evaluator identities, commands, limitations, and optional live-path differences are explicit | Reproducible package with small omissions | Several artifact versions or limitations missing | Mostly screenshots/output dumps | No reproducible package |
Objective checks
The reduced validator checks:
- tenant/active eligibility filtering before ranking;
- deterministic retrieval over eligible sources;
- grounded-output provenance;
- supplied-source subset relationships;
- recall@2 and grounded-answer accuracy recomputation;
- unauthorized-exposure count;
- release-rule recomputation;
- intentional cross-tenant failure rejection.
Judgment questions
Ask yourself, and locate a trace or measurement for each answer:
- Do chunks preserve the evidence the task requires? If not, show the lost span and revise the chunking choice.
- Do lexical, vector, or hybrid choices match the actual query types? If not, compare a failure slice.
- Does reranking improve the intended slices, not just aggregate scores? If not, inspect per-slice metrics.
- Does each citation substantiate its claim? If not, correct or abstain from the claim.
- Are freshness and deletion behavior recorded? If not, document the update boundary.
- Did you locate the earliest failed boundary? If not, trace authorization → retrieval → ranking → generation.
Assessment guardrail
A live vector database or model API is optional for repository acceptance. If provided, it extends the evidence but does not replace deterministic provenance, authorization, and evaluation checks.
Self-check before you call it done
- Can you trace corpus versions, chunk/index IDs, retrieval/reranking settings, and freshness/deletion behavior?
- Can you prove tenant/active filtering happened before ranking and that each cited claim uses an authorized, supplied source?
- Can you reproduce recall@2, grounded-answer accuracy, abstention, unauthorized-exposure count, and the release decision?
- Can you reproduce the cross-tenant failure and diagnose the earliest failed boundary with a focused remedy?