Improve cross_device MemFuse recall with source tags and recallContext.

Auto-enable device/location prefixes for cross_device scenarios, thread question_device into keyword and embedding paths, and boost lexical scores from source-tag tokens.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-02 14:12:48 +08:00
parent fb3a442e73
commit 6d48480b1c
4 changed files with 134 additions and 5 deletions
@@ -167,6 +167,29 @@ DashScope 指标与门控前持平;lexical-hash 路径 recall +0.7pp。deep ra
相对初始 DashScope 基线(~23.7% recall),累计 recall **+5.1pp**、hitAny **+10pp**、MRR **+0.07**。
### cross_device 弱维优化(k=20commit 待填)
`cross_device_*` 题全带 `question_device`(如 `phone_sarah`),证据跨 watch/phone/car 等设备,且 fusion 维平均 **15.2** 条 gold/题(recall@k 天然偏低,hitAny 更关键)。
改动:
-`cross_device_*` 题的 scenario **自动启用 `[device · location]` source-tags**(写入语料前缀,供嵌入/lexical 共用)
- `resolve({ recallContext: { device, user } })`device 拆词优先 keyword`phone`/`sarah`),嵌入 query 追加 `device context:`
- `latinWordQueryCoverage` 对 source-tag 前缀 token(含 `watch_ethan``ethan`)额外 +35% 权重上限
| 维度 | 指标 | 优化前 | 优化后 | Δ |
|---|---|---|---|---|
| information_fusion | candidateRecall | 70.1% | **78.6%** | +8.5pp |
| information_fusion | hitAny@k | 62.0% | **69.0%** | +7.0pp |
| information_fusion | recall@k | 11.0% | 11.8% | +0.8pp |
| causal_reasoning | candidateRecall | 66.0% | **82.3%** | +16.3pp |
| causal_reasoning | hitAny@k | 81.0% | 79.4% | 1.6pp |
| causal_reasoning | recall@k | 22.8% | 21.7% | 1.1pp |
| **全量 357** | recall@k | 28.8% | **28.6%** | ≈0 |
| **全量 357** | hitAny@k | 74.8% | **75.6%** | +0.8pp |
| **全量 357** | MRR | 0.392 | **0.397** | +0.005 |
fusion 仍是最弱维,但候选/ hitAny 明显提升;全量指标基本持平略升。生产侧需在写入记忆时 materialize 与 bench 一致的 device 前缀(或等价 metadata)。
### 语义嵌入(DashScope / Qwen,推荐)
memind_adm 后台 Providers 里配置的 **DashScope Qwen 密钥**存在 MySQL `h5_llm_provider_keys`MemFuse bench 可直接复用,**不需要 OpenAI**