arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.05440cs.IRcs.LG
收藏

嵌入的余弦相似度真的关乎相似度吗?

Is Cosine-Similarity of Embeddings Really About Similarity?

Netflix Inc.(Netflix公司);Cornell University(康奈尔大学)

Harald Steck, Chaitanya Ekanadham, Nathan Kallus

AI总结:

该研究针对嵌入余弦相似度效果不稳定的现象,通过正则化线性模型的解析推导证明其可能产生无意义甚至任意的相似度,且受正则化隐性影响,进而指出深度模型中该问题更复杂,警示勿盲目使用并提出替代方向。

摘要:

余弦相似度是两个向量夹角的余弦值,等价于向量归一化后的点积。一种流行的应用是对学习到的低维特征嵌入计算余弦相似度,以此量化高维对象间的语义相似度。实践中,该方法有时效果优于嵌入向量间的未归一化点积,有时却更差。为深入理解这一经验现象,我们研究了正则化线性模型导出的嵌入,这类模型的闭式解便于开展分析推导。我们通过解析推导证明,余弦相似度可能产生任意的、因而毫无意义的“相似度”。部分线性模型下的相似度甚至不具备唯一性,而另一些线性模型的相似度则由正则化项隐性控制。我们探讨了这些发现对线性模型之外的启示:深度模型训练中会组合使用多种正则化方式,当对最终得到的嵌入计算余弦相似度时,这些正则化会产生隐性且非预期的影响,导致结果不透明甚至可能是任意的。基于这些发现,我们警示不要盲目使用余弦相似度,并概述了替代方案。

英文摘要:

Cosine-similarity is the cosine of the angle between two vectors, or equivalently the dot product between their normalizations. A popular application is to quantify semantic similarity between high-dimensional objects by applying cosine-similarity to a learned low-dimensional feature embedding. This can work better but sometimes also worse than the unnormalized dot-product between embedded vectors in practice. To gain insight into this empirical observation, we study embeddings derived from regularized linear models, where closed-form solutions facilitate analytical insights. We derive analytically how cosine-similarity can yield arbitrary and therefore meaningless `similarities.' For some linear models the similarities are not even unique, while for others they are implicitly controlled by the regularization. We discuss implications beyond linear models: a combination of different regularizations are employed when learning deep models; these have implicit and unintended effects when taking cosine-similarities of the resulting embeddings, rendering results opaque and possibly arbitrary. Based on these insights, we caution against blindly using cosine-similarity and outline alternatives.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑