From 6e752aa904face51b56bb4f869c044e4a212d9a4 Mon Sep 17 00:00:00 2001 From: xiaoyi Date: Mon, 12 Oct 2026 02:42:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(distill):=20=E8=AF=84=E5=88=86=E9=97=B8?= =?UTF-8?q?=E9=97=A8=E9=98=88=E5=80=BC=E9=87=8D=E6=A0=87=E5=AE=9A=EF=BC=88?= =?UTF-8?q?0.7/0.8=20=E2=86=92=20=E5=8F=AF=E6=A0=87=E5=AE=9A=200.30/0.30?= =?UTF-8?q?=EF=BC=8C=E4=BB=8D=E5=BD=B1=E5=AD=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 旧阈值 overall<0.7 && vd<0.8 从未被真实分布验证——它是在「旧 prompt 示例分数被 照抄 ⇒ overall 恒为 0.755」这个 bug 上拍出来的,闸门从未真正丢过任何东西。 实测(4 天 2065 条可用评分,local/minicpm5-2b)真实分布: min=0.175 p25=0.390 中位=0.535 p75=0.600 p90=0.800 max=0.825 用 0.7 卡该分布 ⇒ 仅 17.9% 通过 ⇒ 一开闸即丢 82% 可用内容。 改为环境变量可标定,默认取分布 p10≈0.30 保守档(只丢明确垃圾): ZHIYI_SCORE_MIN_OVERALL / ZHIYI_SCORE_MIN_VD 取向:宁可多留(可逆,后续消费/降权会淘汰),不轻易丢(不可逆)。 影子模式(ZHIYI_SCORE_SHADOW 默认开)未改动 —— 本次不真丢,只观察。 --- go/internal/distill/engine.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/go/internal/distill/engine.go b/go/internal/distill/engine.go index 6ed6094..0311240 100644 --- a/go/internal/distill/engine.go +++ b/go/internal/distill/engine.go @@ -12,6 +12,7 @@ import ( "math/rand" "net/http" "os" + "strconv" "strings" "sync" "sync/atomic" @@ -147,6 +148,38 @@ func IsDegenerateScore(s FiveDScore) bool { // 设环境变量 ZHIYI_SCORE_SHADOW=0 关闭影子(= 恢复真拦)。 var scoreShadowMode = os.Getenv("ZHIYI_SCORE_SHADOW") != "0" +// ─── 评分闸门阈值(2026-10-12 重标定)──────────────────────── +// +// 背景:旧阈值 overall<0.7 && vd<0.8 从未被真实分布验证 —— 它是在 +// 「旧 prompt 示例分数被照抄 ⇒ overall 恒为 0.755」这个 bug 上拍出来的, +// 闸门从未真正丢过任何东西(恒 ≥0.7)。 +// +// 实测(4 天 2065 条可用评分,local/minicpm5-2b)真实分布: +// +// min=0.175 p25=0.390 中位=0.535 p75=0.600 p90=0.800 max=0.825 +// +// 用 0.7 卡这个分布 ⇒ 仅 17.9% 能过 ⇒ 一开闸就丢 82% 可用内容。 +// +// 新默认取分布 p10≈0.30 的保守档:只丢「明确垃圾」。 +// 取向:宁可多留(可逆 —— 后续消费/降权机制会自然淘汰),不轻易丢(不可逆)。 +// 影子模式下可用环境变量随时重标定,无需改代码: +// +// ZHIYI_SCORE_MIN_OVERALL / ZHIYI_SCORE_MIN_VD +var ( + scoreMinOverall = envFloat("ZHIYI_SCORE_MIN_OVERALL", 0.30) + scoreMinVD = envFloat("ZHIYI_SCORE_MIN_VD", 0.30) +) + +// envFloat 读浮点环境变量,缺省/非法则用 def。 +func envFloat(key string, def float64) float64 { + if v := os.Getenv(key); v != "" { + if f, err := strconv.ParseFloat(v, 64); err == nil { + return f + } + } + return def +} + // ─── 蒸馏引擎 ──────────────────────────────────────────────── // Engine 蒸馏引擎 @@ -483,7 +516,7 @@ func (e *Engine) distillOne(input DistillInput) DistillResult { log.Printf("[distill] score for %s: overall=%.3f is=%.2f su=%.2f pa=%.2f vd=%.2f ru=%.2f", input.EpisodeID, overall, score.IS, score.SU, score.PA, score.VD, score.RU) - if overall < 0.7 && score.VD < 0.8 { + if overall < scoreMinOverall && score.VD < scoreMinVD { // 人侧短事实(画像/心迹/牵挂/偏好/习惯/目标)是用户亲口陈述, // LLM 打分天然偏低(短、无上下文),不应因分数被丢弃——否则"牧尘不在招商局工作" // 这类关键事实永远到不了 memories,t6 永远比对不到。