You give us a cultural work. We turn it into a vector. We find a short, signed combination of more famous works whose vectors sum to roughly the same place. The result reads like an equation, e.g.
The Wire ≈ Breaking Bad + The Sopranos − Game of Thrones
Everything runs in your browser. No server, no API key.
Five stages:
basis.js (movies, books, TV, games, comics, manga, albums, musicals, franchises).basis.js changes, downloads the embedding model on the runner, turns each title into a 384-dimensional unit vector, and commits the result back as basis.bin (raw Float32 matrix) and basis.json (titles + metadata).Float32Array. No model needed yet.If the prebuilt artifacts are missing (e.g. during local development), the browser falls back to embedding the basis itself and caching the result in IndexedDB.
We use Xenova/all-MiniLM-L6-v2 via transformers.js. It's a sentence-transformer trained to map similar phrases to nearby points on the unit sphere.
The model loads from jsDelivr's ESM CDN and runs entirely in WASM/WebGPU. The basis matrix is fetched once over HTTP and parsed straight into a Float32Array; the browser caches both via standard HTTP cache headers. Nothing leaves your device — your query is embedded locally and the dot products run in plain JS.
The dictionary is hand-picked for name recognition rather than orthogonality. Roughly:
The bias is intentional: the goal is decompositions that read well. "Severance ≈ Black Mirror + The Office" is funnier and more useful than the same answer with three obscure short stories you've never heard of.
Given a query vector q and a dictionary of N unit-norm basis vectors b₁ … b_N, we run matching pursuit: a classic greedy sparse-coding algorithm.
# initial residual is the query itself r ← q chosen ← [] # up to 4 iterations for step in 1..K: # find the basis vector most aligned with the residual i* ← argmax_i |⟨r, b_i⟩| c ← ⟨r, b_i*⟩ # signed coefficient # subtract its contribution from the residual r ← r − c · b_i* chosen.append((i*, c)) # block near-duplicates so we don't pick "Star Wars" twice block all j where ⟨b_i*, b_j⟩ > 0.85
Three small twists make the output readable:
b_i, every other basis vector closer than 0.85 to it is also blocked, preventing redundant terms like "The Avengers" plus "Avengers: Endgame".|⟨r, b_i⟩| falls below 0.12. Some queries decompose cleanly in 2 terms; others need 4.Terms are sorted by absolute coefficient (strongest contributor first). A + means the basis vector points in the same direction as the residual at that step; a − means it points opposite.
Hover any term to see its category and exact coefficient. Click a term to decompose that work next.
The fit % reports how close the reconstructed vector Σ cᵢ · b_i is to your query, in cosine similarity. 100% would mean a perfect linear combination; in practice 60–85% is typical and makes for the best-reading equations.
Subtraction is the model saying: "your title is a lot like X but minus the Y-ness of it." Useful negatives often capture genre or tone differences — e.g. a slow horror film might come out as The Shining minus Psycho (slow horror ≈ canonical horror minus jump-scare snappiness).
Cultural recommendation engines tend to give you nearest neighbors: "if you liked X, try Y." This is the inverse — given the work, can you describe it as a sentence in the language of things everyone already knows? The output is closer to a critic's opening line than a recommendation.
It's also a quick test of an underappreciated property of embedding spaces: they're approximately additive over short distances. Pop culture happens to have enough mass and structure that you can do meaningful arithmetic on it.