[PR #4806] [Benchmark] compare two standard-v1 benchmark reports (#4325) #5191

Open
opened 2026-11-07 16:33:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4806
Author: @XiaoBinGan
Created: 10/31/2026
Status: 🔄 Open

Base: main ← Head: feat/bench-compare-standard


📝 Commits (1)

  • 673dd39 Feature (#4325): compare two standard-v1 benchmark reports

📊 Changes

3 files changed (+179 additions, -0 deletions)

View changed files

📝 strata_cli/bench_standard.py (+90 -0)
📝 strata_cli/cli.py (+21 -0)
📝 tests/terminal/test_bench_standard.py (+68 -0)

📄 Description

Problem and result

docs/COMMUNITY_BENCHMARKS.md tells a contributor to compare two saved runs, and a standard-v1 run — the default
strata bench run — could not be compared: strata bench compare answered unsupported benchmark report, and
tools/strata_bench.py --compare died with KeyError: 'results' (reported in #4325, with the two readable-error halves
in #4326 and #4329).

After this change strata bench compare BASELINE CANDIDATE reads two standard reports and prints one table with the
baseline and candidate medians per case and figure, the change in percent, and whatever a reader should not carry over.
--output markdown renders the same comparison as a real Markdown table, --out FILE writes that table to a new file
the way strata bench report --output markdown --out already does, and --output json returns the same numbers
({"schema_version": 1, "ok": true, "comparison": {...}}).

This is the actual output on the two real standard-v1 runs from #4313 (RTX 5090, Q2_0, same machine: 2026-10-21 with
the card shared, 2026-10-24 exclusive), read from the saved results.json files:

Standard benchmark comparison (strata-qwen38-thinking-v1-draft.1)
  baseline:  20261021T191758Z-6c436863
  candidate: 20261024T073129Z-55e92f93
  Case        Figure        Baseline  Candidate  Change
  short       Prompt tok/s  204.6     348.3      +70.2%
  short       Decode tok/s  136.8     235.4      +72.0%
  short       TTFT s        0.39      0.23       -40.8%
  short       Total s       2.8       1.8        -36.6%
  prompt-4k   Prompt tok/s  1710.5    3520.6     +105.8%
  prompt-4k   Decode tok/s  132.6     205.7      +55.1%
  prompt-4k   TTFT s        2.42      1.18       -51.3%
  prompt-4k   Total s       6.3       3.7        -41.5%
  prompt-16k  Prompt tok/s  3314.4    5528.9     +66.8%
  prompt-16k  Decode tok/s  134.8     218.4      +62.0%
  prompt-16k  TTFT s        4.99      2.99       -40.1%
  prompt-16k  Total s       8.8       5.3        -39.1%
  Change is the candidate against the baseline; a figure one report does not have is n/a.

and the same comparison with --output markdown:

Case Figure Baseline Candidate Change
short Prompt tok/s 204.6 348.3 +70.2%
short Decode tok/s 136.8 235.4 +72.0%
short TTFT s 0.39 0.23 -40.8%
short Total s 2.8 1.8 -36.6%
prompt-4k Prompt tok/s 1710.5 3520.6 +105.8%
prompt-4k Decode tok/s 132.6 205.7 +55.1%
prompt-4k TTFT s 2.42 1.18 -51.3%
prompt-4k Total s 6.3 3.7 -41.5%
prompt-16k Prompt tok/s 3314.4 5528.9 +66.8%
prompt-16k Decode tok/s 134.8 218.4 +62.0%
prompt-16k TTFT s 4.99 2.99 -40.1%
prompt-16k Total s 8.8 5.3 -39.1%

The changes agree with what #4313 reported by hand: decode +55.1% at 4K, +62.0% at 16K, TTFT -51.3% / -40.1%. No warning
line is printed for the pair: same protocol, same model, same card, same engine.

#4325 — the bug report, and the scope proposal for this feature posted there on 2026-10-31 (per CONTRIBUTING, a feature
agrees scope first). The two readable-error halves are open as #4326 and #4329. The PR was opened as a draft while that
question was unanswered; it is now marked ready for review. If the shape is wrong I will change or drop it.

Approach

One function plus two renderers in strata_cli/bench_standard.py:

def compare(baseline: dict, candidate: dict) -> dict:
    ...  # {"suite", "baseline_run", "candidate_run", "warnings", "rows"}
def format_comparison(comparison: dict) -> str:            # the aligned table above
def format_comparison_markdown(comparison: dict) -> str:  # --output markdown
  • The figures are the ones strata bench report already prints: prompt_tps, decode_tps, ttft_s, total_s per
    case, read from summaries.
  • Nothing is refused. A different suite, model, card or engine is a legitimate "my own before/after" and keeps
    working; it is named in a warning line instead, so a benchmark claim cannot be made by accident. Only a mixed pair
    (one standard report, one serving-suite report) is an error. A missing or unreadable path still gets the reader's
    error from bench.load, not the mixed-pair error.
  • A figure one side does not have — or has as null for an empty summary — is None -> n/a, never 0.
  • _bench() in strata_cli/cli.py asks bench_standard.load_if_standard() for both paths before the serving-suite
    reader, the same way the report command beside it already does; two serving-suite reports go through
    bench.compare untouched.
  • Nothing about the report format or strata bench run changes, and no default changes; the feature is only the new
    reader and the compare branch.

Validation

Passed: the comparison unit cases:
python -m pytest tests/terminal/test_bench_standard.py -q -k StandardComparison -> 4 passed, 69 deselected — a
before/after pair computes the medians and the +50.0% change; a different suite/model/card/engine is named in the
warnings; a figure missing on one side is None/n/a, not 0; the Markdown output has the table header, separator line,
row and warning bullet.

Passed: the CLI branch in human, Markdown, Markdown-file and JSON forms:
python -m pytest tests/terminal/test_bench_standard.py -q -k compare_reads_two_standard_results -> 1 passed, 72
deselected
— two mock standard runs are compared through strata_cli.cli.main, with --out writing the Markdown
file.

Passed: the whole file on this Windows checkout, second run:
python -m pytest tests/terminal/test_bench_standard.py -q -> 73 passed in 46.70s.

Failed: none of the five new tests. The first whole-file run on the same checkout had one failure,
RunTests::test_a_request_that_never_finishes_times_out (1 failed, 72 passed): a timing-sensitive mock-server case.
The same test also failed on this machine with the three files reset to upstream main (1 failed, 67 passed), and
another main run had two failures, that one and RunTests::test_a_round_total_is_null_when_a_counted_request_has_no_token_count
(2 failed, 66 passed), so those are pre-existing environment/timing failures, not this change.

Passed: end-to-end on the two real standard-v1 folders from #4313 (RTX 5090, Q2_0, same machine), reading only the
saved reports; the output is quoted under Problem and result. --output markdown and --output json returned the same
12 rows, and --out wrote a 21-line Markdown file. Since this checkout's Python environment has no requests/numpy/
PIL, python strata.py bench compare refuses to start (its dependency check), so the CLI entry point was called
directly: python -c "from strata_cli.cli import main; raise SystemExit(main(['bench','compare', BASELINE, CANDIDATE]))".

Not run: strata.py bench compare itself (the launcher's dependency check above); no GPU run was made, the figures
come from the saved reports. CUDA, HIP, SYCL and Metal builds do not apply to a Python-only change.

Limits

  • Only the performance phase's four figures are compared; the sanity checks and the artifact hashes are not (a mismatch
    there is a different question — whether two runs are comparable at all — and #4325's guards cover the parts that
    matter for a claim).
  • run.status is not read: a partial or nonconforming run compares like any other, so a claim still needs two complete
    runs. Both example runs are nonconforming because the model file could not be hashed; the same-machine before/after
    this table shows is still the one #4313 measured.
  • Concurrency rounds (optional_concurrency) are not in the table; a report with them compares only its performance
    figures.
  • Percentages are changes of medians, not of distributions: the min-max span stays in strata bench report.
  • The short case's prompt rate is in the table even though strata bench report explains that it is dominated by the
    fixed cost of one request; read prompt speed from the 4K and 16K rows.
  • The other documented comparison path, tools/strata_bench.py --compare, is not changed here; #4326 turns its
    traceback into a sentence.

🔄 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/4806 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/31/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/bench-compare-standard` --- ### 📝 Commits (1) - [`673dd39`](https://github.com/Niko1221/Strata/commit/673dd397f168957ee88035604b1072ba909fa6e8) Feature (#4325): compare two standard-v1 benchmark reports ### 📊 Changes **3 files changed** (+179 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/bench_standard.py` (+90 -0) 📝 `strata_cli/cli.py` (+21 -0) 📝 `tests/terminal/test_bench_standard.py` (+68 -0) </details> ### 📄 Description ## Problem and result `docs/COMMUNITY_BENCHMARKS.md` tells a contributor to compare two saved runs, and a **standard-v1** run — the default `strata bench run` — could not be compared: `strata bench compare` answered `unsupported benchmark report`, and `tools/strata_bench.py --compare` died with `KeyError: 'results'` (reported in #4325, with the two readable-error halves in #4326 and #4329). After this change `strata bench compare BASELINE CANDIDATE` reads two standard reports and prints one table with the baseline and candidate medians per case and figure, the change in percent, and whatever a reader should not carry over. `--output markdown` renders the same comparison as a real Markdown table, `--out FILE` writes that table to a new file the way `strata bench report --output markdown --out` already does, and `--output json` returns the same numbers (`{"schema_version": 1, "ok": true, "comparison": {...}}`). This is the actual output on the two real `standard-v1` runs from #4313 (RTX 5090, Q2_0, same machine: 2026-10-21 with the card shared, 2026-10-24 exclusive), read from the saved `results.json` files: ```text Standard benchmark comparison (strata-qwen38-thinking-v1-draft.1) baseline: 20261021T191758Z-6c436863 candidate: 20261024T073129Z-55e92f93 Case Figure Baseline Candidate Change short Prompt tok/s 204.6 348.3 +70.2% short Decode tok/s 136.8 235.4 +72.0% short TTFT s 0.39 0.23 -40.8% short Total s 2.8 1.8 -36.6% prompt-4k Prompt tok/s 1710.5 3520.6 +105.8% prompt-4k Decode tok/s 132.6 205.7 +55.1% prompt-4k TTFT s 2.42 1.18 -51.3% prompt-4k Total s 6.3 3.7 -41.5% prompt-16k Prompt tok/s 3314.4 5528.9 +66.8% prompt-16k Decode tok/s 134.8 218.4 +62.0% prompt-16k TTFT s 4.99 2.99 -40.1% prompt-16k Total s 8.8 5.3 -39.1% Change is the candidate against the baseline; a figure one report does not have is n/a. ``` and the same comparison with `--output markdown`: | Case | Figure | Baseline | Candidate | Change | | --- | --- | ---: | ---: | ---: | | short | Prompt tok/s | 204.6 | 348.3 | +70.2% | | short | Decode tok/s | 136.8 | 235.4 | +72.0% | | short | TTFT s | 0.39 | 0.23 | -40.8% | | short | Total s | 2.8 | 1.8 | -36.6% | | prompt-4k | Prompt tok/s | 1710.5 | 3520.6 | +105.8% | | prompt-4k | Decode tok/s | 132.6 | 205.7 | +55.1% | | prompt-4k | TTFT s | 2.42 | 1.18 | -51.3% | | prompt-4k | Total s | 6.3 | 3.7 | -41.5% | | prompt-16k | Prompt tok/s | 3314.4 | 5528.9 | +66.8% | | prompt-16k | Decode tok/s | 134.8 | 218.4 | +62.0% | | prompt-16k | TTFT s | 4.99 | 2.99 | -40.1% | | prompt-16k | Total s | 8.8 | 5.3 | -39.1% | The changes agree with what #4313 reported by hand: decode +55.1% at 4K, +62.0% at 16K, TTFT -51.3% / -40.1%. No warning line is printed for the pair: same protocol, same model, same card, same engine. ## Related discussion #4325 — the bug report, and the scope proposal for this feature posted there on 2026-10-31 (per CONTRIBUTING, a feature agrees scope first). The two readable-error halves are open as #4326 and #4329. The PR was opened as a draft while that question was unanswered; it is now marked ready for review. If the shape is wrong I will change or drop it. ## Approach One function plus two renderers in `strata_cli/bench_standard.py`: ```python def compare(baseline: dict, candidate: dict) -> dict: ... # {"suite", "baseline_run", "candidate_run", "warnings", "rows"} def format_comparison(comparison: dict) -> str: # the aligned table above def format_comparison_markdown(comparison: dict) -> str: # --output markdown ``` - The figures are the ones `strata bench report` already prints: `prompt_tps`, `decode_tps`, `ttft_s`, `total_s` per case, read from `summaries`. - **Nothing is refused.** A different suite, model, card or engine is a legitimate "my own before/after" and keeps working; it is named in a warning line instead, so a benchmark claim cannot be made by accident. Only a mixed pair (one standard report, one serving-suite report) is an error. A missing or unreadable path still gets the reader's error from `bench.load`, not the mixed-pair error. - A figure one side does not have — or has as `null` for an empty summary — is `None` -> `n/a`, never 0. - `_bench()` in `strata_cli/cli.py` asks `bench_standard.load_if_standard()` for both paths before the serving-suite reader, the same way the `report` command beside it already does; two serving-suite reports go through `bench.compare` untouched. - Nothing about the report format or `strata bench run` changes, and no default changes; the feature is only the new reader and the `compare` branch. ## Validation **Passed:** the comparison unit cases: `python -m pytest tests/terminal/test_bench_standard.py -q -k StandardComparison` -> **4 passed, 69 deselected** — a before/after pair computes the medians and the +50.0% change; a different suite/model/card/engine is named in the warnings; a figure missing on one side is `None`/`n/a`, not 0; the Markdown output has the table header, separator line, row and warning bullet. **Passed:** the CLI branch in human, Markdown, Markdown-file and JSON forms: `python -m pytest tests/terminal/test_bench_standard.py -q -k compare_reads_two_standard_results` -> **1 passed, 72 deselected** — two mock standard runs are compared through `strata_cli.cli.main`, with `--out` writing the Markdown file. **Passed:** the whole file on this Windows checkout, second run: `python -m pytest tests/terminal/test_bench_standard.py -q` -> **73 passed in 46.70s**. **Failed:** none of the five new tests. The first whole-file run on the same checkout had one failure, `RunTests::test_a_request_that_never_finishes_times_out` (**1 failed, 72 passed**): a timing-sensitive mock-server case. The same test also failed on this machine with the three files reset to upstream `main` (**1 failed, 67 passed**), and another `main` run had two failures, that one and `RunTests::test_a_round_total_is_null_when_a_counted_request_has_no_token_count` (**2 failed, 66 passed**), so those are pre-existing environment/timing failures, not this change. **Passed:** end-to-end on the two real `standard-v1` folders from #4313 (RTX 5090, Q2_0, same machine), reading only the saved reports; the output is quoted under Problem and result. `--output markdown` and `--output json` returned the same 12 rows, and `--out` wrote a 21-line Markdown file. Since this checkout's Python environment has no `requests`/`numpy`/ `PIL`, `python strata.py bench compare` refuses to start (its dependency check), so the CLI entry point was called directly: `python -c "from strata_cli.cli import main; raise SystemExit(main(['bench','compare', BASELINE, CANDIDATE]))"`. **Not run:** `strata.py bench compare` itself (the launcher's dependency check above); no GPU run was made, the figures come from the saved reports. CUDA, HIP, SYCL and Metal builds do not apply to a Python-only change. ## Limits - Only the performance phase's four figures are compared; the sanity checks and the artifact hashes are not (a mismatch there is a different question — whether two runs are comparable at all — and #4325's guards cover the parts that matter for a claim). - `run.status` is not read: a partial or nonconforming run compares like any other, so a claim still needs two complete runs. Both example runs are `nonconforming` because the model file could not be hashed; the same-machine before/after this table shows is still the one #4313 measured. - Concurrency rounds (`optional_concurrency`) are not in the table; a report with them compares only its performance figures. - Percentages are changes of medians, not of distributions: the min-max span stays in `strata bench report`. - The `short` case's prompt rate is in the table even though `strata bench report` explains that it is dominated by the fixed cost of one request; read prompt speed from the 4K and 16K rows. - The other documented comparison path, `tools/strata_bench.py --compare`, is not changed here; #4326 turns its traceback into a sentence. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5191
No description provided.