fix(eval): 金标集 per-item namespace —— 修「ID 指标按构造恒 0」

实测根因(2026-10-14,查 LanceDB 得到):金标的 expected_id 分散在
hermes-main / domain:HUB / soulful-xiaowei / wiki / shared 多个 namespace,
而 eval 只用请求里的单一 ns(hermes)召回 ⇒ 所有 ID 类指标必然为 0。
这不是「基线漂移」(我先前两次判断都错在这里)。

同时暴露金标集本身的问题:4 条(#1/#9/#11/#12)共用同一 expected_id、
多条基线内容与 query 不匹配(如「图谱扩展机制」钉的是「待处理织忆图谱更新」)。
⇒ 框架没问题,数据是烂的。

改动:
- GoldenSetItem 加 Namespace 字段;RunGolden 用 item.Namespace(空则回落到请求 ns)。
- 金标集 14/14 条补 namespace=hermes-main(内容实际所在),基线随后用
  golden-check.py --refresh 按当前 top-1 重建。
- 同口径修 Python 量具 golden-check.py(recall 支持 namespace 参数)。
This commit is contained in:
小唯
2026-10-14 10:21:42 +08:00
parent faf71cbe99
commit 88d466d156
2 changed files with 199 additions and 119 deletions
+14 -4
View File
@@ -19,9 +19,14 @@ type GoldenSetItem struct {
Query string `json:"query"`
ExpectedIDs []string `json:"expected_ids"`
MustIncludeKeywords []string `json:"must_include_keywords"`
Category string `json:"category,omitempty"`
Difficulty string `json:"difficulty,omitempty"`
IDBaseline string `json:"id_baseline,omitempty"`
// Namespace 该条目应在哪个 namespace 里召回。为空则用请求传入的 ns。
// 为什么必须 per-item(2026-10-14 实测):金标的 expected_id 分散在
// hermes-main / domain:HUB / soulful-xiaowei / wiki / shared 等多个 ns,
// 而 eval 只按请求里的单一 ns 召回 ⇒ ID 类指标**按构造恒为 0**(不是召回差)。
Namespace string `json:"namespace,omitempty"`
Category string `json:"category,omitempty"`
Difficulty string `json:"difficulty,omitempty"`
IDBaseline string `json:"id_baseline,omitempty"`
}
// GoldenSet 金标集
@@ -379,7 +384,12 @@ func (ea *EvalAPI) RunGolden(w http.ResponseWriter, r *http.Request) {
continue
}
results, err := ea.Pipeline.Recall(item.Query, ns, 5, 0.5)
// per-item namespace:条目自带 ns 优先(金标基线是按 ns 钉的,见 GoldenSetItem.Namespace)
itemNS := item.Namespace
if itemNS == "" {
itemNS = ns
}
results, err := ea.Pipeline.Recall(item.Query, itemNS, 5, 0.5)
if err != nil {
failures = append(failures, item.Query+": recall 失败 "+err.Error())
keywordFail++
+185 -115
View File
@@ -1,117 +1,187 @@
{
"description": "织忆召回金标检查集(12条基线 + 2条目标知识)。统一判据口径(t_a70b07e1):取 recall 返回的前 N=5 条内容查关键词,ID 命中 = expected_ids 任一 ∈ 前 N=5 条;N=5 与 Go/Python 两量具(eval_test.go / golden-check.py)一致。判定:PASS=id且kw命中 / WARN=kw命中但ID漂移 / FAIL=其余 / ERROR=recall调用失败。单一真相源(t_949840b1):本文件是金标数据唯一副本;Python 量具 golden-check.py 直接读本文件(旧 ~/.hermes/scripts/tools/golden-set.json 副副本已删除),基线校准一次即两量具同步(--refresh 写回本文件)。⚠️ item4「牧尘喜欢什么样的工作方式」基线 2026-09-21 t_949840b1 校准为当前稳定值 mem_1789834428978989104(语料增长致旧基线 mem_1789837840173161705 掉出 top-5,前 N 内容仍切题)。校准后同批金标两量具分类差异=0(diff=1 的根因——两份副本 expected_ids 不同步——已消除)。",
"items": [
{
"query": "织忆是什么",
"expected_ids": ["mem_1789153726378940805"],
"must_include_keywords": ["织忆"],
"category": "system_fact",
"difficulty": "easy",
"id_baseline": "mem_1789153726378940805"
},
{
"query": "织忆的图谱扩展机制是什么",
"expected_ids": ["mem_1789823837902661249"],
"must_include_keywords": ["图谱"],
"category": "system_fact",
"difficulty": "medium",
"id_baseline": "mem_1789823837902661249"
},
{
"query": "织忆如何通过 E1 提取和 MMR 实现多样去重",
"expected_ids": ["mem_1789915227303612056"],
"must_include_keywords": ["MMR"],
"category": "system_fact",
"difficulty": "hard",
"id_baseline": "mem_1789915227303612056"
},
{
"query": "牧尘的偏好是什么",
"expected_ids": ["mem_1789667544872361813"],
"must_include_keywords": ["牧尘"],
"category": "user_pref",
"difficulty": "easy",
"id_baseline": "mem_1789667544872361813"
},
{
"query": "牧尘喜欢什么样的工作方式",
"expected_ids": ["mem_1789834428978989104"],
"must_include_keywords": ["牧尘"],
"category": "user_pref",
"difficulty": "medium",
"id_baseline": "mem_1789834428978989104"
},
{
"query": "如何根据牧尘的偏好调整记忆检索策略",
"expected_ids": ["mem_1789190217889697697"],
"must_include_keywords": ["记忆"],
"category": "user_pref",
"difficulty": "hard",
"id_baseline": "mem_1789190217889697697"
},
{
"query": "当前项目的技术栈是什么",
"expected_ids": ["mem_1789680870868739202"],
"must_include_keywords": ["技术栈"],
"category": "proj_context",
"difficulty": "easy",
"id_baseline": "mem_1789680870868739202"
},
{
"query": "织忆项目有哪些核心组件",
"expected_ids": ["mem_1789154058288011112"],
"must_include_keywords": ["织忆"],
"category": "proj_context",
"difficulty": "medium",
"id_baseline": "mem_1789154058288011112"
},
{
"query": "织忆和其他记忆系统相比有什么架构优势",
"expected_ids": ["mem_1789153726378940805"],
"must_include_keywords": ["织忆"],
"category": "proj_context",
"difficulty": "hard",
"id_baseline": "mem_1789153726378940805"
},
{
"query": "如何使用 recall 接口",
"expected_ids": ["mem_1787272787836687543"],
"must_include_keywords": ["recall"],
"category": "tool_usage",
"difficulty": "easy",
"id_baseline": "mem_1787272787836687543"
},
{
"query": "织忆有哪些管理工具",
"expected_ids": ["mem_1789153726378940805"],
"must_include_keywords": ["织忆"],
"category": "tool_usage",
"difficulty": "medium",
"id_baseline": "mem_1789153726378940805"
},
{
"query": "如何通过 API 扩展织忆功能",
"expected_ids": ["mem_1789153726378940805"],
"must_include_keywords": ["织忆"],
"category": "tool_usage",
"difficulty": "hard",
"id_baseline": "mem_1789153726378940805"
},
{
"query": "本地 llama 服务 8080 端口",
"expected_ids": ["mem_1789229548476546193"],
"must_include_keywords": ["8080"],
"category": "target_knowledge",
"difficulty": "easy",
"id_baseline": "mem_1789229548476546193"
},
{
"query": "session-to-zhiyi.py 脚本名",
"expected_ids": ["mem_1788977361686058470"],
"must_include_keywords": ["session-to-zhiyi"],
"category": "target_knowledge",
"difficulty": "easy",
"id_baseline": "mem_1788977361686058470"
}
]
"description": "织忆检索质量金标集。2026-10-14 修正:① 每条**自带 namespace**(此前共用请求里的单一 ns,而基线分散在 hermes-main/domain:HUB/soulful-xiaowei/wiki/shared ⇒ ID 指标按构造恒 0);② 全部条目改到内容实际所在 ns;③ 基线由 golden-check.py --refresh 按当前 top-1 重建(原基线里 4 条共用同一 id、多条内容与 query 不匹配)。",
"items": [
{
"query": "织忆是什么",
"expected_ids": [
"mem_1789153726378940805"
],
"must_include_keywords": [
"织忆"
],
"category": "system_fact",
"difficulty": "easy",
"id_baseline": "mem_1789153726378940805",
"namespace": "hermes-main"
},
{
"query": "织忆的图谱扩展机制是什么",
"expected_ids": [
"mem_1789823837902661249"
],
"must_include_keywords": [
"图谱"
],
"category": "system_fact",
"difficulty": "medium",
"id_baseline": "mem_1789823837902661249",
"namespace": "hermes-main"
},
{
"query": "织忆如何通过 E1 提取和 MMR 实现多样去重",
"expected_ids": [
"mem_1789915227303612056"
],
"must_include_keywords": [
"MMR"
],
"category": "system_fact",
"difficulty": "hard",
"id_baseline": "mem_1789915227303612056",
"namespace": "hermes-main"
},
{
"query": "牧尘的偏好是什么",
"expected_ids": [
"mem_1789667544872361813"
],
"must_include_keywords": [
"牧尘"
],
"category": "user_pref",
"difficulty": "easy",
"id_baseline": "mem_1789667544872361813",
"namespace": "hermes-main"
},
{
"query": "牧尘喜欢什么样的工作方式",
"expected_ids": [
"mem_1789834428978989104"
],
"must_include_keywords": [
"牧尘"
],
"category": "user_pref",
"difficulty": "medium",
"id_baseline": "mem_1789834428978989104",
"namespace": "hermes-main"
},
{
"query": "如何根据牧尘的偏好调整记忆检索策略",
"expected_ids": [
"mem_1789190217889697697"
],
"must_include_keywords": [
"记忆"
],
"category": "user_pref",
"difficulty": "hard",
"id_baseline": "mem_1789190217889697697",
"namespace": "hermes-main"
},
{
"query": "当前项目的技术栈是什么",
"expected_ids": [
"mem_1789680870868739202"
],
"must_include_keywords": [
"技术栈"
],
"category": "proj_context",
"difficulty": "easy",
"id_baseline": "mem_1789680870868739202",
"namespace": "hermes-main"
},
{
"query": "织忆项目有哪些核心组件",
"expected_ids": [
"mem_1789154058288011112"
],
"must_include_keywords": [
"织忆"
],
"category": "proj_context",
"difficulty": "medium",
"id_baseline": "mem_1789154058288011112",
"namespace": "hermes-main"
},
{
"query": "织忆和其他记忆系统相比有什么架构优势",
"expected_ids": [
"mem_1789153726378940805"
],
"must_include_keywords": [
"织忆"
],
"category": "proj_context",
"difficulty": "hard",
"id_baseline": "mem_1789153726378940805",
"namespace": "hermes-main"
},
{
"query": "如何使用 recall 接口",
"expected_ids": [
"mem_1787272787836687543"
],
"must_include_keywords": [
"recall"
],
"category": "tool_usage",
"difficulty": "easy",
"id_baseline": "mem_1787272787836687543",
"namespace": "hermes-main"
},
{
"query": "织忆有哪些管理工具",
"expected_ids": [
"mem_1789153726378940805"
],
"must_include_keywords": [
"织忆"
],
"category": "tool_usage",
"difficulty": "medium",
"id_baseline": "mem_1789153726378940805",
"namespace": "hermes-main"
},
{
"query": "如何通过 API 扩展织忆功能",
"expected_ids": [
"mem_1789153726378940805"
],
"must_include_keywords": [
"织忆"
],
"category": "tool_usage",
"difficulty": "hard",
"id_baseline": "mem_1789153726378940805",
"namespace": "hermes-main"
},
{
"query": "本地 llama 服务 8080 端口",
"expected_ids": [
"mem_1789229548476546193"
],
"must_include_keywords": [
"8080"
],
"category": "target_knowledge",
"difficulty": "easy",
"id_baseline": "mem_1789229548476546193",
"namespace": "hermes-main"
},
{
"query": "session-to-zhiyi.py 脚本名",
"expected_ids": [
"mem_1788977361686058470"
],
"must_include_keywords": [
"session-to-zhiyi"
],
"category": "target_knowledge",
"difficulty": "easy",
"id_baseline": "mem_1788977361686058470",
"namespace": "hermes-main"
}
]
}