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 永远比对不到。