Skip to content

Fix GPT-5 pricing: exact-model lookup shadowed by prefix fallback - #14

Merged
curtischong merged 2 commits into
Radical-AI:mainfrom
jshah:fix-gpt5-price-lookup
Jul 22, 2026
Merged

Fix GPT-5 pricing: exact-model lookup shadowed by prefix fallback#14
curtischong merged 2 commits into
Radical-AI:mainfrom
jshah:fix-gpt5-price-lookup

Conversation

@jshah

@jshah jshah commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Bug

In resolve_genai_price_params (scripts/paper/benchmarks/helpers/pricing.py), the startswith("gpt-5") fallback runs before the _GPT_MODEL_REF_MAP lookup, making the map unreachable for every gpt-5* name — all GPT-5 variants get priced as base gpt-5. Separately, the gpt-5-pro-high map entry points at "gpt-5" rather than "gpt-5-pro".

Impact

Benchmark scores are unaffected — this function only computes cost_usd after a run. But the cost columns are off. Recomputing from the token counts already published in combined_results/zero_shot_run[1-3].csv:

model published avg cost corrected
gpt-5-mini-medium $3.47 $0.69 (~5x overstated)
gpt-5-2-high $4.99 $6.99 (~29% understated)

This flows into the cost/F1 comparison — e.g. at $0.69, gpt-5-mini-medium is cheaper than claude-haiku-4-5 ($1.72) rather than 2x more expensive.

Fix

  • Check _GPT_MODEL_REF_MAP before the prefix fallback (unknown gpt-5* names still fall back to base gpt-5)
  • Correct the gpt-5-pro-high entry
  • Add tests/test_pricing.py asserting each model name resolves to its own price ref (skipped unless the paper extra is installed, so the default test environment is unaffected)

…lback

resolve_genai_price_params checked startswith("gpt-5") before consulting
_GPT_MODEL_REF_MAP, so every GPT-5 variant was priced as base gpt-5. This
made published costs for gpt-5-mini-medium ~5x too high ($3.47 vs $0.69
actual for the zero-shot runs) and gpt-5-2-high ~29% too low ($4.99 vs
$6.99). Also corrects the gpt-5-pro-high map entry, which pointed at
base gpt-5 pricing.

Extraction scores are unaffected; only the cost_usd columns and the
cost/F1 pareto figure derive from this function.
@curtischong

curtischong commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

this is a good catch thank you. I think we should raise for unknown models rather than falling back to gpt-5 pricing since it's highly unlikely for them to be the same cost. can you make that change (and update the test)? I should probably regenerate the pareto front cost chart bc of this bug

Per PR feedback: an unknown model name is highly unlikely to cost the
same as base gpt-5, so resolve_genai_price_params now raises ValueError
instead of guessing (or returning None, which silently priced runs at
$0). gpt-5-minimal/low/high get explicit map entries since they are
valid config names that relied on the prefix fallback.
@jshah

jshah commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@curtischong thanks for the review, updated with requested feedback!

@curtischong

Copy link
Copy Markdown
Collaborator

Thank you so much for this! I'll update the charts later

@curtischong
curtischong merged commit b2066bc into Radical-AI:main Jul 22, 2026
2 checks passed
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.

2 participants