An interactive playground for understanding how machines turn words into numbers — and why those numbers capture meaning.
Computers can't reason about the word "cat" directly — they only understand numbers. So we convert each word (or sentence, image, product, song…) into a fixed-length list of numbers called a vector. The trick is: we train the conversion so that things with similar meaning end up with similar numbers.
Old-school search matches keywords: if your query doesn't contain the exact word, you miss relevant results. Embeddings match meaning.
✓ "how to fix a flat tire"
✗ "my bike has a puncture, help"
✗ "deflated wheel repair guide"
The words don't overlap, so the results are missed — even though they're obviously the same topic.
✓ "how to fix a flat tire"
✓ "my bike has a puncture, help"
✓ "deflated wheel repair guide"
All three vectors land in roughly the same region of vector space, so they all score as highly similar to the query.
Real embeddings have hundreds of dimensions, which is impossible to visualize. But the same principle holds in 2D. Below is a hand-placed toy embedding of 30 everyday words. Click any word — its 3 nearest neighbors will light up.
How do we numerically compare two vectors? We look at the angle between them. Two vectors pointing in the same direction are similar; pointing opposite ways means opposite meaning; perpendicular means unrelated.
The result ranges from −1 (opposite) to 0 (unrelated) to +1 (identical direction). Drag the red and blue arrow tips below to see how the angle changes the similarity.
Everything above was toy data. Now let's use a real model:
all-MiniLM-L6-v2 — it converts any sentence into a 384-dimensional
vector. The model (~25 MB) loads once, then runs locally. No API calls.
Try: different phrasings of the same idea, same words in different orders, antonyms, different languages, or totally unrelated sentences. Watch the score change.
This is the pattern behind RAG, modern search, and recommendation engines: pre-embed a corpus, embed the query, return the closest matches. Type any query below and watch the 10 sentences re-rank themselves live.
Notice: you don't need to use any words from the sentences themselves — the query matches on meaning. This is what makes embeddings so powerful.
Cosine similarity tells you two sentences are about the same topic — not that they agree. Many opposites, negations, and reversals score surprisingly high. Click any pair below and see for yourself.
Why? A sentence embedding pools every token's vector.
"I am a ___ person" shares the overwhelming majority of tokens in both
sentences, and words like dog / cat or love / hate
are themselves close in embedding space — they appear in similar contexts during training.
The model sees "a statement on the same topic", not "two opposing opinions".
The practical rule: for sentiment, stance, or negation, don't use cosine similarity. Reach for a classifier, an NLI model, or an LLM.
Once you have a way to turn anything into a vector, you unlock a whole toolbox of vector-space operations: searching, clustering, classifying, ranking…
Find documents that mean the same as the query, not just share words.
Give an LLM just the relevant chunks from a big knowledge base by embedding both and retrieving top-k.
Compare an item's vector to label prototypes — zero training required.
Run k-means on vectors to automatically group similar items.
Embed users and items in the same space; recommend the nearest items.
Spot near-duplicate content even when wording, order, or language differs.
Items far from any cluster are outliers — useful for spam, fraud, QA.
Models like CLIP embed images and text into the same space — search images with words.
An embedding model is a function that maps inputs into a geometric space where distance means difference in meaning. Once you have that, almost anything "fuzzy" becomes a math problem: compare, rank, group, recommend, retrieve.