Why does PairDiff work? - A Mathematical Analysis of Bilinear Relational Compositional Operators for Analogy Detection

Huda Hakami, Kohei Hayashi, Danushka Bollegala

  • A Mathematical Analysis of Bilinear Relational Compositional Operators for Analogy Detection

Authors: Huda Hakami (University of Liverpool), Kohei Hayashi (Preferred Networks), Danushka Bollegala (University of Liverpool)

Abstract

The "vector offset" method, or PairDiff (e.g., $king - man + woman = queen$), is a cornerstone of modern Natural Language Processing for identifying semantic relations. Despite its widespread use, the theoretical reasons for its effectiveness have remained under-explored. This paper provides a rigorous mathematical justification for PairDiff by analyzing it within the framework of a general bilinear operator. We prove that under the conditions of standardized and uncorrelated embedding dimensions, the most general bilinear operator simplifies to a linear combination equivalent to PairDiff. Empirical verification across multiple embedding models—including Skip-Gram, CBOW, GloVe, and LSA—confirms that these statistical conditions are naturally met in practice, explaining why complex interaction models often collapse into simple vector subtraction.

1. Introduction

In NLP, representing the relation between two words (e.g., Paris and France) as a single vector is essential for tasks like analogy detection and knowledge base completion. While one could learn a specific vector for every relation, compositional operators that combine word vectors into a "relation vector" are more scalable. PairDiff, which uses simple vector subtraction, is the most popular of these operators.

Critics have questioned whether PairDiff is too simplistic and if more complex bilinear operators—which allow for intricate interactions between the dimensions of the two word vectors—would offer superior performance. This study sets out to determine if these complex operators provide additional value or if they naturally converge to the simplicity of PairDiff.

2. Theoretical Framework: The General Bilinear Operator

The authors analyze a general bilinear operator defined as: $$r(h, t) = h^\top \mathbf{A} t + \mathbf{P}h + \mathbf{Q}t$$ Where $h$ and $t$ are the "head" and "tail" word embeddings, $\mathbf{A}$ is a 3-way tensor representing pairwise interactions between every dimension of $h$ and $t$, and $\mathbf{P}$ and $\mathbf{Q}$ are matrices representing the individual contributions of each word.

The core of the paper's theoretical contribution is a proof showing that if word embeddings are standardized (zero mean, unit variance) and uncorrelated (dimensions are independent), the interaction term ($h^\top \mathbf{A} t$) becomes irrelevant for minimizing relational distance. Under these specific conditions, the optimal operator simplifies to a linear combination: $r(h, t) = \mathbf{P}h + \mathbf{Q}t$.

3. Empirical Verification of Assumptions

To test the validity of the "uncorrelated" assumption in real-world scenarios, the authors examined a wide variety of word embedding models: Skip-Gram (SG), CBOW, GloVe, LSA (Latent Semantic Analysis), LDA (Latent Dirichlet Allocation), and HSC (Hierarchical Sparse Coding).

As illustrated in Figure 1, the empirical results strongly support the theoretical assumptions. For models like SG, CBOW, GloVe, and LSA, the cross-dimensional correlation is extremely low, with a mean absolute pairwise correlation typically less than 0.06.

Figure 1: Cross-dimensional correlation distributions for six word embedding models. The narrow distributions around zero validate the authors' theoretical assumption that embedding dimensions are largely uncorrelated in practice. *[Why does PairDiff work?

  • A Mathematical Analysis of Bilinear Relational Compositional Operators for Analogy Detection, page 8](/pdf/art_cac3d96604fc4d34b8b126dd053d1cbf#page=8)*

4. Results and Discussion

The researchers trained the general bilinear operator on the BATS (Bigger Analogy Test Set) to see which parameters the model would prioritize. The findings were conclusive:

  • Tensor Decay: During optimization, the Frobenius norm of the interaction tensor $\mathbf{A}$ dropped significantly, confirming that the complex interaction term does not contribute to solving the analogy task when embeddings are well-behaved.
  • Convergence to PairDiff: The learned matrices $\mathbf{P}$ and $\mathbf{Q}$ tended to become $c\mathbf{I}$ and $-c\mathbf{I}$ (where $\mathbf{I}$ is the identity matrix). This means the model learned that the optimal way to represent a relation is to take the first word, multiply it by a constant, and subtract the second word—exactly the mechanism of PairDiff.
  • Generalization: The operators learned on BATS performed as well as standard PairDiff on the SAT and SemEval 2012 Task 2 benchmarks. This demonstrates that even when given the capacity for greater complexity, the model "chooses" the simplicity of PairDiff because it is theoretically sufficient.

5. Conclusion and Future Work

This research provides a formal mathematical bridge between the heuristic success of the vector offset method and the statistical properties of modern word embeddings. It shows that PairDiff is not just a lucky trick but a mathematically optimal solution for relational composition when dimensions are uncorrelated.

While this analysis focuses on bilinear operators and Euclidean distance, future work could extend this framework to non-linear operators, such as those used in deep neural networks, to determine if the "simplicity is best" rule holds in more complex architectures.

Summary updated

BibTeX
@inproceedings{hakami2018why,
  author = {Huda Hakami and Kohei Hayashi and Danushka Bollegala},
  title = {{Why does PairDiff work? - A Mathematical Analysis of Bilinear Relational Compositional Operators for Analogy Detection}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2018},
  url = {https://openreview.net/forum?id=ocvpJD_wCkE},
}

Loading related content...

Figure