mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 09:01:28 +01:00
Eval plans now pilot every arm, check the judge per arm, state their cost and take one planned look above 500 dollars (GST-3218) (#4591)
`/eval-plan` now refuses an eval plan that would waste money: every arm gets a small uncounted pilot, the judge is checked on each arm's outputs, the plan carries a cost line, and a run above 500 dollars takes one planned look at half its units. Small questions get a 100-dollar quick look that publishes no number. Why: 23.7% of the 28,836 dollars spent on our last 30 evals settled nothing, mostly through arms and judges that broke after the full run. Nothing to do as a reader; plans frozen before 2026-11-21 keep their old rules. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=specialist-batched Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p1/red-team#3 reader=red-team
This commit is contained in:
1 parent
ffdd5354b8
commit
e057dfa100
22 files changed
+483
-68
No files matched your search
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* The eval-loop checks behind /eval-plan (docs/TESTING_INTERNALS.md#eval-loop-checks):
|
||||
* an uncounted pilot per arm on at most a tenth of its budget that draws every unit
|
||||
* type in a seeded order, a judge read per arm at a stated effort, a cost line, one
|
||||
* preregistered look at half the units above $500 paid, "smaller" scored with tests,
|
||||
* an answers check on the task machine, and a quick look that publishes no number.
|
||||
*/
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { checkPrereg, quickLookTemplate } from '../lib/eval-plan';
|
||||
import { checkJudgeLabels, LOOP_CHECKS_SINCE } from '../lib/eval-plan-checks';
|
||||
import { checkResults } from '../lib/eval-plan-report';
|
||||
|
||||
const PILOT: Record<string, string> = { share: '10%', counted: 'no', ran: "the skill's tool calls appear in each arm's transcripts", judge: "labels checked on each arm's pilot outputs", supply: 'three development rows per arm at the planned rate', units: 'bug fix, refactor and docs tasks, one each', seed: '7, independent of the number of workers' };
|
||||
const COST: Record<string, string> = { paid: '$200', meter: '$40', ledger: 'the private spend ledger' };
|
||||
const INTERIM: Record<string, string> = { at: '50%', looks: '1', bounds: "O'Brien-Fleming, |z| >= 2.80 at the look, 1.98 at the end", futility: 'stop when the paired difference is below zero at the look' };
|
||||
const kv = (o: Record<string, string>) => Object.entries(o).map(([k, v]) => `${k}: ${v}`).join('\n');
|
||||
const without = (o: Record<string, string>, k: string) => Object.fromEntries(Object.entries(o).filter(([key]) => key !== k));
|
||||
const plan = (o: { pilot?: Record<string, string>; cost?: Record<string, string>; interim?: Record<string, string> | null; scoring?: string; arms?: string; bars?: string; heldOut?: string; frozen?: string } = {}) => [
|
||||
o.frozen ? `frozen: ${o.frozen}\n` : '',
|
||||
`## Bars\n${o.bars ?? '- pass rate, higher is better'}\n`,
|
||||
'## Decisions\nif the skill arm passes more items: keep the skill\nif there is no difference: cut the skill\n',
|
||||
`## Arms\n${o.arms ?? '- claude-opus-5-5 the skill installed\n- claude-opus-5-5#plain no skill'}\n`,
|
||||
'## Comparison\nstack: none\nwhy: prompts compared, not skill stacks\n',
|
||||
`## Scoring\n${o.scoring ?? 'judge: gpt-6.2-astra\nlabels: 40\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items'}\n`,
|
||||
`## Pilot\n${kv(o.pilot ?? PILOT)}\n`,
|
||||
`## Cost\n${kv(o.cost ?? COST)}\n`,
|
||||
o.interim === null || o.interim === undefined ? '' : `## Interim look\n${kv(o.interim)}\n`,
|
||||
'## Decoys\n- filled in\n', '## Stop rules\n- filled in\n',
|
||||
`## Held-out exposure\n- none touched\n${o.heldOut ?? 'answers: other git refs and build caches checked on each task machine'}\n`,
|
||||
].join('\n');
|
||||
const messages = (text: string) => checkPrereg(text).loop.errors.map(e => `${e.section}: ${e.message.split(' ')[0]}`);
|
||||
|
||||
describe('## Pilot (R111, G12)', () => {
|
||||
test('a complete pilot passes', () => {
|
||||
expect(checkPrereg(plan())).toMatchObject({ ok: true, missing: [], empty: [] });
|
||||
});
|
||||
|
||||
test('a share above a tenth, a counted pilot, or a missing ran, supply, units, seed or judge line fails', () => {
|
||||
expect(messages(plan({ pilot: { ...PILOT, share: '15%' } }))).toEqual(['Pilot: share:']);
|
||||
expect(messages(plan({ pilot: { ...PILOT, counted: 'yes' } }))).toEqual(['Pilot: counted:']);
|
||||
for (const k of ['ran', 'supply', 'units', 'seed', 'judge']) expect(messages(plan({ pilot: without(PILOT, k) }))).toEqual([`Pilot: ${k}:`]);
|
||||
expect(checkPrereg(plan({ pilot: without(PILOT, 'judge'), scoring: 'judge: none\npaired: yes\ninterval: 95%\nmdd: 3' })).ok).toBe(true);
|
||||
});
|
||||
|
||||
test('a missing Pilot or Cost section is missing', () => {
|
||||
expect(checkPrereg(plan().replace(/## Pilot[\s\S]*?(?=## Cost)/, '')).missing).toEqual(['Pilot']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('## Scoring per arm and effort (R78, G14)', () => {
|
||||
test('a model judge needs per-arm: yes and an effort; judge: none needs neither', () => {
|
||||
expect(messages(plan({ scoring: 'judge: gpt-6-astra\nlabels: 40\nagreement: 0.6\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3' }))).toEqual(['Scoring: per-arm:']);
|
||||
expect(messages(plan({ scoring: 'judge: gpt-6-astra\nlabels: 40\nagreement: 0.6\nper-arm: yes\npaired: yes\ninterval: 95%\nmdd: 3' }))).toEqual(['Scoring: effort:']);
|
||||
});
|
||||
|
||||
test('with per-arm: yes, every label row names its arm and each arm meets the bar', () => {
|
||||
const scoring = { judge: 'gpt-6.2-astra', labels: 40, agreement: 0.6, errors: [], per_arm: true };
|
||||
const row = (i: number, arm: string | null, flip: boolean) => JSON.stringify({ id: `i${i}`, ...(arm ? { arm } : {}), human: i % 2 ? 'pass' : 'fail', judge: (i % 2 ? 'pass' : 'fail') === 'pass' !== flip ? 'pass' : 'fail' });
|
||||
const rows = (arm: (i: number) => string | null, flip: (i: number) => boolean) => Array.from({ length: 40 }, (_, i) => row(i, arm(i), flip(i))).join('\n');
|
||||
const good = checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : 'b'), i => i === 0));
|
||||
expect(good).toMatchObject({ ok: true });
|
||||
expect(good.arms.map(a => a.arm)).toEqual(['a', 'b']);
|
||||
expect(checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : null), () => false)).problems).toEqual(['per-arm: yes needs an "arm" on every label row; 20 have none']);
|
||||
const pooledOk = checkJudgeLabels(scoring, rows(i => (i < 10 ? 'a' : 'b'), i => i < 4));
|
||||
expect(pooledOk.kappa).toBeGreaterThanOrEqual(0.6);
|
||||
expect(pooledOk.problems.map(p => p.split(':')[0])).toEqual(['arm a']);
|
||||
expect(checkJudgeLabels(scoring, rows(() => 'a', () => false), ['a', 'b']).problems).toEqual(['per-arm: yes needs labels from every arm in ## Arms; no rows for b']);
|
||||
expect(checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : 'typo'), () => false), ['a', 'b']).problems).toEqual(['per-arm: yes needs labels from every arm in ## Arms; no rows for b', 'label rows name arms that are not in ## Arms: typo']);
|
||||
expect(checkJudgeLabels({ ...scoring, per_arm: false }, rows(i => (i < 10 ? 'a' : 'b'), i => i < 4), ['a', 'b'])).toMatchObject({ ok: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('## Cost and ## Interim look (R113)', () => {
|
||||
test('a cost line needs paid dollars, a meter and a ledger', () => {
|
||||
for (const k of ['paid', 'meter', 'ledger']) expect(messages(plan({ cost: without(COST, k) }))).toEqual([`Cost: ${k}:`]);
|
||||
});
|
||||
|
||||
test('above $500 paid, one look at half the units with O\'Brien-Fleming and futility bounds is required; at $500 it is not', () => {
|
||||
expect(checkPrereg(plan({ cost: { ...COST, paid: '$500' } })).ok).toBe(true);
|
||||
const big = { ...COST, paid: '$1,200' };
|
||||
expect(messages(plan({ cost: big }))).toEqual(['Interim look: missing:']);
|
||||
for (const paid of ['$2k', '$1e3', '6 arms x $100', '$150USD', '$500-$900']) expect(messages(plan({ cost: { ...COST, paid } }))).toEqual(['Cost: paid:']);
|
||||
expect(checkPrereg(plan({ cost: { ...COST, paid: '1200.50' } })).loop.paid).toBe(1200.5);
|
||||
expect(checkPrereg(plan({ cost: big, interim: INTERIM }))).toMatchObject({ ok: true, loop: { paid: 1200, interim_required: true } });
|
||||
expect(messages(plan({ cost: big, interim: { ...INTERIM, at: '30%' } }))).toEqual(['Interim look: at:']);
|
||||
expect(messages(plan({ cost: big, interim: { ...INTERIM, looks: '3' } }))).toEqual(['Interim look: looks:']);
|
||||
expect(messages(plan({ cost: big, interim: { ...INTERIM, bounds: 'Pocock' } }))).toEqual(['Interim look: bounds:']);
|
||||
expect(messages(plan({ cost: big, interim: without(INTERIM, 'futility') }))).toEqual(['Interim look: futility:']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('smaller is scored with tests (G11) and no answers on the machine (G13)', () => {
|
||||
test('an arm that asks for less code needs a regression-test bar', () => {
|
||||
const arms = '- claude-opus-5-5#smaller "make the smaller change"\n- claude-opus-5-5#plain no instruction';
|
||||
expect(messages(plan({ arms }))).toEqual(['Bars: an']);
|
||||
expect(checkPrereg(plan({ arms, bars: '- pass rate, higher is better\n- regression test added, co-primary, higher is better' })).ok).toBe(true);
|
||||
});
|
||||
|
||||
test('held-out exposure says how each task machine was checked for answers', () => {
|
||||
expect(messages(plan({ heldOut: '' }))).toEqual(['Held-out exposure: answers:']);
|
||||
expect(messages(plan({ heldOut: 'Answers on the task machine: tbd' }))).toEqual(['Held-out exposure: answers:']);
|
||||
expect(checkPrereg(plan({ heldOut: 'Answers on the task machine: git refs and caches checked' })).ok).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('grandfathering by freeze date', () => {
|
||||
test(`a plan frozen before ${LOOP_CHECKS_SINCE} keeps its rules; one frozen on it does not`, () => {
|
||||
const old = plan({ frozen: '2026-11-20', pilot: {}, cost: {}, heldOut: '' }).replace(/## Pilot\n\n/, '').replace(/## Cost\n\n/, '');
|
||||
expect(checkPrereg(old)).toMatchObject({ ok: true, loop_grandfathered: true, grandfathered: false });
|
||||
expect(checkPrereg(old.replace('frozen: 2026-11-20', `frozen: ${LOOP_CHECKS_SINCE}`))).toMatchObject({ ok: false, loop_grandfathered: false, missing: ['Pilot', 'Cost'] });
|
||||
});
|
||||
});
|
||||
|
||||
describe('quick look (R112)', () => {
|
||||
const quick = (cap = '$100', drop = '') => quickLookTemplate('q').replace('cap: $100', `cap: ${cap}`).split('\n').filter(l => !drop || !l.startsWith(drop)).join('\n').replace(/<[^!][^>]*>/g, 'filled');
|
||||
test('three lines and a cap of $100 or less pass, with no counted-run sections', () => {
|
||||
expect(checkPrereg(quick())).toMatchObject({ ok: true, quick: { cap: 100, errors: [] } });
|
||||
});
|
||||
|
||||
test('a cap above $100 or a missing line fails', () => {
|
||||
expect(checkPrereg(quick('$150')).quick!.errors[0]).toContain('at most $100');
|
||||
expect(checkPrereg(quick('$100k')).quick!.errors[0]).toContain('at most $100');
|
||||
expect(checkPrereg(quickLookTemplate('q')).quick!.errors.map(e => e.split(':')[0])).toEqual(['no question', 'no decision', 'no stop']);
|
||||
for (const k of ['question', 'decision', 'stop']) expect(checkPrereg(quick('$100', k)).quick!.errors).toEqual([`no ${k}: line (a quick look is three lines: question, decision, stop rule)`]);
|
||||
});
|
||||
|
||||
test('results --check refuses a quick look: it publishes no number', () => {
|
||||
const r = checkResults(quick(), '| arm | pass rate |\n|---|---|\n| claude-opus-5-5 | 7/10 |\n');
|
||||
expect(r.issues.map(i => i.code)).toEqual(['EVAL_QUICK_LOOK_NO_NUMBER']);
|
||||
});
|
||||
});
|
||||
@@ -21,7 +21,8 @@ const tmp = () => { const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-no-g
|
||||
afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); });
|
||||
|
||||
const RESULT_SECTIONS = '## Decisions\nif the variant passes more items: adopt it\nif there is no difference: keep the default\n\n## Scoring\njudge: none\npaired: yes\ninterval: 95%\nmdd: 2 of 9 items\n';
|
||||
const BASE = ['Bars', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS;
|
||||
const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n';
|
||||
const BASE = ['Bars', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS + LOOP;
|
||||
const ARMS = (...ids: string[]) => `\n## Arms\n${ids.map(id => `- ${id} default settings, $0.01 per item`).join('\n')}\n`;
|
||||
const LOADED = '\n## Comparison\nstack: loaded\n';
|
||||
const NO_GSTACK = (o: Partial<Record<'arms' | 'inputs' | 'prompt' | 'panel' | 'report' | 'masking' | 'install' | 'audit', string>> = {}) => {
|
||||
@@ -190,10 +191,10 @@ describe('gstack-eval-plan prereg --check', () => {
|
||||
return { code: r.status, out: r.stdout ?? '', err: r.stderr ?? '' };
|
||||
};
|
||||
|
||||
test('a loaded comparison without the arm: one PREREG line out of 8, PREREG_NO_GSTACK_ARM on stderr, exit 1', () => {
|
||||
test('a loaded comparison without the arm: one PREREG line out of 10, PREREG_NO_GSTACK_ARM on stderr, exit 1', () => {
|
||||
const r = run(BASE + VARIANTS + LOADED);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toMatch(/^PREREG: incomplete present=8\/8 stack=loaded no_gstack_arm=missing file=/m);
|
||||
expect(r.out).toMatch(/^PREREG: incomplete present=10\/10 stack=loaded no_gstack_arm=missing file=/m);
|
||||
expect(r.err).toContain('missing section');
|
||||
expect(r.err).toContain('(PREREG_NO_GSTACK_ARM)');
|
||||
expect(r.err).not.toContain('(PREREG_INCOMPLETE)');
|
||||
@@ -217,9 +218,9 @@ describe('gstack-eval-plan prereg --check', () => {
|
||||
test('complete: PREREG: ok with stack=loaded no_gstack_arm=ok; an opt-out prints stack=none', () => {
|
||||
const ok = run(BASE + VARIANTS + LOADED + NO_GSTACK());
|
||||
expect(ok.code, ok.out + ok.err).toBe(0);
|
||||
expect(ok.out).toMatch(/^PREREG: ok present=8\/8 stack=loaded no_gstack_arm=ok file=/m);
|
||||
expect(ok.out).toMatch(/^PREREG: ok present=10\/10 stack=loaded no_gstack_arm=ok file=/m);
|
||||
const none = run(BASE + ARMS('claude-opus-5-5') + '\n## Comparison\nstack: none\nwhy: scorer calibration\n');
|
||||
expect(none.code, none.out + none.err).toBe(0);
|
||||
expect(none.out).toMatch(/^PREREG: ok present=8\/8 stack=none file=/m);
|
||||
expect(none.out).toMatch(/^PREREG: ok present=10\/10 stack=none file=/m);
|
||||
});
|
||||
});
|
||||
@@ -14,7 +14,8 @@ import { checkPrereg, parsePreregDiagnostics, preregTemplate } from '../lib/eval
|
||||
import { capyHost, type CapyHost } from './helpers/capy-host';
|
||||
|
||||
const BIN = path.resolve(import.meta.dir, '..', 'bin', 'gstack-eval-plan');
|
||||
const FILLED = ['Bars', 'Arms', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n## Comparison\nstack: none\nwhy: one arm, no skill stack\n\n## Decisions\nif the bar is met: run the full set\nif the bar is missed: fix the scorer first\n\n## Scoring\njudge: none\n';
|
||||
const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n';
|
||||
const FILLED = ['Bars', 'Arms', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + LOOP + '\n## Comparison\nstack: none\nwhy: one arm, no skill stack\n\n## Decisions\nif the bar is met: run the full set\nif the bar is missed: fix the scorer first\n\n## Scoring\njudge: none\n';
|
||||
const SUMMARIZER = [
|
||||
'touch ran.marker',
|
||||
'r=$(grep -c \'"kind":"refusal"\' "$1")',
|
||||
@@ -54,7 +55,7 @@ describe('prereg --check: the Diagnostics section', () => {
|
||||
const r = check(FILLED + diagnostics([['refusals', '2'], ['truncated', '1']]));
|
||||
expect(r.code).toBe(3);
|
||||
expect(r.ran).toBe(false);
|
||||
expect(r.out).toContain('PREREG: ok present=8/8 stack=none diagnostics=2 file=');
|
||||
expect(r.out).toContain('PREREG: ok present=10/10 stack=none diagnostics=2 file=');
|
||||
expect(r.out).toContain(`PREREG_COMMAND: summarizer="sh summarize.sh {fixture}" fixture=fixtures/synthetic records.jsonl cwd=${fs.realpathSync(repo)}`);
|
||||
expect(r.err).toContain('(REPO_COMMANDS_NOT_ALLOWED)');
|
||||
expect(r.out).not.toContain('PREREG_DIAGNOSTICS:');
|
||||
@@ -104,7 +105,7 @@ describe('prereg --check: the Diagnostics section', () => {
|
||||
const r = check(FILLED + diagnostics([['refusals', 'two']], { summarizer: 'sh summarize.sh fixtures/x.jsonl' }), '--allow-repo-commands');
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.ran).toBe(false);
|
||||
expect(r.out).toContain('PREREG: incomplete present=8/8 stack=none diagnostics=invalid');
|
||||
expect(r.out).toContain('PREREG: incomplete present=10/10 stack=none diagnostics=invalid');
|
||||
expect(r.err).toContain('diagnostics: row "| refusals | two |"');
|
||||
expect(r.err).toContain('diagnostics: the summarizer command never names the fixture ({fixture})');
|
||||
expect(r.err).toContain('diagnostics: no | diagnostic | expected | rows');
|
||||
@@ -114,7 +115,7 @@ describe('prereg --check: the Diagnostics section', () => {
|
||||
test('without a Diagnostics section the check is unchanged; the template mentions the section without adding a heading', () => {
|
||||
const r = check(FILLED);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toBe(`PREREG: ok present=8/8 stack=none file=${path.join(repo, 'evals', 'prereg.md')}\n`);
|
||||
expect(r.out).toBe(`PREREG: ok present=10/10 stack=none file=${path.join(repo, 'evals', 'prereg.md')}\n`);
|
||||
expect(parsePreregDiagnostics(FILLED)).toBeNull();
|
||||
expect(parsePreregDiagnostics(FILLED + '\n## Diagnostics\n<!-- none -->\n')).toBeNull();
|
||||
expect(preregTemplate()).toContain('## Diagnostics');
|
||||
|
||||
@@ -19,7 +19,8 @@ const dirs: string[] = [];
|
||||
afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); });
|
||||
|
||||
const DECISIONS = '## Decisions\nif the skill arm passes more items: keep the skill\nif there is no difference: cut the skill\n';
|
||||
const SCORING = (judge = 'gpt-6-astra', extra = 'labels: 40\nagreement: 0.6\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n') => `## Scoring\njudge: ${judge}\n${extra}`;
|
||||
const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n';
|
||||
const SCORING = (judge = 'gpt-6-astra', extra = 'labels: 40\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n') => `## Scoring\njudge: ${judge}\n${extra}`;
|
||||
const prereg = (o: { decisions?: string; scoring?: string; frozen?: string; diagnostics?: string } = {}) => [
|
||||
o.frozen ? `frozen: ${o.frozen}\n` : '',
|
||||
'## Bars\n- pass rate, higher is better\n',
|
||||
@@ -27,11 +28,12 @@ const prereg = (o: { decisions?: string; scoring?: string; frozen?: string; diag
|
||||
'## Arms\n- claude-opus-5-5 the skill installed\n- claude-opus-5-5#plain no skill\n',
|
||||
'## Comparison\nstack: none\nwhy: the scorer calibration compares prompts, not skill stacks\n',
|
||||
o.scoring ?? SCORING(),
|
||||
...['Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`),
|
||||
...['Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`),
|
||||
LOOP,
|
||||
o.diagnostics ?? '',
|
||||
].join('\n');
|
||||
const labels = (n: number, disagree = 0, cls = (i: number) => (i % 2 ? 'pass' : 'fail')) =>
|
||||
Array.from({ length: n }, (_, i) => JSON.stringify({ id: `item-${i}`, human: cls(i), judge: i < disagree ? (cls(i) === 'pass' ? 'fail' : 'pass') : cls(i) })).join('\n') + '\n';
|
||||
Array.from({ length: n }, (_, i) => JSON.stringify({ id: `item-${i}`, arm: i < n / 2 ? 'claude-opus-5-5' : 'claude-opus-5-5#plain', human: cls(i), judge: i < disagree ? (cls(i) === 'pass' ? 'fail' : 'pass') : cls(i) })).join('\n') + '\n';
|
||||
const table = (header: string, ...rows: string[]) => [header, header.replace(/[^|]+/g, '---'), ...rows].join('\n') + '\n';
|
||||
|
||||
describe('## Decisions', () => {
|
||||
@@ -89,6 +91,7 @@ describe('judge labels', () => {
|
||||
expect(checkJudgeLabels(scoring, labels(40, 4))).toMatchObject({ ok: true, n: 40, kappa: 0.8 });
|
||||
expect(checkJudgeLabels(scoring, labels(39)).problems).toEqual(['39 labelled outputs, needs 40']);
|
||||
expect(checkJudgeLabels(scoring, labels(40, 10)).problems).toEqual(['kappa 0.50 is below the bar 0.6']);
|
||||
expect(checkJudgeLabels({ ...scoring, per_arm: true }, labels(40, 10)).problems.map(p => p.split(':')[0])).toEqual(['kappa 0.50 is below the bar 0.6', 'arm claude-opus-5-5']);
|
||||
expect(checkJudgeLabels(scoring, labels(40, 0, () => 'pass')).problems[0]).toContain('one class');
|
||||
expect(checkJudgeLabels(scoring, labels(40) + labels(1)).problems).toContain('id item-0 is labelled twice');
|
||||
expect(checkJudgeLabels({ ...scoring, labels: 60 }, labels(40)).problems).toEqual(['40 labelled outputs, needs 60']);
|
||||
@@ -158,10 +161,10 @@ describe('gstack-eval-plan judge --check and results --labels', () => {
|
||||
test('judge --check prints JUDGE_AGREEMENT and exits 1 with EVAL_JUDGE_UNCHECKED below the bar', () => {
|
||||
const ok = run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg(), 'labels.jsonl': labels(40, 4) });
|
||||
expect(ok.code, ok.err).toBe(0);
|
||||
expect(ok.out).toBe('JUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=0.80 bar=0.6\n');
|
||||
expect(ok.out).toBe('JUDGE_ARM: claude-opus-5-5 n=20 kappa=0.60 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=20 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=0.80 bar=0.6\n');
|
||||
const low = run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg(), 'labels.jsonl': labels(20) });
|
||||
expect(low.code).toBe(1);
|
||||
expect(low.out).toBe('JUDGE_AGREEMENT: unchecked judge=gpt-6-astra n=20/40 kappa=1.00 bar=0.6\n');
|
||||
expect(low.out).toBe('JUDGE_ARM: claude-opus-5-5 n=10 kappa=1.00 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=10 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: unchecked judge=gpt-6-astra n=20/40 kappa=1.00 bar=0.6\n');
|
||||
expect(low.err).toContain('(EVAL_JUDGE_UNCHECKED)');
|
||||
expect(run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg({ scoring: SCORING('none') }), 'labels.jsonl': labels(40) }).code).toBe(2);
|
||||
});
|
||||
@@ -170,7 +173,7 @@ describe('gstack-eval-plan judge --check and results --labels', () => {
|
||||
const files = { 'prereg.md': prereg(), 'results.md': table('| arm | failures |', '| claude-opus-5-5 | 3 |', '| claude-opus-5-5#plain | 0 |'), 'labels.jsonl': labels(40) };
|
||||
const r = run(['results', '--check', 'prereg.md', '--labels', 'labels.jsonl', 'results.md'], files);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toBe('RESULTS: incomplete no_gstack_rows=0/0 rows=0/0 file=results.md\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=1.00 bar=0.6\n');
|
||||
expect(r.out).toBe('RESULTS: incomplete no_gstack_rows=0/0 rows=0/0 file=results.md\nJUDGE_ARM: claude-opus-5-5 n=20 kappa=1.00 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=20 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=1.00 bar=0.6\n');
|
||||
expect(r.err).toContain('(EVAL_REPORT_UNPLANTED_ZERO)');
|
||||
expect(r.err).toContain('(EVAL_REPORT_NO_ANSWER_ONLY)');
|
||||
expect(r.err).not.toContain('(EVAL_REPORT_NO_GSTACK_ROW)');
|
||||
|
||||
@@ -15,7 +15,8 @@ const dirs: string[] = [];
|
||||
afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); });
|
||||
|
||||
const RESULT_SECTIONS = '## Decisions\nif the variant passes more items: adopt it\nif there is no difference: keep the default\n\n## Scoring\njudge: none\npaired: yes\ninterval: 95%\nmdd: 2 of 9 items\n';
|
||||
const BASE = ['Bars', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS;
|
||||
const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n';
|
||||
const BASE = ['Bars', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS + LOOP;
|
||||
const PREREG = BASE + `
|
||||
## Arms
|
||||
- claude-opus-5-5#review-g default settings
|
||||
|
||||
Vendored
+1
-1
@@ -25,7 +25,7 @@
|
||||
"diagram": 4529,
|
||||
"document-generate": 6027,
|
||||
"document-release": 4469,
|
||||
"eval-plan": 6271,
|
||||
"eval-plan": 7057,
|
||||
"freeze": 1163,
|
||||
"gstack": 5793,
|
||||
"gstack-upgrade": 6297,
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('lib/pricing', () => {
|
||||
});
|
||||
|
||||
test('the default eval-arms tier (smart) is priced out of the box', () => {
|
||||
for (const model of ['claude-opus-5-5', 'gpt-6.1-sol']) expect(hasPricing(model)).toBe(true);
|
||||
for (const model of ['claude-opus-5-5', 'gpt-6.1-sol', 'gpt-6.2-sol', 'gpt-6.2-astra']) expect(hasPricing(model)).toBe(true);
|
||||
});
|
||||
|
||||
test('claude-haiku-5-5, gpt-6-luna and gemini-4-argon are priced (#3640)', () => {
|
||||
@@ -59,7 +59,10 @@ describe('preregistration', () => {
|
||||
expect(PREREG_SECTIONS).toContain('Comparison');
|
||||
const filled = t.replace(/^(##\s+.+)$/gm, '$1\n- filled in').replace('## Comparison\n- filled in', '## Comparison\nstack: none\nwhy: one arm, no skill stack')
|
||||
.replace('## Decisions\n- filled in', '## Decisions\nif the bar is met: run the full set\nif the bar is missed: stop and fix the scorer')
|
||||
.replace('## Scoring\n- filled in', '## Scoring\njudge: none');
|
||||
.replace('## Scoring\n- filled in', '## Scoring\njudge: none')
|
||||
.replace('## Pilot\n- filled in', '## Pilot\nshare: 10%\ncounted: no\nran: shown in each arm\'s outputs\nsupply: three rows per arm\nunits: every task type\nseed: 7')
|
||||
.replace('## Cost\n- filled in', '## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger')
|
||||
.replace('## Held-out exposure\n- filled in', '## Held-out exposure\nanswers: other git refs and build caches checked');
|
||||
expect(checkPrereg(filled)).toMatchObject({ ok: true, missing: [], empty: [] });
|
||||
expect(checkPrereg('# nothing here\n').missing).toEqual([...PREREG_SECTIONS]);
|
||||
});
|
||||
@@ -140,7 +143,7 @@ describe('dry run', () => {
|
||||
expect(small.checks.frontier).toMatchObject({ ok: false, small_tier: ['claude-haiku-4-5', 'claude-sonnet-5-5#no-gstack'], tier_question: null });
|
||||
const avgIn = Math.ceil((estimateTokens('hello world') + estimateTokens('second row')) / 2);
|
||||
expect(small.checks.frontier.recost_usd['claude-opus-5-5']).toBe(2 * 2 * estimateCostUsd({ input: avgIn, output: REASONING_OUTPUT_FLOOR }, 'claude-opus-5-5'));
|
||||
expect(small.checks.frontier.recost_usd['gpt-6.1-sol']).toBeGreaterThan(0);
|
||||
expect(small.checks.frontier.recost_usd['gpt-6.2-sol']).toBeGreaterThan(0);
|
||||
expect(renderDryRun(small)).toContain('CHECK: frontier refused');
|
||||
const asked = dryRun({ input: rows, arms: ['claude-haiku-4-5'], retryPrompt: retry, tierQuestion: 'does the diet hold on Haiku' });
|
||||
expect(asked.pass).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user