From dba3b6e801b04bd4d02ea3dd858e0f062fa71405 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 29 Oct 2026 13:30:07 +0100 Subject: [PATCH] Check --thinking against the greedy replies; one main for both hosts - the greedy check records whether the replies hold reasoning (a reasoning field or think tags); the thinking note shows declared and observed, and bench.sh warns when --thinking off meets reasoning or on/low/medium/high meets none. Standard 0.4.1 - main now carries the GitHub links, so Gitea and GitHub have the same main; Gitea is the source and mirrors to GitHub on push Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 1 + README.md | 13 ++++++++++--- bench.sh | 30 ++++++++++++++++++++++++------ dev/DETAILS.md | 10 +++++++--- dev/bench.sh | 26 ++++++++++++++++++++++---- dev/standard.env | 2 +- 6 files changed, 65 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 230eaef..7da24f8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,6 +113,7 @@ Tell your human: | `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 | +| `--thinking X, but the greedy replies ...` | the declared thinking mode doesn't match what the server does. Ask your human which is right; never change the server yourself | | `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 | diff --git a/README.md b/README.md index 43c6abd..5709467 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,8 @@ file next to `bench.sh`. 1. **Warm-up:** one request. Behind llama-swap that loads the model, which can take minutes. 2. **Greedy check:** the same prompt 3 times at temperature 0. The output should be identical. Its hash lets you compare setups: the same model and quant should give - the same text everywhere. + 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 @@ -149,7 +150,8 @@ launch b 4096 · ub 1024 · fa on · ctk q8_0 · ctv q8_0 · ngl 99 · np 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 -run full · concurrency on · bench-standard 0.4.0 · betterbench 0.6.1 +thinking default · reasoning seen +run full · concurrency on · bench-standard 0.4.1 · betterbench 0.6.1 ``` ## Your result @@ -198,6 +200,7 @@ during the benchmark if you want it. | `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 | | `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 | @@ -210,5 +213,9 @@ 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. What each +them into the one file. Commit `dev/` and the rebuilt `bench.sh` together. + +The source repo is [git.linxweiler.xyz/miga/benchmarks](https://git.linxweiler.xyz/miga/benchmarks). +Push there. [GitHub](https://github.com/aneinander/benchmarks) is a mirror that Gitea +updates on every push, so don't push to GitHub directly. What each recorded value means and how it's detected: [`dev/DETAILS.md`](dev/DETAILS.md). diff --git a/bench.sh b/bench.sh index 49919ed..c4dd05d 100755 --- a/bench.sh +++ b/bench.sh @@ -1,5 +1,5 @@ #!/bin/sh -# bench.sh - bench-standard 0.4.0, everything in one file: run ./bench.sh --help +# bench.sh - bench-standard 0.4.1, everything in one file: run ./bench.sh --help # Generated by dev/build.sh from dev/ - edit there and rebuild, not here. set -eu BENCH_HOME=${BENCH_HOME:-$(cd "$(dirname "$0")" && pwd)}; export BENCH_HOME @@ -171,6 +171,7 @@ case "$code" in 2*) ;; *) die "warm-up request failed (HTTP $code): $(head -c 30 # The same prompt three times at temperature 0 must give the same text. The # hash of that text also lets two setups of the same model be compared: a # different hash means different numerics (quant, kernels, spec decoding bug). +# Whether the replies hold reasoning is checked against --thinking below. echo "greedy check: 3 requests at temperature 0 ..." >&2 ENDPOINT=$endpoint MODEL=$model python3 - > "$tmp/measured" <<'PY' import hashlib, json, os, urllib.request @@ -182,7 +183,7 @@ body = json.dumps({"model": os.environ["MODEL"], "temperature": 0, "seed": 0, hdr = {"Content-Type": "application/json"} if os.environ.get("BETTERBENCH_API_KEY"): hdr["Authorization"] = "Bearer " + os.environ["BETTERBENCH_API_KEY"] -outs = [] +outs, thought = [], [] try: for _ in range(3): req = urllib.request.Request(os.environ["ENDPOINT"].rstrip("/") + "/chat/completions", @@ -190,8 +191,12 @@ try: with urllib.request.urlopen(req, timeout=600) as r: msg = json.load(r)["choices"][0]["message"] # thinking models may spend all 128 tokens on reasoning - outs.append((msg.get("reasoning_content") or msg.get("reasoning") or "") + - "\0" + (msg.get("content") or "")) + reasoning = msg.get("reasoning_content") or msg.get("reasoning") or "" + content = msg.get("content") or "" + outs.append(reasoning + "\0" + content) + # a separate reasoning field (server with a reasoning parser), or + # think tags left in the text (server without one) + thought.append(bool(reasoning.strip()) or "" in content or "" in content) except Exception as e: print("greedy_check=failed") print("greedy_error=" + " ".join(str(e).split())[:200]) @@ -199,6 +204,7 @@ else: hashes = [hashlib.sha256(o.encode()).hexdigest()[:12] for o in outs] print("greedy_check=" + ("identical" if len(set(hashes)) == 1 else "differs")) print(f"greedy_variants={len(set(hashes))}\ngreedy_runs={len(hashes)}\ngreedy_hash={hashes[0]}") + print("greedy_reasoning=" + ("yes" if all(thought) else "no" if not any(thought) else "mixed")) PY # ---------------------------------------------------------------- collect @@ -411,6 +417,18 @@ elif meas.get("greedy_check") == "differs": else: greedy = "failed" +# --thinking is declared, but the greedy replies show whether the model +# reasoned: check one against the other. +seen = meas.get("greedy_reasoning") +thinking = join(m["thinking"], {"yes": "reasoning seen", "no": "no reasoning seen", + "mixed": "reasoning in some replies"}.get(seen, "")) +if m["thinking"] == "off" and seen in ("yes", "mixed"): + print("bench.sh: warning: --thinking off, but the greedy replies contain reasoning;" + " check the server's chat template or reasoning flags", file=sys.stderr) +elif m["thinking"] in ("on", "low", "medium", "high") and seen == "no": + print(f"bench.sh: warning: --thinking {m['thinking']}, but the greedy replies contain no" + " reasoning; thinking may be off on the server", file=sys.stderr) + eng = g("engine") engine = join(" ".join(p for p in (eng, g("engine_version")) if p), g("engine_slots") and g("engine_slots") + " slots", @@ -431,7 +449,7 @@ notes = [ ("launch", launch), ("env_flags", env_flags), ("spec", m["spec"]), - ("thinking", m["thinking"]), + ("thinking", thinking), ("greedy_check", greedy), ("run", join(m["run_mode"], "concurrency " + m["concurrency"], "bench-standard " + m["bench_standard"], "betterbench " + m["betterbench"])), @@ -1105,7 +1123,7 @@ __BENCH_STANDARD_EOF__ cat > "$d/standard.env" <<'__BENCH_STANDARD_EOF__' # Pins for this version of the group standard. Bump STANDARD_VERSION whenever # config.json, the minimum BetterBench or the mandatory fields change. -STANDARD_VERSION=0.4.0 +STANDARD_VERSION=0.4.1 # Oldest BetterBench that has everything bench.sh uses; newer ones run too, # and the version goes into the run note so compare shows a mismatch. BETTERBENCH_MIN_VERSION=0.6.1 diff --git a/dev/DETAILS.md b/dev/DETAILS.md index 0a5b9be..9f4cda2 100644 --- a/dev/DETAILS.md +++ b/dev/DETAILS.md @@ -43,9 +43,10 @@ can't be detected is left out or shows `unknown`. | `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` | +| `spec` | `mtp:5`, `none` | +| `thinking` | `default · reasoning seen`, `off · no reasoning seen` (declared · observed) | | `greedy_check` | `identical 3/3 · 1d5105fe09dc`, `differs: 2 variants in 3 · first ...` | -| `run` | `full · concurrency on · bench-standard 0.4.0 · betterbench 0.6.1` | +| `run` | `full · concurrency on · bench-standard 0.4.1 · betterbench 0.6.1` | | `special_notes` | only when given | The context size appears as BetterBench's own chip. @@ -84,7 +85,10 @@ 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. +different hash isn't automatically wrong, since kernels round differently. The check +also records whether the replies held reasoning: a separate reasoning field, or think +tags in the text. `bench.sh` warns when `--thinking off` meets reasoning, or when +`on`/`low`/`medium`/`high` meets none. With `default` the observation is only recorded. ## After the run diff --git a/dev/bench.sh b/dev/bench.sh index 0c30899..d24c95f 100755 --- a/dev/bench.sh +++ b/dev/bench.sh @@ -161,6 +161,7 @@ case "$code" in 2*) ;; *) die "warm-up request failed (HTTP $code): $(head -c 30 # The same prompt three times at temperature 0 must give the same text. The # hash of that text also lets two setups of the same model be compared: a # different hash means different numerics (quant, kernels, spec decoding bug). +# Whether the replies hold reasoning is checked against --thinking below. echo "greedy check: 3 requests at temperature 0 ..." >&2 ENDPOINT=$endpoint MODEL=$model python3 - > "$tmp/measured" <<'PY' import hashlib, json, os, urllib.request @@ -172,7 +173,7 @@ body = json.dumps({"model": os.environ["MODEL"], "temperature": 0, "seed": 0, hdr = {"Content-Type": "application/json"} if os.environ.get("BETTERBENCH_API_KEY"): hdr["Authorization"] = "Bearer " + os.environ["BETTERBENCH_API_KEY"] -outs = [] +outs, thought = [], [] try: for _ in range(3): req = urllib.request.Request(os.environ["ENDPOINT"].rstrip("/") + "/chat/completions", @@ -180,8 +181,12 @@ try: with urllib.request.urlopen(req, timeout=600) as r: msg = json.load(r)["choices"][0]["message"] # thinking models may spend all 128 tokens on reasoning - outs.append((msg.get("reasoning_content") or msg.get("reasoning") or "") + - "\0" + (msg.get("content") or "")) + reasoning = msg.get("reasoning_content") or msg.get("reasoning") or "" + content = msg.get("content") or "" + outs.append(reasoning + "\0" + content) + # a separate reasoning field (server with a reasoning parser), or + # think tags left in the text (server without one) + thought.append(bool(reasoning.strip()) or "" in content or "" in content) except Exception as e: print("greedy_check=failed") print("greedy_error=" + " ".join(str(e).split())[:200]) @@ -189,6 +194,7 @@ else: hashes = [hashlib.sha256(o.encode()).hexdigest()[:12] for o in outs] print("greedy_check=" + ("identical" if len(set(hashes)) == 1 else "differs")) print(f"greedy_variants={len(set(hashes))}\ngreedy_runs={len(hashes)}\ngreedy_hash={hashes[0]}") + print("greedy_reasoning=" + ("yes" if all(thought) else "no" if not any(thought) else "mixed")) PY # ---------------------------------------------------------------- collect @@ -401,6 +407,18 @@ elif meas.get("greedy_check") == "differs": else: greedy = "failed" +# --thinking is declared, but the greedy replies show whether the model +# reasoned: check one against the other. +seen = meas.get("greedy_reasoning") +thinking = join(m["thinking"], {"yes": "reasoning seen", "no": "no reasoning seen", + "mixed": "reasoning in some replies"}.get(seen, "")) +if m["thinking"] == "off" and seen in ("yes", "mixed"): + print("bench.sh: warning: --thinking off, but the greedy replies contain reasoning;" + " check the server's chat template or reasoning flags", file=sys.stderr) +elif m["thinking"] in ("on", "low", "medium", "high") and seen == "no": + print(f"bench.sh: warning: --thinking {m['thinking']}, but the greedy replies contain no" + " reasoning; thinking may be off on the server", file=sys.stderr) + eng = g("engine") engine = join(" ".join(p for p in (eng, g("engine_version")) if p), g("engine_slots") and g("engine_slots") + " slots", @@ -421,7 +439,7 @@ notes = [ ("launch", launch), ("env_flags", env_flags), ("spec", m["spec"]), - ("thinking", m["thinking"]), + ("thinking", thinking), ("greedy_check", greedy), ("run", join(m["run_mode"], "concurrency " + m["concurrency"], "bench-standard " + m["bench_standard"], "betterbench " + m["betterbench"])), diff --git a/dev/standard.env b/dev/standard.env index 8e19922..d63ce1d 100644 --- a/dev/standard.env +++ b/dev/standard.env @@ -1,6 +1,6 @@ # Pins for this version of the group standard. Bump STANDARD_VERSION whenever # config.json, the minimum BetterBench or the mandatory fields change. -STANDARD_VERSION=0.4.0 +STANDARD_VERSION=0.4.1 # Oldest BetterBench that has everything bench.sh uses; newer ones run too, # and the version goes into the run note so compare shows a mismatch. BETTERBENCH_MIN_VERSION=0.6.1