Retrieval track  ·  Lessons 01 & 02

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.

~35 min
the short way
5
interactive playgrounds
8
runnable demos
<$0.01
to build it yourself

Behind this: an embedding space. Every few seconds one point becomes a query and reaches for its nearest neighbours — which is all retrieval is.

The shape of the thing

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.

Pipeline 01  ·  INGESTION  ·  runs once
Sourcedocuments
→
Chunkingcut to size
→
Embeddingmodel
→
Vectorslists of numbers
→
Vectordatabase
Pipeline 02  ·  RETRIEVAL  ·  runs per question
Userquestion
→
Embeddingmodel
→
Retrieverranks by closeness
→
Top chunksplain text
→
LLM writesthe answer

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.

Outcomes

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.
Honesty

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.

Work along

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.

Get the source →

# 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