Paper commentary
Distributed Representations of Words and Phrases and their Compositionality
- Problem Skip-gram word vectors give idioms such as 'Air Canada' no representation of their own, and very frequent words take up much of the training effort.
- Method The authors pair frequent-word subsampling and Negative sampling with a bigram-based step that merges detected phrases into single tokens before Skip-gram training.
- Results Phrase analogy accuracy reached 72% with a hierarchical softmax model of dimensionality 1000 trained on about 33 billion words.
Why word vectors miss idioms
Skip-gram word vectors treat each token as a single word, so an expression whose meaning does not come from its parts gets no vector of its own. The authors use 'Air Canada' as the example, since 'Canada' and 'Air' cannot easily be combined into it. 'Boston Globe' is a newspaper, so its meaning is not a natural combination of 'Boston' and 'Globe', which is why the authors want vectors for whole phrases.
The Skip-gram model is the base here. Its training does not depend on dense matrix multiplications, and an optimized single-machine implementation can process more than 100 billion words per day. Two issues motivate the changes. Very frequent words such as 'in', 'the' and 'a' absorb training effort while carrying little information, and the hierarchical softmax used in earlier work is more complex than the authors need.
The authors combine three changes: subsampling of frequent words, a sampling-based objective in place of the hierarchical softmax, and phrase detection that lets phrases be trained as single tokens.
The Skip-gram objective and the softmax cost
Training maximizes the average log probability of the words around each center word over a sequence of training words w1 to wT. The objective is \[ \frac{1}{T}\sum_{t=1}^{T}\sum_{-c\le j\le c,\; j\ne 0}\log p(w_{t+j}\mid w_t) \] The context size c can depend on the center word. A larger c gives more training examples and can raise accuracy, but it also costs training time.
The basic model defines p(w_O | w_I) with a softmax, where each word has an input vector v_w and an output vector v'_w. \[ p(w_O\mid w_I)=\frac{\exp(v'^\top_{w_O}v_{w_I})}{\sum_{w=1}^{W}\exp(v'^\top_{w}v_{w_I})} \] Here W is the vocabulary size.
Hierarchical softmax and the Huffman tree
The hierarchical softmax replaces evaluation of all W output nodes with a walk down a binary tree whose leaves are the words. Only about log2(W) nodes are evaluated to obtain the probability distribution. Each word is reached by a path from the root. Here n(w, j) is the j-th node on that path and L(w) is the path length, with n(w, 1) as the root and n(w, L(w)) = w.
Each step along the path contributes a sigmoid factor, and the probability of a word is their product. \[ p(w\mid w_I)=\prod_{j=1}^{L(w)-1}\sigma\left([\![n(w,j+1)=ch(n(w,j))]\!]\cdot v'^\top_{n(w,j)}v_{w_I}\right) \] Here σ(x) = 1 / (1 + exp(−x)), ch(n) is a fixed child of the inner node n, and the bracket term is 1 when its condition is true and −1 otherwise.
The word probabilities sum to one over the vocabulary, so the tree defines a valid distribution.
The authors use a binary Huffman tree, so frequent words get short codes and training is faster. Earlier work by Mnih and Hinton studied how the tree is built, and grouping words by frequency had been used as a speedup before.
Negative sampling and the noise distribution
Noise Contrastive Estimation trains a model to separate data from noise with logistic regression. The authors note that NCE approximately maximizes the log probability of the softmax, but the Skip-gram goal is good vectors, so the method can be simplified. A hinge loss used by Collobert and Weston, which ranks data above noise, is similar in spirit.
Negative sampling replaces each log p term of the Skip-gram objective with a term of the form \[ \log\sigma(v'^\top_{w_O}v_{w_I})+\sum_{i=1}^{k}\mathbb{E}_{w_i\sim P_n(w)}\left[\log\sigma(-v'^\top_{w_i}v_{w_I})\right] \] The target word w_O is distinguished from k draws from the noise distribution P_n(w).
Unlike NCE, Negative sampling uses only the samples and does not need the numerical probabilities of the noise distribution. The noise distribution is the unigram distribution raised to the 3/4 power, U(w)^{3/4}/Z. It outperformed the plain unigram and uniform distributions for both NCE and NEG on the tasks tried, while the language modeling results are not reported.
Subsampling frequent words
In very large corpora, words such as 'in', 'the' and 'a' can occur hundreds of millions of times. Because nearly every word co-occurs with 'the', observing 'France' with 'the' teaches the model far less than observing 'France' with 'Paris'. Vectors of frequent words also change little after several million training examples.
The authors chose this formula heuristically, but they found it works well in practice. They report that it speeds up learning and also improves the accuracy of the vectors for rare words.
Phrase detection by bigram scores
Phrases are found from unigram and bigram counts. A bigram's score takes its joint count, subtracts a discounting coefficient δ, and divides by the product of the two unigram counts, so a pair scores high when it occurs together often compared with how often each word occurs alone. The δ keeps phrases made of very infrequent words from being formed too often.
Bigrams whose score is above the chosen threshold become phrases and are replaced by single tokens in the training data. The process runs 2-4 passes over the data with the threshold decreased each time, so longer phrases can form. Examples are 'New York Times' and 'Toronto Maple Leafs', which become unique tokens, while the bigram 'this is' stays unchanged.
The authors use this simple data-driven approach and state that comparing it with other phrase detection methods is outside their scope.
Word analogy results
The training data is an internal news dataset of about one billion words. Words occurring fewer than 5 times were discarded, leaving a vocabulary of 692K.
Negative sampling outperforms the hierarchical softmax on this task and is slightly better than NCE. The authors argue that the linearity of the Skip-gram model suits linear analogies. They also note that sigmoidal recurrent networks, which are non-linear, improve on this task as the training data grows, which suggests non-linear models also favour a linear structure.
Phrase analogy results
The phrase analogy set has five categories: newspapers, NHL teams, NBA teams, airlines and company executives. It has 3218 examples and is publicly available.
The experiments use the same news data as the word experiments, with vectors of dimensionality 300 and context size 5, and compare models with and without 10−5 subsampling.
Negative sampling with k = 15 is clearly better than k = 5. Hierarchical softmax was the weakest without subsampling but the strongest with it. The authors read this as showing that subsampling can speed training and also improve accuracy, at least in some cases.
Scaling the phrase model
To maximize phrase accuracy, the authors trained on about 33 billion words with the hierarchical softmax, dimensionality 1000 and sentence-wide context. This reached 72% accuracy. The authors' best model on the phrase set reached 72% accuracy on this dataset.
Reducing the training data to 6B words lowered accuracy to 66%, which suggests that a large amount of training data is crucial.
Nearest neighbours of infrequent phrases were inspected by hand for several models, and Table 4 gives a sample. The authors say the best phrase representations come from the hierarchical softmax with subsampling, though this comparison rests on manual reading.
Additive compositionality
Element-wise addition of word vectors gives tokens that combine the two inputs. Table 5 shows that Russian plus river has Volga River among its closest tokens, and German plus airlines has Lufthansa, with the best Skip-gram model. Czech plus currency gives koruna and Vietnam plus capital gives Hanoi in the same table.
The authors explain this through the training objective. The word vectors are linear in the inputs to the softmax, and the logarithm ties those values to the output probabilities, so the sum of two vectors corresponds to a product of two context distributions. The product acts like an AND: words given high probability by both vectors keep high probability, and the others drop.
So a phrase that co-occurs with 'Russian' and 'river' ends up near the sum.
Table 5 lists tokens without scores, so the evidence for this property consists of these examples.
Comparison with published vectors
The authors downloaded word vectors from Collobert and Weston, Turian et al. and Mnih and Hinton. Mikolov et al. had earlier shown on the word analogy task that the Skip-gram models beat these vectors by a wide margin.
Table 6 lists the closest tokens for five infrequent words. The reported training times are 2 months for Collobert (50d), few weeks for Turian (200d), 7 days for Mnih (100d), and 1 day for Skip-Phrase (1000d). For 'Redmond', Skip-Phrase returns Redmond Wash., Redmond Washington and Microsoft, and for 'Havel' it returns Vaclav Havel and Velvet Revolution.
For 'ninjutsu', it returns ninja, martial arts and swordsmanship; for 'graffiti', spray paint, graffiti and taggers; for 'capitulate', capitulation, capitulated and capitulating.
Skip-Phrase was trained on over 30 billion training words, and an empty cell in Table 6 means the word was not in the vocabulary.
Limitations
The authors state that the best training algorithm and hyperparameter choices are task specific, so no single configuration is presented as optimal across problems. In their experiments, the model architecture, the vector size, the subsampling rate and the training window size had the largest effect on performance.
The subsampling formula is justified by its practical results rather than by derivation. Every subsampling comparison in these tables uses a threshold of 10−5, so other thresholds are not examined in them.
The word analogy experiments use an internal news dataset, and the phrase analogy set was built by the authors, so the phrase numbers are tied to that set. The 72% and 66% figures come from one hierarchical softmax configuration trained on the 33 billion and 6B word corpora.
The k ranges for Negative sampling are described as the authors' experimental indication, not as a derived rule. The qualitative neighbour comparisons with published vectors combine a larger training corpus with other differences, and the authors attribute the gap partly to the data size.
Paper info
- Authors
- Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, Jeffrey Dean
- Venue
- arXiv · Preprint
- First published
- 2013-10-16
- Added
- 2026-10-20
- Updated
- 2013-10-16
- Version
- v1
- arXiv
- 1310.4546
- Category
- cs.CL · cs.LG · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, Jeffrey Dean (2013). Distributed Representations of Words and Phrases and their Compositionality. arXiv:1310.4546v1. https://arxiv.org/abs/1310.4546v1
BibTeX
@misc{mikolov2013distributed,
title = {{Distributed Representations of Words and Phrases and their Compositionality}},
author = {Tomas Mikolov and Ilya Sutskever and Kai Chen and Greg Corrado and Jeffrey Dean},
year = {2013},
eprint = {1310.4546},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1310.4546v1}
}