End-to-End RAG and Multihop Retrieval
Wiring retrieval into generation properly — then handling the questions no single document can answer.
- Assemble the full retrieve → construct → generate → cite pipeline
- Engineer prompts that resist 'lost in the middle' degradation
- Decompose complex questions into retrievable sub-questions
- Handle multihop queries with iterative retrieval
Open the full Week 6 study material → Complete lesson: concepts in depth, the full lab with all code, and troubleshooting.
Concepts
1. Prompt construction is context engineering
Where context appears in the window matters: models attend best to the start and end, worst to the middle. Ordering, formatting, and citation scaffolding measurably change answer quality.
2. Grounded citation
Production answers cite sources. You'll design a citation format the model reliably follows, and verify citations point at text that actually supports the claim.
3. Query decomposition
'Which of our courses shares prerequisites with the one Maria teaches?' requires two lookups. Decomposition splits complex questions into sub-queries, retrieves for each, and synthesizes.
4. Iterative and multihop retrieval
Sometimes hop 2 depends on hop 1's answer. The pipeline becomes a loop: retrieve, read, decide what's still missing, retrieve again. This is the bridge to agents in Week 7.
Lab — live session
- Wire your Week 4 retriever into a full generation pipeline with citations
- A/B test context ordering and formatting with your Week 5 harness
- Implement query decomposition; route simple queries past it
- Build iterative retrieval for genuine multihop questions from your corpus
A complete RAG system answering single-hop and multihop questions with verifiable citations — evaluated, of course.
Reading
Watch
Reflection — bring answers to the next session
- Did context ordering change your metrics? By how much?
- What kinds of questions in your domain are inherently multihop?
- When does decomposition hurt — and how would your router detect those cases?
Challenge 6: The Multihop Gauntlet — Write the questions your system CAN'T answer yet — then make it answer them.