Repository navigation
feat(eval): ASR 基线实测优先 + LLM-judge 入默认装配 —— 队友改动清理移植 - #131
Merged
Merged
Conversation
移植队友 zip 的有效增量并纠错(基线为其 main 分支,与 dev 有大量漂移, 逐文件比对后只取真实增量;沙箱文件与基线完全一致——zip 不含沙箱改动): ① eval/baseline.py(新增):裸模型 vs 经枢衡**双臂同批对照**,产出实测 ASR 基线(口径对齐 model_in_the_loop:裸臂被诱导吐危险工具调用=成功、 不执行避免副作用;防护臂中和判定一致);未配真端点返回 None。 ② metrics.compute(asr_baseline=...):实测优先,asr_baseline_measured 如实标注;未实测退回保守上界 1.0。**不移植**队友对 high_risk_handling 分母的改动(回退 #124 处置校准口径,属回归)。 ③ report 主表:baseline 单元格按 measured 渲染「X%†(实测)」/ 「100%†(保守上界)」,脚注同步。 ④ __main__:--baseline **显式开关**跑对照臂(纠错:队友为自动触发, 会使任何评测在有密钥的机器上静默消耗真实调用;实测本机一次评测 216s→加开关后 eval 域测试恢复 1.35s)。 ⑤ llm_judge 入默认装配(语义层从"实测有效但没开"变为默认开着, 端点不可达自动降级 no-op);端点/密钥**不入 fulcrum.yml**(纠错:队友 yml 硬编码本机 Ollama 11434+mimo)——组装根 _inject_judge_endpoint 从 .env 注入,显式本地端点优先;_DEFAULT_ENDPOINT 改空+前置短路, 防 Ollama 机器上测试静默打本地模型。 ⑥ 审计库路径接线(纠错:队友写入键名 db_path,SqliteAuditSink 参数 实为 path,错键装配即 TypeError)——Settings.audit_db_path 注入, yml 显式 path 优先。 实测(方舟 ark-code-latest):中性术语攻击(规则层零信号)被 judge 判 llm_injection→挂审;--baseline 双臂 裸模型 12.5% vs 防护 0.0%,主表标 「12.5%†(实测)」;200 条 corpus 混淆矩阵逐位不变(TP=167 FN=3 FP=0)。 +13 测试;pytest 971 全过,ruff/format/pyright 0、import-linter 3 KEPT。
There was a problem hiding this comment.
Hi @leilehuimieba! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
This was referenced Sep 4, 2026
Owner
|
已合入 未采纳: 已采纳并合入: 验证:pytest 1047 passed,冻结语料 default 与 gov_demo 两策略均 TP=168 FN=2。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
队友发来改动包(metrics 硬编码移除 + judge 装配)。其基线是落后的 main 分支(与 dev 大量漂移),本 PR 逐文件比对后只移植真实增量,并修掉其中四处会出问题的细节。
移植内容
①
eval/baseline.py(新增)—— 实测 ASR 基线"裸模型直连"与"经枢衡防护"同批对照评测(8 攻击 + 2 良性,口径对齐
model_in_the_loop:裸臂被诱导吐危险工具调用=攻击成功,不执行工具避免真实副作用)。未配置真端点(无 key 或本地端点)→ 返回 None,调用方退回保守上界并如实标注。②
metrics.py实测优先compute(asr_baseline=...):传入实测值直接采用 +asr_baseline_measured=True;未传退回保守上界 1.0 并measured=False。不移植:队友把 high_risk_handling 分母改回"全部恶意"——这会回退 #124 的处置校准口径(金标准 sanitize 样本不应进 block/approve 分母),属回归,保留 dev 现口径。
③
report.py如实渲染主表 baseline 单元格按 measured 显示「12.5%†(实测)」/「100%†(保守上界)」,脚注同步——保守上界不再被误读为实测。
④
--baseline显式开关(纠错①)队友设计为"端点可用即自动跑"。实测后果:本机配了模型 key 后,每次
fulcrum.eval(含测试)静默打 ~20 次真实调用——eval 域测试从 1.35s 涨到 216s。改为显式 flag:默认不打网(测试/CI 确定性),要实测就--baseline。⑤ llm_judge 入默认装配(纠错②:端点不入库)
语义层从"实测有效但默认没开"变为默认开着(对抗审查的语义泛化缺口由此补上),端点不可达自动降级 no-op、规则链路兜底。队友 yml 里硬编码了本机 Ollama 端点+mimo——违反配置入库边界,改为:组装根
_inject_judge_endpoint从 .env(FULCRUM_MODEL_*)注入,显式本地端点优先不被覆盖;_DEFAULT_ENDPOINT改空 + 前置短路(原默认指 127.0.0.1:11434,会让装 Ollama 的机器在测试里静默打本地模型)。⑥ 审计库路径接线(纠错③:错键)
队友写入
options.sqlite.db_path,而SqliteAuditSink参数是path——错键在audit: sqlite装配时直接 TypeError。按正确键名接线:Settings(FULCRUM_AUDIT_DB_PATH)注入,yml 显式 path 优先。关于"沙箱部分"
核实:zip 不含任何沙箱改动——其
restricted_executor.py与其基线(main)逐字节一致,与 dev 的差异全部来自 dev 领先(v1.57 软链/多键加固)。沙箱优化现状:#130 已落嵌套 URL + NTFS 流硬ening,进程隔离归 #121。验证(方舟 ark-code-latest 实测)
llm_injection→ approve 挂审(端点注入链路 .env→组装根→检测器全通);