Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(eval-lab): 连续数值 metric 题校准支持前沿上限留白
- calibration.cjs:对含 mode: metric 的题目,在校验参考解全过正确性门禁、非数值考核点满分、得分 >= 0.5 且严格高于基线与半成品对照的前提下允许参考解 < 1,为超越人类参考解的前沿模型保留连续区分空间;纯布尔题保持原有满分要求不变。
- author-prompt.md 与 marketplace-readiness.test.cjs:同步说明并补充正向/低于阈值/门禁失败/平分 4 组校准单测。

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
  • Loading branch information
dashhuang committed Dec 4, 2026
commit a693f01c6398acf3a9fb7a94c64ebd0e649cac4d
2 changes: 1 addition & 1 deletion eval-lab/manual/workflows/author-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ question.json 格式:id、revision、title、scoringVersion、environment、ch

评分命令 python3 -B author/grade.py <candidate绝对目录> <outputJson绝对路径>。输出 {status:'graded',items:{考核点:boolean},metrics?:{指标id:number}} 或 {status:'environment_invalid',reason:说明}。使用相对 __file__ 定位可信资产,不依赖作者电脑绝对路径。不能调用被测模型新增的测试充当评分。评分器必须检查禁止改动的题面/环境/原有测试。参考答案、评分器、原始聊天只留作者目录。

实际验证候选原版暴露缺陷、reference满分、controls/incomplete有缺陷且非满分。加确定性时序屏障、正常行为保护与逐项变异测试,保留执行日志。不可用手填分数代替执行。先查依赖可用性,不联网安装可执行代码。若材料不足,只输出候选方案和缺口,不伪造可运行题。
实际验证候选原版暴露缺陷、reference通过全部正确性门禁且达标(布尔题满分;连续数值 `metric` 题允许留出前沿上限,reference 须全过门禁、得分 `>= 0.5` 且严格高于 candidate 与 controls/incomplete)、controls/incomplete有缺陷且非满分。加确定性时序屏障、正常行为保护与逐项变异测试,保留执行日志。不可用手填分数代替执行。先查依赖可用性,不联网安装可执行代码。若材料不足,只输出候选方案和缺口,不伪造可运行题。

不要把真实账号、凭证、个人路径、客户内容、原始聊天放进 candidate、reference 或公开报告。完成题包和上述验证后报告结果并结束出题任务,无需调用 calibrate_question。插件会在任务结束后导回草稿并独立校准;校准失败保持草稿。待用户在插件选择冻结发布到自己的本地题库后才成为可测版本。
10 changes: 9 additions & 1 deletion eval-lab/node/calibration.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ module.exports=function calibration({base,within,files,read,write,id,validateSpe
const tmp=path.join(attempt,'receipt.json');await write(tmp,result);await fs.rename(tmp,resultPath);
return publicStep(result);
}
function calibrationPassed(spec,results){
if(!results.every(x=>x.status==='graded'))return false;
const [baseRes,refRes,incRes]=results;
if(!spec.groups.some(g=>g.mode==='metric'))return refRes.score===1&&baseRes.score<1&&incRes.score<1;
const nonMetricOk=spec.groups.filter(g=>g.mode!=='metric').every(g=>g.items.every(k=>refRes.raw?.items?.[k]===true));
const gatesOk=Array.isArray(refRes.metrics)&&refRes.metrics.length>0&&refRes.metrics.every(m=>m.gatePassed===true);
return nonMetricOk&&gatesOk&&refRes.score>=0.5&&baseRes.score<refRes.score&&incRes.score<refRes.score&&baseRes.score<1&&incRes.score<1;
}
async function finish(p){
const {checks,plan,spec}=await context(p),results=[];
for(let i=0;i<names.length;i++)results.push(receipt(await read(path.join(checks,'step-'+i+'.json')),names[i],spec));
const ok=results.every(x=>x.status==='graded')&&results[1].score===1&&results[0].score<1&&results[2].score<1;
const ok=calibrationPassed(spec,results);
const cal={...plan,ok,results},dest=path.join(checks,'calibration.json');
const tmp=path.join(checks,'finish-'+crypto.randomUUID()+'.tmp');
try{
Expand Down
37 changes: 37 additions & 0 deletions eval-lab/test/marketplace-readiness.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,40 @@ test('continuous metric scoring enforces hard gates, supports linear/log scales,
}
}finally{await fs.rm(root,{recursive:true,force:true});}
});

test('metric calibration allows frontier headroom above human reference while enforcing gates and ordering',async()=>{
const headroomSpec={
id:'perf-headroom',revision:'v1',scoringVersion:'v1',title:'Headroom Metric',environment:'any',
groups:[
{id:'mem',weight:'1/2',mode:'metric',gate:['correct'],metric:{id:'heap_kb',label:'Heap',unit:'KB',direction:'lower',baseline:1000,target:10,scale:'log'}},
{id:'spd',weight:'1/2',mode:'metric',gate:['correct'],metric:{id:'speedup',label:'Speedup',unit:'×',direction:'higher',baseline:1,target:100,scale:'log'}}
]
};
const runCase=async(id,refVal,incVal,baseVal={ok:true,heap_kb:1000,speedup:1})=>{
const root=await fs.mkdtemp(path.join(os.tmpdir(),'eval-headroom-'));
try{
const d=await dispatch('draft',{root,id,revision:'v1',records:[{sessionId:'s',text:'Headroom'}]});
const dir=d.directory;
for(const sub of ['candidate','reference','controls/incomplete','author'])await fs.mkdir(path.join(dir,sub),{recursive:true});
await fs.writeFile(path.join(dir,'question.json'),JSON.stringify({...headroomSpec,id}));
await fs.writeFile(path.join(dir,'candidate/val.json'),JSON.stringify(baseVal));
await fs.writeFile(path.join(dir,'reference/val.json'),JSON.stringify(refVal));
await fs.writeFile(path.join(dir,'controls/incomplete/val.json'),JSON.stringify(incVal));
await fs.writeFile(path.join(dir,'author/grade.py'),"import pathlib,json,sys\nv=json.loads((pathlib.Path(sys.argv[1])/'val.json').read_text())\npathlib.Path(sys.argv[2]).write_text(json.dumps({'status':'graded','items':{'correct':bool(v['ok'])},'metrics':{'heap_kb':v['heap_kb'],'speedup':v['speedup']}}))\n");
return await dispatch('calibrate',{root,id,revision:'v1'});
}finally{await fs.rm(root,{recursive:true,force:true});}
};
// Human reference lands at ~0.75 (well below target 10 KB / 100x) leaving room for models to beat it.
const pass=await runCase('h-pass',{ok:true,heap_kb:31.6,speedup:31.6},{ok:true,heap_kb:316,speedup:3.16});
assert.equal(pass.ok,true);
assert.ok(pass.results[1].scoreExact!=='1');
// Reference below 0.5 floor fails calibration.
const tooLow=await runCase('h-low',{ok:true,heap_kb:400,speedup:2.5},{ok:true,heap_kb:800,speedup:1.2});
assert.equal(tooLow.ok,false);
// Reference failing gate fails calibration even with extreme metric numbers.
const badGate=await runCase('h-gate',{ok:false,heap_kb:1,speedup:500},{ok:true,heap_kb:500,speedup:2});
assert.equal(badGate.ok,false);
// Incomplete tying or beating reference fails calibration.
const tied=await runCase('h-tie',{ok:true,heap_kb:31.6,speedup:31.6},{ok:true,heap_kb:31.6,speedup:31.6});
assert.equal(tied.ok,false);
});
Loading