Free concept playground · no account

RAG Sandbox

See why that chunk got retrieved, in 2D space.

RAG Sandbox

AvailableFree

One query, eight document chunks laid out in a 2D semantic space. The sandbox retrieves the top-K nearest chunks and shows why each one was picked — and whether the chunk that actually answers the question survived the cut.

QueryHow long is the refund window?
12345678
  1. #1Returns are accepted only for items in their original, unopened packaging.1.414context
  2. #2Refunds are credited back to your original payment method automatically.2.000context
  3. #3You can request a refund within 30 days of the delivery date.3.000answer
  4. #4Standard shipping usually takes 5 to 7 business days after dispatch.4.000skipped
  5. #5Create a free account to track every order from one dashboard.5.000skipped
  6. #6Our support team is available Monday to Friday, 9am to 6pm.6.000skipped
  7. #7Download the mobile app from the App Store or Google Play.7.000skipped
  8. #8Enterprise plans include a dedicated account manager and SLA.8.000skipped

Answer retrieved — it sits at rank 3, inside your top-3 cut.

Why that chunk got retrieveda distance, not an understanding

Retrieval never “reads” anything. Each chunk is a point; the query is a point; the engine simply keeps the 3 chunks whose straight-line distance to the query is smallest. That’s the whole mechanism — nearest neighbours in space, not comprehension.

The chunk that truly answers “How long is the refund window?” is rank 3 2 keyword-similar decoys (returns policy, refund method) sit closer to the query than the real answer does. Nearest is not the same as correct.

At top-3 the answer just makes the cut. Tighten K below 3 and it vanishes — that is a retrieval miss no bigger model can fix.

Was this playground useful?

RAG Sandbox

Ask one question, watch eight document chunks light up in a 2D semantic space, and see exactly why each retrieved chunk got picked. Instead of a black-box "the AI found the answer," the sandbox ranks every chunk by its distance to the query, marks your top-K as retrieved, and reveals whether the chunk that actually answers the question survived the cut — or lost to a keyword-similar decoy sitting closer in space. Retrieval stops being a metaphor and becomes a picture you can read. Runs entirely in your browser (0 uploads, works offline).

How to use it

  1. Read the fixed query at the top — the sandbox is asking "How long is the refund window?" against a small seeded corpus.
  2. Drag the top-K slider (or hit a preset — Top-1, Top-3, Top-5) to change how many nearest chunks retrieval keeps.
  3. Watch the 2D plot: the query is the crosshair, each chunk is a numbered dot, and the lines show which chunks were retrieved. Green is the true answer; red means it was missed.
  4. Scan the ranked list to see every chunk's distance, and read the verdict to learn whether your K reached the answer.
  5. Open the X-ray to see the mechanism — nearest neighbours in space, not comprehension — and copy the result to explain RAG to a teammate.

What this clears up (the fundamentals)

  • Retrieval is distance, not understanding — a chunk is "relevant" only because its point is near the query's point. No reading, no reasoning; just nearest neighbours in an embedding space.
  • Nearest is not the same as correct — two decoys that merely share keywords ("returns policy", "refund method") sit closer than the chunk with the real 30-day answer. Semantic similarity is fuzzy, and it ranks distractors ahead of truth.
  • Top-K is a hard cliff — the answer lives at a fixed rank; set K below it and the model never sees the answer at all. That is a retrieval miss, and no bigger or smarter model can fix what was never handed to it.
  • Grounding starts before generation — the quality of an AI answer is capped by what retrieval selects. Chunking, embeddings, K, and reranking decide the ceiling; the model just writes under it.

Where it's used

A top-of-funnel AI-engineering check — the fastest way to feel why a RAG system quotes the wrong passage even with a great model. It's a miatz build-lab concept playable: play the seeded version here, then learn to build the real thing — embeddings, a vector store, hybrid search, reranking, and a citation-truth overlay — inside the AIE-202 retrieval module.

FAQ

What is RAG, in one line?

Retrieval-Augmented Generation: before the model answers, a retriever fetches the most relevant chunks from your documents and pastes them into the prompt, so the answer is grounded in your data instead of the model's memory.

Why does the true answer rank behind the decoys here?

Because embedding similarity measures surface closeness, not truth. The decoys share the words "returns" and "refund," which pulls their points near the query even though they don't answer "how long is the window." This is the single most common RAG failure, and the plot makes it literal.

What does top-K actually control?

How many of the nearest chunks retrieval hands to the model. Small K is precise but risks dropping the answer; large K catches more but floods the prompt with noise (and can trigger lost-in-the-middle). The slider lets you watch that trade-off in real time.

Are these real embeddings from a live model?

No. The coordinates are precomputed and hand-placed so the lesson is crisp and identical every time — a seeded teaching model, not a live vector database. The distances and ranking are computed exactly, deterministically, on your device.

Is anything uploaded?

No. The query, the chunks, and every distance are computed entirely in your browser — nothing is transmitted, stored, or logged. Turn off your Wi-Fi and it still works.

Limits

This is a seeded demo: one fixed query, eight fixed chunks, and precomputed 2D coordinates chosen to teach why nearest ≠ correct — not a live retrieval engine. Real embeddings live in hundreds of dimensions (projected down for plots), and real retrieval adds hybrid keyword+vector scoring, rerankers, and citation grounding. Feeding your own documents through a live embedding model with a BYOK key is a separate future mode; here the mechanism is the same, but the numbers are baked in so the lesson never changes.

Related

Part of the Demystify Playgrounds. Explore the rest from the Playgrounds home.

Bookmark this page (Ctrl+D, or ⌘D on Mac) — it works offline the next time you need it.

Ninety playgrounds. Zero setup.

Every concept here is playable free, no account — and inside the program you learn to rebuild the machinery yourself.