[PR #3494] [CLOSED] [Benchmark] Paired stats for bench comparisons: the test says, and a size note next to it #4654

Closed
opened 2026-11-07 15:38:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3494
Author: @victorgabr
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: feature/paired-ab-stats


📝 Commits (2)

  • b070ebf [Benchmark] Paired statistics for bench comparisons: strata_bench --compare and ab_engine --stats test matched run pairs (Wilcoxon signed-rank on the speed ratios, Holm-corrected) through scipy and statsmodels, opt-in via requirements-bench.txt - the tables print as before without the packages. The test is the ground result: every compare table opens with that line and shows 'the test says (Wilcoxon, Holm)' next to 'size vs the floor' (defaults --floor-prefill 2% / --floor-decode 5%), so being over the floor can never read as a statistical claim and being under it never cancels a real one. A run warns before starting when --runs cannot reach significance (the prompt pairs' p floor is 2**(1-n)), the README and docs write the same, and a footer answers was-this-many-runs-enough. Also fixes the redactor ordering when the user name sits inside the Strata folder path, and the no-scipy fallback crashing on the None verdict tuple. The port NameError on the start-server path is NOT here - it is PR #3320. New: tools/paired_stats.py, tools/test_paired_stats.py, requirements-bench.txt; 24 tests pass (4 skip without the packages)
  • 1cedc75 Merge remote-tracking branch 'upstream/main' into feature/paired-ab-stats

📊 Changes

7 files changed (+400 additions, -14 deletions)

View changed files

📝 docs/COMMUNITY_BENCHMARKS.md (+18 -0)
➕ requirements-bench.txt (+24 -0)
📝 tools/ab_engine.py (+47 -2)
➕ tools/paired_stats.py (+125 -0)
📝 tools/strata_bench.py (+115 -12)
➕ tools/test_paired_stats.py (+42 -0)
📝 tools/test_strata_bench.py (+29 -0)

📄 Description

Problem and result

--compare and ab_engine printed a median delta only. Three runs carry 1-2% noise easily, so a 1% delta read as an improvement. That is how phantom improvements and regressions reach reports.

Now both tools match runs slot by slot (same question, same prompt size) and test the speed ratios: Wilcoxon signed-rank, Holm-corrected across the metrics. The compare table gets two columns, kept apart on purpose:

  • the test says (Wilcoxon, Holm) - the ground result. It says yes or no whatever the size, and nothing else in the table can overturn it.
  • size vs the floor - magnitude only: faster/slower, over/under the floor (default 2% prefill / 5% decode, set with --floor-prefill / --floor-decode). Over the floor is never a statistical claim; under it never cancels a real one.

A run also says up front when its --runs cannot reach significance (with three runs the prompt pairs' p cannot drop below 0.25), the report README writes the same, and a footer answers "was this many runs enough".

Also fixed here: the redactor order broke when the user name sits inside the Strata folder path; the no-scipy fallback crashed on the None verdict tuple. The port NameError is NOT here - that is #3320.

Why this approach

tools/paired_stats.py wraps scipy and statsmodels; nothing is re-implemented in-tree. Optional via requirements-bench.txt (the core install stays light). Without the packages every table prints as before, with a line naming the install. The measurement run stays standard library only.

Validation

Passed (Linux, Python 3.10.9 venv, scipy 1.15.3, statsmodels 0.15.0):

  • python tools/test_strata_bench.py: 20/20.
  • python tools/test_paired_stats.py: 4/4; and 4 clean skips on system Python without the packages (degraded path proven).
  • Live A/B on this machine: a same-day paired A100 run pair whose configs differ by one argument, --vram-reserve-mib 700 vs 1600 (A100 SXM4 80 GB, Qwen3.8-Flash-Next IQ3_S, --runs 3, medians). Raw deltas up to -3.6% - none survives the test, so the reserve change is not shown to have moved speed, and a false regression claim from the -3.6% is exactly what the test stops:
metric old new change the test says (Wilcoxon, Holm) factor (CI), pairs
chat decode tok/s 121.00 116.60 -3.6% no (p=0.7344, Holm 1.000) x0.992 (x0.957-x1.038), n=9
chat first token s 0.24 0.24 -0.4% no (p=0.5703, Holm 1.000) x1.008 (x0.978-x1.015), n=9
4K prompt tok/s 2550.30 2567.40 +0.7% no (p=0.2500, Holm 1.000) x1.007 (x1.002-x1.008), n=3
16K prompt tok/s 3258.50 3275.10 +0.5% no (p=0.2500, Holm 1.000) x1.005 (x1.002-x1.006), n=3

With 3 runs the prompt pairs' p cannot drop below 0.25; the run itself says --runs 8 or more can decide. All four size cells read size unknown (test not passed).

Failed: none.

Not run: Windows. No CUDA/HIP/SYCL file touched.

Limits

  • Depends on #3320: on this branch alone, a fresh-server bench run still hits the port NameError.
  • The agent rows cannot be paired (different conversations), so they stay descriptive.
  • Verdicts need the optional packages; the significance floor warning prints either way.

Commit: 16d3ae05 (one commit).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3494 **Author:** [@victorgabr](https://github.com/victorgabr) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/paired-ab-stats` --- ### 📝 Commits (2) - [`b070ebf`](https://github.com/Niko1221/Strata/commit/b070ebf91087f7caa6095894b284b7c8eec5c283) [Benchmark] Paired statistics for bench comparisons: strata_bench --compare and ab_engine --stats test matched run pairs (Wilcoxon signed-rank on the speed ratios, Holm-corrected) through scipy and statsmodels, opt-in via requirements-bench.txt - the tables print as before without the packages. The test is the ground result: every compare table opens with that line and shows 'the test says (Wilcoxon, Holm)' next to 'size vs the floor' (defaults --floor-prefill 2% / --floor-decode 5%), so being over the floor can never read as a statistical claim and being under it never cancels a real one. A run warns before starting when --runs cannot reach significance (the prompt pairs' p floor is 2**(1-n)), the README and docs write the same, and a footer answers was-this-many-runs-enough. Also fixes the redactor ordering when the user name sits inside the Strata folder path, and the no-scipy fallback crashing on the None verdict tuple. The port NameError on the start-server path is NOT here - it is PR #3320. New: tools/paired_stats.py, tools/test_paired_stats.py, requirements-bench.txt; 24 tests pass (4 skip without the packages) - [`1cedc75`](https://github.com/Niko1221/Strata/commit/1cedc75a879c6f7d648a04916be07f2528d01fe3) Merge remote-tracking branch 'upstream/main' into feature/paired-ab-stats ### 📊 Changes **7 files changed** (+400 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `docs/COMMUNITY_BENCHMARKS.md` (+18 -0) ➕ `requirements-bench.txt` (+24 -0) 📝 `tools/ab_engine.py` (+47 -2) ➕ `tools/paired_stats.py` (+125 -0) 📝 `tools/strata_bench.py` (+115 -12) ➕ `tools/test_paired_stats.py` (+42 -0) 📝 `tools/test_strata_bench.py` (+29 -0) </details> ### 📄 Description ## Problem and result `--compare` and `ab_engine` printed a median delta only. Three runs carry 1-2% noise easily, so a 1% delta read as an improvement. That is how phantom improvements and regressions reach reports. Now both tools match runs slot by slot (same question, same prompt size) and test the speed ratios: Wilcoxon signed-rank, Holm-corrected across the metrics. The compare table gets two columns, kept apart on purpose: - `the test says (Wilcoxon, Holm)` - the ground result. It says yes or no whatever the size, and nothing else in the table can overturn it. - `size vs the floor` - magnitude only: `faster/slower, over/under the floor` (default 2% prefill / 5% decode, set with `--floor-prefill` / `--floor-decode`). Over the floor is never a statistical claim; under it never cancels a real one. A run also says up front when its `--runs` cannot reach significance (with three runs the prompt pairs' p cannot drop below 0.25), the report README writes the same, and a footer answers "was this many runs enough". Also fixed here: the redactor order broke when the user name sits inside the Strata folder path; the no-scipy fallback crashed on the None verdict tuple. The `port` NameError is NOT here - that is #3320. ## Why this approach `tools/paired_stats.py` wraps scipy and statsmodels; nothing is re-implemented in-tree. Optional via `requirements-bench.txt` (the core install stays light). Without the packages every table prints as before, with a line naming the install. The measurement run stays standard library only. ## Validation **Passed** (Linux, Python 3.10.9 venv, scipy 1.15.3, statsmodels 0.15.0): - `python tools/test_strata_bench.py`: 20/20. - `python tools/test_paired_stats.py`: 4/4; and 4 clean skips on system Python without the packages (degraded path proven). - Live A/B on this machine: a same-day paired A100 run pair whose configs differ by one argument, `--vram-reserve-mib 700` vs `1600` (A100 SXM4 80 GB, Qwen3.8-Flash-Next IQ3_S, `--runs 3`, medians). Raw deltas up to -3.6% - none survives the test, so the reserve change is not shown to have moved speed, and a false regression claim from the -3.6% is exactly what the test stops: | metric | old | new | change | the test says (Wilcoxon, Holm) | factor (CI), pairs | |---|---|---|---|---|---| | chat decode tok/s | 121.00 | 116.60 | -3.6% | no (p=0.7344, Holm 1.000) | x0.992 (x0.957-x1.038), n=9 | | chat first token s | 0.24 | 0.24 | -0.4% | no (p=0.5703, Holm 1.000) | x1.008 (x0.978-x1.015), n=9 | | 4K prompt tok/s | 2550.30 | 2567.40 | +0.7% | no (p=0.2500, Holm 1.000) | x1.007 (x1.002-x1.008), n=3 | | 16K prompt tok/s | 3258.50 | 3275.10 | +0.5% | no (p=0.2500, Holm 1.000) | x1.005 (x1.002-x1.006), n=3 | With 3 runs the prompt pairs' p cannot drop below 0.25; the run itself says `--runs 8 or more` can decide. All four size cells read `size unknown (test not passed)`. **Failed**: none. **Not run**: Windows. No CUDA/HIP/SYCL file touched. ## Limits - Depends on #3320: on this branch alone, a fresh-server bench run still hits the port NameError. - The agent rows cannot be paired (different conversations), so they stay descriptive. - Verdicts need the optional packages; the significance floor warning prints either way. Commit: `16d3ae05` (one commit). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:38:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4654
No description provided.