Geometric Relationship between Word and Context Representations

Jiangtao Feng, Xiaoqing Zheng

Abstract

Traditional word embeddings, such as Word2Vec and GloVe, are widely recognized for their effectiveness when evaluated using cosine similarity, yet they often perform poorly under Euclidean distance metrics. This paper investigates the underlying geometric reasons for this discrepancy. We demonstrate that standard training objectives only constrain word vectors to lie within the conic hull of their context vectors, leaving their magnitudes largely unconstrained. To address this, we propose a Hierarchical Gaussian Model (HGM-MAP) that forces word vectors into the convex hull of their contexts, effectively making them the geometric centroids. Our model achieves state-of-the-art results on word similarity and analogy tasks, particularly demonstrating a breakthrough in Euclidean distance performance and a robust capacity for handling polysemy through contextual shifting.

Introduction

In Natural Language Processing (NLP), representing words as dense vectors is a foundational technique. A long-standing "folk wisdom" in the field suggests that cosine similarity is the only reliable metric for comparing these vectors, as Euclidean distance often yields poor results. This paper seeks to understand why this is the case and proposes a mathematical framework to bridge the gap between word vectors and the contexts in which they appear.

The authors argue that if word embeddings truly captured the "distributional hypothesis"—the idea that a word's meaning is defined by its company—the word vector should ideally be the central point of its context vectors. However, standard models do not strictly enforce this, leading to embeddings where vector magnitude acts as noise that interferes with distance-based measurements.

Methods

Theoretical Analysis: Conic vs. Convex Hull

The researchers first analyzed prediction-based models like Skip-gram and CBOW. They mathematically derived that in these models, a word vector ($v_w$) is constrained only to the conic hull of its context vectors ($u_c$). This means the word vector points in the same general direction as its contexts, but its length is not strictly tied to them. This explains why cosine similarity (which ignores magnitude) works, while Euclidean distance (which considers magnitude) fails.

The HGM-MAP Model

To rectify this, the authors proposed a Hierarchical Gaussian Model (HGM). They assume context vectors are drawn from a Gaussian distribution centered at the target word vector: $u_c \sim \mathcal{N}(v_w, \sigma^2 I)$. By applying Maximum A Posteriori (MAP) estimation and a cross-entropy loss, the model forces the word vector to belong to the convex hull of its contexts. This effectively makes the word vector the "centroid" or average of its contexts, ensuring both direction and magnitude carry semantic information.

Multi-Sense Extension

To handle polysemy, the model employs a simple geometric shift. A general word vector is moved toward a specific context vector: $v_{w|c} = (1 - \lambda)v_w + \lambda u_c$. This allows the model to represent a word's specific meaning in a given sentence (e.g., distinguishing "blackberry" as a fruit versus a mobile device) without needing complex multi-prototype architectures.

Key Results

The Euclidean Breakthrough

The most significant finding was the dramatic improvement in Euclidean distance performance. On the WordSim353 task, the proposed model achieved a Spearman correlation of 0.7049 using Euclidean distance, compared to just 0.3787 for CBOW and 0.4143 for Skip-gram. This empirical evidence supports the theory that constraining vectors to the convex hull eliminates "magnitude noise."

Comparison of word similarity performance using Cosine (Cos) and Euclidean Distance (ED) across different models.

Qualitative Polysemy Analysis

The model's ability to handle multiple meanings was demonstrated through nearest-neighbor analysis. When the word "blackberry" appears near words like "jam," its neighbors shift toward other fruits. Conversely, when used near "iPhone," its neighbors shift toward technology terms. This confirms that the contextual shifting mechanism effectively captures subtle semantic variations.

Qualitative examples of nearest neighbors for polysemous words using the contextual shifting mechanism.

Analogy and Downstream Tasks

The model also excelled in analogy tasks, reaching 78.7% accuracy on the Google analogy dataset, significantly outperforming GloVe (61.2%). Furthermore, it showed competitive performance in downstream tasks like POS-tagging and Chunking, proving that better geometric foundations translate to practical NLP utility.

Conclusion

This paper provides a rigorous geometric explanation for the limitations of traditional word embeddings. By moving from conic to convex hull constraints via the HGM-MAP model, the authors demonstrate that vector magnitude can be a meaningful semantic feature rather than just noise. While modern Transformer-based models have since shifted the landscape toward dynamic embeddings, the geometric insights provided here remain fundamental to our understanding of vector space semantics.

Summary updated

BibTeX
@inproceedings{feng2018geometric,
  author = {Jiangtao Feng and Xiaoqing Zheng},
  title = {{Geometric Relationship between Word and Context Representations}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.1609/aaai.v32i1.11986},
}
Figure