Phase 19: Capstone Projects

End-to-End RAG System

Six lessons of components. One pipeline. One eval loop. One self-terminating demo. This is the system you ship. Compose the chunker, hybrid retriever, query rewriter, cross-encoder reranker, and answer generator into a single end-to-end pipeline. Implement an answer generator that cites its claims by chunk anchor, with refuse-on-low-confidence fallback. Run the lesson 68 eval against the assembled pipeline and prove the staged build wins on every metric over the same components in isolation. Build a self-terminating CLI demo that ingests a fixture corpus, runs a fixed query set, and exits zero with a summary report. Six components in isolation prove nothing. The chunker can win on recall@5 against the corpus and lose on the system's recall@5 because the retriever cannot rank what the chunker emits. The reranker can lift MRR on a synthetic candidate pool and fail on real bi-encoder candidates because the bi-encoder's recall at the rerank budget is too low. The query rewriter can promote the gold doc on a single query and break on the next because the LLM mock returns a degenerate hypothetical. The integration test is the whole pipeline run end to end against the same fixture qrels, with the same metric, with one orchestrator file that wires everything together. That is what this lesson builds. If the metrics on the integrated pipeline beat the…

End-to-End RAG System: Six lessons of components. One pipeline. One eval loop. One self-terminating demo. This is the system you ship.

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.