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))