Module 09
Retrieval-Augmented Generation (RAG)
Teach a model to answer from your own documents instead of its memory. You will build the RAG pipeline from scratch, then make it production-grade with better chunking, hybrid search, reranking, query rewriting and honest "I don't know" answers, measured with RAGAS. You will also learn LlamaIndex and when a framework is worth it.
By the end of this module you can
- explain why models hallucinate about private data and when RAG, long prompts or fine-tuning is the right fix
- build a RAG pipeline end to end: load, chunk, embed, store, retrieve, generate with citations
- improve retrieval with hybrid search (BM25 + vectors with reciprocal rank fusion), cross-encoder reranking and query rewriting
- measure a RAG system with RAGAS and tune it to abstain when the documents do not support an answer
- build RAG with LlamaIndex and choose honestly between LlamaIndex, LangChain and plain Python
- ship a guarded, evaluated RAG service over real corporate-style documents
Lessons
8 in this module- 01Why RAG existsExplain why an LLM confidently gets your private facts wrong, and build a tiny retrieve-then-answer pipeline that fixes it.
- 02The RAG pipeline: indexing and retrievalBuild both halves of a RAG system, indexing once and retrieving per question, and diagnose a wrong answer by finding the stage that failed.
- 03Loaders, chunking and retrievers with LangChainLoad real PDFs into documents with metadata, split them along natural boundaries, add contextual headers, and expose the result through a LangChain retriever.
- 04Hybrid search, reranking and query rewritingCombine BM25 and vector search with reciprocal rank fusion, rerank candidates with a cross-encoder, and use multi-query and HyDE rewriting where they measurably help.
- 05RAGAS metrics and the "I don't know" rateBuild a golden dataset, score retrieval and generation separately with RAGAS, and tune a RAG system to abstain correctly when the documents do not support an answer.
- 06LlamaIndex fundamentalsBuild RAG with LlamaIndex readers, nodes, indexes, retrievers and query engines, and replace the defaults that are wrong for your data.
- 07LlamaIndex vs LangChainChoose between LlamaIndex, LangChain/LangGraph and plain Python for each part of an app, based on what it does, who maintains it and how it will be debugged.
- 08Project: Enterprise advanced RAGShip a guarded RAG service over a 200-page operations handbook and HR policies, with hybrid search, reranking, cited answers, PII protection and a RAGAS report that proves it works.