02Chapter 2: Why the user's question is often a poor search queryThis chapter assumes you have built a basic RAG pipeline (index, retrieve, generate). It also assumes you know how embedding search and BM25 keyword search rank documents, and that you can read Python.3 min read
03Chapter 3: Query rewriting: the core idea and where it sits in the pipelineThis chapter assumes you have built a basic RAG pipeline (index, retrieve, generate). It also assumes you know what embeddings and BM25 keyword search do, and that you can call an LLM with a text prompt. Examples are in Python.2 min read
05Chapter 5: Multi-query expansion: searching with several phrasingsThis chapter assumes you have a working RAG pipeline (index, retrieve, generate), know what embeddings and BM25 search do, can call a language model with a text prompt, and can read Python. Multi-query expansion is one of the rewriting techniques from the previous chapters. It leads into rank fusion3 min read
06Chapter 6: Merging ranked lists with reciprocal rank fusionThis chapter assumes you know how a basic RAG pipeline works, how vector and BM25 search return ranked results, and how to read Python. You will learn how to merge several ranked lists into one, which you need after multi-query expansion.3 min read
07Chapter 7: HyDE: searching with a hypothetical answerThis chapter assumes you know how a basic RAG pipeline works, how embedding search ranks passages, and how to call an LLM with a prompt. It also assumes you can read Python.3 min read
08Chapter 8: Step-back queries for broader contextThis chapter assumes you have a working RAG pipeline (index, retrieve, generate), know how embedding or BM25 search returns a ranked list, and can call an LLM with a text prompt. You should also be able to read Python.3 min read
09Chapter 9: Decomposing complex questions into sub-questionsThis chapter assumes you know how a basic RAG pipeline works (index, retrieve, generate), how embedding or BM25 search returns a top-k list, and how to call an LLM with a text prompt. The code is Python.2 min read
10Chapter 10: Multi-step retrieval: using earlier results to shape later queriesThis chapter assumes you can run a basic RAG pipeline, know how vector or BM25 search returns a ranked list, and can read Python. It also assumes you have seen query decomposition and reciprocal rank fusion (RRF) in earlier chapters.2 min read
11Chapter 11: Building an iterative retrieval loop with a stopping ruleThis chapter assumes you know the basic RAG pipeline (index, retrieve, generate), can call an LLM with a text prompt, and can read Python. It builds on multi-step retrieval, where earlier results shape later queries.3 min read
12Chapter 12: Routing queries to strategies, or skipping retrievalThis chapter assumes you have read the earlier chapters on multi-query expansion, decomposition and the iterative retrieval loop. You should be comfortable reading Python and calling an LLM with a text prompt.2 min read
13Chapter 13: Measuring whether rewriting helpsThis chapter assumes you can run a retrieval function that returns ranked document ids. It also assumes you have a few questions with known relevant documents, and that you know the rewriting techniques from earlier chapters. Rewriting adds model calls, so you should keep a technique only if the mea2 min read
14Chapter 14: Cost, latency and query driftThis chapter assumes you have read the earlier chapters and can call an LLM, run vector or BM25 search, and read Python. You have seen the rewriting techniques. Each one adds cost and can also make results worse. This chapter shows how to measure both problems and limit them.3 min read