Word2Vec

Word2Vec

Two shallow models (Skip-gram and CBOW) that learn dense word vectors by predicting context, so semantically similar words come close and linear relations such as capitals and gender appear. It launched the era of distributed representations in NLP.

2013Static embeddingsPublished weights
DeveloperGoogle
Year of publication2013
Number of parametersA 100–300-dimensional vector per word (the released model: 300 dimensions for about 3 million words and phrases)
LayersA single projection layer (a shallow model)
Context lengthA local context window (usually 5–10 words)
Training dataThe released model was trained on Google News (about 100 billion words)
Training objectiveSkip-gram or CBOW with negative sampling or hierarchical softmax
LicenceApache 2.0 (the original code)
ArabicThe released model does not support Arabic, but the algorithm can be trained on any language; ready Arabic models include AraVec.
Page contents
  1. The idea
  2. Why was it influential?
  3. How is it used today?

The idea

Word2Vec turns each word into a short dense vector (hundreds of dimensions instead of hundreds of thousands in one-hot representation), learned from a simple prediction task: in Skip-gram the center word predicts its context words, and in CBOW the context average predicts the center word. The network has no nonlinear hidden layer; just an embedding table and a dot product, which is the secret of its speed.

Why was it influential?

Before 2013, distributional representations were built by factorizing huge co-occurrence matrices, or with neural language models that were slow to train. Word2Vec came with three tricks that made it practical at scale: negative sampling instead of the full softmax, subsampling of frequent words, and merging common phrases (such as New_York) into single tokens. It became possible to train good vectors on billions of words on an ordinary computer in hours.

How is it used today?

  • A fast baseline for classification and similarity when resources are limited.
  • Initializing the embedding layer in small models.
  • A research tool for studying semantic change over time or corpus biases.

Contextual representations (BERT and its siblings) and sentence embeddings have replaced it in most applications, but understanding it is essential for understanding them.

The Word2Vec architecture Skip-gram and CBOW
Skip-gramw(t)projection(embedding)w(t-2)w(t-1)w(t+1)w(t+2)CBOWw(t-2)w(t-1)w(t+1)w(t+2)average(sum)w(t)

In Skip-gram the center word predicts its context words, and in CBOW the average of the context predicts the center word. The hidden layer is linear, and its weights are the word vectors.

Key contributions

  • Very fast training on billions of words, thanks to its simplicity and negative sampling.
  • Measurable linear relations (king − man + woman ≈ queen).
  • A theoretical basis: it implicitly factorizes a shifted PMI matrix.

Limitations and caveats

  • One vector per word, however many meanings it has.
  • No vector for unseen words, which is costly in morphologically rich Arabic.
  • It inherits the biases of the corpus (gender stereotypes, for example).

Original references

  1. Mikolov, T., Chen, K., Corrado, G. & Dean, J. (2013). Efficient Estimation of Word Representations in Vector Space arxiv.org/abs/1301.3781
  2. Mikolov, T. et al. (2013). Distributed Representations of Words and Phrases and their Compositionality. NeurIPS arxiv.org/abs/1310.4546

The figures are taken from the papers and official cards cited in the references. When the developer does not disclose a figure we write "not disclosed" and do not estimate it. Check the model card before any commercial use, because license terms may change.