AI at work · course 32 of 105
Which Chunk Comes Back? Embedding Search Maths
Do the maths under embedding search and RAG: dot product and cosine similarity, ranking documents for a query, scoring a search with precision@k, recall@k and MRR, and counting chunks.
Not on sale yet. When sales open: $4.99 USD for this course, paid once, or every course for $9.99 USD a month. Prices
$4.99 USD, paid once. Or every course for $9.99 USD a month until you cancel; try it free for 7 days first (email only, no card, ends on its own). Tax added at checkout where it applies.
Runs in Claude (claude.ai, the Claude apps or Claude Code) with your own Claude account. A course opens there as soon as your payment goes through; nothing is shipped.
Preview
What it teaches
The maths under embedding search and RAG (retrieval-augmented generation: an AI model looks up passages of your documents before it answers). What an embedding and a vector are; the dot product, vector length and cosine similarity (exactly, and to 3 decimals); ranking documents against a query by cosine and taking the top k; why the dot product and the cosine can rank differently (vector length) and what normalising does; then scoring a search with precision@k, recall@k, reciprocal rank and mean reciprocal rank (MRR), and counting how many chunks a text makes for a chunk size and an overlap. The AI asks 3 questions, places you, shows a short card per module, then gives you one question at a time.
Not a coding course, and it can’t judge your own search system or tell you which model, chunk size or k to use.
How long
40 items. About 25-35 rounds for a confident learner up to about 55-75 for a beginner, plus a 12-item final: 1-3 sessions (estimate, not timed with a real student). The tutor gives a one-line save code at the end of each session.
The modules
4 modules, drilled one item at a time.
- M0
The words
The words: embedding, dot product, length, cosine similarity, normalising, RAG, chunk and overlap, top-k
- M1
Vector maths: dot product, length, cosine similarity
Dot product, vector length and cosine similarity, exactly and to 3 decimals
- M2
Ranking: cosine, top-k, dot product vs cosine, normalising
Rank documents by cosine and take the top k; dot product against cosine; what normalising does
- M3
Retrieval scores and chunks: precision@k, recall@k, reciprocal rank, chunk counts
Precision@k, recall@k, reciprocal rank and MRR, and how many chunks a text makes
Before it teaches, it asks
- 1What are you building or hoping to build (search over documents, a chatbot over your own files, recommendations, nothing yet), and have you worked with embeddings before?
- 2What is the cosine similarity of a = (3, 4) and b = (4, 3)? Give it exactly (a fraction or a whole number).
- 3A search returns these documents, best first: D4, D9, D2, D7, D1, D6. The relevant documents (the ones that really answer the question) are D2, D4, D5 and D8. What is precision@3?
What’s exact, and what isn’t
Show
Straight from the course’s own notes.
- Words and rules (M0, and the quotes on every card)
- Quoted word for word from 12 pages read on 2026-10-13: Wikipedia (Cosine similarity, Dot product, Euclidean vector, Retrieval-augmented generation, Nearest neighbor search, Precision and recall, Evaluation measures (information retrieval), Mean reciprocal rank); Google’s Machine Learning Crash Course page on embedding space and Google’s Recommendation Systems course page on candidate generation (both say “Last updated 2025-08-25 UTC”); the scikit-learn 1.9.1 user guide (section 8.8); Microsoft Learn’s Azure AI Search “Text Split skill” page (last updated 2026-09-17). A script checks all 35 quotes word for word on saved copies of those pages and does not re-fetch the live pages, which may change. M0's answers are short answers built from those quotes, not word-for-word quotes. The short glosses in parentheses on the cards (for example “a vector here is a list of numbers”) are the course’s own plain words, not quotes.
- Computed by script
- Every M1, M2 and M3 key. M1 in exact whole numbers and fractions, with the 3-decimal keys rounded half up from 60-digit decimal arithmetic (the script refuses a value that sits near a rounding tie). M2 rankings compared as exact fractions, never as floating-point numbers; the vectors are chosen so every length is a whole number, every cosine is an exact fraction, and no two cosines are closer than 0.01. M3 scores in exact fractions. All 29 listed wrong answers are recomputed from the slip each one names and must differ from the key.
- The chunk-count rule is this course's own
- Chunk 1 is the first S words, each next chunk starts S - O words after the previous one starts, and the count stops at the first chunk that reaches the end of the text (written on the M3 card; a script counts by simulating it and by a formula, and the two must agree). It follows the idea of the Microsoft page’s overlap setting, but that tool counts characters or tokens, not words, and does its best to break on sentence boundaries, so a real tool’s count can differ (the card quotes the page on both).
- Honest limits
- The course drills the maths and the quoted definitions. It can’t tell whether a real search is good, which embedding model or chunk size or k suits your data, or what a real model’s vectors look like (real embeddings have far more than 3 numbers: the card quotes Google’s course on that). The vectors and document lists are made up. Cosine and dot product only; precision, recall, reciprocal rank and MRR only; chunks are counted in words. It isn’t connected to Google, Microsoft, Wikipedia or scikit-learn.
- Not in it yet
- Euclidean distance, approximate nearest-neighbour search, F1, NDCG and MAP, tokens and tokenizers, real text-splitting libraries, keyword-plus-vector (hybrid) search, re-ranking, and any code.