RAG, one block at a time

Give a model the right pages before it answers

RAG (retrieval-augmented generation) finds relevant text and hands it to the model along with your question, so the answer can rest on your documents rather than memory alone.

"Basic", "agentic", "graph", "LLM wiki": they all answer the same question in different ways. Which text does the model read, and who decides? This page has a real search engine you can break, so you can see the differences instead of memorizing them.

Try the live retriever ↓ Help me choose
1 · How basic RAG works

Five steps. Tap each one.

✋

First: do you need RAG at all?

Anthropic's guidance: if your knowledge base is under about 200,000 tokens (roughly 500 pages), you may be able to skip retrieval and put all of it in the prompt, using prompt caching to keep it fast and affordable. Source ↗

2 · The live retriever

Search a tiny company handbook, and watch it fail

This is real retrieval running in your browser. BM25 and Reciprocal Rank Fusion are computed live over 15 chunks from a made-up company, "Northwind". Pick a question, then switch methods. Rows marked Needed are the chunks a full answer requires.

1. Pick a question
2. Search method
3. How many chunks to send (top-k):
See the prompt the model would receive

What's real and what's a stand-in: BM25 and the rank fusion are the real algorithms. "Vector" uses a small hand-built table of word meanings, because real embedding models are too large to ship in one page. It imitates the idea of embeddings, but it's a teaching toy, not a measure of how real models perform. No LLM runs here, and the corpus is fictional.

3 · The RAG family

Eight approaches, and what each is for

They aren't strict rungs on a ladder, and most are combinable. Tap a block.

ApproachWhen the work happensWho picks what to readBest atMain cost
4 · Same question, different approach

Trace how each type would handle a hard question

Uses the same Northwind handbook. These traces are illustrative walkthroughs of how each design is meant to behave, not live LLM runs. Real results depend on your data and models.

QUESTION TYPE
APPROACH
5 · Pick one

Which approach should you start with?

A few questions. The advice is deliberately conservative: start simple, measure, and add complexity only when a failure calls for it. This is our own rule of thumb, not an official standard.

6 · Build it

Step-by-step tutorials

Start with A. The Python in A, B, and C uses only the standard library, and we ran it before publishing. D and E follow each project's own docs. Ticked steps are saved in this browser.

7 · Gotchas

Where RAG projects actually go wrong

8 · Check yourself

Which approach fits?

Sources

Numbers are the figures those authors reported on their own data. Your results will differ. Checked November 2026.