[Bug]: 自定义重排把 Qwen3-Reranker 标成无界 logit,vLLM 实际返回 0~1 概率
Affected Component
Backend Service & API / Frontend UI(模型配置文案)
Bug Description
自定义、LiteLLM、GPUStack 的「Rerank 分数标度」把 Qwen3-Reranker 写成无界 logit。按官方 vLLM 配方部署的 Qwen3-Reranker,/v1/rerank 的 relevance_score 已经是 0~1 的 yes 概率。选 logit 后 WeKnora 再做一次 sigmoid,分数被压进约 0.50~0.73。再叠加 CompositeScore = 0.6*模型分 + 0.3*检索底分 + 0.1,重排信号被检索底分盖过,金标页从模型自己的第 1 名掉到第 2~5 名。
界面与注释:
internal/models/providers/generic.go、litellm.go、gpustack.go:选项文案Unbounded score (Qwen3-Reranker class)/无界分数(Qwen3-Reranker 一类),值为logitinternal/models/legacy_keys.go:Qwen3-Reranker-class models an unbounded scorewebsite-docs/03-features/06-models.md:logit(无界分数,Qwen3-Reranker 一类)
GPUStack 提供商默认 ScoreScale=logit 的注释引用了 https://docs.gpustack.ai/2.0/user-guide/rerank-api/。该页示例模型是 bge-reranker-v2-m3,返回 1.952 / -3.735 / -6.158,不是 Qwen3-Reranker。不能据此把整个 Qwen3-Reranker 族标成无界。
Steps to Reproduce
- 用 vLLM 官方配方启动 Qwen3-Reranker-0.6B(vLLM
v0.32.0):
vllm serve Qwen/Qwen3-Reranker-0.6B \
--hf-overrides '{"architectures":["Qwen3ForSequenceClassification"],"classifier_from_token":["no","yes"],"is_original_qwen3_reranker":true}' \
--chat-template qwen3_reranker_score.jinja
配方与上游示例一致:https://github.com/vllm-project/vllm/blob/main/examples/pooling/score/qwen3_reranker_online.py。classifier_from_token: ["no","yes"] 得到的是两类 softmax,即概率。
-
POST /v1/rerank,同一查询、17 个候选。实测relevance_score落在 0.0177~0.9996,没有负数,也没有大于 1 的值。 -
在 WeKnora 里用自定义厂商注册该模型,按界面文案把
extra_config.score_scale设为logit。 -
normalizeScore(internal/models/rerank/protocol.go)对 logit 做 sigmoid。sigmoid(0.9996)=0.731,sigmoid(0.0177)=0.504。原先约 0.98 的跨度变成约 0.23。 -
internal/reranking/rerank.go的CompositeScore用0.6*modelScore + 0.3*baseScore + 0.1排序。模型项只剩约 0.14 的活动范围,检索底分把顺序改掉。
Expected Behavior
- vLLM 这条
/v1/rerank应按probability使用,不再 sigmoid。 - 选项文案不要把「Qwen3-Reranker 一类」等同于无界 logit。GPUStack 返回 logit(含其 BGE 示例)应写成该提供商的行为,而不是 Qwen3-Reranker 模型族的属性。
- 文档应写明:按端点实测选择;vLLM
classifier_from_token是 0~1 概率。
Actual Behavior
同一批关闭重排取出的候选上,直接比较名次(C 库,3 道 bge 排第 1 的题):
| 题 | Qwen 原始分名次 | 当作 logit 再合成后 | BGE 合成后 |
|---|---|---|---|
| 题 1 | 1 | 2 | 1 |
| 题 2 | 1 | 2 | 1 |
| 题 3 | 1 | 5 | 1 |
题 1 的 Qwen 前三名原始分是 0.9996 / 0.9995 / 0.9995,sigmoid 后全部挤在 0.731 附近,合成公式只能靠检索底分拆开。
50 题、6 个知识库、其余检索参数不变(embedding_top_k=45,阈值 0.25/0.25,rerank_top_k=20,rerank_threshold=0.2,rrf_k=60,权重 0.7/0.3):
| 指标 | bge-reranker-v2-m3 | Qwen 且 score_scale=probability | Qwen 且 score_scale=logit |
|---|---|---|---|
| 严格口径 P@1(六库平均) | 37.0% | 27.3% | 25.7% |
| 整图口径 P@1(六库平均) | 42.7% | 33.0% | 30.0% |
logit 比 probability 更差,两者都低于 bge。头部饱和(多个非金标块也到 0.999)是模型区分度问题;把概率再 sigmoid 是 WeKnora 标度文案导致的确定错误。检索 meta 也能对上:probability 时 top_score≈0.999,logit 时 top_score≈0.731。
WeKnora Version
App Version: v0.8.3(wechatopenai/weknora-app:v0.8.3)。对照的源码是 v0.8.3 树中的上述文件,与当前文档一致。
Deployment Method
Docker Compose
Operating System
Linux(服务端)
Relevant Logs
无异常日志。重排 outcome=ok。问题是分数被静默换算,阈值比较和排序都继续进行。
Confirmation
已搜索现有 issue。#4516 是 SGLang 返回裸数组、无法解包,与分数标度无关。未找到把 Qwen3-Reranker 标成无界 logit 的报告。
I'd like to take this. I confirmed the current generic/LiteLLM/GPUStack provider fields associate Qwen3-Reranker with logits, while score normalization is already configurable per endpoint. I will correct the selector guidance and model documentation to describe the endpoint's output scale rather than the model family, explicitly document the vLLM no/yes Qwen3 recipe as probability, and clarify the GPUStack BGE example without silently migrating existing configurations or changing provider defaults. I'll verify the real resolver/normalization path with representative probability and logit responses and run the affected model package checks. This is an intent to work, not a maintainer assignment.