Deconstructing and reconstructing word embedding algorithms

Edward Newell, Kian Kenyon-Dean, Jackie Chi Kit CheungarXiv 2019 · OpenReview

Abstract

Uncontextualized word embeddings are reliable feature representations of words used to obtain high quality results for various NLP applications. Given the historical success of word embeddings in NLP, we propose a retrospective on some of the most well-known word embedding algorithms. In this work, we deconstruct Word2vec, GloVe, and others, into a common form, unveiling some of the necessary and sufficient conditions required for making performant word embeddings. We find that each algorithm: (1) fits vector-covector dot products to approximate pointwise mutual information (PMI); and, (2) modulates the loss gradient to balance weak and strong signals. We demonstrate that these two algorithmic features are sufficient conditions to construct a novel word embedding algorithm, Hilbert-MLE. We find that its embeddings obtain equivalent or better performance against other algorithms across 17 intrinsic and extrinsic datasets.

Introduction

Despite the massive success of word embeddings, the field has long relied on a collection of seemingly disparate algorithms—such as Skip-gram with Negative Sampling (SGNS) and GloVe—each utilizing different loss functions and heuristics. While researchers have intuited that these models are related, a unified "first principles" explanation for why they work has been missing. This work seeks to uncover the "necessary and sufficient" conditions for creating high-quality word embeddings by introducing the Low Rank Embedder framework.

The Low-Rank Embedder Framework

Our mathematical deconstruction of popular algorithms reveals that they all share two core design features:

  1. PMI Approximation: They all aim to make the dot product of a word vector and a context covector approximate the Pointwise Mutual Information (PMI) of those words in the corpus. Transforming raw co-occurrence counts into PMI acts as a normalization step that provides a more "normally distributed" target for bilinear models.
  2. Gradient Modulation: They use specific weighting functions to balance the "weak signals" from rare word pairs and "strong signals" from frequent ones. This "tempering" of the gradient is essential to prevent the model from being overwhelmed by the power-law distribution of common words.
Table 1: Comparison of word embedding algorithms within the unified framework, showing how each approximates PMI and modulates gradients.

Hilbert-MLE: A Principled Reconstruction

Based on these insights, we derive Hilbert-MLE. Unlike previous models that rely on specific neural architectures or heuristic weighting, Hilbert-MLE is derived directly from the maximum likelihood estimate of a multinomial distribution of corpus statistics. To make it computationally feasible for large vocabularies, we provide both a global matrix factorization version and a local sampling version using contrastive divergence.

Figure 1: The relationship between global matrix factorization and local sampling approaches as unified in this work.

Experimental Results

We evaluated Hilbert-MLE against established methods using a 5.4 billion token corpus across 17 diverse datasets:

  • Superior Similarity: Hilbert-MLE achieved the best performance on 5 out of 10 word similarity tasks, notably earning a 0.462 Spearman correlation on Simlex999—an 18% relative improvement over SGNS.
  • Robustness: On downstream tasks like IMDB sentiment analysis and AGNews classification, Hilbert-MLE performed on par with or slightly better than SGNS and GloVe.
  • Efficiency: The matrix factorization version of Hilbert-MLE trained in less than 3 hours for a 50,000-word vocabulary on a single consumer-grade GPU.

Discussion and Conclusion

A key insight of this work is that the primary difference between algorithms is not the target (they all target PMI), but how they modulate the gradient. Furthermore, we highlight the value of covectors (context vectors); while vector-vector similarity captures paradigmatic relations (synonyms), vector-covector similarity captures syntagmatic relations (co-occurrence/expressions).

While the industry has moved toward deep contextualized models, understanding these fundamental building blocks is essential for developing efficient models for resource-constrained devices and for providing a theoretical foundation for future deep architectures.

Summary updated

BibTeX
@misc{newell2019deconstructing,
  author = {Edward Newell and Kian Kenyon-Dean and Jackie Chi Kit Cheung},
  title = {{Deconstructing and reconstructing word embedding algorithms}},
  year = {2019},
  eprint = {1911.13280},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.13280},
}
Figure