Matrix Factorization using Window Sampling and Negative Sampling for Improved Word Representations

Alexandre Salle, Aline Villavicencio, Marco IdiartACL 2016

Abstract

LexVec is a word embedding method that bridges the gap between count-based matrix factorization and predictive models like Word2Vec. By explicitly factorizing the Positive Point-wise Mutual Information (PPMI) matrix using window-based sampling and negative sampling, LexVec achieves state-of-the-art results in word similarity and semantic analogy tasks. This approach combines the robust statistical foundations of traditional methods with the efficient, high-performance training of modern neural architectures.

Introduction

In Natural Language Processing (NLP), representing words as dense vectors (embeddings) is fundamental. Historically, two paradigms have dominated: count-based methods (e.g., SVD on PPMI matrices) and predictive methods (e.g., Skip-gram with Negative Sampling or SGNS). While count-based methods provide a global statistical view, they often treat all errors equally, regardless of word frequency. Conversely, predictive methods are highly effective but only implicitly factorize specific matrices. GloVe, another popular hybrid, ignores "negative co-occurrences"—the information gained when two words do not appear together.

LexVec (Lexical Vectors) addresses these limitations by explicitly factorizing the PPMI matrix while adopting the sampling and weighting strategies that have made predictive models successful.

Methodology

LexVec introduces a loss function designed to explicitly factorize the PPMI matrix. Its core innovations include:

  • Weighting by Frequency via Window Sampling: Unlike traditional SVD, LexVec utilizes window sampling. Frequent word pairs appear more often in the training window, causing the model to naturally prioritize minimizing errors for these pairs.
  • Negative Co-occurrence via Negative Sampling: To prevent the model from hallucinating relationships between unrelated words, LexVec employs negative sampling. It randomly selects word pairs that do not co-occur and ensures their vector similarity remains low.
  • Explicit PPMI Factorization: LexVec targets the PPMI matrix directly, which is widely regarded as superior for capturing semantic similarity compared to the shifted PMI matrix implicitly factorized by SGNS.
  • Stochastic Optimization: The model is trained using Stochastic Gradient Descent (SGD), ensuring computational efficiency comparable to predictive models.

Experimental Setup

The models were trained on a June 2015 Wikipedia dump, filtered to a vocabulary of approximately 302,000 words. Evaluation was conducted across a comprehensive suite of benchmarks:

  • Word Similarity: WS-353, MEN, MTurk, Rare Words (RW), SimLex-999, MC, RG, and SCWS.
  • Word Analogy: The Google Analogy dataset (split into semantic and syntactic components) and the MSR syntactic analogy dataset.

Results and Analysis

LexVec demonstrates strong performance across both similarity and analogy tasks, particularly excelling in semantic contexts.

Word Similarity

As shown in Figure 1, LexVec variants (particularly those using SGNS-style weighting) consistently outperform PPMI-SVD and frequently exceed the performance of SGNS and GloVe. Notably, LexVec achieves top-tier results on challenging datasets like SimLex-999 and WS-353 (WSim).

Evaluation of word representations on various word similarity and relatedness datasets.

Word Analogy

In analogy tasks (Figure 2), LexVec shows a clear advantage in semantic reasoning. In the Google Semantic (GSem) task, LexVec significantly outperforms SGNS and approaches the performance of GloVe. However, a performance gap remains in syntactic tasks (GSyn and MSR), where SGNS and GloVe maintain an edge.

Performance of LexVec and baseline models on word analogy tasks (GSem, GSyn, MSR).

Key Insights

  • Explicit Target: Targeting PPMI directly is more effective for semantic tasks than relying on the implicit factorization performed by predictive models.
  • The Role of Zero-Counts: By penalizing pairs that do not co-occur through negative sampling, LexVec creates a more accurate and "scattered" vector space than models like GloVe.
  • Efficiency: The "Stochastic" variant of LexVec provides a computationally efficient alternative to "Mini-batch" versions without sacrificing accuracy.

Discussion and Future Work

The primary limitation of LexVec is its performance on syntactic analogies. The authors suggest this may be inherent to the PPMI measure itself. Future work aims to address this by incorporating positional context—considering the relative distance between words rather than just their presence within a window. Additionally, further hyperparameter exploration may yield a more optimal balance between semantic and syntactic performance.

Summary updated

BibTeX
@inproceedings{salle2016matrix,
  author = {Alexandre Salle and Aline Villavicencio and Marco Idiart},
  title = {{Matrix Factorization using Window Sampling and Negative Sampling for Improved Word Representations}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2016},
  doi = {10.18653/v1/p16-2068},
}
Figure