Skip to content

Compute geometric-mean speedup in log space - #179

Open
tuannx wants to merge 1 commit into
ScalingIntelligence:mainfrom
tuannx:cursor/geometric-mean-log-space-5eb4
Open

tuannx wants to merge 1 commit into
ScalingIntelligence:mainfrom
tuannx:cursor/geometric-mean-log-space-5eb4

Conversation

@tuannx

@tuannx tuannx commented Oct 27, 2026 •

Copy link
Copy Markdown

np.prod over a level of speedup ratios overflows float64 to inf or underflows to 0. Take the mean of log(baseline) - log(actual) instead. Non-positive, NaN, and non-finite timings are omitted. A correct sample with actual runtime 0 is an infinite speedup.

Addresses part 1 of #177 (np.prod overflow/underflow). Part 2 (excessive_speedup not read by benchmark_eval_analysis.py) is left for a separate PR.

np.prod over a level of speedup ratios overflows float64 to inf or
underflows to 0. Take the mean of log(baseline) - log(actual) instead.
Non-positive, NaN, and non-finite timings are omitted. A correct sample
with actual runtime 0 is an infinite speedup.

Co-authored-by: Tony Nguyen <tuannx87@gmail.com>
@nagLio

nagLio commented Oct 28, 2026

Copy link
Copy Markdown

Thanks for picking this up. I ran score.py and unit_tests/test_score.py from d384aa4 standalone (Python 3.11, numpy 2.4.6): 11 passed, and the repro from #177 now returns 19999.99999999995 (fast) and 9.999999999999991e-05 (slow) with no RuntimeWarning.

Two notes:

  1. This covers part 1 of [Bug] score.py uses np.prod for geometric mean speedup (overflowing float64 to inf and underflowing to 0.0), and excessive_speedup metadata is ignored by downstream analysis #177 (np.prod overflow and underflow). Part 2 (metadata["excessive_speedup"] is set in eval.py but never read by scripts/benchmark_eval_analysis.py) is not touched here. Since Fixes #177 would close the issue on merge, could you change it to Addresses part 1 of #177? Part 2 can go in a separate PR.
  2. The new _log_speedups filter also drops the -1.0 untimed sentinel, which is what Skip untimed correct samples in geometric mean speedup #170 does for score.py accepts runtime=-1.0 on correct rows, so geo_mean_speedup goes NaN or wrong and fast_p stops matching the correctness rate #169. The two PRs overlap on score.py, so only one of them needs to be merged.

@tuannx

tuannx commented Oct 29, 2026

Copy link
Copy Markdown
Author

Thanks for running it. Updated the description to "Addresses part 1 of #177".

On #170: agreed, both PRs change the same filter. One difference: #170 warns when correct samples are skipped, and this PR drops them silently. If #170 lands first, I'll rebase this onto it so its filter and warning stay, and this PR only changes np.prod to log space. Happy to go either way the maintainers prefer.

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.

3 participants