Module 11 of 16

Retrieval

Finding the right passages for a model to read: embeddings and approximate nearest-neighbor indexes, chunking and hybrid search with reranking, and measuring whether retrieval works.

3 lessons50 min reading

Most answers that look like a model failure are retrieval failures: the right passage was never ingested, was split in half, or was ranked eleventh when only ten were sent. This module treats retrieval as the search system it is.

The first lesson covers embeddings and the approximate nearest-neighbor indexes that search them (IVF, product quantization, HNSW) with their recall, latency, and memory tradeoffs at 100 million vectors. The second covers chunking, keyword and vector search, how to fuse them, and where a reranker earns its latency. The third covers evaluation: recall, MRR, and nDCG, how many queries a comparison needs, the bias of incomplete judgments, and why retrieval recall caps answer quality. Afterwards you should be able to size a vector index, choose its parameters from a recall target, and prove that a retrieval change helped.

Lessons

  1. 11.aEmbeddings and ANN searchHow does vector search find neighbors among millions of embeddings, and what do you give up for speed?18 min
  2. 11.bChunking and hybrid searchHow should documents be cut into chunks, and how do keyword search, vector search, fusion, and reranking fit together?17 min
  3. 11.cEvaluating retrievalHow do you prove that a retrieval change made answers better, not just different?15 min