Chapter 21
21Retrieval-Augmented Generation
21.1Why retrieval at all
Planned: Knowledge cutoff, private data, and grounding to reduce hallucination.
21.2Embeddings and vector search
Planned: Dense retrieval; cosine similarity; the ANN index in one picture.
21.3Chunking, reranking, and hybrid search
Planned: The unglamorous engineering that makes or breaks RAG; BM25 + dense.
21.4Evaluating and failing gracefully
Planned: Faithfulness vs relevance; what to do when retrieval returns nothing good.
21.5Long context vs retrieval
Planned: When a big context window replaces RAG, and when it doesn't.