Learning path
Next moduleModule 17: LLM evaluation
Module 16
Retrieval-augmented generation
Ground LLM answers in your documents: ingest, chunk, embed, retrieve, rerank, generate, and evaluate.
- 1. The RAG pipelineBuild retrieval-augmented generation end to end (ingest, chunk, embed, index, retrieve, rerank, construct context, generate with citations) and diagnose its failures.45 min
- 2. Vector searchPick a similarity metric and an approximate nearest-neighbor index (IVF, HNSW, product quantization), trade recall against latency and memory, and combine BM25 with dense retrieval using reciprocal rank fusion.40 min
RAG gives a model the right context at query time instead of hoping the answer is stored in its weights. Most RAG failures are retrieval failures, so this module treats retrieval as a search system with its own metrics.
| Step | What happens | Failure mode |
|---|---|---|
| Ingest | parse and clean sources | missing or corrupted text |
| Chunk | split documents into retrievable units | too small loses context; too large dilutes relevance |
| Embed and index | store vectors plus metadata | wrong model, stale index |
| Retrieve | find relevant chunks | poor query or low recall |
| Rerank | score candidates more precisely | extra latency |
| Generate | answer using the supplied context | hallucination or weak grounding |
| Evaluate | measure retrieval and answer quality | only judging fluency |
| # | Lesson | You will be able to |
|---|---|---|
| 1 | The RAG pipeline | build each stage, compute retrieval metrics, and decide between RAG and fine-tuning |
| 2 | Vector search | choose a similarity metric and an ANN index (IVF, HNSW, PQ), trade recall against latency and memory, and fuse BM25 with dense results |
Interactive labs: RAG pipeline · Approximate nearest neighbors