From 227e5f34533d74c0b55b60f8b0cb36aa0791a897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=94=AF?= Date: Tue, 24 Nov 2026 17:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=BA=A7=E5=88=86=E8=A7=A3=E6=97=A5?= =?UTF-8?q?=E5=BF=97=EF=BC=88ZHIYI=5FDECOMP=3D1=EF=BC=89=EF=BC=9Acosine=20?= =?UTF-8?q?/=20bias=20/=20pre=20/=20spec=5Ff=20/=20final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 牧尘 2026-11-24 17:0x 判决:判决性实验先于手术文本。 问题:生日案 0.956 压过真答案,胜负差来自偏置(加法项)还是 cosine(词面重合)? 来自偏置 ⇒ 偏置手术适用 来自 cosine ⇒ 病三比偏置深,刀重开 实现:Step 3.7 前快照 Score(=cosine),specificity 之后反推 pre=final/f,输出: cosine=原始向量分 / bias=四项加法偏置和 / pre=cosine+bias / spec_f / final 门控 ZHIYI_DECOMP=1,默认关 ⇒ 逐位等价现状。 判读:|bias| > |cosine 差| ⇒ 偏置决定胜负;反之 cosine 决定。 --- go/internal/storage/recall.go | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/go/internal/storage/recall.go b/go/internal/storage/recall.go index 7cbeae0..f8c74d3 100644 --- a/go/internal/storage/recall.go +++ b/go/internal/storage/recall.go @@ -1172,6 +1172,21 @@ func (p *RecallPipeline) recallUncached(ctx context.Context, query, namespace st } } + // ── 项级分解快照(2026-11-24 17:0x 牧尘判决:判决性实验先于手术文本)── + // + // 问题:「生日案 0.956 压过真答案」的胜负差,来自偏置(加法项)还是 cosine(词面重合)? + // 来自偏置 ⇒ 偏置手术适用;来自 cosine ⇒ 病三比偏置深,刀重开。 + // 本快照记录 Step 3.7 之前的分数 —— 此时 Score = cosine(fusionW=1.0 时 Step 3.6 不改值), + // 之后所有 += 都是条目先验偏置,最后 × specificityFactor。 + // 门控 ZHIYI_DECOMP=1,默认关 ⇒ 逐位等价现状。 + var decompBase []float64 + if os.Getenv("ZHIYI_DECOMP") == "1" { + decompBase = make([]float64, len(reranked)) + for i := range reranked { + decompBase[i] = reranked[i].Score + } + } + // Step 3.7: 来源加权偏置(2026-10-09 P0 修正) // // 修前的错位:λ 只加在 Step 4 之后的**展示分**上,而候选的取舍早已由 rerank+MMR 定死 @@ -1305,6 +1320,28 @@ func (p *RecallPipeline) recallUncached(ctx context.Context, query, namespace st } } + // ── 项级分解输出(2026-11-24 17:0x)── + // 格式:cosine=原始向量分 / bias=四项加法偏置之和 / pre=cosine+bias / spec=具体性因子 / final + // 判读:|bias| > |cosine 差| ⇒ 胜负由偏置决定(手术适用);反之由 cosine(词面重合)决定(刀重开) + if decompBase != nil { + for i := 0; i < len(reranked) && i < 5; i++ { + idx := reranked[i].Index + if idx < 0 || idx >= len(candidates) { + continue + } + final := reranked[i].Score + // 反推 pre:若被 specificity 乘过,final = pre × f + f := specificityFactor(candidates[idx].Content, &candidates[idx]) + pre := final + if f != 0 && f != 1.0 { + pre = final / f + } + cos := decompBase[i] + log.Printf("[recall][decomp] q=%q pos=%d id=%s cosine=%.6f bias=%+.6f pre=%.6f spec_f=%.4f final=%.6f", + query, i, candidates[idx].ID, cos, pre-cos, pre, f, final) + } + } + // Step 4: MMR diversity if tr != nil { tr.Stage("rerank_fusion", stRerank, len(reranked))