Skip to content
aiqbench takeMachine Learning

aiqbench analysis

This paper clarifies that the perceived instability of cosine similarity in matrix factorization stems from unnormalized embeddings rather than a fundamental flaw in the metric itself. By constraining embeddings to the unit sphere, the authors prove that cosine distance becomes mathematically equivalent to half the squared Euclidean distance, ensuring consistent neighbor rankings. Practitioners should prioritize normalization during or after training to eliminate gauge freedom and validate their similarity computations.
Sources coveringarXiv, AI Alignment Forum, Latent Space, LessWrong
What this isA model's reading of the article and related coverage, written for aiqbench. Not the publisher's words.

In Defense of Cosine Similarity: Normalization Eliminates the Gauge Freedom

arXiv2 min read

arXiv:2602.19393v2 Announce Type: replace Abstract: Steck, Ekanadham, and Kallus [arXiv:2403.05440] demonstrate that cosine similarity of learned embeddings from matrix factorization models can be rendered arbitrary by a diagonal ``gauge'' matrix $D$. Their result is correct and important for practitioners who compute cosine similarity on embeddings trained with dot-product objectives. However, we argue that their conclusion, cautioning against cosine similarity in general, conflates the pathology of an incompatible training objective with the geometric validity of cosine distance on the unit sphere. We prove that when embeddings are constrained to the unit sphere $\mathbb{S}^{d-1}$ (either during or after training with an appropriate objective), the $D$-matrix ambiguity vanishes identically, and cosine distance reduces to exactly half the squared Euclidean distance. This monotonic equivalence implies that cosine-based and Euclidean-based neighbor rankings are identical on normalized embeddings. The ``problem'' with cosine similarity is not cosine similarity, it is the failure to normalize.

Abstract:Steck, Ekanadham, and Kallus [arXiv:2403.05440] demonstrate that cosine similarity of learned embeddings from matrix factorization models can be rendered arbitrary by a diagonal ``gauge'' matrix $D$. Their result is correct and important for practitioners who compute cosine similarity on embeddings trained with dot-product objectives. However, we argue that their conclusion, cautioning against cosine similarity in general, conflates the pathology of an incompatible training objective with the geometric validity of cosine distance on the unit sphere. We prove that when embeddings are constrained to the unit sphere $\mathbb{S}^{d-1}$ (either during or after training with an appropriate objective), the $D$-matrix ambiguity vanishes identically, and cosine distance reduces to exactly half the squared Euclidean distance. This monotonic equivalence implies that cosine-based and Euclidean-based neighbor rankings are identical on normalized embeddings. The ``problem'' with cosine similarity is not cosine similarity, it is the failure to normalize.

Machine Learning (cs.LG)

arXiv:2602.19393 [cs.LG]

(or arXiv:2602.19393v2 [cs.LG] for this version)

https://doi.org/10.48550/arXiv.2602.19393 Focus to learn more arXiv-issued DOI via DataCite

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Full text under the publisher's open licence · 234 words

Related coverage