TL;DR
This paper reveals that cosine-similarity, a common metric for measuring semantic similarity between learned embeddings, can be surprisingly arbitrary and even meaningless. The authors demonstrate this by analyzing linear matrix factorization models, showing how regularization choices can lead to non-unique or counter-intuitive similarity results, and caution against its blind application.
What Problem Does This Paper Address?
In many machine learning domains, like natural language processing and recommender systems, discrete entities (words, items, users) are represented as dense, low-dimensional vectors called embeddings. A popular way to measure how semantically similar two entities are is by calculating the cosine-similarity between their corresponding embedding vectors. This metric is intuitive because it focuses on the direction of the vectors, assuming that vectors pointing in similar directions represent similar entities. However, empirical observations have shown that cosine-similarity doesn't always align with expected semantic similarity, sometimes performing worse than simpler methods like the unnormalized dot product. This paper aims to understand why this discrepancy occurs and to shed light on the underlying mechanisms that can render cosine-similarity unreliable.
Methods
The authors tackle this problem by analytically studying linear matrix factorization (MF) models. These models are chosen because they allow for closed-form solutions, making it easier to derive theoretical insights. They consider two common MF training objectives, both involving L2-norm regularization.
The key insight comes from analyzing the first objective, which regularizes the product of the factor matrices (ABᵀ). This objective is shown to be invariant to arbitrary rescalings of the columns of the embedding matrices (A and B) via a diagonal matrix D. This invariance means that even if the underlying model (X ≈ XABᵀ) is the same, different choices of D can lead to different cosine-similarities between embeddings, making them arbitrary and non-unique.
In contrast, the second objective, which regularizes the individual factor matrices (||XA|| + ||B||), leads to a unique solution (up to rotation). This uniqueness implies that cosine-similarities derived from this objective are more stable and less prone to arbitrariness.
Datasets
The paper uses simulated data for its experiments. The simulation involves generating user-item interactions based on predefined item clusters and user preferences. This approach allows the authors to have ground truth item-item similarities (based on cluster assignments) to compare against the cosine-similarities computed from learned embeddings. No standard public datasets are mentioned for training or evaluation.
Key Insights and Ideas
- Cosine-similarity's Achilles' Heel: Arbitrary Scaling: The core finding is that the first regularization scheme (regularizing ABᵀ) allows for arbitrary scaling of embedding dimensions. This scaling, controlled by a diagonal matrix D, directly impacts the normalization of embeddings and thus their cosine-similarity, leading to results that can be arbitrary and not unique, even for the same underlying model.
- Regularization Dictates Similarity: The choice of regularization is not just about model performance; it fundamentally influences what cosine-similarity measures. Regularizing the product (Objective 1) introduces arbitrariness, while regularizing individual matrices (Objective 2) leads to unique and more predictable similarity measures.
- "Meaningless" Similarities are Possible: In extreme cases, like with a full-rank MF model and specific scaling choices, item-item cosine-similarities can become zero for all distinct pairs of items, implying an item is only similar to itself. This highlights how cosine-similarity can become detached from true semantic relatedness.
- Deep Models Inherit the Problem: The authors hypothesize that deep learning models, which often employ a complex combination of regularizations across multiple layers, are likely to suffer from similar, if not more pronounced, issues of opaque and arbitrary cosine-similarities.
Key Results
The paper's key results are analytical and qualitative, demonstrating the potential for arbitrary cosine-similarities rather than reporting specific quantitative performance metrics on benchmark datasets.
- Analytical Derivations: The paper provides mathematical derivations showing how cosine-similarity between embeddings derived from the first MF objective can be made arbitrary by choosing different diagonal scaling matrices D.
- Illustrative Examples: Two specific cases for a full-rank MF model are presented to illustrate how different choices of D lead to drastically different item-item cosine-similarities, including a bizarre result where all distinct items have zero similarity.
- Experimental Illustration: Figure 1 visually demonstrates the variability of item-item cosine-similarities on simulated data, showing how different scaling choices (after training with Objective 1) produce vastly different similarity matrices compared to the unique result from Objective 2.
Limitations and Future Work
- Focus on Linear Models: The analytical insights are derived for linear matrix factorization models. While the authors suggest these issues extend to deep models, the direct analytical proof is not provided for those more complex architectures.
- Simulated Data: Experiments are conducted on simulated data, which allows for ground truth but may not fully capture the complexities of real-world datasets.
- Future Work: The paper suggests exploring remedies such as training models directly for cosine-similarity (potentially facilitated by layer normalization) or avoiding the embedding space altogether by applying similarity measures in the original space. They also point to the need for further investigation into how various regularization techniques in deep models implicitly affect embedding similarities.
Summary updated