RAG, built in
front of you.
How to give a language model access to a hundred thousand documents without ever putting a hundred thousand documents in the prompt. Every number on screen is real output — nothing here is an illustration.
Behind this: an embedding space. Every few seconds one point becomes a query and reaches for its nearest neighbours — which is all retrieval is.
Three ways in
Three lengths, each in two modes: talk-only, where the output is on screen and gets explained, or work-along, where you run it. Same slides, same output, same rigour. The essentials edition is not a summary — it is the whole argument with the prose written tight.
The lesson →
Every slide as a document, with what the presenter says underneath and the playgrounds where they belong. Reads properly on a phone.
essentials · 32 slides · ~35 min
short · 40 slides · ~42 min
full · 55 slides · ~91 min
Five playgrounds →
Move the sliders, ask a question, break the system on purpose. Runs in your browser with no API key and nothing to install.
Teach it · slides + notesPresent or record →
Full-screen deck, a speaker window with narration and a timer, and a cue sheet of every demo in order — one per edition.
A RAG system is two pipelines
Not one. People collapse them in their heads, and that is exactly where the mental model breaks. Ingestion runs once, ahead of time. Retrieval runs on every question.
The same embedding model appears in both rows. That is not a drawing shortcut — and the last playground breaks it on purpose to show you why.
Five things you can take apart
Each one takes a single idea from the lesson and lets you push on it until it breaks.
When do you need RAG?
Drag from one megabyte to one petabyte and watch the cost, the token count, and the number of context windows you would need.
Playground 02 · real vectorsThe neighbourhood map
Click any word. Watch twelve real embeddings re-rank themselves by meaning — and see the clusters nobody labelled.
Playground 03Watch the chunks re-cut
Drag chunk_size and chunk_overlap and see the seams move,
the duplication climb, and sentences get cut in half.
Ask, and watch the prompt build
Type a question, move top k, and read the exact prompt that would reach the model. Then ask something the documents cannot answer and watch the score collapse.
Playground 05 · real vectorsBreak it on purpose
Flip the model that embeds the question. Same store, same question — and retrieval quietly falls apart with zero errors raised.
What you will be able to do
- Explain why a bigger context window does not remove the need for RAG.
- Define token, chunk, embedding, dimension, vector database and retriever.
- Draw both halves of a RAG system from memory.
- Predict which chunks a retriever will return, and say why.
- Build a working ingestion pipeline in about sixty lines of Python.
- Avoid the mistake that silently breaks most first RAG builds.
Where the numbers come from
Every terminal block in the lesson is pasted from a real run. Where reality disagreed with the source material, the lesson says so:
- The tokenizer gives 7 tokens for a sentence the source calls 9.
- This corpus yields 547 chunks, not 797 — article lengths differ.
- Real embeddings put dog closest to cat, not kitten. The demo explains why.
Three playgrounds run on real precomputed OpenAI vectors. Only a question you type yourself falls back to a rough local measure — embedding it needs an API call — and the panel says which you are looking at rather than implying otherwise.
Build it on your own machine
The whole thing is a repo. One entry point, eight demos, and the finished sixty-line pipeline. Costs well under a cent in embeddings.
# clone it, then:
./run.sh setup # venv, packages, documents
./run.sh check # preflight, tests your API key
./run.sh slides # this deck, locally
./run.sh demo 5 # chunking, in the terminal
./run.sh demo all # all eight, in order