On SkipGram Word Embedding Models with Negative Sampling: Unified Framework and Impact of Noise Distributions

Ziqiao Wang, Yongyi Mao, Hongyu Guo, Richong ZhangarXiv 2020

Introduction

SkipGram with Negative Sampling (SGN) has long been a foundational technique in Natural Language Processing for learning word embeddings. Despite its widespread adoption, its success has remained largely empirical. While theoretical work has linked SGN to the implicit factorization of a Pointwise Mutual Information (PMI) matrix, the choice of noise distribution—such as the ubiquitous "3/4-unigram" distribution—has lacked a rigorous theoretical justification. This paper addresses these gaps by introducing a unified framework and proposing an adaptive approach to negative sampling.

The Word-Context Classification (WCC) Framework

The authors formalize word embedding as a binary classification task, termed the Word-Context Classification (WCC) framework. In this setting, the model learns to distinguish between true word-context pairs from the data distribution and "noise" pairs drawn from a synthetic distribution.

A key theoretical insight is that SGN essentially performs density ratio estimation. The optimal score for a word-context pair is shown to be the log-ratio of the data distribution to the noise distribution. This suggests that the quality of the learned embeddings is intrinsically tied to the choice of the noise distribution. The authors hypothesize that the most effective noise distribution is one that "barely covers" the data distribution—being as close to the real data as possible while ensuring all real pairs have a non-zero probability in the noise distribution.

Conditional Adaptive SGN (caSGN)

Traditional SGN models rely on a static, global (unconditional) noise distribution. This often results in "easy" negative samples that do not sufficiently challenge the model, leading to sub-optimal embeddings. To overcome this, the authors propose caSGN (Conditional Adaptive SGN), which incorporates adversarial learning to generate "hard" negative samples.

Graphical models for different SGN variants: (a-c) show conditional adaptive models (caSGN) with varying dependencies between center word x, context word y, and latent noise z; (d) shows the unconditional adaptive model (aSGN).

As illustrated in the figure above, caSGN models introduce dependencies between the center word ($x$) and the generated noise context ($y$). By training a neural generator alongside the embedding model (the discriminator), the system adaptively learns a noise distribution that converges toward the real data distribution. This adversarial process forces the embeddings to capture finer semantic nuances to distinguish real pairs from increasingly sophisticated "fake" ones.

Experimental Results

The models were evaluated on a diverse set of benchmarks, including 12 word similarity and analogy datasets, and a downstream Named Entity Recognition (NER) task.

  • Semantic Similarity: The caSGN variants consistently outperformed vanilla SGN. Notably, on the SimLex-999 dataset—a benchmark focused on semantic similarity rather than mere association—caSGN2 achieved a score of 34.01, a significant improvement over the baseline's 30.32.
  • Sample Efficiency: Adaptive models demonstrated superior efficiency, achieving higher performance with just one negative sample per positive sample than vanilla SGN achieved with five.
  • Downstream Performance: In NER tasks using the CoNLL-2003 benchmark, embeddings pre-trained with caSGN provided a statistically significant boost in F1 scores.

Conclusion and Future Work

The WCC framework provides a much-needed theoretical grounding for SGN-like models, highlighting the critical role of the noise distribution. While caSGN offers substantial improvements in embedding quality and sample efficiency, it comes with increased computational costs, with training times roughly ten times longer than vanilla SGN due to the additional generator network. Future research may explore applying these principles to more complex architectures like Transformers to optimize pre-training objectives for large-scale language models.

Summary updated

BibTeX
@misc{wang2020skipgram,
  author = {Ziqiao Wang and Yongyi Mao and Hongyu Guo and Richong Zhang},
  title = {{On SkipGram Word Embedding Models with Negative Sampling: Unified Framework and Impact of Noise Distributions}},
  year = {2020},
  eprint = {2009.04413},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.04413},
}
Figure