Skip to content

RAG ​

Retrieval-augmented generation is the most common enterprise LLM pattern. Three chapters: the decision, the pipeline in, and the pipeline out. Measuring it lives in Production/01, next to every other eval.

The common thread is that most "the model gave a wrong answer" bugs are not model bugs. The right passage was never retrieved, or was ranked eleventh, or was cut in half by a chunker that counted characters. Until retrieval is measured, every fix is a guess.

Chapters ​

#ChapterWhat it answers
01When RAG, When Fine-Tune, When NeitherWhich problem does each solve, and why do teams pick wrong?
02Ingestion and ChunkingHow do you split a document without destroying its meaning?
03Embeddings, Vector Stores and RetrievalWhat is a vector, is pgvector enough, and where does reranking earn its latency?

The Running Project ​

The documentation assistant arrives here streaming answers over a keyword query. This section replaces that search.

ChapterWhat it adds to the assistant
01The decision out loud: the docs change weekly, so the facts belong in a store, not in weights
02Chunking by heading, with the page, heading path and updated date on every chunk
03Embeddings in pgvector, the re-embed job, and hybrid retrieval with a rerank at k = 5

By the end of this section retrieval works but nothing measures it. Production/01 builds that first.

What Interviewers Probe For ​

  • "The assistant answered wrongly. Where do you look first?" At what was retrieved. Print the chunks that went into the window before touching the prompt. Most candidates skip this.
  • "Why not fine-tune instead?" Fine-tuning teaches form and behaviour; retrieval supplies facts. Facts that change weekly belong in a store.
  • "How big should a chunk be?" A trap unless you answer with a method: measure recall on a golden set (fixed questions with known right passages), with recall@5 as the number.

Reading Order ​

Read 01 first. It stops you building a pipeline for a problem that did not need one. Then 02 → 03, the pipeline in build order. Then Production/01.

Interview sprint: 01, then the retrieval half of Production/01.

The whole book, free to read. Generated from the manuscript on every change.

Your progress

Tick each chapter in the sidebar once you have read and understood it. Your name and email keep the ticks on any device.

Your name and email are stored to save your progress. Nothing else is done with them.