- 引入 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,读写关闭时与原生模型逐位相同
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
"""Extract the gate-scan summary block from a probe log (quoting-safe helper)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
import sys
|
|
|
|
KEYS = [
|
|
"cases_scanned",
|
|
"target_record_retracted_or_absent",
|
|
"target_record_active",
|
|
"records_per_case",
|
|
"active_records_min",
|
|
"active_records_max",
|
|
"cases_with_direct_records",
|
|
"cases_with_address_hits",
|
|
"cases_with_lexical_hits",
|
|
"v2_gate_open_pct_deployed_router",
|
|
"v2_gate_open_pct_random_router_copies",
|
|
"stop_reasons",
|
|
"legacy_prefix_used_pct",
|
|
]
|
|
|
|
|
|
def main() -> int:
|
|
path = sys.argv[1]
|
|
text = open(path, encoding="utf-8", errors="replace").read()
|
|
decoder = json.JSONDecoder()
|
|
found = []
|
|
for match in re.finditer(r"\{", text):
|
|
try:
|
|
obj, _ = decoder.raw_decode(text[match.start():])
|
|
except ValueError:
|
|
continue
|
|
if isinstance(obj, dict) and "target_record_active" in obj:
|
|
found.append(obj)
|
|
if not found:
|
|
print("no summary block with target_record_active found; tail follows")
|
|
print(text[-1200:])
|
|
return 1
|
|
summary = found[-1]
|
|
print(json.dumps(summary, ensure_ascii=False, indent=2))
|
|
print()
|
|
correct = 0
|
|
total = 0
|
|
for match in re.finditer(r'"correct": (true|false)', text):
|
|
total += 1
|
|
correct += 1 if match.group(1) == "true" else 0
|
|
if total:
|
|
print("per-case correct: %d/%d = %.2f%%" % (correct, total, 100.0 * correct / total))
|
|
print()
|
|
for key in KEYS:
|
|
if key in summary:
|
|
print(" %-44s = %s" % (key, json.dumps(summary[key], ensure_ascii=False)))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|