Embedding Space Walk: king − man + woman, With the Rule Shown
Vector arithmetic on vectors you supply, with the metric and the exclusion rule as switches — because the famous analogy result depends on both and neither is usually mentioned.
Similarity 1.000. The three input vectors are hidden. Turn that off and the top of the list becomes queen — which is the part of this demo that usually goes unmentioned.
- Vectors parsed
- 13
- Dimensions
- 6
- Target vector
- 1.00, 0.00, 1.00, 1.00, 0.00, 0.00
- Metric
- cosine similarity
- Best match with the inputs excluded
- queen
- Best match with nothing excluded
- queen
- Is the top result one of your inputs?
- no
What the analogy result actually shows
The famous claim is that embedding spaces have linear structure: a direction that means "female rather than male" exists, is roughly the same direction everywhere, and can be added to any vector. The arithmetic on this page is exactly the arithmetic behind that claim, and with the axes written out you can see what makes it work. Subtracting man from king cancels the shared coordinates and leaves the difference; adding woman writes a different value into the same slots. No semantics are involved anywhere — it is vector addition.
Now drag λ back towards zero with the exclusion switch off. At λ = 0.2 the target is still almost exactly king, so king is the nearest vector to it and the "analogy result" is the word you started from. This is not a defect of the toy space. It is the reason every implementation of the demo silently excludes the three input words: in real embedding spaces the offset between related words is small relative to the distance between unrelated ones, so the inputs very often outrank the intended answer. The result people quote is the result after a filter that is rarely mentioned.
Two further things this page deliberately does not hide. Cosine and Euclidean disagree whenever the candidates have different magnitudes, so "nearest" is a choice, not a fact — swap the metric and watch the ranking move. And the linear structure that makes any of this work is a property of some spaces, not all: it was strong in word2vec and GloVe, is weaker and less reliable in contextual sentence embeddings, and does not survive at all in spaces that were never trained with a co-occurrence objective. If you paste your own vectors and the analogies do not land, that is information about your model rather than an error here.