Skip to content

Record per-arm bench cost and apply the cost check - #1962

Closed
remigiusz-antczak wants to merge 2 commits into
mainfrom
feat/bench-cost-capture
Closed

remigiusz-antczak wants to merge 2 commits into
mainfrom
feat/bench-cost-capture

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Bench results recorded spend_usd 0.0 for every arm, so the cost leg of "superior" was unmeasured on every row of the scoreboard. This change records real per-arm usage and makes the verdict check cost.

  • scripts/rival_eval.py records prompt and completion tokens per item, plus spend in USD when the provider reports it. A missing price is stored as unmeasured, never as 0.
  • An arm counts as measured only when every scenario item has usage. A partial or quota-stopped run stays unmeasured.
  • scripts/bench_verdict.py reports the Perun/rival cost ratio and fails the cost check closed when either arm is unmeasured, when the arms report in different units, or when the rival cost is zero.

Older results.json files still read as unmeasured, so this changes no existing scoreboard row. Rows get cost numbers on their next run.

An independent review found one 🔴, fixed in this commit: a partial run could read as measured.

Tests: 14/14 in scripts/test_bench_cost_capture.py; test_bench_verdict and test_rival_eval green; prepush parity 6/6.

🤖 Generated with Claude Code

https://claude.ai/code/session_014QNFFPWVcPUbeuvwM5fk2Z

Remigiusz Antczak and others added 2 commits October 23, 2026 22:11
rival_eval.py now writes cost_per_arm (prompt_tokens, completion_tokens, spend_usd) taken from the PCSS response or claude -p JSON, never estimated, with a per-output sidecar so resumed runs keep it. bench_verdict.py --cost prints per-arm cost per item and the Perun/rival ratio and exits 1 unless Perun cost <= rival cost.

Tests: 14/14 (new) + bench_verdict, rival_eval, prepush parity 6/6 green

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014QNFFPWVcPUbeuvwM5fk2Z
@remigiusz-antczak

Copy link
Copy Markdown
Collaborator Author

Superseded by #1980.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant