Visualizers

Learn by moving things

Interactive explainers for the ideas behind retrieval, embeddings, and agents. A formula tells you what is true; dragging a vector shows you why. Each one also appears inside the article it belongs to, and runs entirely in your browser, so drag, poke, and break it.

Portrait of Sachin Gupta rendered in binary

Cutting a document every N words ignores meaning: sentences get split across chunk boundaries and a heading is glued to the first sentence. Trivial to implement, but the cuts fall wherever the counter lands.

Fixed-size: cut every N words, ignore meaninginteractive
document: Section 3: Returns. A defective laptop may be returned within 30 days. After 30 days, no returns are accepted.
Section 3: Returns. A defective laptop may be returned within 30 days. After 30 days, no returns are accepted.

One clean document, before any cutting.

Structure-aware chunking

From: How RAG Reads a Corpus

Cutting on the document's own seams (headings, paragraphs, sentences) keeps each chunk a whole, coherent unit, so a fact is never split across a boundary and the heading stands on its own.

Structure-aware: cut on the seams, keep whole thoughtsinteractive
document: Section 3: Returns. A defective laptop may be returned within 30 days. After 30 days, no returns are accepted.
Section 3: Returns. A defective laptop may be returned within 30 days. After 30 days, no returns are accepted.

The same document, before any cutting.

Naive chunking cuts first and embeds each scrap blind to the rest. Late chunking flips the order: embed the whole document first, so every chunk's vector is informed by the full page, then cut and pool. The chunk keeps the context naive chunking throws away.

Late chunking: read the whole page, then cutinteractive
naive chunkingorder of operations:
1. cut into chunks2. then embed each chunk, blind
the vector for the chunk "the rate rose to 4 percent" ends up:
context lostwhich rate? which year? the scrap was embedded alone

Naive chunking cuts first and embeds each scrap on its own, so the chunk's vector never learns the context that surrounded it.

Visualizers — Sachin Gupta