My intuition of why things like king + man - woman work is because the points in the vector space model happen to create a well-behaving manifold with smooth meaning changes. It's not very principled, but it does work.
I wrote a series of blog posts with a coworker about doing this with music:
https://tech.iheart.com/mapping-the-world-of-music-using-mac...
https://tech.iheart.com/mapping-the-world-of-music-using-mac...
Instead of mixing nouns and adjectives, we do things like mixing songs and artists and radio stations etc. In the second post we show how Nirvana - Kurt Cobain + Female Vocalist works remarkably well. I've studied empirically why this worked, and the best I could come up with is that the high dimensional space we created had a very dense set of points in the region of popular western music that led to a smooth manifold.
For differences - see this section: http://p.migdal.pl/2017/01/06/king-man-woman-queen-why.html#....
I mention also that multiplying a word by a factor (for PMI compression) results in a word of similar meaning, just being more characteristic (bear in mind that for other models in can be related e.g. to word frequency or other properties).
But you are right, that there are some problems with linear structure. Some of them were brought to me be Omer Levy (a researcher in this subject). I think an article that summarises it the best (or rather: shows empirically that it does not always work as intended) is:
- Tal Linzen, Issues in evaluating semantic spaces using word analogies, https://arxiv.org/abs/1606.07736
(Also, by "scalar product" I meant "scalar multiplication"--the product of a scalar and a vector, not the dot product. It's pretty clear how to make some sense out of the dot product, but it's pretty hard to make consistent sense out of scalar multiplication. Apologies for being unclear.)
"Essentially, all models are wrong, but some are useful." - George Box
I guess you know this, but for others: London-Paris makes sense, but has a different type to London and Paris (it's a vector, not a position) and while 2London doesn't make sense, 2(London-Paris) does make sense (it's a vector with the same direction but twice the length).
Such a system, with two distinct types -- positions and vectors, with vectors being the differences between positions -- is called an affine space. You can identify positions with vectors by picking a distinguished origin, but then you don't get the type-safety that forbids ridiculous expressions like 2London.
What is a secondmeter? A voltvoltgram?
I'm glad it can be useful. But, I agree it seems to leave a lot lacking.
Consider, king + woman = queen + man. Which looks neat, but is not a universal truth. It could be concubine, for example.
So, is queen + man also concubine?
Again. I'm glad this works for some things. But really just shows which words are often used together. It does not show any good rationale for their meanings. Unlike math, where 1 + 1 equals 2. Possibly in different encodings. But not just from convention of often being used together.
It's still useful -- you can classify millions of pictures in a meaningful way much faster than before.
That is, x+y has meaning and use in most maths. Here, it seems primarily use.
That said, I definitely agree with you. An English speaker may find any of these reasonable:
1. King - man = expensive clothing 2. King - man = prince 3. King - man = queen
What is "king"? What is "-"? What is "man"?
If a king is a dressed up wealthy man, and you remove the man, you have wealthy clothes? Or, does removing the man mean degrading the king back into a boy? Or, does removing a man mean adding a woman? Wait -- what if a king is more than a dressed up wealthy man? Should we include his home? Do we need to subtract the home? How do you subtract a home? Is the king minus a man a prince if the king was a beggar when he was young? ... death of the universe ...
Like you said, there's a combinatoric explosion here. Maybe this example is akin to trying to model each and every trajectory of all 10^23 particles in a gas. It looks like these scientists are stepping back, and looking at the big picture, instead, trying to find something more akin to PV = NkT
So king + woman = queen + man is better described as:
Masculine monarch feminine person = feminine monarch masculine person
A bit of reordering of adjectives and it is exactly the same. Even monarch is the wrong word, because you seem to be getting hung up on nouns, when these are all actually a bunch of chained adjectives. Perhaps "regality + nobility + rulery". English is a bad language to describe this, because we tend to noun and verb our adjectives regularly.
That's totally fime, because actual words don't define universal truths either.
Queen could be a band, a transvestite, an actual queen, and several other things besides.
Precisely. Models which use this space do not propose strong equality (==). Rather, they would output a series of probabilities, and choose the most likely. Stating king + woman = queen + man is somewhat disingenuous; what should be said (mathematically) is something like the following: the word lying closest to the vector vec('king') + vec('woman') - vec('man') is 'queen'.
To suggest that a NN can't learn something about the meaning of words from a large corpus of text is unsubstantiated, I believe. The statement above suggests they do, I would say. I would not be too surprised if a sufficiently complex NN could 'learn' the concept of gender with a corpus of English text to a decently high degree of accuracy, simply based on vestigial features left from French and Old English.
Similarly, add a woman to a person, and you just have two people. One being a woman.
I get that there is an answer that seems fun... But there is not a deep meaning to the math.
This is like the games where "send + more = money". Fun. But is there really something illuminating?
Similarly with woman + person, the concept of woman is femininity. It makes sense if you think in terms of concepts.
Yes, and some of those meanings can be closer to the common understanding of reality or the weight of each notion or its probability than others.
Which is also why we can solve riddles and don't get lost in their infinite similar possibilities.
However, something like the dot-product here does make sense, since you can use it to determine similarities of vectors.
The engine does have an emergent notion of the relationship, which is the whole point.
It's not supposed to be english, it's a query language.
The fundamental problem is that linearity is probably not that accurate in representing words relationships, but I don't think this is the goal.
War? Murder?
:)