We left off with a sentence as a sequence of
It works, but it is wasteful and dumb: the vectors are enormous (a real vocabulary has
Instead, give every word a short, dense vector of
How do we fetch word
Step 1 — write the matrix–vector product as a sum of columns. For a matrix
Step 2 — use that the one-hot is zero everywhere but slot
Step 3 — read off the punchline. Multiplying the embedding matrix by a one-hot
vector simply selects row
In practice nobody forms the giant one-hot vector or does the multiply — they just index row
Because the rows are trained, words that play similar roles drift to nearby points, and directions in the space pick up meaning. The famous example: the vector from man to woman is roughly the same as the one from king to queen, so
Analogies become vector arithmetic; similarity becomes
The first embeddings to make a splash came from word2vec (2013), which never looked at a dictionary. It learned each vector by a single, almost trivial pretext task: predict a word from the words around it (or vice versa). Sliding that window over billions of words of text, it nudged the embedding of each word toward the company it keeps — and out fell vectors in which meaning is geometry.
The analogy
It is tempting to say an embedding "understands" that a king is royal or that a queen is female. It doesn't — an embedding only captures statistical patterns of use: it learned that king and queen tend to appear near similar words in a huge pile of text, nothing more. There is no concept of royalty inside the vector, only geometry that happens to mirror how humans write about royalty.
That has a sharp consequence: if the training text contains real-world stereotypes, the embedding learns those too. Famous analogy studies on early word2vec-style embeddings turned up exactly this — for instance, solving "man is to computer programmer as woman is to ___" returned homemaker, and "father is to doctor as mother is to ___" returned nurse. The model wasn't reasoning about occupations; it was faithfully reproducing gender/occupation biases baked into the corpus. This is a genuine, well-documented limitation, and a lot of active research goes into detecting and correcting it (e.g. "debiasing" the embedding space) rather than pretending it isn't there.
A toy 2-D embedding of six words. Pick an analogy and the figure draws the arithmetic: start at the first word, subtract the second, add the third — the dashed result vector lands right next to the answer. The two solid arrows are parallel: that parallelism is the analogy.