bench-standard 0.5.0: fix silent exits and signals, check declared values, hash the model

Fixes:
- A run on a machine without nvidia-smi/xpu-smi (every AMD box) exited
  silently with status 1 after BetterBench: the power sampler had already
  exited, so `kill` failed under set -e. No summary, no post_run, no done.
- Ctrl-C or kill didn't stop the script: the INT/TERM traps cleaned up and
  carried on, so a partial run could print a summary and `done:`. Now
  BetterBench is stopped at once and the folder is renamed .interrupted. The
  one-file bench.sh exec's the real script, so kill PID reaches it.
- Redaction turned --max-num-batched-tokens=8192 into <redacted>, corrupting
  the launch note. Env-style secrets and user:pass@ in URLs are still redacted.
- The --kv check was inverted when only -ctk is set: it warned on the
  correct q8_0/f16 and accepted q8_0.
- Negative flag values (-t -1) were parsed as flags.
- Model sizes in the HF cache counted symlinks, not the weights.
- A failed greedy check was recorded without any message.

Improvements:
- The served model is hashed (cached) and checked against the README's table
  (dev/models.txt), with a --quant cross-check.
- --spec, --thinking and vLLM --tp/--pp are checked against the launch
  command, like --kv; warnings name the value to declare.
- Weights are found through docker -v/--mount for any launch command, not
  only llama-swap's, and vLLM repo ids through the HF cache.
- AMD power and clock are sampled from amdgpu's hwmon sysfs files.
- Warnings are repeated after the summary and in the dry run, and saved in
  meta.json; the summary is saved as summary.txt.
- dev/test.sh: 36 end-to-end tests with a fake server and fake BetterBench,
  no GPU; CI runs them under dash and bash, plus shellcheck and build --check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9aTJE7srSQEYUqdQio
This commit is contained in:
Claude committed 2026-11-01 20:05:40 +00:00
1 parent b892e7b14d
commit b36805d1cb
14 files changed
+1004 -206

No files matched your search

+24 -7
View File
@@ -75,6 +75,11 @@ cd MODEL_DIR && sha256sum *.safetensors | LC_ALL=C sort -k2 | sha256sum # a rep
For a repo, the hash is over the per-file hashes in name order. Keep `LC_ALL=C`:
other locales sort the files differently and give a different hash.
`bench.sh` does this for you when it finds the weights on the machine (also through
docker `-v` mounts and the Hugging Face cache). It records the hash in the `model_file`
note and warns when the file isn't in this table or `--quant` doesn't match. The hash is
cached, so only the first run spends time on it; `HASH_MODEL=0` skips it.
- The RedHatAI checkpoints are int4 weights with 16-bit activations
(compressed-tensors). They include an MTP head, so `--spec mtp:N` works.
- The 27B GGUF repo has no plain Q4_K_M, only Unsloth's dynamic `UD-Q4_K_M`.
@@ -99,6 +104,9 @@ can be read off the command you started the server with:
`off`, `on`, `low`, `medium`, `high` and `default`. BetterBench can't switch thinking on or
off per request, so it has to be set in the server's chat template or launch flags.
`bench.sh` checks `--kv`, `--spec`, `--thinking` and, for vLLM, `--tp`/`--pp` against the
launch command, and warns with the value the command implies.
**`--server-cmd-file`** is a text file with the exact command that started your server,
including env vars (`VAR=x ...`, docker `-e VAR=x`). It's how batch sizes, flash
attention and env flags get recorded, and those swing results by 10-50%. Behind
@@ -131,13 +139,16 @@ file next to `bench.sh`.
the same text everywhere. The replies also show whether the model reasoned, and
`bench.sh` warns if that contradicts your `--thinking`.
3. **Detection:** GPU, driver, power limit, PCIe link and ReBAR, CPU, RAM, OS, the
engine and its exact build, the docker image, the model file and size, launch and
env flags. **Memory bandwidth** is measured with random data inside the server's
engine and its exact build, the docker image, the model file, its size and hash,
launch and env flags. **Memory bandwidth** is measured with random data inside the server's
container. Zeros compress on Arc and read about 3× too high.
4. **BetterBench:** single-stream decode per category, a prefill sweep and a
concurrency sweep. GPU power, energy and clock are sampled throughout.
5. **Summary:** decode t/s, TTFT, concurrency and prefill throughput, % of memory
bandwidth reached, average power and clock, and J per token.
bandwidth reached, average power and clock, J per token, and every warning again.
Ctrl-C or a `kill` stops the run at once; the folder is renamed `.interrupted` and
doesn't count.
Everything is recorded as notes in `results.json`, so it shows in the report and in
`compare`. Example notes:
@@ -146,12 +157,13 @@ Everything is recorded as notes in `results.json`, so it shows in the report and
gpu 1x Intel Arc Pro B65 · 32 GB · driver 1.17.39395
pcie Gen4 x16 · ReBAR on
engine llama.cpp b11913-7aca0d2ea · 4 slots · image ghcr.io/ggml-org/llama.cpp:server-intel@1a2b3c4d5e6f
model_file /models/Qwen3.5-9B-Q4_K_M.gguf · 5.68 GB · sha256 03b74727a860 (standard: Qwen3.5-9B-Q4_K_M.gguf)
launch b 4096 · ub 1024 · fa on · ctk q8_0 · ctv q8_0 · ngl 99 · np 4
env_flags GGML_SYCL_DISABLE_OPT=0 · ZES_ENABLE_SYSMAN=1
mem_bw 532 GB/s measured (torch copy, random, 1024 MiB) · 608 GB/s declared
greedy_check identical 3/3 · 1d5105fe09dc
thinking default · reasoning seen
run full · concurrency on · bench-standard 0.4.1 · betterbench 0.6.1
run full · concurrency on · bench-standard 0.5.0 · betterbench 0.6.1
```
## Your result
@@ -162,7 +174,8 @@ Each run makes a folder `results/<date>-<you>-<model>-<engine>-<gpu>/`:
|---|---|
| `results.html` | the report; open it in a browser |
| `results.json` | the results, with all notes |
| `meta.json` | every raw value, plus energy and % of bandwidth |
| `meta.json` | every raw value, plus energy, % of bandwidth and the warnings |
| `summary.txt` | the summary printed at the end |
| `server-cmd.txt` | your server's launch command, secrets redacted |
| `config.json`, `power.csv`, `betterbench.log` | the config used, power samples, the full output |
@@ -198,11 +211,14 @@ during the benchmark if you want it.
| `warm-up request failed` | is the server up? Are `--endpoint` and `--model` right? `curl URL/models` lists the ids. For a slow first load, try `WARM_TIMEOUT=1800` |
| `missing mandatory value(s)` | pass the listed flags |
| `GPU power limit not detected` | pass `--power-limit W` (or `stock`) |
| `--kv X but the launch command sets Y` | your `--kv` is wrong; use what the command sets |
| `--X A but the launch command sets ...: declare --X B` | the declared value contradicts the server's launch command; check it and use B |
| `not one of the standard models` | the served file's hash isn't in the [table](#models): wrong file or quant |
| `greedy check failed` | the temperature-0 requests failed; the error is in the message |
| `greedy_check=differs` | not fatal. Kernels or spec decoding aren't deterministic; mention it |
| `--thinking off, but the greedy replies contain reasoning` | thinking is still on in the server's chat template or flags. Fix the server, or declare what it does |
| `launch=unknown` | pass `--server-cmd-file` |
| `betterbench failed` | see `betterbench.log` in the `.failed` folder, usually a server crash or OOM |
| `interrupted` | the run was stopped; the `.interrupted` folder doesn't count, run again |
## Rules
@@ -213,7 +229,8 @@ during the benchmark if you want it.
## Developing
`bench.sh` is generated: the sources are in [`dev/`](dev/), and `sh dev/build.sh` packs
them into the one file. Commit `dev/` and the rebuilt `bench.sh` together.
them into the one file. Commit `dev/` and the rebuilt `bench.sh` together. `sh dev/test.sh`
runs the end-to-end tests against a fake server and a fake BetterBench, no GPU needed.
Bugs and ideas: open an issue on [GitHub](https://github.com/aneinander/benchmarks/issues).
The GitHub repo is a mirror, updated automatically from the maintainers' source repo.