Papers · arXiv 1301.3781
Efficient Estimation of Word Representations in Vector Space
Summary in three lines
- 🎯 Prior neural language models were too computationally expensive to train high-dimensional word representations on multi-billion-token corpora.
- 🔧 Introduces two log-linear architectures that discard non-linear hidden layers: Continuous Bag-of-Words (predicting a center word from context) and Continuous Skip-gram (predicting surrounding context given a center word), both optimized with hierarchical softmax.
- 📈 Trained on 6 billion tokens with 1000 dimensions via DistBelief, Skip-gram achieved 65.6% overall accuracy on a new 19,544-question semantic-syntactic analogy benchmark, outperforming complex neural models at a fraction of the compute.
Abstract
We propose two novel model architectures for computing continuous vector representations of words from very large data sets. The quality of these representations is measured in a word similarity task, and the results are compared to the previously best performing techniques based on different types of neural networks. We observe large improvements in accuracy at much lower computational cost, i.e. it takes less than a day to learn high quality word vectors from a 1.6 billion words data set. Furthermore, we show that these vectors provide state-of-the-art performance on our test set for measuring syntactic and semantic word similarities.
Reading guide
Problem and motivation
Traditional NLP systems represented words as discrete atomic indices, discarding inherent semantic and syntactic relationships. While distributed word representations trained using neural network language models (NNLMs) or recurrent neural network language models (RNNLMs) significantly outperformed n-grams, their computational complexity made scaling prohibitively expensive. Previous architectures were rarely trained on more than a few hundred million words, usually restricted to dimensionalities between and .
In feedforward NNLMs, the computational bottleneck stems from the dense non-linear hidden layer () and the unnormalized vocabulary output layer (). The goal of this paper is to eliminate the non-linear hidden layer bottleneck, enabling models to scale to billions of training tokens and vocabularies containing millions of words, while retaining subtle linear relationships (e.g., ).
Key ideas
- Removing Hidden Layer Non-Linearities: By stripping out the non-linear activation layer, training complexity drops dramatically, allowing vast increases in both corpus size and embedding dimensionality.
- Continuous Bag-of-Words (CBOW): A log-linear classifier predicting a target center word given its surrounding context words (both history and future). Context vectors are averaged into a shared projection layer.
- Continuous Skip-gram: A log-linear classifier predicting surrounding context words within a window given only the current center word, sampling distant words less frequently.
- Hierarchical Softmax with Huffman Coding: Softmax normalization cost is reduced from to approximately (or via Huffman trees, which assign shorter codes to frequent words).
- Analogy Evaluation Benchmark: A new 19,544-question test set evaluating syntactic (e.g., comparative, past tense) and semantic (e.g., capital-country, currency) linguistic regularities using vector arithmetic and cosine distance.
Method (with the key equations)
Training complexity is defined as the number of parameter accesses across epochs, words in the training set, and per-example cost :
Feedforward NNLM Baseline
For context length , embedding dimension , hidden units , and vocabulary size : When using hierarchical softmax, the output term reduces to , leaving as the bottleneck.
Recurrent Neural Net Language Model (RNNLM) Baseline
With hidden state dimension equal to embedding dimension : Using hierarchical softmax, the output term reduces to , leaving recurrent transition as the dominant cost.
Continuous Bag-of-Words (CBOW)
CBOW replaces the hidden layer with an averaged projection layer across context words (typically 4 past and 4 future words):
Continuous Skip-gram
Skip-gram takes the center word and predicts context words within maximum distance (in experiments, ). For each word, an offset is drawn uniformly, predicting words before and after:
Analogy Search
Questions of the form " is to as is to " are answered by finding the vocabulary vector maximizing:
Results (with the most important numbers)
- Analogy Benchmark Performance (640-D, 320M words):
- RNNLM: 9% Semantic, 36% Syntactic.
- NNLM: 23% Semantic, 53% Syntactic.
- CBOW: 24% Semantic, 64% Syntactic.
- Skip-gram: 55% Semantic, 59% Syntactic.
- Scaling on Google News 6B tokens (DistBelief distributed training):
- NNLM (-D): 34.2% Semantic, 64.5% Syntactic, 50.8% Total (took CPU-core days).
- CBOW (-D): 57.3% Semantic, 68.9% Syntactic, 63.7% Total (took CPU-core days).
- Skip-gram (-D): 66.1% Semantic, 65.1% Syntactic, 65.6% Total (took CPU-core days).
- Microsoft Sentence Completion Challenge: Skip-gram alone reached 48.0% accuracy; combined with an ensemble of RNNLMs, it reached a state-of-the-art 58.9% accuracy.
- Epochs vs. Data: Training for 1 epoch on twice as much data performed comparably to or better than 3 epochs over smaller data while reducing wall-clock training time.
Limitations and open questions
- Exact Match Evaluation Metric: The test set counts synonyms as mistakes (e.g., predicting an equivalent valid city or plural form), setting an artificial ceiling below 100%.
- Lack of Subword Morphology: Words are treated as single tokens; the model does not exploit internal character or morpheme structure, limiting its syntactic generalization on rare or inflected words.
- Multi-Word Phrases: The model operates only on single-token words and does not natively handle multi-word expressions (such as "New York").
- Sentence Completion Performance: Skip-gram by itself scored lower (48.0%) than average LSA similarity (49.0%) on the Microsoft Sentence Completion task, relying on hybridization with RNNLMs to achieve competitive results.
Key terms
- Continuous Bag-of-Words Model
- A log-linear neural architecture (CBOW) that predicts a target center word from the continuous average of context word vectors before and after it without a hidden layer.
- Continuous Skip-gram Model
- A log-linear model that uses a target word vector to predict surrounding context words within a dynamically sampled window.
- Hierarchical Softmax
- An output layer approximation structuring the vocabulary into a binary tree (such as a Huffman tree), reducing evaluation complexity from to approximately .
- Semantic-Syntactic Word Relationship test set
- A benchmark of 19,544 analogy questions (8,869 semantic and 10,675 syntactic) designed to evaluate vector offsets using cosine similarity.
- DistBelief
- A distributed computing framework developed at Google used to train neural network architectures across hundreds of CPU cores via asynchronous gradient updates.
- Word offset technique
- Simple vector arithmetic (e.g., ) used to identify analogous words via nearest-neighbor cosine search.
- Huffman binary tree
- A frequency-based coding tree representation of the vocabulary used in hierarchical softmax to assign shorter paths to frequent words, cutting evaluation costs.
Questions
What is the main architectural difference between NNLM and CBOW?
CBOW removes the non-linear hidden layer completely and averages the continuous representations of context words in a shared projection layer, eliminating the compute bottleneck.
How does Continuous Skip-gram handle context words at different distances?
Skip-gram samples context words up to a maximum distance (typically 10), but samples more distant words less frequently by randomly drawing a window size for each training word.
Which model performs better on semantic vs. syntactic tasks?
CBOW achieves higher accuracy on syntactic analogies (64% vs. 59% at 640-D), whereas Skip-gram performs significantly better on semantic analogies (55% vs. 24% at 640-D).
Is it better to train for multiple epochs or use more data with fewer epochs?
The paper finds that training for a single epoch on twice as much data yields equal or superior representation quality compared to iterating over smaller data for three epochs, while also training faster.
The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.