Repository navigation
Todo
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpm:on-holdDecision made, deliberately deferred — no dispatch, no nag; restart condition in the hold commentpriority:p2Medium: important, M3
Description
在真实中文制度题上,知识库混合检索(向量一路 + 关键词一路,按 RRF 等权合并)比只用向量一路明显更差:第一条就是正确条款所在制度、以及前 3 条里有正确条款的比例都会下降。损失全部来自关键词一路;一位压缩的近似向量索引没有造成损失。
测量结果
数据:BrightRule 的制度条款知识源,59,621 条(每条一段),嵌入模型 qwen3.7-text-embedding,1024 维,knowledge-turso。题目是 132 道真实员工问题(口语问法),其中 118 道有标准制度、70 道有标准条款。每道题都把检索范围限定在提问人所属单位链上,取前 8 条。
| 检索方式 | 第一条属于正确制度 | 前 3 条有正确条款 | 前 8 条有正确条款 |
|---|---|---|---|
| 只用向量(float32 全量精确扫描) | 79.7% | 88.6% | 94.3% |
| 只用向量(一位近似索引 + float32 重排,平台实际路径) | 79.7% | 88.6% | 94.3% |
| 只用关键词 | 60.2% | 42.9% | 58.6% |
| 混合(等权 RRF,平台现状) | 76.3% | 71.4% | 91.4% |
| 混合,关键词权重减半 | 77.1% | 77.1% | 92.9% |
- 前四行和第六行是按
turso-adapter.ts的检索 SQL 和fuse()离线重算的:两路各取 40 条(topK 8 × SEARCH_FIRST_ROUND_FACTOR 5)、RRF k=60、关键词按keywordTerms()切词并算 BM25 IDF。 - 同样的题经 MCP 调
search_knowledge(带同样的单位范围、groupBy: "clause_hash")实测:76.3% / 72.9% / 91.4%,和离线混合结果基本一致。 - 不带范围、靠权限事后过滤时,实测是 79.7% / 82.9% / 90.0%,也低于只用向量。
- 混合和只用向量相比:前 3 条有正确条款,丢了 14 题、只多对 2 题。
原因
- 关键词一路的切词在口语问句上几乎全是噪声。 一段汉字先切成全部三字窗口,再切二字窗口,最多 16 个词。132 道题全部顶到 16 个,而且多数题 16 个名额被三字窗口占满,二字词根本轮不到。例子:
- 「我在集团干了 12 年了,一年有几天年假?」切成:
12、我在集、在集团、集团干、团干了、年了、一年有、年有几、有几天、几天年、天年假、我在、在集、集团、团干、干了。真正的关键词「年假」不在里面,12和「集团」把档案保管期限表、出国证件管理排到了关键词一路前三;只用向量时第一条就是休假管理的正确条款,混合后正确条款掉出前 8。 - 「我在涉密岗位上干过,现在调走了,要过多久才算脱密?」16 个词全是三字窗口(
我在涉、位上干、才算脱……),「脱密」不在里面。关键词一路把第十四条、第十三条排在前面,正确的第十八条(向量一路第一)被挤到第 5 到第 6。
- 「我在集团干了 12 年了,一年有几天年假?」切成:
- 等权 RRF 让关键词一路的噪声有一半话语权。 只在向量一路排第一的段落,归一化得分是 0.5;两路都排得靠前的段落(哪怕向量一路只排第 4、第 5)能到 0.9 以上。所以只要关键词一路命中了一些高频的三字窗口,就会压过向量一路最相关的那条。
期望
真实中文口语问题上,混合检索至少不比只用向量差。可选做法供平台判断,例如:
- 关键词一路对中文问句改用真正的分词,或者只保留能区分条文的词,不再用全部滑动窗口;
- RRF 给关键词一路更低的权重,或者只在关键词命中足够强时才参与合并;
- 让知识源或调用方能选择只用向量一路。
复现脚本和逐题数据在本地,平台需要的话可以提供。
Metadata
Metadata
Assignees
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpm:on-holdDecision made, deliberately deferred — no dispatch, no nag; restart condition in the hold commentpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 30, 2026
triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ
Triage: lands in the knowledge hybrid search (
keywordTerms()segmentation and thefuse()RRF weighting,packages/services/service-knowledgeandturso-adapter.ts) · area:ai · domain:server · Bug · p2 · pm:queue · size M.Grade: area:ai · Bug · Impeded (answers still come back, ranked worse) · end users, daily (every knowledge question in Chinese) · measured (132 real questions on a 59,621-clause source; offline recompute matches the MCP
search_knowledgerun).Rationale: hybrid retrieval loses to vector-only on top-3 clause hits (71.4% vs 88.6%), and the whole loss comes from the keyword path. Shipped retrieval is broken in quality but not outright, so Impeded at end-user reach gives p2. It sits in the knowledge topic beside #38591 and #38504. The
knowledge-service.tssplit #38660 goes first by the maintainer's order, so the claim should check whether its files overlap that split.os-bob commentedon Nov 30, 2026
关联:#38692 提议给知识源加「检索方式」(只用向量 / 只用关键词 / 混合)和混合时的关键词比例。实测在本 issue 的同一知识源上,只用向量时「前 3 条有正确条款」从 72.9% 回到 88.6%。本 issue 修好关键词一路的切词和合并以后,应用可以借这两个设置按知识源重新选择方式、调整比例。
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu
2026-11-30T05:28Z · Claim · zone o2-A (area:ai), knowledge topic. Serial behind #38675 and #38676 on the same files, so this PR is stacked on #38697's branch while the release freeze holds both.
Claim: PM loop round 1
Session:
session_01JQwxbXyLoBzNYY1U8SNPFuThread session:
session_01JQwxbaAVoqUQiPmxMVpLstAccount:
os-warrenBranch: new, from
claude/project-thread-slovhl-38676(PR #38697) at40596897a6; the PR's base is that branch until it landsWorktree:
objectstack-issue-38671Domain:
domain:serverSeat:
repo:objectstack#2Area:
o2-A(area:ai)File surface:
packages/plugins/knowledge-turso/src/{turso-adapter,sql}.ts, tests and a Chinese-question fixture underpackages/plugins/knowledge-turso/src/__tests__/, the package README, and one changeset. ⛔packages/services/service-knowledge/**is held by #38660. (Stop on breach and explain in the report.)Container & model: M, mode:thread, model: default (dispatch-gates --tier: no path-derived mandate), effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: n/a (retrieval-quality card)
Thread-read: none
Premise: to be re-read on #38697's head.
keywordTerms()(sql.ts) cuts a CJK question into sliding windows.fuse()(turso-adapter.ts:1631on main) merges the two legs by equal-weight RRF (k=60). The card's measurement is in the reporter's local environment, not in this repository.Serial constraints cleared: stacked on #38697, which is stacked on #38693.
Pre-claim lane:
packages/plugins/knowledge-turso/**⇒ domain:server; area:ai, zone o2-A.Pre-claim deps: #38675 and #38676 (PRs #38693 and #38697, open; this PR stacks on them).
Prior rulings read: triage 7266779061. The related #38692 (a per-source search mode and keyword weight) is a separate feature and not part of this card.
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu
Dispatch order · #38671 (知识库混合检索在中文口语问题上比只用向量更差) · zone
o2-A· 2026-11-30T05:29ZCard #38671 is held by seat 2 (
os-warren) under the claim above. It is the third card on the #38675 thread.claude/project-thread-slovhl-38676(PR perf(knowledge-turso): compute the keyword leg once a search; send a scope too narrow for the approximate pass straight to the exact scan #38697) at its head. Open a draft PR with that branch as its base and say "stacked on perf(knowledge-turso): compute the keyword leg once a search; send a scope too narrow for the approximate pass straight to the exact scan #38697". Retarget after the stack below it lands.Intl.Segmenter(built in, no new dependency) or a stop-term filter over the sliding windows, and say which you used and why.fuse()so the keyword leg cannot outvote a strong vector order. Either give the keyword leg a lower weight, or let it join only when its match is strong. State the rule and its constant.packages/plugins/knowledge-turso/src/{turso-adapter,sql}.ts, tests and the fixture undersrc/__tests__/, the package README, and one changeset.changeset/38671-*.md. ⛔ Notpackages/services/service-knowledge/**.Clause-②:andMetadata-protocol:lines in the PR body and the changeset.## 席位核对record, request reviewers, mark ready, or enqueue.pr_create(draft,Fixes #38671). Make every other write only through the relay write tools, and report both counts.mode:thread,model: default,effort: high.objectstack-fleet commentedon Nov 30, 2026
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu
2026-11-30T05:40Z · Claim withdrawn, card back to the queue. The maintainer said 「暂时不开工新的知识任务」 at 2026-11-30T05:39Z, so claim 7269717009 and order 7269726389 are void and no PR is opened for this card. A new claim takes the card when the maintainer lifts the pause. That claim stacks on, or branches after, #38697.
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN
2026-11-30T07:55Z ·
pm:queue→pm:blocked, on topic #38711's order (this card is that topic's B8b, held by seatrepo:objectstack@baozhoutao, post #38724).fuse()weighting,retrieval.vectorWeight(知识源加「检索方式」和混合比例:只用向量 / 只用关键词 / 混合(可设比例),由应用元数据指定,单次检索可覆盖 #38692 phase 1b), and the hybrid-against-vector acceptance. Those sit on knowledge: Chinese questions are cut into real words by a dictionary segmenter, in one module both knowledge-turso and knowledge-pgvector use #38710's step 2 (both adapters'search()), and step 2 sits on 知识源加「检索方式」和混合比例:只用向量 / 只用关键词 / 混合(可设比例),由应用元数据指定,单次检索可覆盖 #38692 phase 1a.Blocked-by: #38710
objectstack-fleet commentedon Nov 30, 2026
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN
2026-11-30T08:11Z · Pointer for this card's next claimant (B8b): seat 2's hand-over note is comment 7272065725 on mailbox PR #38723.
kshare≥ 0.5 keeps RRF; weaker keyword matches take max-rank credit).knowledge-tursoonly. Seat 2 will push it to a branch if asked there.These are leads to re-measure, not rulings. The topic's ruled design for this card is
retrieval.vectorWeightinfuse()(topic #38711 row B8b, #38692 phase 1b), and the term cut now belongs to@objectstack/service-segmenter(#38710, ruling 7272436453), not to the adapters'sql.ts. A gate in place of, or beside, the weight is a fork for the maintainer, not a claim-time choice.fix(knowledge-turso): a scoped search reads its passage table once a …
docs(adr): ADR-0161 dated revision note — knowledge source declares r…
feat(service-segmenter): a segmenter service that cuts a Chinese ques…
objectstack-fleet commentedon Dec 1, 2026
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN
2026-12-01T23:39Z ·
pm:blocked→pm:on-hold. The card this one waits on, #38710, went topm:on-holdthis round: its step 2 sits on #38692, which is itself on hold. The rule is that a blocked card follows its blocker into hold. The grade is unchanged. The maintainer's pause on new knowledge work also still covers B8b (ruling on #38711).Restart-when: closed #38710