01Chapter 1: Why keyword search falls short: matching words versus matching meaningKeyword search finds documents that contain the words you typed. Semantic search finds documents that mean what you meant. This chapter shows where the first approach breaks, why patching it only goes so far, and what the second approach has to do differently. The rest of the tutorial builds that se6 min read
02Chapter 2: What an embedding is: text as a point in vector spaceThis chapter explains what a text embedding is and why distance between embeddings tracks similarity in meaning. It assumes you know basic Python, can read NumPy code, and know what a vector, a dot product, and a vector length are. It also assumes you have a general idea of what a neural network doe7 min read
03Chapter 3: Measuring closeness: cosine similarity, dot product, and Euclidean distanceThis chapter assumes you know basic Python and NumPy, the dot product and vector length, and that an embedding is a vector that represents a text. You will learn the three standard ways to score how close two embeddings are, how they relate, and which one to pick.6 min read
04Chapter 4: Where embeddings come from: transformer encoders, pooling, and contrastive trainingThis chapter explains how a model turns a sentence into one fixed-size vector. It assumes you know basic Python, what a neural network does in general, and how dot products and vector lengths work. You do not need to know transformer internals in detail. The chapter gives the working model you need 7 min read
05Chapter 5: Generating embeddings with a pretrained modelThis chapter assumes you know basic Python, can read NumPy arrays, and understand dot products and vector length. You should also know roughly what an embedding is and how cosine similarity compares two vectors. Here you will turn real text into vectors with a pretrained model. You will also learn w5 min read
06Chapter 6: The semantic search pipeline: embed, index, query, rankEarlier chapters covered what embeddings are, how similarity is measured, and how to generate vectors with a pretrained model. This chapter connects those pieces into one working system. It assumes you can read basic Python and NumPy, know what a dot product and a vector norm are, and have seen `Sen7 min read
07Chapter 7: Exact top-k search with matrix operationsThis chapter assumes you can write basic Python and NumPy, and that you know the dot product and vector length. It also assumes you have met cosine similarity and can produce embeddings with a model such as all-MiniLM-L6-v2. The chapter turns "find the most similar documents" into a few NumPy oper5 min read
08Chapter 8: Chunking long documents for embeddingAn embedding model turns a piece of text into one vector. A long document is a poor fit for that. This chapter explains why, and how to split documents into chunks that embed well and retrieve well. It assumes you can run the earlier examples: you know how to call model.encode, you know what a uni6 min read
09Chapter 9: Scaling up: approximate nearest-neighbor search (IVF, HNSW)This chapter assumes you can write basic Python and NumPy, and that you have built the exact top-k search from the earlier chapter, where one matrix-vector product scores every document. Here you will see why that approach stops working at scale. You will also learn how the two most common approxima6 min read
10Chapter 10: Vector databases and libraries: what they add beyond an indexThis chapter assumes you can write basic Python and know what an embedding is. It also assumes you have seen an exact search over a matrix of vectors and have met the idea of an approximate nearest-neighbor (ANN) index such as HNSW. Here you will see what a vector database adds on top of an index, a6 min read
11Chapter 11: Hybrid search: combining BM25 and vector resultsThis chapter assumes you can read basic Python and NumPy. It also assumes you know how to embed text and rank documents by cosine similarity, as shown in the earlier chapters on the semantic search pipeline and exact top-k search. You should know what keyword search does. You don't need to know how 6 min read
12Chapter 12: Improving precision with cross-encoder rerankingThis chapter assumes you can run the bi-encoder search from earlier chapters (embed documents, take a matrix product, sort for the top k). It also assumes you know what hybrid search returns: a ranked list of candidate documents. Here you add a second, slower scoring stage that reorders those candid6 min read
13Chapter 13: Measuring retrieval quality: recall@k, MRR, and nDCGThis chapter assumes you can run the search code from the earlier chapters, meaning you can embed documents and queries and get a ranked list back. You also need basic Python and comfort with averages and logarithms. It covers how to tell whether that ranked list is any good, and how to compare two 7 min read
15Chapter 15: Using retrieval in applications: RAG, clustering, deduplication, recommendationsThis chapter assumes you can already embed text with a pretrained model, compute cosine similarity with a matrix product, and chunk documents. Here you apply those pieces to four common jobs: answering questions with a language model, grouping texts, removing near-duplicates, and recommending items.5 min read