Meta-Eval (2/2): Report Model Request Usage for Benchmark Runs - #112
Open
kargibora wants to merge 2 commits into
Open
Meta-Eval (2/2): Report Model Request Usage for Benchmark Runs#112kargibora wants to merge 2 commits into
kargibora wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replicates #107 however implements according to OpenRouters official API.
Problem
JudgeArena currently discards token and cost information returned by model providers. Users can see benchmark results, but they cannot tell how many model requests were made or how much reported usage came from generation and judging.
This PR collects provider-reported usage through the shared inference path and attaches one summary to the run metadata. It works for every benchmark using
do_inference(), including pairwise, ELO, MT-Bench, fluency, and meta-evaluation.Before and after
run-metadata.v1.jsonincludes ausagesectionHow it works
Generation requests use the
generationstage and judge requests use thejudgingstage. Meta-evaluation only reports judging because it evaluates stored completions and does not generate model answers.The summary includes request count, input tokens, output tokens, total tokens, reasoning tokens, cached tokens, and cost when the provider returns those fields.
This PR does not estimate missing prices or token counts. If a backend does not report cost, the result says that cost is unavailable. If only some requests contain usage, the totals are marked as partial.
Example
The terminal prints a summary such as:
The same information is stored under
usage.total,usage.by_stage, andusage.by_modelinrun-metadata.v1.json.Tests
The tests cover provider response parsing, structured inference results, partial cost reporting, metadata output, benchmark-run scoping, and meta-evaluation integration.
Notes
~180 lines are for the tests, thus this PR is minimal and optional (although definitely recommended)
Example
Mergin everything, we can finally report
============================================================ 🏆 MODEL BATTLE RESULTS 🏆 📊 Task: arena-hard-v2.0-official 🤖 Competitors: Model A: deepseek-r1 vs Model B: gemini-2.0-flash-001+o3-mini-2025-01-31 ⚖️ Judge: OpenRouter/openai/gpt-4.1 📈 Results Summary: Total Battles: 154 (2×77 — each instruction judged in both orders to detect positional bias) Win Rate (A): 57.8% ✅ Wins: 86 ❌ Losses: 62 🤝 Ties: 6 Per-Category Breakdown: Category | Win Rate(A) | Wins | Losses | Ties ---------------+-------------+------+--------+----- creative_writing | 93.3% | 56 | 4 | 0 hard_prompt | 35.1% | 30 | 58 | 6 📁 Results: parity-results/arena-hard-v2-gpt41-smoke/arena-hard-v2.0-official-deepseek-r1-gemini-2.0-flash-001+o3-mini-2025-01-31-OpenRouter_openai_gpt-4.1-both-20260820_103526 ============================================================ Model usage: Judging: 100 request(s), 241,932 input / 89,919 output tokens, $1.200336 Total: 100 request(s), 241,932 input / 89,919 output tokens, $1.200336Comparison to the official results (https://github.com/lmarena/arena-hard-auto/blob/main/show_result.py)