01Chapter 1: Why models need outside knowledgeThis chapter assumes you can read basic Python and have prompted a large language model (LLM) through an API. You should also be comfortable with JSON. Later chapters use vectors and the dot product, but this one does not.2 min read
02Chapter 2: The RAG pipeline at a glanceThis chapter assumes you know basic Python, how LLMs are prompted, what a vector and a dot product are, and how to read JSON from an API. It gives you the working model of a retrieval-augmented generation (RAG) system. Later chapters cover each stage in detail.2 min read
03Chapter 3: RAG, fine-tuning, and long context: choosing between themThis chapter assumes you know how an LLM is prompted, have read the pipeline overview, and understand that a model has a fixed knowledge cutoff and a limited context window. Here you will compare three ways to give a model knowledge it lacks and learn how to pick one.2 min read
04Chapter 4: Loading and cleaning source documentsThis chapter covers the first stage of a RAG pipeline: getting raw files into clean text. It assumes you know basic Python, can read JSON, and have the pipeline overview from the earlier chapter. Everything downstream (chunking, embeddings, retrieval) can only be as good as the text you produce here2 min read
05Chapter 5: Splitting documents into chunksThis chapter assumes you know basic Python and have a cleaned document from the ingestion step. Chunking is the step that turns that document into the units your RAG system will embed, retrieve, and show to the model.3 min read
06Chapter 6: Turning text into embeddingsThis chapter assumes you know basic Python, can read vectors and the dot product, and have a rough idea of how chunks are produced (covered in the previous chapter). It explains what an embedding is, how a RAG system uses one, and the errors that most often break retrieval.2 min read
07Chapter 7: Measuring similarity and finding nearest neighborsThis chapter assumes you know basic Python, vectors, and the dot product, and that you have seen how text becomes an embedding. Here you will learn how to compare a query embedding with stored chunk embeddings and pick the closest ones.2 min read
08Chapter 8: Vector indexes and approximate nearest neighbor searchThis chapter assumes you can read basic Python, know what an embedding is, and understand cosine similarity from the previous chapter. It explains why brute-force search stops scaling and how an index trades a little accuracy for a lot of speed.2 min read
09Chapter 9: Retrieving the top-k passagesThis chapter assumes you can read basic Python, know what an embedding vector is, and understand cosine similarity as a normalized dot product. Retrieval is the step that turns a user question into a short list of passages for the prompt.2 min read
10Chapter 10: Combining keyword and vector searchThis chapter assumes you can read basic Python and know that an embedding is a vector, and that vector search ranks passages by similarity. You should also know how top-k retrieval works from the previous chapters.2 min read
11Chapter 11: Reranking retrieved passagesThis chapter assumes you can write basic Python, know how top-k retrieval and reciprocal rank fusion work, and understand that embeddings turn text into vectors. It covers a second ranking pass that reorders the passages your first retrieval step returns.2 min read
12Chapter 12: Rewriting and expanding queriesThis chapter assumes you can already run top-k retrieval and know reciprocal rank fusion from the hybrid search chapter. It also assumes you can call an LLM from Python.2 min read
13Chapter 13: Building the augmented promptThis chapter covers the step after retrieval: turning the top-k passages into a prompt the model can use. It assumes you can write basic Python, know how LLMs are prompted, and already have a retriever that returns a ranked list of passage strings.2 min read
14Chapter 14: Generating grounded answers with citationsThis chapter assumes you can write basic Python, have prompted an LLM before, and have already built a retriever that returns the top-k passages for a question. Here you turn those passages into an answer that the reader can check.2 min read
15Chapter 15: Evaluating a RAG systemThis chapter assumes you can read basic Python, know how a RAG pipeline retrieves passages and builds a prompt, and are comfortable with the idea of top-k retrieval. It shows how to measure the two halves of the pipeline separately.2 min read
16Chapter 16: Diagnosing common failuresThis chapter assumes you have built a basic RAG pipeline: chunking, embeddings, top-k retrieval, and a grounded prompt. It also assumes you know the recall_at_k metric from the evaluation chapter. Here you will learn to locate which stage failed when an answer is wrong.1 min read
17Chapter 17: Running RAG in productionThis chapter covers what changes when a RAG system moves from a notebook to real users. It assumes you have read the earlier chapters on ingestion, retrieval, prompt assembly, and evaluation. It also assumes you know basic Python and how to call APIs.3 min read