How does a model know a coach is like a bus?
A model keeps every word piece as a list of numbers, and words used in similar places get similar lists. Here those lists are learned in your browser from 44 short sentences: count which words appear near which, then squeeze the counts into a few numbers per word.
Learned from 44 sentences about buses, food, animals, weather and places:
One word, as numbers
A map of all 87 words
Their numbers flattened to two directions. Words that sit close are used alike; shaded islands are the five topics. Click a word, or point at a dot.
Search six notices, two ways
More numbers per word, until it stops helping
Solid: a word's 3 closest share its topic. Dashed: meaning search puts the right notice first.
Numbers per word
Out of 87 directions the counts could keep.
Neighbours on topic
A word's 3 closest words share its topic.
Meaning search
Questions whose right notice comes first.
You know a word by its neighbours
Count which words appear near each word. Bus and coach both appear near ticket, driver and station, so their counts look alike.
Squeeze the counts into a few numbers
The count table has a column for every word. Breaking it into its main directions keeps the pattern in a handful of numbers per word: its embedding.
Close in numbers, close in use
Two words whose numbers point the same way are used alike. The angle between them (cosine similarity) is the measure most meaning searches use.
The trap
Close in numbers means used alike, which usually lines up with meaning alike. Opposites like early and late appear in the same kinds of sentence, so they end up neighbours too: try "early" above.
Open Under the hood for the three steps that turn sentences into numbers.
- Count: for every pair of the 87 words, how often they appear within 3 words of each other in the same sentence. A 87 × 87 table.
- Weight (PPMI): turn each count into log(how often the pair appears ÷ how often it would by chance), and set anything below zero to zero. Common words like "the" were already dropped.
- Squeeze: break the table into its main directions (eigenvectors), strongest first. A word's embedding is its position along the first 6, each scaled by the square root of how strong that direction is, then set to length 1.
Real models learn their embeddings during training, by predicting words, and give each token a few hundred to a few thousand numbers. Counting neighbours and breaking the table into directions, as here, reaches the same kind of space, and early word vectors were built this way. Search embedding models are trained by contrast: pull a question and its matching passage together, push unrelated passages apart. They read a whole passage and give it one vector, where this page averages its words, and inside a model a word's numbers change with the sentence around it.
Why knowing this helps you
Embeddings power search by meaning, in your own tools and in local document setups. A few things to know when you rely on them.
Search by meaning
Embedding search finds passages that say the same thing in other words. It is what lets a document assistant answer "earliest coach" from a page about the first bus.
Mind the opposites
Words used in the same places sit together even when they mean opposite things. Check meaning-search results where early and late, or allowed and banned, both match.
Same model, same space
Vectors from different embedding models do not line up. Search with the same model that embedded your documents, and re-embed everything when you switch.
Mix it with keywords
Names, codes and exact numbers match better by keyword. Many setups run both searches and combine the results.
Checked on 2026-10-06 against Levy and Goldberg (2014) on counting and prediction reaching the same space, the Qwen3 Embedding report on how search embedding models are trained, and Anthropic's Contextual Retrieval post on mixing keyword and meaning search.
Where this goes next
Next: sampling settings
At the other end, the model turns its numbers back into odds for every token. Settings decide which one it picks.
Then: LoRA
Settings change how it picks. To change what it knows, you change the model itself, without retraining all of it.
Every count, vector, similarity and map position on this page comes from a C engine compiled to WebAssembly, learned in your browser from the 44 sentences above. Real models learn far richer spaces from far more text.