mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 17:11:28 +01:00
/eval-plan refuses gpt-4o and older-generation models in every role, and asks for 100 judge labels from 2026-11-22 (GST-3384) (#4630)
/eval-plan now refuses gpt-4o and older-generation models in every role a plan picks (arms, judge, readers, simulators) and names the replacement; a competitor tested as its vendor ships it keeps its built-in model on its own arm. Why: eval numbers should come from current frontier models, and from 2026-11-22 a model judge must agree with 100 hand labels, not 40. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: lib/eval-plan-checks.ts:153:functional-contract reader=qa Review-Finding: p1/red-team#2 reader=red-team
This commit is contained in:
1 parent
79eea6d5fc
commit
5db285c1a4
71 files changed
+458
-139
No files matched your search
+2
-2
@@ -36,8 +36,8 @@ const DEFAULTS = {
|
||||
// Tests needing a cheaper or historical model pass it explicitly or set
|
||||
// GSTACK_EVAL_MODEL_CAPTURE / GSTACK_EVAL_MODEL_JUDGE / GSTACK_EVAL_MODEL.
|
||||
capture: CLAUDE_CAPTURE_EVAL_MODEL,
|
||||
warmup: "claude-haiku-4-5",
|
||||
distill: "claude-haiku-4-5-20251001",
|
||||
warmup: "claude-haiku-5-5",
|
||||
distill: "claude-haiku-5-5",
|
||||
judge: CLAUDE_JUDGE_EVAL_MODEL,
|
||||
} as const satisfies Record<string, string>;
|
||||
|
||||
|
||||
+61
-7
@@ -7,8 +7,14 @@
|
||||
* `frozen:` date is before RESULT_CHECKS_SINCE keeps the rules it was frozen
|
||||
* under. Reads text only; executes nothing.
|
||||
*/
|
||||
import { currentReplacement } from './pricing';
|
||||
|
||||
export const RESULT_CHECKS_SINCE = '2026-11-15';
|
||||
export const JUDGE_MIN_LABELS = 40;
|
||||
/** R78 amendment (Garry, 2026-11-21): a plan frozen on or after this date (or with no frozen: line) checks its judge on at least JUDGE_RAISED_MIN_LABELS labels; earlier plans keep JUDGE_MIN_LABELS. */
|
||||
export const JUDGE_LABELS_RAISED_SINCE = '2026-11-22';
|
||||
export const JUDGE_RAISED_MIN_LABELS = 100;
|
||||
export const judgeMinLabels = (frozen: string | null) => (frozen !== null && frozen < JUDGE_LABELS_RAISED_SINCE ? JUDGE_MIN_LABELS : JUDGE_RAISED_MIN_LABELS);
|
||||
export const JUDGE_MIN_KAPPA = 0.6;
|
||||
|
||||
const PLACEHOLDER = /^(?:|-+|—|n\/a|none|tbd|todo|\?)\.?$/i;
|
||||
@@ -110,6 +116,53 @@ export function checkLoop(s: LoopSections): LoopCheck {
|
||||
return { paid, interim_required, errors };
|
||||
}
|
||||
|
||||
/**
|
||||
* R116 (Garry, 2026-11-21): no gpt-4o, and no model lib/pricing.ts marks
|
||||
* `superseded_by`, in any role a plan chooses: an arm, the judge, a reader or
|
||||
* a simulator (docs/TESTING_INTERNALS.md#frontier-models-under-test). A
|
||||
* competitor system tested as its vendor ships it keeps its built-in model
|
||||
* through a `vendor-default: <model> <system>` line in `## Models`; the
|
||||
* check records it and results --check wants the results to name it. A
|
||||
* preregistration frozen before MODEL_GENERATIONS_SINCE keeps its models.
|
||||
*/
|
||||
export const MODEL_GENERATIONS_SINCE = '2026-11-21';
|
||||
export type ModelRole = 'arm' | 'judge' | 'reader' | 'simulator';
|
||||
export interface ModelUse { model: string; role: ModelRole; loadout?: string }
|
||||
export interface ModelGenerationCheck { ok: boolean; exempt: boolean; refused: Array<{ model: string; role: ModelRole; replacement: string }>; exceptions: Array<{ model: string; system: string; roles: ModelRole[] }>; errors: string[] }
|
||||
export function checkModelGenerations(o: { arms: string[]; judge?: string | null; models?: string[] | null; frozen?: string | null }): ModelGenerationCheck {
|
||||
if (o.frozen && o.frozen < MODEL_GENERATIONS_SINCE) return { ok: true, exempt: true, refused: [], exceptions: [], errors: [] };
|
||||
const list = (v: string) => v.split(/[\s,]+/).map(m => m.replace(/^`|`$/g, '')).filter(m => m && !PLACEHOLDER.test(m));
|
||||
const uses: ModelUse[] = [...o.arms.map(a => ({ model: a.split('#')[0]!, loadout: a.split('#')[1], role: 'arm' as const })), ...list(o.judge ?? '').map(model => ({ model, role: 'judge' as const }))];
|
||||
const errors: string[] = [];
|
||||
const exceptions: ModelGenerationCheck['exceptions'] = [];
|
||||
for (const line of o.models ?? []) {
|
||||
const m = /^\s*(?:[-*]\s+)?(readers?|simulators?|vendor-default):(.*)$/i.exec(line);
|
||||
if (!m) continue;
|
||||
const key = m[1]!.toLowerCase().replace(/s$/, '');
|
||||
if (key !== 'vendor-default') { uses.push(...list(m[2]!).map(model => ({ model, role: key as ModelRole }))); continue; }
|
||||
const [model = '', ...rest] = m[2]!.trim().split(/\s+/);
|
||||
const system = rest.join(' ').replace(/^(?:[—–:|-]+|in|for)\s+/i, '').trim();
|
||||
if (!model || !filled(system)) errors.push(`vendor-default: ${m[2]!.trim() || '(empty)'} needs the model and the competitor system that ships it as its default, such as "vendor-default: gpt-4o-mini Mem0 1.2 as shipped"`);
|
||||
else exceptions.push({ model: model.replace(/^`|`$/g, '').split('#')[0]!, system, roles: [] });
|
||||
}
|
||||
const bare = (m: string) => m.toLowerCase().replace(/^(?:[a-z-]+[/:])+/, '');
|
||||
const word = (s: string) => s.toLowerCase().replace(/[^a-z0-9]/g, '');
|
||||
const refused: ModelGenerationCheck['refused'] = [];
|
||||
for (const use of uses) {
|
||||
const replacement = currentReplacement(use.model);
|
||||
if (!replacement) continue;
|
||||
const exception = use.role === 'arm' && use.loadout ? exceptions.find(e => bare(e.model) === bare(use.model) && word(e.system).startsWith(word(use.loadout!)) && word(use.loadout!) !== '') : undefined;
|
||||
if (exception) { if (!exception.roles.includes('arm')) exception.roles.push('arm'); continue; }
|
||||
if (!refused.some(r => r.model === use.model && r.role === use.role)) refused.push({ model: use.model, role: use.role, replacement });
|
||||
}
|
||||
return { ok: !refused.length && !errors.length, exempt: false, refused, exceptions, errors };
|
||||
}
|
||||
export const modelGenerationProblems = (c: ModelGenerationCheck) => [...c.refused.map(r => `${r.model} as ${r.role} is an older generation; use ${r.replacement} (R116)`), ...c.errors];
|
||||
export const renderModelGenerations = (c: ModelGenerationCheck) => [
|
||||
...c.refused.map(r => `MODEL_GENERATION: refused ${r.model} role=${r.role} replacement=${r.replacement} (R116, docs/TESTING_INTERNALS.md#frontier-models-under-test)`),
|
||||
...c.exceptions.map(e => `MODEL_EXCEPTION: ${e.model} vendor-default system=${JSON.stringify(e.system)} roles=${e.roles.join(',') || 'declared'} (the results must name it)`),
|
||||
].map(l => `${l}\n`).join('');
|
||||
|
||||
export interface DecisionsCheck { outcomes: Array<{ result: string; action: string }>; errors: string[] }
|
||||
/** `## Decisions`: one `if <result>: <what we do>` line per possible result, at least two, and not all the same action. */
|
||||
export function checkDecisions(body: string[] | null): DecisionsCheck {
|
||||
@@ -127,15 +180,16 @@ export function checkDecisions(body: string[] | null): DecisionsCheck {
|
||||
return { outcomes, errors };
|
||||
}
|
||||
|
||||
export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[]; per_arm?: boolean }
|
||||
export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[]; per_arm?: boolean; min_labels?: number }
|
||||
/**
|
||||
* `## Scoring`: `judge: none` or the judge model; a model judge needs `labels:`
|
||||
* (at least 40) and `agreement:` (a kappa bar of at least 0.6) and a family no
|
||||
* (at least judgeMinLabels(frozen): 100, or 40 for a plan frozen before 2026-11-22) and `agreement:` (a kappa bar of at least 0.6) and a family no
|
||||
* arm shares. Two or more arms need `paired: yes`, `interval: 95%` and `mdd:`,
|
||||
* the smallest difference the run can detect.
|
||||
*/
|
||||
export function checkScoring(body: string[] | null, arms: string[]): ScoringCheck {
|
||||
if (!body?.length) return { judge: null, labels: null, agreement: null, errors: [] };
|
||||
export function checkScoring(body: string[] | null, arms: string[], frozen: string | null = null): ScoringCheck {
|
||||
const min_labels = judgeMinLabels(frozen);
|
||||
if (!body?.length) return { judge: null, labels: null, agreement: null, errors: [], min_labels };
|
||||
const kv = keyValues(body);
|
||||
const judge = kv.judge || null;
|
||||
const labels = firstNumber(kv.labels);
|
||||
@@ -143,7 +197,7 @@ export function checkScoring(body: string[] | null, arms: string[]): ScoringChec
|
||||
const errors: string[] = [];
|
||||
if (!judge) errors.push('no judge: line (judge: none, or the judge model)');
|
||||
else if (judge.toLowerCase() !== 'none') {
|
||||
if (labels === null || labels < JUDGE_MIN_LABELS) errors.push(`labels: needs at least ${JUDGE_MIN_LABELS} hand-labelled outputs the judge is checked against`);
|
||||
if (labels === null || labels < min_labels) errors.push(`labels: needs at least ${min_labels} hand-labelled outputs the judge is checked against${min_labels > JUDGE_MIN_LABELS ? ` (${JUDGE_MIN_LABELS} only for a plan frozen before ${JUDGE_LABELS_RAISED_SINCE})` : ''}`);
|
||||
if (agreement === null || agreement < JUDGE_MIN_KAPPA || agreement > 1) errors.push(`agreement: needs a kappa bar from ${JUDGE_MIN_KAPPA} to 1`);
|
||||
const family = modelFamily(judge);
|
||||
for (const arm of [...new Set(arms)]) if (modelFamily(arm) === family) errors.push(`judge ${judge} is the same model family (${family}) as arm ${arm}; use a judge from another family`);
|
||||
@@ -153,7 +207,7 @@ export function checkScoring(body: string[] | null, arms: string[]): ScoringChec
|
||||
if (firstNumber(kv.interval) !== 95) errors.push('interval: 95% (the interval every comparison is reported with)');
|
||||
if (PLACEHOLDER.test(kv.mdd ?? '')) errors.push('mdd: the smallest difference this run can detect, stated before the run');
|
||||
}
|
||||
return { judge, labels, agreement, errors, per_arm: /^yes\b/i.test(kv['per-arm'] ?? '') };
|
||||
return { judge, labels, agreement, errors, per_arm: /^yes\b/i.test(kv['per-arm'] ?? ''), min_labels };
|
||||
}
|
||||
|
||||
export interface JudgeLabelCheck { ok: boolean; judge: string; n: number; kappa: number | null; need_n: number; need_kappa: number; problems: string[]; arms: Array<{ arm: string; n: number; kappa: number | null }> }
|
||||
@@ -171,7 +225,7 @@ export function cohensKappa(pairs: Array<[string, string]>): number | null {
|
||||
|
||||
/** Score the preregistered judge against a JSONL file of `{"id", "human", "judge"}` rows. */
|
||||
export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string, planArms: string[] = []): JudgeLabelCheck {
|
||||
const need_n = Math.max(JUDGE_MIN_LABELS, scoring.labels ?? 0);
|
||||
const need_n = Math.max(scoring.min_labels ?? JUDGE_RAISED_MIN_LABELS, scoring.labels ?? 0);
|
||||
const need_kappa = Math.max(JUDGE_MIN_KAPPA, scoring.agreement ?? 0);
|
||||
const problems: string[] = [];
|
||||
const pairs: Array<[string, string]> = [];
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Reads text only; executes nothing.
|
||||
*/
|
||||
import { armIdentities, checkPrereg } from './eval-plan';
|
||||
import { checkJudgeLabels, type JudgeLabelCheck } from './eval-plan-checks';
|
||||
import { checkJudgeLabels, modelGenerationProblems, type JudgeLabelCheck } from './eval-plan-checks';
|
||||
import type { ResultCodeName } from './result-codes';
|
||||
|
||||
export interface ResultsIssue { code: ResultCodeName; message: string }
|
||||
@@ -59,6 +59,8 @@ export function checkResults(preregText: string, resultsText: string, labelsText
|
||||
for (const s of prereg.missing) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${s}: missing` });
|
||||
for (const s of prereg.empty) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${s}: empty` });
|
||||
for (const e of prereg.loop.errors) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${e.section}: ${e.message}` });
|
||||
for (const p of modelGenerationProblems(prereg.models)) issues.push({ code: 'EVAL_MODEL_OLD_GENERATION', message: p });
|
||||
for (const e of prereg.models.exceptions) if (!resultsText.toLowerCase().includes(e.model.toLowerCase())) issues.push({ code: 'EVAL_MODEL_OLD_GENERATION', message: `the results never name ${e.model}, the vendor default kept for ${e.system}; the results row names it` });
|
||||
let judge: JudgeLabelCheck | null = null;
|
||||
if (!prereg.grandfathered) {
|
||||
for (const [section, errors] of [['Decisions', prereg.decisions.errors], ['Scoring', prereg.scoring.errors]] as const) {
|
||||
|
||||
+18
-9
@@ -19,7 +19,7 @@ import { EXCLUDED_BILLING_CATEGORIES, estimateCostUsd, hasPricing, PRICING, pric
|
||||
import type { ResultCodeName } from './result-codes';
|
||||
import type { ModelRulesCheck } from './eval-models';
|
||||
import { readLedger, release, reserve, settle, SpendCapExceeded, summarize, type SpendLedger, type SpendSummary } from './spend-ledger';
|
||||
import { checkDecisions, checkLoop, checkQuickLook, checkScoring, frozenDate, grandfathered, isQuickLook, loopGrandfathered, type DecisionsCheck, type LoopCheck, type QuickLookCheck, type ScoringCheck } from './eval-plan-checks';
|
||||
import { checkDecisions, checkLoop, checkModelGenerations, checkQuickLook, checkScoring, frozenDate, grandfathered, isQuickLook, loopGrandfathered, type DecisionsCheck, type LoopCheck, type ModelGenerationCheck, type QuickLookCheck, type ScoringCheck } from './eval-plan-checks';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// preregistration
|
||||
@@ -33,7 +33,7 @@ const LOOP_CHECK_SECTIONS: readonly string[] = ['Pilot', 'Cost'];
|
||||
export interface ComparisonCheck { stack: 'loaded' | 'none' | null; why: string | null; errors: string[] }
|
||||
/** `## No-gstack arm`, required when `stack: loaded`: one `<model>#no-gstack` Arms line per model, the inputs, prompt, panel and report it shares with the variants, and its masking, install and audit lines. */
|
||||
export interface NoGstackArmCheck { required: boolean; ok: boolean; arms: string[]; problems: string[] }
|
||||
export interface PreregCheck { ok: boolean; present: string[]; missing: string[]; empty: string[]; comparison: ComparisonCheck; no_gstack: NoGstackArmCheck; diagnostics: PreregDiagnostics | null; decisions: DecisionsCheck; scoring: ScoringCheck; frozen: string | null; grandfathered: boolean; loop: LoopCheck; loop_grandfathered: boolean; quick: QuickLookCheck | null }
|
||||
export interface PreregCheck { ok: boolean; present: string[]; missing: string[]; empty: string[]; comparison: ComparisonCheck; no_gstack: NoGstackArmCheck; diagnostics: PreregDiagnostics | null; decisions: DecisionsCheck; scoring: ScoringCheck; frozen: string | null; grandfathered: boolean; loop: LoopCheck; loop_grandfathered: boolean; quick: QuickLookCheck | null; models: ModelGenerationCheck }
|
||||
export const NO_GSTACK_LOADOUT = 'no-gstack';
|
||||
/** masking, install and audit keep the arm clean (TESTING_INTERNALS.md#no-gstack-arm): an arm that read a gstack skill file is contaminated. */
|
||||
export const NO_GSTACK_KEYS = ['arms', 'inputs', 'prompt', 'panel', 'report', 'masking', 'install', 'audit'] as const;
|
||||
@@ -48,7 +48,7 @@ export function preregTemplate(title = 'Eval preregistration'): string {
|
||||
<!-- One \`if <result>: <what we do>\` line per way the run can come out (a pass, a miss, no difference), at least two, written before anything is spent. If every result leads to the same action, the eval changes nothing: do not run it. -->
|
||||
|
||||
## Arms
|
||||
<!-- One line per arm: the arm identity first (\`<model>\` or \`<model>#<loadout>\`, the model in lib/pricing.ts, e.g. \`claude-opus-5-5#no-gstack\`), settings, and the per-item cost from \`gstack-eval-plan arms\`. Models under test are frontier models (today \`claude-opus-5-5\`, \`gpt-6.2-sol\`) plus at most one named low-cost primary; a Haiku or Sonnet arm only with a stated tier question. -->
|
||||
<!-- One line per arm: the arm identity first (\`<model>\` or \`<model>#<loadout>\`, the model in lib/pricing.ts, e.g. \`claude-opus-5-5#no-gstack\`), settings, and the per-item cost from \`gstack-eval-plan arms\`. Models under test are frontier models (today \`claude-opus-5-5\`, \`gpt-6.2-sol\`) plus at most one named low-cost primary; a Haiku or Sonnet arm only with a stated tier question. No gpt-4o and no model lib/pricing.ts marks \`superseded_by\` (R116). -->
|
||||
|
||||
## Comparison
|
||||
<!-- \`stack: loaded\` when any arm loads gstack or another skill stack (review variants, preamble loadouts, skill diets, a model panel under a stack); otherwise \`stack: none\` and a \`why:\` line. -->
|
||||
@@ -57,7 +57,10 @@ export function preregTemplate(title = 'Eval preregistration'): string {
|
||||
<!-- Required with \`stack: loaded\`: \`arms:\` one \`<model>#no-gstack\` Arms line per model; \`inputs:\` the same rows and fixture; \`prompt:\` the task only (no SKILL.md, preamble, hooks or installed skills); \`panel:\` the same E2E kind, trials and judge; \`report:\` its row beside the variants; \`masking:\` how the run agent is kept from gstack (an empty directory bind-mounted over ~/.capy/drive/user-garry-tan and ~/.capy/drive/org-gstack-gbrain before it starts, or a container that sees no Capy drive); \`install:\` no gstack at ~/.local/share/gstack or ~/.claude/skills; \`audit:\` the per-arm drive-read audit (an arm that read a gstack skill file is contaminated and gets zero credit). -->
|
||||
|
||||
## Scoring
|
||||
<!-- \`judge: none\` when a rule scores every metric; otherwise \`judge: <model>\` from another model family than every arm, \`labels: <n>\` hand-labelled outputs it is checked against (at least 40, never held-out rows) and \`agreement: <kappa bar>\` (at least 0.6), \`per-arm: yes\` (agreement read on each arm's outputs, not pooled) and \`effort: <the reasoning effort set in the judge's start>\`; GPT-6 Astra or GPT-6.2 Astra judges Claude arms, Claude Opus 5.5 judges GPT arms. With two or more arms: \`paired: yes\`, \`interval: 95%\` and \`mdd: <the smallest difference this run can detect>\`. -->
|
||||
<!-- \`judge: none\` when a rule scores every metric; otherwise \`judge: <model>\` from another model family than every arm, \`labels: <n>\` hand-labelled outputs it is checked against (at least 100, or 40 for a plan frozen before 2026-11-22; never held-out rows) and \`agreement: <kappa bar>\` (at least 0.6), \`per-arm: yes\` (agreement read on each arm's outputs, not pooled) and \`effort: <the reasoning effort set in the judge's start>\`; GPT-6 Astra or GPT-6.2 Astra judges Claude arms, Claude Opus 5.5 judges GPT arms. With two or more arms: \`paired: yes\`, \`interval: 95%\` and \`mdd: <the smallest difference this run can detect>\`. -->
|
||||
|
||||
## Models
|
||||
<!-- Optional: every other model the run starts, as \`reader: <model>\` and \`simulator: <model>\` lines. R116 refuses gpt-4o and any model lib/pricing.ts marks \`superseded_by\` in every role, arms and the judge included, and names the replacement. \`vendor-default: <model> <system>\` keeps a competitor system's built-in model when that system (an arm) is tested as its vendor ships it; the check records it and the results must name it. -->
|
||||
|
||||
## Pilot
|
||||
<!-- Uncounted, per arm, before its counted run: \`share: <at most 10>%\` of that arm's budget; \`counted: no\`; \`ran:\` how the arm's own outputs show the part under test ran; \`judge:\` the judge's label check on that arm's pilot outputs (with a model judge); \`supply:\` how the units are shown to be suppliable at the planned rate; \`units:\` every unit type the counted run uses, each drawn at least once; \`seed:\` the fixed seed for the draw order, independent of the number of workers. An arm that fails is fixed or left out, and reported as left out. -->
|
||||
@@ -170,7 +173,7 @@ export function checkPrereg(text: string): PreregCheck {
|
||||
const noLoop: LoopCheck = { paid: null, interim_required: false, errors: [] };
|
||||
if (isQuickLook(text)) {
|
||||
const quick = checkQuickLook(text);
|
||||
return { ok: !quick.errors.length, present, missing, empty, comparison: { stack: null, why: null, errors: [] }, no_gstack: { required: false, ok: true, arms: [], problems: [] }, diagnostics: null, decisions: { outcomes: [], errors: [] }, scoring: { judge: null, labels: null, agreement: null, errors: [] }, frozen: frozenDate(text), grandfathered: exempt, loop: noLoop, loop_grandfathered: loopExempt, quick };
|
||||
return { ok: !quick.errors.length, models: checkModelGenerations({ arms: [] }), present, missing, empty, comparison: { stack: null, why: null, errors: [] }, no_gstack: { required: false, ok: true, arms: [], problems: [] }, diagnostics: null, decisions: { outcomes: [], errors: [] }, scoring: { judge: null, labels: null, agreement: null, errors: [] }, frozen: frozenDate(text), grandfathered: exempt, loop: noLoop, loop_grandfathered: loopExempt, quick };
|
||||
}
|
||||
for (const name of PREREG_SECTIONS) {
|
||||
if (exempt && RESULT_CHECK_SECTIONS.includes(name)) continue;
|
||||
@@ -182,11 +185,12 @@ export function checkPrereg(text: string): PreregCheck {
|
||||
const no_gstack = checkNoGstackArm(text, comparison.stack);
|
||||
const diagnostics = parsePreregDiagnostics(text);
|
||||
const decisions = exempt ? { outcomes: [], errors: [] } : checkDecisions(sectionBody(text, 'Decisions'));
|
||||
const scoring = exempt ? { judge: null, labels: null, agreement: null, errors: [] } : checkScoring(sectionBody(text, 'Scoring'), armIdentities(text));
|
||||
const scoring = exempt ? { judge: null, labels: null, agreement: null, errors: [] } : checkScoring(sectionBody(text, 'Scoring'), armIdentities(text), frozenDate(text));
|
||||
const section = (name: string) => sectionBody(text, name);
|
||||
const loop = loopExempt ? noLoop : checkLoop({ pilot: section('Pilot'), cost: section('Cost'), interim: section('Interim look'), scoring: section('Scoring'), bars: section('Bars'), arms: section('Arms'), heldOut: section('Held-out exposure') });
|
||||
const ok = missing.length === 0 && empty.length === 0 && !comparison.errors.length && no_gstack.ok && !diagnostics?.errors.length && !decisions.errors.length && !scoring.errors.length && !loop.errors.length;
|
||||
return { ok, present, missing, empty, comparison, no_gstack, diagnostics, decisions, scoring, frozen: frozenDate(text), grandfathered: exempt, loop, loop_grandfathered: loopExempt, quick: null };
|
||||
const models = checkModelGenerations({ arms: armIdentities(text), judge: scoring.judge, models: section('Models'), frozen: frozenDate(text) });
|
||||
const ok = missing.length === 0 && empty.length === 0 && !comparison.errors.length && no_gstack.ok && !diagnostics?.errors.length && !decisions.errors.length && !scoring.errors.length && !loop.errors.length && models.ok;
|
||||
return { ok, models, present, missing, empty, comparison, no_gstack, diagnostics, decisions, scoring, frozen: frozenDate(text), grandfathered: exempt, loop, loop_grandfathered: loopExempt, quick: null };
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -345,6 +349,8 @@ export interface DryRunResult {
|
||||
model_rules?: { ok: boolean; source: string; refused: string[] };
|
||||
/** R54: Haiku and Sonnet are not models under test; arms on them alone are refused unless the plan asks about that tier. */
|
||||
frontier: { ok: boolean; small_tier: string[]; tier_question: string | null; recost_usd: Record<string, number> };
|
||||
/** R116: no arm is gpt-4o or a model lib/pricing.ts marks superseded_by. */
|
||||
generation: ModelGenerationCheck;
|
||||
};
|
||||
per_item_usd: Record<string, number | null>; excluded_billing: readonly string[]; pass: boolean; stub: 'stub-model (no network, $0)';
|
||||
}
|
||||
@@ -395,9 +401,10 @@ export function dryRun(o: DryRunOptions): DryRunResult {
|
||||
const smallTier = o.arms.filter(a => isSmallTierModel(armModel(a)));
|
||||
const recost = Object.fromEntries(FRONTIER_MODELS.map(m => [m, rows * o.arms.length * estimateCostUsd({ input: avgIn, output: budget }, m)]));
|
||||
checks.frontier = { ok: smallTier.length < o.arms.length || !!o.tierQuestion?.trim(), small_tier: smallTier, tier_question: o.tierQuestion?.trim() || null, recost_usd: recost };
|
||||
checks.generation = checkModelGenerations({ arms: o.arms });
|
||||
return {
|
||||
schema_version: 1, input: o.input, rows, bad_rows: bad, est_input_tokens: inputTokens, est_output_tokens: rows * budget, arms: o.arms, checks, per_item_usd: perItem,
|
||||
excluded_billing: EXCLUDED_BILLING_CATEGORIES, pass: rows > 0 && bad.length === 0 && checks.price_table.ok && checks.output_budget.ok && checks.retry_prompt.ok && (checks.reservation_fits_cap?.ok ?? true) && (checks.model_rules?.ok ?? true) && checks.frontier.ok, stub: 'stub-model (no network, $0)',
|
||||
excluded_billing: EXCLUDED_BILLING_CATEGORIES, pass: rows > 0 && bad.length === 0 && checks.price_table.ok && checks.output_budget.ok && checks.retry_prompt.ok && (checks.reservation_fits_cap?.ok ?? true) && (checks.model_rules?.ok ?? true) && checks.frontier.ok && checks.generation.ok, stub: 'stub-model (no network, $0)',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -410,6 +417,7 @@ export function renderDryRun(r: DryRunResult): string {
|
||||
`CHECK: retry-prompt ${r.checks.retry_prompt.ok ? `ok — ${JSON.stringify(r.checks.retry_prompt.text)}` : 'missing (pass --retry-prompt <file> with the exact text the run will send)'}`,
|
||||
...(r.checks.reservation_fits_cap ? [renderReservationCheck(r.checks.reservation_fits_cap, r.checks.output_budget.budget)] : []),
|
||||
...(r.checks.frontier.small_tier.length ? [renderFrontierCheck(r.checks.frontier, r.arms.length)] : []),
|
||||
...(r.checks.generation?.refused.length ? [`CHECK: model-generation refused ${r.checks.generation.refused.map(a => `${a.model} (use ${a.replacement})`).join(', ')} (R116, docs/TESTING_INTERNALS.md#frontier-models-under-test)`] : []),
|
||||
...(r.checks.model_rules ? [`CHECK: model-rules ${r.checks.model_rules.ok ? 'ok' : `refused ${r.checks.model_rules.refused.join('; ') || 'invalid rules'}`} (source ${r.checks.model_rules.source})`] : []),
|
||||
...Object.entries(r.per_item_usd).map(([m, usd]) => `ESTIMATE: ${m} per_item=${usd === null ? 'unknown (no price)' : `$${usd.toFixed(4)}`} (estimate: excludes ${r.excluded_billing.length} billing categories, see lib/pricing.ts)`),
|
||||
`DRY_RUN_RESULT: ${r.pass ? 'pass' : 'fail'}`,
|
||||
@@ -445,6 +453,7 @@ export function startPilot(o: PilotStartOptions): { record: PilotRecord; error?:
|
||||
const dry = JSON.parse(fs.readFileSync(o.dryRun, 'utf8')) as DryRunResult;
|
||||
if (!dry.pass) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_DRY_RUN_FAILED', message: `${o.dryRun} did not pass; the pilot never starts on a failed dry run` } };
|
||||
if (o.arms.length && o.arms.every(a => isSmallTierModel(armModel(a))) && !dry.checks.frontier?.tier_question) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_DRY_RUN_FAILED', message: `every pilot arm is Haiku or Sonnet and ${o.dryRun} records no --tier-question (R54, docs/TESTING_INTERNALS.md#frontier-models-under-test)` } };
|
||||
const stale = checkModelGenerations({ arms: o.arms }).refused; if (stale.length) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_MODEL_OLD_GENERATION', message: stale.map(a => `${a.model} is an older generation; use ${a.replacement} (R116)`).join('; ') } };
|
||||
const tokens = o.tokens ?? { input: dry.rows ? Math.ceil(dry.est_input_tokens / dry.rows) : DEFAULT_TOKENS.input, output: dry.checks.output_budget.budget };
|
||||
const seat = o.seatMetered ?? [];
|
||||
const stray = seat.filter(a => !o.arms.includes(a));
|
||||
|
||||
+28
-11
@@ -28,6 +28,13 @@ export interface ModelPricing {
|
||||
input_per_mtok: number;
|
||||
output_per_mtok: number;
|
||||
cached_input_per_mtok?: number;
|
||||
/**
|
||||
* Set when a newer major generation of this model's family has its own row
|
||||
* here: the row that replaces it. gstack-eval-plan refuses a superseded
|
||||
* model in every role a plan chooses (R116, docs/TESTING_INTERNALS.md#frontier-models-under-test).
|
||||
* A point release (gpt-6-astra beside gpt-6.2-astra) is the same generation.
|
||||
*/
|
||||
superseded_by?: string;
|
||||
as_of: string; // YYYY-MM
|
||||
}
|
||||
|
||||
@@ -47,14 +54,14 @@ export const PRICING: Record<string, ModelPricing> = {
|
||||
// https://platform.claude.com/docs/en/models/opus-5-5/overview#pricing (list prices effective 2026-10-07)
|
||||
'claude-opus-5-5': { input_per_mtok: 4.00, output_per_mtok: 20.00, cached_input_per_mtok: 0.20, as_of: '2026-10' },
|
||||
// https://platform.claude.com/docs/en/about-claude/pricing (fetched 2026-10-12)
|
||||
'claude-opus-4-7': { input_per_mtok: 5.00, output_per_mtok: 25.00, cached_input_per_mtok: 0.50, as_of: '2026-10' },
|
||||
'claude-opus-4-7': { input_per_mtok: 5.00, output_per_mtok: 25.00, cached_input_per_mtok: 0.50, superseded_by: 'claude-opus-5-5', as_of: '2026-10' },
|
||||
// https://platform.claude.com/docs/en/about-claude/pricing (fetched 2026-10-12)
|
||||
'claude-sonnet-5-5': { input_per_mtok: 2.00, output_per_mtok: 10.00, cached_input_per_mtok: 0.10, as_of: '2026-10' },
|
||||
'claude-sonnet-4-6': { input_per_mtok: 3.00, output_per_mtok: 15.00, as_of: '2026-04' },
|
||||
'claude-sonnet-4-6': { input_per_mtok: 3.00, output_per_mtok: 15.00, superseded_by: 'claude-sonnet-5-5', as_of: '2026-04' },
|
||||
// https://platform.claude.com/docs/en/about-claude/pricing (fetched 2026-10-31; standard tier, prompts up to
|
||||
// 100,000 tokens; the $0.50 / $2.50 / $0.05 rate above that is excluded like the other long-context surcharges)
|
||||
'claude-haiku-5-5': { input_per_mtok: 0.10, output_per_mtok: 0.50, cached_input_per_mtok: 0.01, as_of: '2026-10' },
|
||||
'claude-haiku-4-5': { input_per_mtok: 1.00, output_per_mtok: 5.00, as_of: '2026-04' },
|
||||
'claude-haiku-4-5': { input_per_mtok: 1.00, output_per_mtok: 5.00, superseded_by: 'claude-haiku-5-5', as_of: '2026-04' },
|
||||
|
||||
// OpenAI (GPT + o-series)
|
||||
// https://developers.openai.com/api/docs/models/gpt-6-astra
|
||||
@@ -67,13 +74,13 @@ export const PRICING: Record<string, ModelPricing> = {
|
||||
'gpt-6.2-astra': { input_per_mtok: 8.00, output_per_mtok: 40.00, cached_input_per_mtok: 0.40, as_of: '2026-11' },
|
||||
// https://developers.openai.com/api/docs/models/gpt-6-luna (fetched 2026-10-31; standard tier, up to 272K input)
|
||||
'gpt-6-luna': { input_per_mtok: 0.10, output_per_mtok: 0.50, cached_input_per_mtok: 0.01, as_of: '2026-10' },
|
||||
'gpt-5.4': { input_per_mtok: 2.50, output_per_mtok: 10.00, as_of: '2026-04' },
|
||||
'gpt-5.4': { input_per_mtok: 2.50, output_per_mtok: 10.00, superseded_by: 'gpt-6.2-sol', as_of: '2026-04' },
|
||||
// https://developers.openai.com/api/docs/models/gpt-4o (fetched 2026-10-13; gbrain's LongMemEval judge, the official scorer's model;
|
||||
// the alias only: the gpt-4o-2024-05-13 snapshot has its own price)
|
||||
'gpt-4o': { input_per_mtok: 2.50, output_per_mtok: 10.00, cached_input_per_mtok: 1.25, as_of: '2026-10' },
|
||||
'gpt-5.4-mini': { input_per_mtok: 0.60, output_per_mtok: 2.40, as_of: '2026-04' },
|
||||
'o3': { input_per_mtok: 15.00, output_per_mtok: 60.00, as_of: '2026-04' },
|
||||
'o4-mini': { input_per_mtok: 1.10, output_per_mtok: 4.40, as_of: '2026-04' },
|
||||
'gpt-4o': { input_per_mtok: 2.50, output_per_mtok: 10.00, cached_input_per_mtok: 1.25, superseded_by: 'gpt-6.2-sol', as_of: '2026-10' },
|
||||
'gpt-5.4-mini': { input_per_mtok: 0.60, output_per_mtok: 2.40, superseded_by: 'gpt-6-luna', as_of: '2026-04' },
|
||||
'o3': { input_per_mtok: 15.00, output_per_mtok: 60.00, superseded_by: 'gpt-6.2-sol', as_of: '2026-04' },
|
||||
'o4-mini': { input_per_mtok: 1.10, output_per_mtok: 4.40, superseded_by: 'gpt-6-luna', as_of: '2026-04' },
|
||||
|
||||
// Google
|
||||
// https://ai.google.dev/gemini-api/docs/pricing (fetched 2026-10-31; the rates starting 2026-12-01, so estimates
|
||||
@@ -85,9 +92,9 @@ export const PRICING: Record<string, ModelPricing> = {
|
||||
// https://ai.google.dev/gemini-api/docs/pricing (fetched 2026-10-12; same schedule as gemini-3.8-flash)
|
||||
'gemini-3.6-flash': { input_per_mtok: 0.75, output_per_mtok: 3.75, cached_input_per_mtok: 0.075, as_of: '2026-10' },
|
||||
// https://ai.google.dev/gemini-api/docs/pricing (fetched 2026-10-12; prompts <= 200k tokens, the long-context rate is excluded)
|
||||
'gemini-3.1-pro-preview': { input_per_mtok: 2.00, output_per_mtok: 12.00, cached_input_per_mtok: 0.20, as_of: '2026-10' },
|
||||
'gemini-2.5-pro': { input_per_mtok: 1.25, output_per_mtok: 5.00, as_of: '2026-04' },
|
||||
'gemini-2.5-flash': { input_per_mtok: 0.30, output_per_mtok: 1.20, as_of: '2026-04' },
|
||||
'gemini-3.1-pro-preview': { input_per_mtok: 2.00, output_per_mtok: 12.00, cached_input_per_mtok: 0.20, superseded_by: 'gemini-4-argon', as_of: '2026-10' },
|
||||
'gemini-2.5-pro': { input_per_mtok: 1.25, output_per_mtok: 5.00, superseded_by: 'gemini-4-argon', as_of: '2026-04' },
|
||||
'gemini-2.5-flash': { input_per_mtok: 0.30, output_per_mtok: 1.20, superseded_by: 'gemini-3.8-flash', as_of: '2026-04' },
|
||||
|
||||
// Particle AI: https://docs.particle.ai/usage-billing (fetched 2026-10-30; peak rates, off-peak and flex are 50% lower;
|
||||
// OpenRouter serves particle-ai/particle-1 at the same rates)
|
||||
@@ -138,6 +145,16 @@ export function hasPricing(model: string | undefined): boolean {
|
||||
return pricingRow(model) !== undefined;
|
||||
}
|
||||
|
||||
/** gpt-4o in any variant, snapshot or provider form (`openrouter:openai/gpt-4o`, `gpt-4o-mini-2024-07-18`, `chatgpt-4o-latest`), priced or not. */
|
||||
const GPT_4O = /^(?:chatgpt-4o|gpt-4o)(?:$|-)/;
|
||||
|
||||
/** The current model that replaces `model` when it is gpt-4o or a row marked `superseded_by` (R116), else null. */
|
||||
export function currentReplacement(model: string): string | null {
|
||||
const segments = model.trim().toLowerCase().split(/[:/]/);
|
||||
if (segments.some(s => GPT_4O.test(s))) return segments.some(s => /4o-mini/.test(s)) ? 'gpt-6-luna' : PRICING['gpt-4o']!.superseded_by!;
|
||||
return pricingRow(model)?.superseded_by ?? null;
|
||||
}
|
||||
|
||||
const WARNED = new Set<string>();
|
||||
|
||||
export function estimateCostUsd(
|
||||
|
||||
@@ -11,7 +11,7 @@ export const EVAL_RESULT_CODES = {
|
||||
PREREG_INCOMPLETE: {
|
||||
anchor: 'prereg-incomplete',
|
||||
summary: 'the preregistration file lacks a required section, a section is empty, or the Comparison, Decisions, Scoring or Diagnostics declaration is malformed',
|
||||
fix: 'fill every section `gstack-eval-plan prereg --check` names (bars, decisions, arms, comparison, scoring, decoys, stop rules, held-out exposure) before any priced call: at least two decisions with different actions, and a judge from another model family checked against at least 40 labels at kappa 0.6 or better',
|
||||
fix: 'fill every section `gstack-eval-plan prereg --check` names (bars, decisions, arms, comparison, scoring, decoys, stop rules, held-out exposure) before any priced call: at least two decisions with different actions, and a judge from another model family checked against at least 100 labels (40 for a plan frozen before 2026-11-22) at kappa 0.6 or better',
|
||||
},
|
||||
// Field list 2 (2026-10-16), W8: preregistered diagnostics run before the freeze commit.
|
||||
PREREG_DIAGNOSTIC_UNTESTED: {
|
||||
|
||||
+2
-2
@@ -684,8 +684,8 @@ export const RESULT_CODES = {
|
||||
},
|
||||
EVAL_MODEL_OLD_GENERATION: {
|
||||
anchor: 'eval-model-old-generation',
|
||||
summary: 'an arm names an older generation of a model family the eval model rules order newest first',
|
||||
fix: 'use the newest id of the family the EVAL_MODEL line names, or reorder families in .gstack/eval-models.json in a reviewed PR',
|
||||
summary: 'an arm, judge, reader or simulator is gpt-4o or a model lib/pricing.ts marks superseded_by (R116), or an arm is not the newest id of a family the eval model rules order newest first',
|
||||
fix: 'use the replacement the MODEL_GENERATION or EVAL_MODEL line names; a competitor system tested as its vendor ships it declares its built-in model with a vendor-default: line in ## Models; or reorder families in .gstack/eval-models.json in a reviewed PR',
|
||||
},
|
||||
EVAL_MODEL_GENERATION_UNRESOLVED: {
|
||||
anchor: 'eval-model-generation-unresolved',
|
||||
|
||||
Reference in new issue
Block a user