O&O ConsultingBook a free call

Home / Insights / AI Foundations

Word Embeddings: How Machines Represent Meaning

Turning words into vectors, why similar words end up close together, and what biases come along.

O&O Consulting · · 2 min read

Printed documents spread on a desk

Computers work with numbers, so language must be encoded. The simplest scheme gives every word its own position in a very long list, with no notion that "doctor" is closer to "nurse" than to "bicycle". Embeddings solve that problem.

Meaning from context

The distributional hypothesis, associated with the linguist J. R. Firth's remark that you shall know a word by the company it keeps, holds that words appearing in similar contexts tend to have related meanings. Embedding methods turn this into a learning task.

In 2013 Tomas Mikolov and colleagues introduced word2vec, which trains a small network to predict a word from its neighbours, or the neighbours from a word. The weights learned along the way become each word's vector, typically a few hundred numbers.

From text to embeddingsIllustrative diagram, not data
Large body of textPredict words from their neighboursEach word gets a list of numbersSimilar contexts give nearby vectors
Large body of textPredict words from theirneighboursEach word gets a list of numbersSimilar contexts give nearbyvectors

Diagram by O&O Consulting.

Geometry of meaning

In the resulting space, distance reflects similarity, and some directions correspond to relationships. The well-known example is that the vector for "king", minus "man", plus "woman", lands near "queen". Such analogies are illustrative rather than reliable rules, but they show that structure is captured.

From fixed to contextual

A single vector per word cannot separate the "bank" of a river from a financial bank. Models such as BERT produce contextual embeddings, in which the vector for a word depends on the whole sentence. The same approach yields vectors for sentences and documents, which power semantic search: finding passages by meaning rather than exact words.

Limitations and open questions

Because embeddings learn from human writing, they can encode its prejudices. Research has found gender and ethnic stereotypes reflected in the geometry of widely used embeddings. Reducing a bias along one measured direction does not necessarily remove it elsewhere. Embeddings also reflect the period and domain of their training text, so specialised vocabulary may be poorly represented.

References

  • Mikolov, T. et al. (2013). "Efficient Estimation of Word Representations in Vector Space." arxiv.org/abs/1301.3781
  • Devlin, J. et al. (2018). "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding." arxiv.org/abs/1810.04805
  • Bolukbasi, T. et al. (2016). "Man is to Computer Programmer as Woman is to Homemaker? Debiasing Word Embeddings." arxiv.org/abs/1607.06520

This article is general information, not financial, legal or investment advice. AI research and rules change quickly; check the cited sources for the current position.