Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
Copy Markdown

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
File: src/main.rs
Line: 1341
Symbol: run
Issue: 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.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

let drafts = if let Runner::Gpu(g) = &r { g.drafts } else { (0, 0) };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 agent
File: src/main.rs
Line: 1342
Symbol: run
Issue: 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.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

record["drafts"] = json!({"made": drafts.0, "accepted": drafts.1});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 agent
File: src/main.rs
Line: 1343
Symbol: run
Issue: 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.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 agent
File: src/main.rs
Line: 1343
Symbol: run
Issue: 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.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

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()))?;
Expand Down
Loading