菜单

关于 🐙 GitHub
arXiv 提交日期: 2026-02-23
📄 Abstract - In Defense of Cosine Similarity: Normalization Eliminates the Gauge Freedom

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 theory
详细标签: embedding normalization cosine similarity gauge freedom matrix factorization distance metric 或 搜索:

为余弦相似度辩护:归一化消除了规范自由度 / In Defense of Cosine Similarity: Normalization Eliminates the Gauge Freedom


1️⃣ 一句话总结

这篇论文反驳了先前关于余弦相似度存在缺陷的观点,指出问题的根源并非余弦相似度本身,而是没有对嵌入向量进行归一化处理,只要将向量约束在单位球面上,余弦相似度就与欧氏距离等价且结果唯一稳定。

源自 arXiv: 2602.19393