RE
RAG Explainer Chunking — Baguette Slicer
[02/08] Chunking — Baguette Slicer

Cut the baguette — find the garlic slice

A 50-page policy is too long for AI. We cut it into slices (chunks). Drag the sliders — every number on this page updates instantly.

How it works

  1. Slice the long text into chunks (drag the sliders below).
  2. Overlap keeps an answer that sits at a cut from being lost.
  3. Smaller slices = precise but fragmented; bigger = complete but diluted.
Your question (fixed for this demo)
“Which hospitals are covered in this policy?”
We rank every slice by cosine similarity — simply a 0–100% similarity score between meanings — to this question. Highest score = slice that would be sent to the AI.

Slice the document

Drag the sliders below. The baguette shows each slice’s character range and the ↩shared overlap at every cut.

How long every slice is. Watch the ranges printed on the baguette and the black-ringed Best slice below. Try 180 → “St. Jude’s” gets cut in half; 800 → legal fluff lands in the same slice.
Overlap does not change slice length — slices stay as long as Chunk size. It starts each next slice a bit earlier, so the text at a cut is read twice (the ↩ badge) and nothing is lost. Step = size − overlap.
Source text — 50-page excerpt (tap to edit)

You can edit this — try pasting a clause and see how slicing changes.

Your slices — tap any

Black = best for your question — at the Search step this is what the AI receives. Gray = others. Score = cosine similarity.

Highlighted text = shared with the neighbouring slice — it is read twice.

0 chunks • ~0 ms

What Search will retrieve

Nothing is sent to the AI yet — this is a preview. At the Search step, the highest-scoring slice (like the one below) is what gets sent.

Move sliders to see the best slice.
Why this one is highlighted

We compute cosine(slice, question) for every slice — highest wins. Move Chunk size and watch the winner change; move Overlap to see a cut sentence survive in the next slice.

For builders

Real pipeline: 500 chars + 50 overlap, 768-D embeddings. Overlap prevents boundary loss; step = size − overlap.

Next: Embeddings — fingerprints

Slices become Meaning Fingerprints next — see them as a map in Embeddings [03/08] →