Files
natural-memory-nm21/check_refusal_bilingual.py
T
WpyQwq 643e22ecb9 Natural Memory NM2.1: 记忆路由器分叉、数据集缺陷修复与全轴评测证据
- 引入 MemoryRouterXL 与 v5/v6 流式多线程训练/编码管线
- 修复 prepare_memory_router_dataset 候选池重建缺陷(mega 家族 3568x 加速,输出逐字节相同)
- 修复 v5 被破坏的拒答与多跳标签(train 未知样本 319 -> 16319,multi_hop 平均正例 1.00 -> 2.00)
- 同存储预算下 V2-128 v6 逐轴 22/22 通过:Top-1 41.12% -> 94.62%,未知拒答 0.00% -> 100.00%
- 记录三条被实测推翻的显然优化(logits_to_keep=1 反而慢 55%、XL 容量未带来收益)
- 记忆手术跨架构可移植性 14/14,读写关闭时与原生模型逐位相同
2026-09-19 11:11:31 +08:00

34 lines
1.5 KiB
Python

"""Spot-check bilingual refusal detection on real reply wordings."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from V2_dpskw.eval_scoring import is_refusal
CASES = [
("zh", "关于您的 weekly 会议安排,当前长期记忆中未包含相关信息,无法回答。", True),
("zh", "您的协议编号未知。", True),
("zh", "您的培训周期是 32GB。", False),
("zh", "我固定每周三 22:00 做上线。", False),
("en", "I don't know when that happened.", True),
("en", "There is no mention of a charity race in the conversation.", True),
("en", "The date was not mentioned.", True),
("en", "I cannot determine that from the dialogue.", True),
("en", "She was unable to answer that question about her research.", True),
("en", "The conversation does not mention any support group.", True),
("en", "I'm not sure about that.", True),
("en", "She went to the LGBTQ support group on 7 May 2023.", False),
("en", "2022", False),
("en", "Caroline researched adoption agencies.", False),
("en", "Melanie painted a sunrise in 2022.", False),
]
bad = 0
for lang, reply, expected in CASES:
got = is_refusal(reply)
flag = "ok " if got == expected else "BAD"
if got != expected:
bad += 1
print(f"{flag} [{lang}] expected={'REFUSE' if expected else 'assert'} got={'REFUSE' if got else 'assert'} {reply[:64]}")
print(f"\nmismatches: {bad}/{len(CASES)}")