dify icon indicating copy to clipboard operation
dify copied to clipboard

Retrieval Test return defferent result when i check the rerank settings card in the Hybrid Search

Open SuperZhanggy opened this issue 4 months ago • 2 comments

Self Checks

  • [x] I have read the Contributing Guide and Language Policy.
  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report, otherwise it will be closed.
  • [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

when i select Rerank Model and click save, it return nothing.

Image

when i select Weighted Score and click save, it return the corrent result.

✔️ Expected Behavior

I think that choosing different settings card, but the same settings, should return the same results.

❌ Actual Behavior

No response

SuperZhanggy avatar Dec 24 '25 12:12 SuperZhanggy

我在检索测试里,相同的设置,选择 Rerank 模型 和选择权重设置,检索同一个问题,检索的结果不一样,为啥,这里难道不只是切换设置项吗?

SuperZhanggy avatar Dec 24 '25 12:12 SuperZhanggy

这两个设置其实背后用的是完全不同的检索排序逻辑,不只是切换配置项那么简单。

“权重设置”模式(Weighted Score)是通过你设定的向量和关键词权重,把两种分数加权后排序,属于“加权融合”方式。你可以直接调节权重,结果就是分数线性组合。

“Rerank模型”模式则是先用初步检索(比如向量或关键词),再把候选结果交给一个训练好的Rerank模型(比如跨编码器等)做二次排序,这个模型会根据语义相关性重新打分排序,和简单加权完全不同。

所以即使其它参数(top_k、阈值等)一样,两个模式的底层排序算法不同,结果自然会有差异。这是预期行为,不是简单的UI切换。你可以理解为“权重设置”是规则融合,“Rerank模型”是AI模型二次判别,结果不可能完全一致。

如果你在“Rerank模型”模式下点保存没反应,通常是没有选定具体的Rerank模型,UI会报错提示,建议检查下模型选择栏是否已选中模型,否则不会执行检索逻辑(详见代码实现)。

底层检索服务会根据你选择的模式,把不同参数传给后端,决定用哪种排序方式(见后端实现)。所以结果不同是正常的。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 24 '25 12:12 dosubot[bot]