ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Language and language models

TM072

Word analogies (vector offsets)

Also: offset method, 3CosAdd, king − man + woman

In Spanish: Analogías entre palabras (desplazamientos vectoriales)

Solving “A is to B as C is to ?” with embedding arithmetic: compute B − A + C and look for the word closest to the result.

If a relation (singular–plural, country–capital) were encoded as a constant offset in embedding space, adding it would take you from one pair to the other. To answer "big is to biggest as small is to ?", Mikolov, Chen, et al. (2013) compute vector(biggest) − vector(big) + vector(small) and return the closest word by cosine similarity, discarding the question words (2013, sec. 4). With this test (8,869 semantic and 10,675 syntactic analogies, counting only the exact word as a hit) they evaluated word2vec; the best model reached 65.6% (2013, secs. 4.1, 4.4).

There are precedents in psychology: Rumelhart and Abrahamson (1973) modeled analogies between animal names as parallelograms in a similarity space. And there is fine print. Levy and Goldberg (2014) showed that, with normalized vectors, the method amounts to adding and subtracting similarities (hence the name 3CosAdd): cos(x, B) − cos(x, A) + cos(x, C). Linzen (2016) went further: without excluding the question words, the answer was almost always C; and part of the success can be had by simply returning the nearest neighbor of C. Nissim et al. (2020) noted that the same rule forbids answering doctor to "man is to doctor as woman is to ?", which exaggerated some famous biases.

For M. Mitchell (2019), who studied analogy with Hofstadter, these games fall short (2019, ch. 11). Genuine analogy requires conceptual slippage: if abc changes to abd, what happens to xyz? Whoever answers wyz has let "last" slip to "first" and "successor" to "predecessor" (2019, ch. 14). A fixed vector offset cannot slip: it applies the same subtraction in every case. The question is whether the contextual representations of current models, which are no longer fixed, change that diagnosis.

Sources

  • Linzen, T. (2016). Issues in evaluating semantic spaces using word analogies. In Proceedings of the 1st Workshop on Evaluating Vector-Space Representations for NLP (pp. 13–18). Association for Computational Linguistics. https://doi.org/10.18653/v1/W16-2503 §
  • Mikolov, T., Chen, K., Corrado, G., & Dean, J. (2013). Efficient estimation of word representations in vector space (arXiv:1301.3781). arXiv. https://doi.org/10.48550/arXiv.1301.3781 §
  • Mitchell, M. (2019). Artificial intelligence: A guide for thinking humans. Pelican Books. §
  • Nissim, M., van Noord, R., & van der Goot, R. (2020). Fair is better than sensational: Man is to doctor as woman is to doctor. Computational Linguistics, 46(2), 487–497. https://doi.org/10.1162/coli_a_00379 §