Retrieval Basics (RAG)
Give a model the right pages of your own data: keyword search, vector search, chunking, a working pipeline, numbered citations and honest refusals.
A model knows only what it read during training. It has never seen your price list, your policies or yesterday's incident report, and it will still answer questions about them in a confident voice. Retrieval-augmented generation (RAG) fixes this in the simplest possible way: before the model answers, your program looks up the few pages that matter and puts them in the prompt. The model then answers from those pages instead of from memory.
This phase builds retrieval by hand on a tiny shop: eight short documents from a made-up bike shop called Nimbus Bikes. You will write an inverted index and TF-IDF scoring, a fake embedder (a small deterministic stand-in that makes the maths visible, not a real learned model), cosine similarity with top-k and tie-breakers, a chunker, a full ingest-retrieve-prompt-answer pipeline, a citation checker and a rule that refuses to answer without evidence. Every example runs in Python, Java and JavaScript and prints the same numbers, small enough to check with a pencil.
Real embedding models and vector databases appear as short, clearly marked sections (Topics 8.3 and 8.7), and two real-model labs show a model citing a source and refusing when the answer is not there. The coming RAG course goes much deeper on production retrieval: hybrid search, re-ranking, evaluation of retrieval and scale.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.