Mental model
Module 02: Build the smallest working RAG loop- Build a tiny retrieval-and-generation flow so the architecture becomes concrete before introducing embeddings or vector databases.
Build a tiny retrieval-and-generation flow so the architecture becomes concrete before introducing embeddings or vector databases.
Engineering focus: Build the smallest working RAG loop
Build a tiny retrieval-and-generation flow so the architecture becomes concrete before introducing embeddings or vector databases.
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.
A minimal RAG system is three boxes connected in order: find, package, answer. Keeping those boxes separate makes failures visible.
If you cannot inspect what was retrieved, you cannot reliably debug the answer.
A production stack may contain parsers, embeddings, vector indexes, rerankers and observability. But the learning path starts with a tiny corpus and deterministic retrieval so every moving part is visible.
The answer should use supplied evidence, cite it, and abstain when evidence is insufficient.
Keep retrieval, prompt construction and generation as separate functions. That makes failures diagnosable.
Module 02: Build the smallest working RAG loopretrieve(query) -> hits
build_context(hits) -> context + source_ids
generate(query, context) -> answer
validate(answer, source_ids) -> ANSWERED | INSUFFICIENT_EVIDENCEA wrong answer appears and the team cannot tell whether retrieval or generation failed.
Separate pipeline stages and make their inputs/outputs inspectable.
Goal: Build a minimal Python retriever over three text records and return source IDs with the answer context.
python3 - <<'PY2'
docs={'net.md':'The service listens on port 8080.','auth.md':'VPN reset requires MFA.','hr.md':'Payroll closes Friday.'}
q='Which port does the service use?'
hits=[(k,v) for k,v in docs.items() if 'port' in v.lower() or '8080' in v]
assert hits
print({'context':hits[0][1],'source':hits[0][0]})
PY2Record the intermediate source IDs, ranks, metadata or state produced by the baseline. Explain which pipeline layer this evidence belongs to.
Change the query to an unrelated question. Confirm retrieval returns no evidence and define the structured INSUFFICIENT_EVIDENCE result.
Separate pipeline stages and make their inputs/outputs inspectable. 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.
Stage interfaces are testable
No-evidence status is explicit
Source IDs survive to output
So retrieval failures can be distinguished from generation failures.
Return an explicit insufficient-evidence state rather than fabricate an answer.
They provide provenance for debugging, citations and auditability.
Understand the control flow, not maximize retrieval sophistication.
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.