Revisiting Cosine Similarity via Normalized ICA-transformed Embeddings

Hiroaki Yamagiwa, Momose Oyama, Hidetoshi Shimodaira

Abstract

Cosine similarity is widely used to measure the similarity between two embeddings, while interpretations based on angle and correlation coefficient are common. In this study, we focus on the interpretable axes of embeddings transformed by Independent Component Analysis (ICA), and propose a novel interpretation of cosine similarity as the sum of semantic similarities over axes. The normalized ICA-transformed embeddings exhibit sparsity, enhancing the interpretability of each axis, and the semantic similarity defined by the product of the components represents the shared meaning between the two embeddings along each axis. The effectiveness of this approach is demonstrated through intuitive numerical examples and thorough numerical experiments. By deriving the probability distributions that govern each component and the product of components, we propose a method for selecting statistically significant axes.

Introduction

In Natural Language Processing, cosine similarity is the standard metric for measuring the relatedness of word or sentence embeddings. However, it is often treated as a "black box"; while it indicates that two vectors are close, it fails to explain why. Standard embeddings, and even those transformed by Principal Component Analysis (PCA), are dense, meaning that semantic information is distributed across hundreds of uninterpretable dimensions. This research addresses this interpretability gap by utilizing Independent Component Analysis (ICA) to find a transformation where each axis corresponds to a distinct semantic concept.

Methodology: Normalized ICA-transformed Embeddings

The authors propose using Normalized ICA-transformed Embeddings to decompose similarity scores. Unlike PCA, which maximizes variance, ICA searches for a rotation where components are as statistically independent as possible. This process naturally encourages sparsity, where most values are near zero and only a few significant features stand out.

Heatmap comparison of ICA and PCA transformed embeddings.

By normalizing embeddings to unit length after the ICA transformation, cosine similarity can be redefined as an additive sum of "semantic similarities" across axes:

$$\cos(w_i, w_j) = \sum_{\ell=1}^{d} \text{sem}_\ell(w_i, w_j)$$

where $\text{sem}_\ell$ is the product of the $\ell$-th components. This framework allows researchers to mathematically identify which axes are "statistically significant" for a given word pair by deriving theoretical probability distributions for the components and their products.

Key Insights and Results

Sparsity and Interpretability

ICA-transformed axes are significantly sparser than PCA axes. This sparsity allows humans to easily label dimensions based on top-weighted words (e.g., an axis featuring salts and chlorine as [chemistry]).

The "Aha" Moment of Decomposition

For the word pair ultraviolet and light, the total similarity is 0.485. The ICA transformation reveals that nearly 60% of that similarity originates from a single axis labeled [spectrum]. In contrast, PCA spreads that similarity across dozens of uninterpretable axes, obscuring the semantic connection.

Decomposition of cosine similarity for 'ultraviolet' and 'light'.

Semantic Ablation and Universal Geometry

The interpretability of these axes enables "semantic surgery." For instance, zeroing out a [female] axis in the embedding for woman increases its similarity to man, effectively neutralizing the gendered component. Furthermore, the study found that different models (like GPT-2 and BERT) often learn the same semantic axes, suggesting a universal semantic geometry across diverse architectures.

Conclusion

This work transforms cosine similarity from an opaque metric into a transparent sum of human-interpretable meanings. By leveraging the sparsity of ICA, the authors provide a robust framework for understanding the semantic drivers of embedding similarity. While ICA is more computationally expensive than PCA and currently requires some manual labeling, it offers a powerful tool for making embedding-based models more explainable and controllable.

Summary updated

BibTeX
@inproceedings{yamagiwa2025revisiting,
  author = {Hiroaki Yamagiwa and Momose Oyama and Hidetoshi Shimodaira},
  title = {{Revisiting Cosine Similarity via Normalized ICA-transformed Embeddings}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=5KMn1iOODi},
}
Figure