diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..e50e58f --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,128 @@ +# AGENTS.md + +Instructions for a coding agent that helps someone benchmark their LLM server with +this repo. The human-facing docs are [`README.md`](README.md) and +[`DETAILS.md`](DETAILS.md). + +Your job: get one correct, comparable result folder out of `bench.sh`, and tell your +human what it says. A wrong declared value makes the result worthless, and a skipped +one makes the run fail. Correct is more important than fast. + +## Rules + +- **Run benchmarks only through `./bench.sh`.** Never call `betterbench run` directly, + and never add BetterBench flags. `bench.sh` refuses them. +- **Don't change the standard to make a run pass.** Leave `config.json`, + `standard.env`, `bench.sh`, `collect-env.sh`, `gpu-power.sh` and `mem-bw.py` alone. If one + of them seems wrong, tell your human instead. +- **Never edit anything in a results folder.** +- **Never guess a declared value silently.** Derive it from the launch command (below), + show your human what you derived, and ask when the command doesn't say. + `--submitter` always comes from the human. +- **Ask before `--full`.** It takes much longer than the quick run, and the GPU is busy + the whole time. +- **Don't restart, reconfigure or stop the inference server** without asking. Don't + start other GPU work while a benchmark runs. +- **API keys** go in `$BETTERBENCH_API_KEY`, never into files or committed commands. +- **Don't commit results.** `results/` and `bench.local.env` are git-ignored on purpose. + +## Procedure + +### 1. Check the tools + +```sh +betterbench --version # must print 0.6.1 +python3 --version # 3.10+ +``` + +If BetterBench is missing or a different version, install it as the README shows +(`git checkout v0.6.1 && pip install -e .`). If an existing install has a different +version, ask before touching it. + +### 2. Find the endpoint and the model id + +```sh +curl -s http://localhost:8080/v1/models # ids the server accepts +curl -s http://localhost:8080/running # llama-swap only: loaded models + launch commands +``` + +`--endpoint` is the base URL ending in `/v1`. `--model` is the id exactly as listed. + +### 3. Get the launch command + +- **Behind llama-swap** (`/running` answers): nothing to do, `bench.sh` reads it. +- **Otherwise:** write the exact command the server was started with into + `server-cmd.txt`, including any `VAR=value` env prefixes and docker `-e` flags. Pass it + with `--server-cmd-file server-cmd.txt`. Get the command from your human, a + launch script, `docker inspect`, or `ps -o args= -p PID`. + +Without it, the `launch` and `env_flags` notes read `unknown`, and those settings +swing results by 10-50%. + +### 4. Check the model, derive the declared values + +Results only count for the models in [`models.md`](models.md). Check the served file's +SHA256 against that table, with the commands at its end. On a mismatch, tell your +human before benchmarking. For those models, `--quant` is listed in `models.md`. + +For the rest, use the launch command and confirm with your human: + +| flag | llama.cpp | vLLM | +|---|---|---| +| `--quant` | quant in the GGUF filename (`Q4_K_M`, `Q8_0`, ...) | `--quantization`, or the checkpoint's format (`gptq-int4`, `awq`, `fp8`); `bf16`/`fp16` when unquantized | +| `--kv` | `-ctk`/`-ctv`; `f16` when unset; `q8_0/q4_0` when K and V differ | `--kv-cache-dtype`; with `auto` (or unset), the model dtype (`bf16`) | +| `--tp` / `--pp` | `1` / `1` on one GPU; multi-GPU: ask | `--tensor-parallel-size` / `--pipeline-parallel-size`; default `1` | +| `--spec` | `-md`/`--model-draft` with `--draft-max N` → `draft:N`; otherwise `none` | `--speculative-config` method and `num_speculative_tokens` → e.g. `mtp:5`, `eagle3:4`, `ngram:4`; otherwise `none` | +| `--thinking` | `--reasoning-budget 0` or `enable_thinking: false` in the template kwargs → `off`; unclear → ask | `enable_thinking`/effort in the chat template or default kwargs; nothing set → `default`; unclear → ask | +| `--submitter` | ask | ask | + +`--spec` methods are `mtp`, `eagle`, `eagle3`, `ngram` and `draft`. `--thinking` values are +`off`, `on`, `low`, `medium`, `high` and `default`. + +### 5. Dry run + +```sh +./bench.sh --endpoint URL --model ID --tp 1 --pp 1 --quant Q --kv KV \ + --spec none --thinking default --submitter NAME [--server-cmd-file server-cmd.txt] --dry-run +``` + +This sends the warm-up and the greedy check, detects everything, prints the notes it +would record, and stops. Read the notes: +- `unknown` values should have a reason (VM PCIe, no cmd file, ...). +- Any `bench.sh: warning:` line needs fixing or explaining before the real run. + +### 6. Quick run, then full run + +Run the same command without `--dry-run`. This is a quick check of a few minutes, +ending in a summary. If it looks sane, ask your human, then run again with `--full`. +That is the result that counts. + +For long runs, use a terminal multiplexer or a background job, so a dropped +session doesn't kill the benchmark. + +### 7. Report back + +Tell your human: +- the result folder (printed after `done:`) +- the summary block: decode t/s, TTFT, concurrency, prefill, bandwidth %, power, energy +- every warning, and whether the greedy check was `identical` +- that the folder is what they send in, and that they should check `server-cmd.txt` for + anything private first + +## When something goes wrong + +| message | what to do | +|---|---| +| `BetterBench 0.6.1 required, found ...` | install 0.6.1 (step 1) | +| `warm-up request failed (HTTP ...)` | server not up, or wrong `--endpoint`/`--model` (step 2). Behind llama-swap the first load can take minutes; `WARM_TIMEOUT=1800` gives it longer | +| `missing mandatory value(s)` | pass the listed flags (step 4) | +| `GPU power limit not detected here` | ask for the limit, pass `--power-limit W` or `stock` | +| `--kv X but the launch command sets Y` | the declared `--kv` is wrong. Use what the command sets | +| `greedy_check=differs` | not a failure, but report it. It means nondeterministic kernels or a broken spec-decoding path | +| `mem_bw` has no measured figure | no torch in the server container. Set `BW_PYTHON` to a python with GPU torch, or install `clpeak`, or leave it | +| `launch=unknown (pass --server-cmd-file)` | step 3 | +| `betterbench failed (exit N)` | read `betterbench.log` in the `.failed` folder. Usually the server crashed or ran out of memory | +| `ReBAR ... but BetterBench reads ...` | BetterBench runs on another machine than the GPU. Use `--env-file` (see README) | + +BetterBench on a different machine than the GPU: run `collect-env.sh` on the GPU +machine and pass its output with `--env-file` (README, "More"). diff --git a/DETAILS.md b/DETAILS.md new file mode 100644 index 0000000..edee953 --- /dev/null +++ b/DETAILS.md @@ -0,0 +1,109 @@ +# Details + +What `bench.sh` records, and how. For running it, see [`README.md`](README.md). + +## What a run does + +1. One warm-up request. Behind llama-swap the first request loads the model, which + can take minutes. +2. **Greedy check:** the same prompt 3 times at temperature 0. +3. `collect-env.sh` detects the hardware and the engine, and measures memory bandwidth. +4. BetterBench runs while `gpu-power.sh` samples power, energy and clock every 2 s. +5. A summary prints. Energy and % of bandwidth are written to `meta.json`. + +## Files in a run folder + +| file | what | +|---|---| +| `results.json` | BetterBench results; the notes below are under `env.notes` | +| `results.html` | the standalone report | +| `meta.json` | every raw value: `mandatory` (declared), `collected` (detected), `measured`, `launch`, `post_run` | +| `server-cmd.txt` | the server launch command, secrets redacted | +| `power.csv` | `epoch_s,watts,joules,mhz` during the run | +| `betterbench.log` | BetterBench's full output | + +## Notes + +One note per topic, so the report and the compare page stay readable. Anything that +can't be detected is left out or shows `unknown`. + +| note | example | +|---|---| +| `submitter` | `pascal` | +| `gpu` | `1x Intel Arc Pro B65 · 32 GB · driver 1.17.39395` (VRAM per GPU) | +| `pcie` | `Gen4 x16 · ReBAR on`, `Gen1 x16 now, Gen4 x16 max · ReBAR on`, `unknown (VM) · ReBAR on` | +| `power_limit` | `200 W`, or `180 W (GPU reports 200 W)` | +| `host` | `AMD EPYC 7282 16-Core Processor · 60 GB RAM · Ubuntu 26.04.1 LTS · kernel 7.0.0-38-generic · VM kvm` | +| `engine` | `llama.cpp b11913-7aca0d2ea · 4 slots · image ghcr.io/ggml-org/llama.cpp:server-intel@1a2b3c4d5e6f · via llama-swap` | +| `model_file` | `/models/Qwen3.8-27B-Q4_0.gguf · 15.60 GB` (weights as stored) | +| `mem_bw` | `532 GB/s measured (torch copy, random, 1024 MiB) · 608 GB/s declared` | +| `parallel` | `tp 1 · pp 1` | +| `precision` | `weights Q4_0 · kv f16` | +| `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`, or `none` | +| `spec`, `thinking` | `mtp:5`, `default` | +| `greedy_check` | `identical 3/3 · 1d5105fe09dc`, `differs: 2 variants in 3 · first ...` | +| `run` | `full · concurrency on · bench-standard 0.3.0` | +| `special_notes` | only when given | + +The context size appears as BetterBench's own chip. + +## How things are detected + +**GPU:** `nvidia-smi`, then `rocm-smi`, then `xpu-smi`. + +**PCIe** is the link into the slot. Cards with their own PCIe switch (Intel Arc, some AMD) +are read at the switch's upstream port. Inside a VM the link can't be read: run +`collect-env.sh` on the hypervisor, or pass `--pcie`. + +**ReBAR** is on when the GPU's largest BAR is bigger than 256 MiB (about the size of VRAM). +This works in a VM too, because passthrough keeps BAR sizes. + +**Engine:** llama.cpp via `/props` (its build includes the commit), vLLM via `/version` and +`/v1/models`. Behind llama-swap these go through `/upstream//`, which also gives the +launch command. For a docker server the image is recorded with its ID, because tags like +`server-intel` move daily. + +**Launch settings** come from the launch command, because no API reports them: +- llama.cpp: `b`, `ub`, `fa`, `ctk` and `ctv` always show, as `default` when not set, + because the defaults change between builds. +- vLLM: batching, KV type, compilation and spec config. +- **Env flags** come from `VAR=x cmd`, `env VAR=x` and docker `-e VAR=x`. Settings in + llama-swap's `env:` block, or in the shell that started the server, aren't visible; + put them in the command. +- If `--kv` doesn't match the command, `bench.sh` warns. + +**Memory bandwidth:** `mem-bw.py` copies 1 GiB of random data with torch, inside the +server's container (same GPU, env and torch), or with `$BW_PYTHON`. It uses random +data because Arc compresses uniform buffers: zeros read 1627 GB/s on a B65 that really +does 532. The fallback is `clpeak`, which may read high on Arc. `MEASURE_BW=0` skips the +test. `--mem-bw` adds the spec figure next to the measured one. + +**Greedy check:** temperature 0, seed 0, 128 tokens, 3 times. `identical` is expected. +`differs` points to nondeterministic kernels or a broken spec-decoding path. The hash +lets you compare setups: the same model and quant should give the same hash. A +different hash isn't automatically wrong, since kernels round differently. + +## After the run + +These go to `meta.json` under `post_run` and the summary, not to the notes, which are +fixed before BetterBench starts. + +- **energy:** kJ, average and peak W, J per output token, and average, min and max clock. + The clock counts only samples where the GPU is running. The figures cover the + **whole run**, warm-up and prefill included, so compare only runs of the same mode. + Power is sampled only when BetterBench runs on the server. On a split setup, run + `gpu-power.sh > power.csv` on the server yourself. +- **roofline:** median batch-1 decode t/s × weight bytes ÷ memory bandwidth = % of + bandwidth. It holds for dense models. Spec decoding and MoE can exceed 100%. So + can models quantized at load (e.g. vLLM fp8 from bf16 files), because they read + fewer bytes than are stored. For safetensors the size includes every file, so the + RedHatAI models' MTP head adds about 5%. + +## BetterBench with PR #4 + +[GGZ14/BetterBench#4](https://github.com/GGZ14/BetterBench/pull/4) adds BetterBench's +own GPU/PCIe/ReBAR probe under `env.gpu` (still version 0.6.1). That probe describes the +machine BetterBench runs on, so the notes above are what count. `bench.sh` warns when +the two disagree. The probe adds an `intel`-style chip, so `compare` shows a `gpu` +mismatch between runs with and without the PR. diff --git a/README.md b/README.md index fc05e53..606d5a0 100644 --- a/README.md +++ b/README.md @@ -1,181 +1,92 @@ # bench-standard -A thin wrapper around [BetterBench](https://github.com/GGZ14/BetterBench) so everyone in the group -benchmarks the same way and every result records the setup it was measured on. -BetterBench itself is used unmodified, only through its CLI. +One script so everyone in the group benchmarks LLM servers the same way, with +[BetterBench](https://github.com/GGZ14/BetterBench). Every result records the setup it was +measured on: GPU, PCIe, engine, launch flags and more. Results stay comparable that way. -## The rules +Using a coding agent? Point it at [`AGENTS.md`](AGENTS.md). -1. **BetterBench 0.6.1**, exactly (tag `v0.6.1`). `bench.sh` refuses any other version. - The pin lives in `standard.env`. -2. **Models:** the ~9B model and Qwen3.8-27B, exact checkpoints in [`models.md`](models.md). - Verify the SHA256 before you benchmark. -3. **Config:** `config.json`, identical to BetterBench's `config/default.json` (no - deviations). max_tokens comes from the corpus, so it matches as long as the corpus does. -4. **Server settings you have to fix and declare** (BetterBench cannot set or detect them): +## 1. Install - | flag | meaning | example | - |---|---|---| - | `--tp` / `--pp` | tensor / pipeline parallel size | `1` / `1` | - | `--quant` | weight quantization | `Q4_K_M`, `gptq-int4` | - | `--kv` | KV cache dtype | `f16`, `q8_0`, `int8_k_int4_v` | - | `--spec` | speculative decoding: `none` or `METHOD:N` (`mtp`, `eagle`, `eagle3`, `ngram`, `draft`) | `mtp:5` | - | `--thinking` | thinking mode **configured on the server**: `off`, `on`, `low`, `medium`, `high`, `default` | `default` | - | `--submitter` | who ran it | `pascal` | - - The GPU power limit is read from the GPU. Pass `--power-limit W` (or `stock`) only - where it can't be detected, or to declare it; a mismatch is noted in the result. - - BetterBench can't send `chat_template_kwargs` / `reasoning_effort`, so the thinking - mode must be fixed in the server's chat template or launch flags and declared here. -5. **Results come from `bench.sh` only.** It adds everything it can detect itself - (GPU, driver, PCIe/ReBAR, memory bandwidth, CPU, RAM, OS, engine and version, - model file and size, launch flags and env flags, context) as notes. -6. **Memory bandwidth is measured** with `mem-bw.py`, a torch copy of random data run - inside the server's container (vLLM images have torch). Elsewhere set `BW_PYTHON` - to a python with GPU torch, or install `clpeak` as a fallback. Pass the card's - spec figure as `--mem-bw GBPS`; both are recorded. - -## Running - -On the inference server (or any machine that reaches it and has BetterBench 0.6.1): +On the machine with the GPU and the inference server (Linux, Python 3.10+): ```sh -./bench.sh --endpoint http://localhost:8080/v1 --model vllm/lfm3-1.7b \ - --tp 1 --pp 1 --quant bf16 --kv bf16 --spec none --thinking default \ - --submitter pascal --server-cmd-file my-server-cmd.txt +git clone https://github.com/GGZ14/BetterBench && cd BetterBench +git checkout v0.6.1 && pip install -e . && cd .. +git clone https://git.linxweiler.xyz/miga/benchmarks bench-standard ``` -That is a quick smoke run (BetterBench `--quick`, a few minutes) to check the setup. -Add `--full` for the run that counts; it takes much longer and occupies the GPU. +## 2. Run -- `--full` - the complete, publishable run; recorded as `run=full · ...`. -- `--no-concurrency` - skip the concurrency sweep; recorded as `concurrency=off`. -- `--dry-run` - print the BetterBench command and exit. -- `--verbose` - stream BetterBench's full output and list the notes. By default you - see the progress lines and a summary at the end. The full output is in - `betterbench.log` either way, and what gets recorded is identical. -- `--pcie "Gen4 x16"` - declare the slot link where it can't be read (VMs). -- `--special-notes "..."` - free text for anything unusual about the run (custom - kernels, undervolt, patched engine). Recorded as `special_notes`. -- `--mem-bw GBPS` - the card's declared (spec sheet) memory bandwidth. - `MEASURE_BW=0` skips the measurement (a few seconds, 2 GiB of free VRAM). -- `--server-cmd-file FILE` - the server launch command; needed for the `launch` and - `env_flags` notes unless the server runs behind llama-swap. -- `--api-key KEY` or `$BETTERBENCH_API_KEY` - never stored. -- Each mandatory flag can also come from `BENCH_` (e.g. `BENCH_SUBMITTER`). -- Results go to `results/` next to this file, or `--results-dir` / `$BENCH_RESULTS_DIR`. - Machine-local defaults can go in `bench.local.env` (sourced, not committed). +Serve one of the models in [`models.md`](models.md), Qwen3.5-9B or Qwen3.8-27B as +GGUF or w4a16, and check its SHA256. Any OpenAI-compatible server works (llama.cpp, +vLLM, ...). Then: -`bench.sh` first sends one warm-up request (through llama-swap the first request loads -the model, which takes minutes), then the greedy check, then `collect-env.sh`, then -BetterBench while `gpu-power.sh` samples GPU power and clock. +```sh +cd bench-standard +./bench.sh --endpoint http://localhost:8080/v1 --model MODEL_ID \ + --tp 1 --pp 1 --quant Q4_K_M --kv f16 --spec none --thinking default \ + --submitter YOUR_NAME --server-cmd-file server-cmd.txt +``` -**BetterBench on a different machine than the server:** run `./collect-env.sh --endpoint -http://localhost:PORT/v1 --model ID > env.txt` on the server and pass `--env-file env.txt` -to `bench.sh` on the client. +That's a quick check run of a few minutes. When it looks right, add `--full` for the +run that counts. It takes much longer and uses the GPU the whole time. -Each run produces `results/----/` with -`results.json`, `results.html`, `meta.json`, `server-cmd.txt`, `power.csv` and -`betterbench.log`. See -[`SUBMIT.md`](SUBMIT.md). +**You declare** what the script can't detect: -## Recorded notes +| flag | what | examples | +|---|---|---| +| `--tp` / `--pp` | tensor / pipeline parallel size | `1` / `1` | +| `--quant` | weight quantization | `Q4_K_M`, `gptq-int4`, `bf16` | +| `--kv` | KV cache type | `f16`, `q8_0` | +| `--spec` | speculative decoding | `none`, `mtp:5`, `eagle3:4`, `draft:8` | +| `--thinking` | thinking mode set **on the server** | `default`, `off`, `on`, `low`, `high` | +| `--submitter` | your name | `pascal` | -The notes are grouped, one per topic, so the report and compare page stay readable: +`--server-cmd-file` is a text file with the command you started the server with. Behind +llama-swap you can leave it out, because it's read automatically. -| note | example | +**Everything else is detected.** That includes the GPU, driver, power limit, +PCIe and ReBAR, measured memory bandwidth, CPU, OS, the engine and its exact +version, the model file, and launch and env flags. A temperature-0 output check +runs too. During the run it records power, clock and energy. + +Optional flags: + +| flag | for | |---|---| -| `submitter` | `pascal` | -| `gpu` | `1x Intel Arc Pro B65 · 32 GB · driver 1.17.39395` (VRAM per GPU) | -| `pcie` | `Gen4 x16 · ReBAR on`, `Gen1 x16 now, Gen4 x16 max · ReBAR on` (idle downclock), `Gen4 x16 (declared) · ReBAR off` | -| `power_limit` | `200 W`, or `180 W (GPU reports 200 W)` when they disagree | -| `host` | `AMD EPYC 7282 16-Core Processor · 60 GB RAM · Ubuntu 26.04.1 LTS · kernel 7.0.0-38-generic · VM kvm` | -| `engine` | `vllm 0.32.0 · image lfm3-vllm-xpu:v0.32.0-lfm3-fp8fix@ad5083ed33a7 · via llama-swap`, `llama.cpp b11913-7aca0d2ea · 4 slots · image ghcr.io/ggml-org/llama.cpp:server-intel@1a2b3c4d5e6f` | -| `model_file` | `/models/Qwen3.8-27B-Q4_0.gguf · 15.60 GB` (weights as stored) | -| `mem_bw` | `532 GB/s measured (torch copy, random, 1024 MiB) · 608 GB/s declared` | -| `parallel` | `tp 1 · pp 1` | -| `precision` | `weights Q4_0 · kv f16` | -| `launch` | llama.cpp: `b 4096 · ub 1024 · fa on · ctk q8_0 · ctv q8_0 · ngl 99 · np 4`; vLLM: `max-num-batched-tokens 4224 · max-num-seqs 4 · kv-cache-dtype int8_k_int4_v · ...` | -| `env_flags` | `GGML_SYCL_DISABLE_OPT=0 · ZES_ENABLE_SYSMAN=1`, `none` | -| `spec`, `thinking` | `mtp:5`, `default` | -| `greedy_check` | `identical 3/3 · 1d5105fe09dc`, `differs: 2 variants in 3 · first ...` | -| `run` | `full · concurrency on · bench-standard 0.3.0` | -| `special_notes` | only when given: free text from `--special-notes` | +| `--full` | the real run (default is a quick check) | +| `--verbose` | show everything BetterBench prints | +| `--dry-run` | print what would run, then stop | +| `--mem-bw 608` | the card's spec memory bandwidth in GB/s | +| `--power-limit 250` | when the power limit can't be read | +| `--pcie "Gen4 x16"` | inside a VM, where the PCIe link can't be read | +| `--special-notes "..."` | anything unusual: custom kernels, undervolt, patched engine | +| `--api-key KEY` | if the server needs one (never stored) | -The context size shows as BetterBench's own context chip. Parts that can't be detected -are left out. `meta.json` keeps every raw value (`mandatory`, `collected` from -`collect-env.sh`) for scripts. +## 3. Send your result -PCIe is the link into the slot. Cards with their own PCIe switch, like Intel Arc, are -read at the switch's upstream port. Inside a VM the link can't be read: run -`collect-env.sh` on the hypervisor or pass `--pcie "Gen4 x16"`. +Each run makes a folder `results/----/`. Send the whole +folder. Open `results.html` in a browser to see the report. -ReBAR comes from the GPU's largest BAR: on when it's bigger than 256 MiB (roughly the -size of VRAM), off otherwise. This works inside a VM too, because passthrough keeps -the BAR sizes. The raw size is kept in `meta.json` as `gpu_bar_mib`. +- Only `--full` runs count. +- Check `server-cmd.txt` for anything private first. Tokens, keys and passwords + are already redacted. -**BetterBench with [#4](https://github.com/GGZ14/BetterBench/pull/4)** (Intel GPU, -PCIe and ReBAR detection; still reports version 0.6.1) also records its own probe in -`results.json` under `env.gpu` (`pci`, `xpu_smi_discovery`), and the report shows a -vendor chip such as `intel`. That probe describes the machine **BetterBench** runs -on, not necessarily the server, and inside a VM it reads the placeholder link. The -`gpu`/`pcie` notes are what counts. After the run, `bench.sh` checks that probe: it -prints a note if the probe lists a different GPU (expected with `--env-file`), and a -warning if the two disagree on ReBAR. Measurements are unaffected, but the vendor -chip makes a run with #4 show a `gpu` mismatch in `compare` against one without it. +To compare two runs: `betterbench compare A/results.json B/results.json` -**Launch settings.** Batch/ubatch, flash attention, KV types and env flags can swing -results by 10-50%, and no API reports them, so they are read from the launch command -(llama-swap's, or `--server-cmd-file`). Env flags are `VAR=x` prefixes, `env VAR=x` -and docker `-e VAR=x`. Settings in llama-swap's `env:` block, or set in the shell -that started the server, are invisible: put them in the command or the cmd file. -For llama.cpp, `b`, `ub`, `fa`, `ctk` and `ctv` show `default` when they aren't set, -because the defaults change between builds. Offline switches and cache paths -(`HF_HUB_OFFLINE`, `VLLM_CACHE_ROOT`, ...) are left out. `meta.json` keeps everything -parsed under `launch`. If `--kv` doesn't match the KV type the command sets, -`bench.sh` prints a warning. +## Rules -**Greedy check.** Before the benchmark, the same prompt runs 3 times at temperature 0 -(seed 0, 128 tokens). `identical` is expected. `differs` points to nondeterministic -kernels or batching, or a broken spec-decoding path. The hash makes the output -comparable across runs: the same model and quant should give the same hash on -another engine or card. A different hash isn't automatically wrong (kernels round -differently), but check spec decoding or a new kernel against a run without it. +- BetterBench **0.6.1** exactly, with the settings in `config.json`. `bench.sh` refuses + any other version, and other BetterBench flags aren't allowed. +- Results come from `bench.sh` only. Don't edit them. -**After the run** (in `meta.json` under `post_run`, printed at the end; these can't be -notes because the notes are fixed before BetterBench starts): +## More -- `energy` - from `power.csv` (GPU power, energy counter and graphics clock every 2 s, via - `nvidia-smi` or `xpu-smi`): kJ, average/peak W, and J per output token. This - covers the **whole run** (warm-up passes and prefill included), so it is a gross - figure, comparable only between runs of the same mode. Only measured when - BetterBench runs on the server; on a split setup run `gpu-power.sh > power.csv` on - the server yourself. - Also average/min/max clock, counted only over samples where the GPU is running - (a clock-gated idle GPU reads 0 MHz). -- `roofline` - median batch-1 decode t/s × weight bytes ÷ measured `mem_bw` (else the - declared one) = % of memory - bandwidth. Valid for dense models whose stored weights are what the GPU reads. - Spec decoding and MoE can exceed 100%. A model quantized at load (e.g. vLLM - `--quantization fp8` from bf16 files) reads fewer bytes than are stored, so its - figure comes out too high. - -**Why random data:** Arc compresses uniform buffers, so a test on zeros reads far too -high. On the B65 here zeros give 1627 GB/s and random data 532 GB/s, against 608 -declared. A docker server's image is recorded with its ID, because tags like -llama.cpp's `server-intel` move daily. The llama.cpp build and commit are in the -`engine` note anyway (`b11913-7aca0d2ea`, from `/props`). - -Engine detection: llama.cpp via `/props`, vLLM via `/version` + `/v1/models`; behind -llama-swap through `/upstream//...`, which also yields the launch command. -GPU detection: `nvidia-smi`, then `rocm-smi`, then `xpu-smi`. - -## Comparing - -```sh -betterbench compare A/results.json B/results.json -``` - -Every note that differs between two runs shows up as a mismatch chip. Compare like -with like. +- **BetterBench on another machine than the GPU:** run + `./collect-env.sh --endpoint URL --model ID > env.txt` on the server, then add + `--env-file env.txt` on the other machine. +- The declared values can also be set as `BENCH_`, e.g. `BENCH_SUBMITTER=pascal`. + Results go to `results/` (or `--results-dir`). Machine-local defaults like these + go in `bench.local.env`. +- What each recorded field means and how it's detected: [`DETAILS.md`](DETAILS.md). diff --git a/SUBMIT.md b/SUBMIT.md deleted file mode 100644 index 1d22a1c..0000000 --- a/SUBMIT.md +++ /dev/null @@ -1,20 +0,0 @@ -# Submitting a result - -Send the whole run directory `results/----/`: - -| file | what | -|---|---| -| `results.json` | BetterBench results, all notes under `env.notes` | -| `results.html` | the standalone report | -| `meta.json` | detected + declared setup, the exact BetterBench command | -| `server-cmd.txt` | the server launch command (from `--server-cmd-file`, or from llama-swap) | -| `power.csv` | GPU samples during the run (`epoch_s,watts,joules,mhz`), when measured | -| `betterbench.log` | BetterBench's full terminal output | - -Only full runs count (`bench.sh --full`): the `run` note starts with `full`. Runs -without `--full` are quick smoke tests. - -If `server-cmd.txt` is missing, pass `--server-cmd-file` next time, or add the launch -command by hand. Values of variables or flags named like `*TOKEN*`, `*KEY*`, `*SECRET*`, -`*PASSWORD*` are redacted automatically; check the file for anything else private -before sending. diff --git a/models.md b/models.md index d8a715b..87cb9ce 100644 --- a/models.md +++ b/models.md @@ -1,33 +1,42 @@ # Models -**TBD by the group.** Fill in exact checkpoints; nobody benchmarks a file whose hash -doesn't match this table. +Benchmark only these files, and check the hash first. A different file is a different +benchmark. -| model | format | HF repo | file(s) | SHA256 | +| model | engine | Hugging Face repo | file(s) | `--quant` | |---|---|---|---|---| -| ~9B (TBD) | GGUF | `TBD` | `TBD.gguf` | `TBD` | -| ~9B (TBD) | safetensors | `TBD` | `model-*.safetensors` | `TBD` (see below) | -| Qwen3.8-27B | GGUF | `TBD` | `TBD.gguf` | `TBD` | -| Qwen3.8-27B | safetensors | `TBD` | `model-*.safetensors` | `TBD` (see below) | +| Qwen3.5-9B | vLLM & co. | [`RedHatAI/Qwen3.5-9B-quantized.w4a16`](https://huggingface.co/RedHatAI/Qwen3.5-9B-quantized.w4a16) | the repo (`model.safetensors`, `model_mtp.safetensors`) | `w4a16` | +| Qwen3.8-27B | vLLM & co. | [`RedHatAI/Qwen3.8-27B-INT4`](https://huggingface.co/RedHatAI/Qwen3.8-27B-INT4) | the repo (`model.safetensors`, `model_mtp.safetensors`) | `w4a16` | +| Qwen3.5-9B | llama.cpp | [`unsloth/Qwen3.5-9B-GGUF`](https://huggingface.co/unsloth/Qwen3.5-9B-GGUF) | `Qwen3.5-9B-Q4_K_M.gguf` | `Q4_K_M` | +| Qwen3.8-27B | llama.cpp | [`unsloth/Qwen3.8-27B-GGUF`](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF) | `Qwen3.8-27B-UD-Q4_K_M.gguf` | `UD-Q4_K_M` | -Open: which quant(s) of Qwen3.8-27B are standard. +Both RedHatAI checkpoints are int4 weights with 16-bit activations (compressed-tensors), +and they include an MTP head (`model_mtp.safetensors`) for `--spec mtp:N`. The 27B GGUF +repo has no plain Q4_K_M, only Unsloth's dynamic `UD-Q4_K_M`. -## Verify +## SHA256 -Single file (GGUF): +| file | SHA256 | +|---|---| +| `Qwen3.5-9B-Q4_K_M.gguf` | `03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8` | +| `Qwen3.8-27B-UD-Q4_K_M.gguf` | `322e194ff79741c7baa497c240f677f54b201b0efab44ca8e50f122b39123482` | +| `RedHatAI/Qwen3.5-9B-quantized.w4a16` (directory) | `cca16f9855b9f92eee5876ddc8656ed6397316ffc65b9f17ca1939a9549e4c26` | +| `RedHatAI/Qwen3.8-27B-INT4` (directory) | `bffa6b23fa11be557fe9de4b122a8bb99f537ad7a1a4effa702f7d0c677778f7` | + +The hashes are from the Hugging Face repos as of 2026-10-29 (revisions `3885219`, +`4ca7207`, `a398088`, `91bd022`). If a repo changes its files, this table gets updated. + +## Check + +A GGUF file: ```sh -sha256sum /path/to/model.gguf +sha256sum Qwen3.5-9B-Q4_K_M.gguf ``` -Directory (safetensors) - one hash over the per-file hashes, in name order: +A safetensors directory: one hash over the per-file hashes, in name order. `LC_ALL=C` +matters, because other locales sort `model_mtp` before `model.` and give a different hash. ```sh -cd /path/to/model-dir && sha256sum *.safetensors | sort -k2 | sha256sum -``` - -The upstream hash of a single file on Hugging Face (the LFS etag is its SHA256): - -```sh -curl -sI https://huggingface.co/REPO/resolve/main/FILE | grep -i x-linked-etag +cd /path/to/model-dir && sha256sum *.safetensors | LC_ALL=C sort -k2 | sha256sum ```