FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

Tutorials/2_Metrics /2.1_Similarity_Metrics.ipynb 示例中的最终结论写反

Open 1104056452 opened this issue 2 months ago • 1 comments

在 Tutorials/2_Metrics/2.1_Similarity_Metrics.ipynb 的最后一个示例中,结论应该写反了。

根据计算结果:

  • 欧氏距离:sentence 1 和 3 的距离更小(0.593 < 0.715)
  • 余弦相似度:sentence 1 和 3 的相似度更高(0.824 > 0.745)

因此应该是:

sentence 1 and 3 are more similar than sentence 1 and 2

而当前教程写成了 sentence 1 and 2 更相似。

1104056452 avatar Sep 16 '26 09:09 1104056452

确认:cell 48 的结论方向写反了,而且 notebook 里保存的运行输出就能直接证明。

Cell [45](欧氏距离,bge-large-en-v1.5 的实际输出)

  • s1-s2:0.7146
  • s1-s3:0.5931 ← 更近

Cell [47](余弦相似度)

  • s1-s2:0.7447
  • s1-s3:0.8241 ← 更相似

即按 notebook 自己的运行结果,embedding 判定 s1 与 s3 更相似,与 cell [38] 的语义设定一致(s1≈s3;s2 因 watch/show 词性对调含义不同)。cell [48] 写成 "sentence 1 and 2 should be more similar than sentence 1 and 3",恰好把方向说反了。

建议改为:

Using embeddings, we get the correct result, unlike Jaccard similarity: sentence 1 and 3 are more similar than sentence 1 and 2 under both Euclidean distance and cosine similarity.

另外一个补充提醒:我用同家族小号 bge-small-en-v1.5 复跑,排序会翻转(s1-s2 余弦 0.9008 > s1-s3 0.8367,欧氏 0.4454 < 0.5715)——这个教学例子依赖 large 模型的语义能力。修正文案时建议注明结论基于 bge-large-en-v1.5,或者顺手加一句"小模型可能得出相反的排序",本身就是一个很好的教学点。

JingHao-Leon avatar Sep 22 '26 17:09 JingHao-Leon