Repository navigation
bench: include draft acceptance in the JSON record #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1337,7 +1337,10 @@ fn run(cmd: Cmd) -> anyhow::Result<()> { | |
| reps, | ||
| }; | ||
| let unix_time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).map_or(0, |d| d.as_secs()); | ||
| let record = bench_record(&meta, &results, r.expert_summary().as_ref(), unix_time); | ||
| let mut record = bench_record(&meta, &results, r.expert_summary().as_ref(), unix_time); | ||
| // The arch-specific benchners print this; putting it in the JSON too gives tools one reliable source. | ||
| let drafts = if let Runner::Gpu(g) = &r { g.drafts } else { (0, 0) }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Correctness · 2 of 4 Tuple field order (made, accepted) is assumed, not checked against g.drafts. The code maps drafts.0 to "made" and drafts.1 to "accepted" without any visible definition of g.drafts. If the GPU runner stores (accepted, made), every bench JSON silently swaps the two values, and the acceptance ratio reported downstream is inverted or exceeds 1. Naming the fields on the GPU side, or destructuring with named bindings, would make the mapping explicit. Prompt for your AI agentReply |
||
| record["drafts"] = json!({"made": drafts.0, "accepted": drafts.1}); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Correctness · 1 of 4 Non-GPU runners are reported as zero drafts, indistinguishable from a GPU run with no drafts. For a CPU or other non-Gpu runner the else branch sets drafts to (0, 0), and the JSON gets "drafts": {"made": 0, "accepted": 0}. A downstream tool computing acceptance rate sees 0/0 and either treats it as a real 0% rate or divides by zero. The record cannot tell 'not applicable' from 'speculation ran and nothing was drafted'. Emitting null (or omitting the key) for non-GPU runs would keep the two apart. Prompt for your AI agentReply There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low · Maintainability · 4 of 4 Drafts are patched into the record after construction instead of passed to bench_record. bench_record builds the JSON, then the caller reaches in with record["drafts"] = ... to add a field. Any other caller of bench_record will silently lack the field, and the schema is now split across two places. Passing drafts as a parameter (or an Option) into bench_record keeps the schema in one function. Prompt for your AI agentReply |
||
| let mut line = serde_json::to_string(&record)?; | ||
| line.push('\n'); | ||
| std::fs::write(&path, line).with_context(|| format!("writing the JSON record to {}", path.display()))?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High · Correctness · 3 of 4
Comment overstates the source as 'reliable' while non-GPU runs fill in zeros. The comment says this gives tools 'one reliable source', yet for every non-GPU runner the value is a fabricated (0, 0) rather than a measurement. Someone reading the comment would trust the field for CPU benches and draw wrong conclusions about speculative decoding. The comment should say the field is only populated for GPU runs.
Prompt for your AI agent
Reply
/dismiss(optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.