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

Retrieve then rerank

From: Rerankers →

First-stage retrieval ranks by a cheap score; a cross-encoder reranker rereads each result against the query and reorders. Press Rerank and watch an on-topic but keyword-poor result jump to the top.

Query: “how do I cancel my subscription?”
First-stage retrieval (fast, crude)cheap score
  1. 1Subscription pricing and plans0.88
  2. 2Cancel your subscription0.82
  3. 3Subscription terms of service0.79
  4. 4Pause your subscription temporarily0.60
  5. 5How to update your payment method0.55
  6. 6End your membership and stop billing0.41
First-stage ranks by a cheap score, so “Subscription pricing” tops the list on keyword overlap alone. Press Rerank to score each result against the query with a cross-encoder.

Inverted index & boolean retrieval

From: How Search Works →

The data structure under almost every search engine: term → the documents that contain it. Toggle query terms and switch AND/OR to watch it resolve a query into a candidate set.

Query — click terms
Inverted index → postings
  • fox→d0d2d4
  • fast→d0d1d3
Documents1 match
  • d0fast red fox
  • d1red fast car
  • d2quiet fox den
  • d3red fast engine
  • d4blue fox tail
AND keeps documents in every selected term's list (intersection).

The default text-ranking function. Tune term frequency, document length, term rarity, and the k1/b knobs, and watch the score and its saturation curve respond.

BM25 term score
3.61
IDF 2.30 · ceiling 5.06
Score vs term frequency

Dashed line = the ceiling more frequency can never beat.

More of a term helps with diminishing returns (k1). Longer documents are penalized (b). Rarer terms (low rarity count) score higher (IDF).
Visualizers — Sachin Gupta