Why score of bge-reranker-v2-gemma is over 1? #12893

Closed
opened 2026-02-21 19:09:33 -05:00 by yindo · 4 comments
Owner

Originally created by @Lizsxx on GitHub (Apr 14, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I use bge-reranker-v2-gemma for rerank. Why all the scores are over 1?
I never met the same when I use other reranker.

✔️ Expected Behavior

The scores should be no more than 1.

Actual Behavior

All the scores are over 1.

Image

Originally created by @Lizsxx on GitHub (Apr 14, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I use **bge-reranker-v2-gemma** for rerank. Why all the scores are over 1? I never met the same when I use other reranker. ### ✔️ Expected Behavior The scores should be no more than 1. ### ❌ Actual Behavior All the scores are over 1. ![Image](https://github.com/user-attachments/assets/66dc193f-de8e-475b-bcae-2d401e421449)
yindo added the 🙋‍♂️ question label 2026-02-21 19:09:33 -05:00
yindo closed this issue 2026-02-21 19:09:33 -05:00
Author
Owner

@crazywoola commented on GitHub (Apr 15, 2025):

Please try to upgrade to v1.2.0

@crazywoola commented on GitHub (Apr 15, 2025): Please try to upgrade to v1.2.0
Author
Owner

@Lizsxx commented on GitHub (Apr 16, 2025):

Please try to upgrade to v1.2.0

I‘ve updated to v1.2.0, but it dosen't work.
Actually, it doesn't have big impact to retrive or rerank though, it only let Score Threshold not working.

@Lizsxx commented on GitHub (Apr 16, 2025): > Please try to upgrade to v1.2.0 I‘ve updated to v1.2.0, but it dosen't work. Actually, it doesn't have big impact to retrive or rerank though, it only let Score Threshold not working.
Author
Owner

@crazywoola commented on GitHub (Aug 7, 2025):

@dosu

@crazywoola commented on GitHub (Aug 7, 2025): @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Aug 7, 2025):

The reason you see bge-reranker-v2-gemma scores over 1 in Dify is that Dify does not normalize or cap reranker scores—it simply uses whatever value the reranker model/plugin returns. Some rerankers (especially OpenAI-compatible ones) apply a normalization that scales scores from 01 to 0100, but for most custom or plugin-based rerankers like bge-reranker-v2-gemma, the score range depends on the model implementation itself. Dify's Score Threshold feature compares the literal score, so if your reranker outputs scores above 1, you need to set the threshold accordingly. If you want scores in a specific range (like 0~1), you would need to normalize them in your reranker plugin or modify the backend code to apply normalization before the threshold is used. Dify core will not do this automatically for you, and this is expected behavior for plugin-based rerankers (source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Aug 7, 2025): <!-- Answer --> The reason you see bge-reranker-v2-gemma scores over 1 in Dify is that Dify does not normalize or cap reranker scores—it simply uses whatever value the reranker model/plugin returns. Some rerankers (especially OpenAI-compatible ones) apply a normalization that scales scores from 0~1 to 0~100, but for most custom or plugin-based rerankers like bge-reranker-v2-gemma, the score range depends on the model implementation itself. Dify's Score Threshold feature compares the literal score, so if your reranker outputs scores above 1, you need to set the threshold accordingly. If you want scores in a specific range (like 0~1), you would need to normalize them in your reranker plugin or modify the backend code to apply normalization before the threshold is used. Dify core will not do this automatically for you, and this is expected behavior for plugin-based rerankers [(source)](https://github.com/langgenius/dify/blob/1c60b7f0704c5b718c37bd71ca05b520f9a1d24b/api/core/rag/rerank/rerank_model.py). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/93beeba5-f0f3-45e8-b2ad-1baa9a12b6b0?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/18030)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12893