real-embeddings -- a trained model's semantic geometry

The default path turns each word you type into a row of numbers and draws how close every pair of rows is. Load the optional trained model, about 23 MB, with nothing sent anywhere, or stay on the labelled synthetic stand-in. When that trained model is loaded, nearby words land near each other because of the training. A nested toggle draws a different set of vectors built so the leading prefix is the coarse part: the prefix keeps a distinction that lives inside the cut and fails to separate a pair that differs only past the cut, while the full vector separates that pair. Those nested vectors are constructed for this demo. They are not a truncation of the loaded model.

Interactive page: the real counterpart to embedding/. The synthetic page shows the mechanism (a token id is a row lookup in a seeded table E[V×D]); this page shows the numbers are real by fetching a small trained sentence-embedding model and running it in your browser on the words you type. Anchor: A1 token embedding (same attribute as the synthetic sibling). One of the real-model grounding pages: it runs a real trained model instead of synthetic weights.

What it shows

You type a list of words. Each becomes a unit vector from all-MiniLM-L6-v2 (≈23 MB, 384-dim, mean-pooled + L2-normalized). Two views of the same real numbers:

The point of the real-model pages: the synthetic pages run real math on synthetic weights; here both the math and the weights are real.

Real model, fetched at runtime (no build, no committed weights)

The model is loaded via [transformers.js] as a CDN ES module and cached by the browser — same no-build ethos as every other page, and nothing heavy enters git (weights are fetched at runtime, never committed). The page does NOT auto-download (large-model consent rule): it opens on the synthetic stand-in and fetches the real model only when you click "load real model" (or pass ?autoload=1). A banner shows the state: downloading… NN% → running… → ● real model.

Before you load (or offline / no network): the page renders a clearly- labelled synthetic stand-in (the default clusters are hand-seeded so it still teaches) and swaps in the real vectors once you load the model.

[transformers.js]: https://github.com/huggingface/transformers.js

Render tier

T1 (Canvas2D — similarity heatmap + scatter). The "compute" tier is the real model running under WASM/WebGPU inside transformers.js.

Wiring

layout.mount + controls.text('words') (free input) + two action buttons (re-embed, load real model), drawn with render.heatmap/grid + ctx. The real run is async and never throws into mount — failures degrade to the synthetic stand-in. Two challenges (?ch=N): switch to the real model, type a tight single-theme cluster (min pairwise cosine ≥ 0.30). The nested prefix picture is constructed and does not count. Headless hooks: ?words=a,b,c (override the list), ?real=0 (suppress the download — fast deterministic synthetic capture), ?hover=x,y (fake cursor for the tooltip). Source: page.js.