Skip to content

BGE-M3 vs MiniLM A/B 对比报告 · v0.9

时间: 2026-06-14 · Track K2.2 索引: ecc_lessons_v2.{BAAI_bge-m3.pkl, paraphrase-multilingual-MiniLM-L12-v2.pkl} 语料: ecc-shared/sop/training/audit-mock/references + 3 skill SKILL/README/references + ecc-vert-case auditlogs + 所有 plugins SKILL.md/README.md (glob 模式)

一、规模对比

配置 语料源 sections embedding 维度 pkl 大小 rebuild 耗时
MiniLM (v0.8 默认, narrow) 7 文件 96 384 147 KB ~3 s
BGE-M3 (v0.9 wide) 41+ 文件 3229 1024 12.9 MB 47 分钟

结论: wide 模式把语料扩 33 倍 (96 → 3229), embedding 维度提 2.7 倍 (384 → 1024), pkl 大小提 88 倍 (147 KB → 12.9 MB)。


二、查询性能

配置 1 query 总耗时 model load embed query top-k search
MiniLM narrow (96) ~0.5 s 0.3 s 0.1 s 0.1 s
BGE-M3 wide (3229) ~3.5 s 2.5 s 0.5 s 0.5 s

结论: BGE-M3 wide 查询时间 7x 增长, 不适合 hook 路径 (UserPromptSubmit hook 5s timeout)。生产建议: - hook / 频繁查询 → MiniLM (默认) - 立项 / 周报 / 复盘等批处理 → BGE-M3 wide


三、命中精准度 (示例)

Q: 知识密度审计

MiniLM narrow (v0.8, 96 sections)

Rank Score Source Section
1 0.642 sop/02_甲方需求与审核要点.md 2.2 审核要点 (3 维)
2 0.579 sop/04_5角色SOP教程.md 2.3 你的 1 天
3 0.546 audit-mock/01_对抗审查报告.md (无标题)

BGE-M3 wide (v0.9, 3229 sections)

Rank Score Source Section
1 1.000 audit-mock/01_对抗审查报告.md 知识密度审计输出 (实指条款)
5 0.575 sop/04_5角色SOP教程.md 1.5 你的考核

结论: BGE-M3 wide 把 top 1 直接锚定到 "知识密度审计输出 < 5 的, 90% 是 AI 通稿" 这条直接定义, score 跃升 0.642 → 1.000。MiniLM narrow 只匹配到外围审核要点。


四、生产决策

默认: MiniLM narrow (UserPromptSubmit hook)

python lesson_indexer_v2.py --query "..."  # 默认 --model minilm 走 96 sections
# 查询 <1s, 适合 hook 5s timeout

高精度: BGE-M3 wide (PM 立项 / 周报 / 复盘)

python lesson_indexer_v2.py --query "..." --model bge-m3  # 走 3229 sections
# 查询 ~3s, top 1 精准锚定真定义

Hook 配置升级建议 (未来 v1.0)

user_prompt_submit_hook.py 也支持双模式: - 关键词命中 "立项 / 复盘 / 周报" → 切 BGE-M3 - 其他 → 用 MiniLM

或者:hook 后台预加载 BGE-M3 model 到内存常驻(避免每次 2.5s load)。


五、待办 (v0.9 后续)

  • MiniLM 也跑 wide 同语料 rebuild (3229 sections) 出公平 A/B
  • 用 10 query 跑统计指标 (nDCG@5, MRR, 平均 score)
  • BGE-M3 model 常驻服务 (避免每次 hook 重新 load 2.5s)
  • pkl 切 mmap 加载 (12.9 MB 不需要全 load)

作者: chunx + claude · v0.9 Track K2.2 关联: ~/.claude/skills/ecc-shared/scripts/lesson_indexer_v2.py (新 --wide 模式 + MODEL_ALIASES)