by otabdeveloper4 · 1y ago · 0 comments
The "similarity" here means word ID's that commonly occur together in vectors.
There is no logical reasoning or attempts at semantic analysis here.
> The dot products (cosine similarity) of man . woman end up being very similar to king . queen
This is because 'king' and 'man' occur together in a distribution similar to that of 'queen' and 'woman'.
The idea that the embedding of 'king' is somehow a sum of 'autarch' and 'man' and that subtracting 'man' from 'king' and adding 'woman' somehow gives you 'queen' is an urban legend. Embeddings don't carry semantic meanings, they aren't dictionaries or encyclopedias. They are only statistical features about word co-occurrences.
[0] https://blog.dataiku.com/arithmetic-properties-of-word-embed...
EDIT: I guess there are different forms of word embeddings and apparently modern LLMs don't use static word embeddings like word2vec and it's more contextual. Tokens aren't 1:1 with words either of course. I guess it's more complex than "LLMs represent words as vectors". Still though it's a neat trick and is indeed that simple with something like word2vec.
Edit 2: some interesting slides including the bit about semantic analogy and a paraphrase from the original word2vec paper about the king queen thing: https://staff.fnwi.uva.nl/e.kanoulas/wp-content/uploads/Lect...
And the original word2vec paper by Mikolov mentions it https://arxiv.org/abs/1301.3781
(Shrug) Take it up with Bishop, page 376: https://i.imgur.com/PgjQK3t.png