FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

sparse得分

Open comateT opened this issue 1 year ago • 1 comments

sentence_1 = ["What is BGE M3?"] sentence_2 = ["What is BGE M3?"] 经过模型解码后得到稀疏向量: sentence_1 : {'What': 0.0836, 'is': 0.08154, 'B': 0.1295, 'GE': 0.252, 'M': 0.17, '3': 0.2695, '?': 0.04074} sentence_2: {'What': 0.0836, 'is': 0.08154, 'B': 0.1295, 'GE': 0.252, 'M': 0.17, '3': 0.2695, '?': 0.04074}

score = 0.1971435546875

如上,两个完全相同的句子,按照现在稀疏向量得分计算权重相乘的方式,sparse 得分0.19,不符合常理。稀疏向量得分计算是否存在问题,还有优化空间?求解答

comateT avatar Mar 15 '24 09:03 comateT

  1. 所有模型都不完美,存在优化空间
  2. 稀疏向量模型(包括bm25)根据单词重要性计算分数,并没有对分数进行归一化,分数不存在像稠密向量相似度那样分布在[-1,1]区间。同时排序任务主要关注相对大小,而不是绝对值大小。因此,这个得分是在预期之内的。当然,如果您有更好的计算分数的方式,欢迎讨论。

staoxiao avatar Mar 15 '24 10:03 staoxiao