From 1ac7622005bf4a47a1df34c5e2d7182ac31ce4a1 Mon Sep 17 00:00:00 2001 From: claude Date: Wed, 28 Oct 2026 23:04:07 +0100 Subject: [PATCH] Add bench-standard: standardized BetterBench group benchmark Thin wrapper around BetterBench 0.6.1 (unmodified): bench.sh enforces the pinned version and the mandatory server settings, collect-env.sh records GPU/host/engine details, and every value lands in the results as a note. Co-Authored-By: Claude Opus 5.5 --- .gitattributes | 1 + .gitignore | 2 + README.md | 80 +++++++++++++++++++ SUBMIT.md | 17 ++++ bench.sh | 207 +++++++++++++++++++++++++++++++++++++++++++++++++ collect-env.sh | 198 ++++++++++++++++++++++++++++++++++++++++++++++ config.json | 21 +++++ models.md | 33 ++++++++ standard.env | 4 + 9 files changed, 563 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.md create mode 100644 SUBMIT.md create mode 100755 bench.sh create mode 100755 collect-env.sh create mode 100644 config.json create mode 100644 models.md create mode 100644 standard.env diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..38e61ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +results/ +bench.local.env diff --git a/README.md b/README.md new file mode 100644 index 0000000..e4c525c --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +# 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. + +## The rules + +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): + + | 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` | + | `--power-limit` | GPU power limit in W, or `stock` | `200` | + | `--submitter` | who ran it | `pascal` | + + 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, CPU, RAM, OS, engine and version, model file, context) as notes. + +## Running + +On the inference server (or any machine that reaches it and has BetterBench 0.6.1): + +```sh +./bench.sh --endpoint http://localhost:8080/v1 --model llamacpp-sycl/qwen3.8-27b-q4-mtp \ + --tp 1 --pp 1 --quant Q4_K_M --kv f16 --spec mtp:5 --thinking default \ + --power-limit 200 --submitter pascal \ + --server-cmd-file my-server-cmd.txt +``` + +- `--quick` - smoke run (BetterBench `--quick`); recorded as `run_mode=quick`, not for submission. +- `--no-concurrency` - skip the concurrency sweep; recorded as `concurrency=off`. +- `--dry-run` - print the BetterBench command and exit. +- `--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). + +`bench.sh` first sends one warm-up request (through llama-swap the first request loads +the model, which takes minutes), then runs `collect-env.sh`, then BetterBench. + +**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. + +Each run produces `results/----/` with +`results.json`, `results.html`, `meta.json` and `server-cmd.txt`. See [`SUBMIT.md`](SUBMIT.md). + +## Recorded notes + +Declared: `submitter tp pp quant kv spec thinking power_limit`, plus `bench_standard +run_mode concurrency`. Detected (by `collect-env.sh`): `gpu_vendor gpu_model gpu_count +gpu_vram_gb gpu_driver gpu_power_limit_w cpu_model ram_gb os kernel proxy engine +engine_version engine_slots model_file ctx`. `gpu_vram_gb` is per GPU. Anything +undetectable is `unknown`. + +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. diff --git a/SUBMIT.md b/SUBMIT.md new file mode 100644 index 0000000..50bac0d --- /dev/null +++ b/SUBMIT.md @@ -0,0 +1,17 @@ +# 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) | + +Only full runs count: `run_mode=full` in `meta.json`. Quick runs are 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/bench.sh b/bench.sh new file mode 100755 index 0000000..9e5fc94 --- /dev/null +++ b/bench.sh @@ -0,0 +1,207 @@ +#!/bin/sh +# bench.sh - the single entry point for a standardized BetterBench run (see README.md). +# +# usage: bench.sh --endpoint URL --model ID +# --tp N --pp N --quant Q --kv KV --spec none|METHOD:N +# --thinking MODE --power-limit W|stock --submitter NAME +# [--api-key KEY] [--server-cmd-file FILE] [--env-file FILE] +# [--results-dir DIR] [--quick] [--no-concurrency] [--dry-run] +# +# Mandatory values may also come from the environment: BENCH_TP, BENCH_PP, +# BENCH_QUANT, BENCH_KV, BENCH_SPEC, BENCH_THINKING, BENCH_POWER_LIMIT, +# BENCH_SUBMITTER. API key: --api-key or $BETTERBENCH_API_KEY. +# --env-file: output of collect-env.sh run on the server, when BetterBench +# runs on another machine (default: run collect-env.sh here). + +set -eu +umask 002 +here=$(cd "$(dirname "$0")" && pwd) +. "$here/standard.env" +# Machine-local defaults (e.g. BENCH_RESULTS_DIR), not part of the standard. +[ -f "$here/bench.local.env" ] && . "$here/bench.local.env" + +die() { echo "bench.sh: $*" >&2; exit 1; } +usage() { sed -n '2,15p' "$0"; exit "${1:-0}"; } + +endpoint="" model="" server_cmd_file="" env_file="" quick=0 no_conc=0 dry=0 +tp=${BENCH_TP:-} pp=${BENCH_PP:-} quant=${BENCH_QUANT:-} kv=${BENCH_KV:-} +spec=${BENCH_SPEC:-} thinking=${BENCH_THINKING:-} power_limit=${BENCH_POWER_LIMIT:-} +submitter=${BENCH_SUBMITTER:-} +results_dir=${BENCH_RESULTS_DIR:-$here/results} + +need() { [ "$1" -ge 2 ] || die "$2 needs a value"; } +while [ $# -gt 0 ]; do + case "$1" in + --endpoint) need $# "$1"; endpoint=$2; shift 2 ;; + --model) need $# "$1"; model=$2; shift 2 ;; + --api-key) need $# "$1"; BETTERBENCH_API_KEY=$2; export BETTERBENCH_API_KEY; shift 2 ;; + --server-cmd-file) need $# "$1"; server_cmd_file=$2; shift 2 ;; + --env-file) need $# "$1"; env_file=$2; shift 2 ;; + --results-dir) need $# "$1"; results_dir=$2; shift 2 ;; + --tp) need $# "$1"; tp=$2; shift 2 ;; + --pp) need $# "$1"; pp=$2; shift 2 ;; + --quant) need $# "$1"; quant=$2; shift 2 ;; + --kv) need $# "$1"; kv=$2; shift 2 ;; + --spec) need $# "$1"; spec=$2; shift 2 ;; + --thinking) need $# "$1"; thinking=$2; shift 2 ;; + --power-limit) need $# "$1"; power_limit=$2; shift 2 ;; + --submitter) need $# "$1"; submitter=$2; shift 2 ;; + --quick) quick=1; shift ;; + --no-concurrency) no_conc=1; shift ;; + --dry-run) dry=1; shift ;; + -h|--help) usage 0 ;; + *) echo "bench.sh: unknown argument: $1 (other BetterBench flags are not allowed)" >&2; usage 2 ;; + esac +done + +# ---------------------------------------------------------------- checks +matches() { printf '%s\n' "$1" | grep -Eqx "$2"; } + +have_ver=$(betterbench --version 2>/dev/null | awk '{print $NF}') || have_ver="" +[ "$have_ver" = "$BETTERBENCH_VERSION" ] || + die "BetterBench $BETTERBENCH_VERSION required, found '${have_ver:-not installed}'" \ + "(git checkout v$BETTERBENCH_VERSION && pip install -e .)" +command -v python3 >/dev/null || die "python3 not found" +command -v curl >/dev/null || die "curl not found" + +missing="" +for f in endpoint model tp pp quant kv spec thinking power_limit submitter; do + eval "v=\${$f}" + [ -n "$v" ] || missing="$missing --$(printf '%s' "$f" | tr _ -)" +done +[ -z "$missing" ] || die "missing mandatory value(s):$missing" + +matches "$tp" '[1-9][0-9]*' || die "--tp must be a positive integer" +matches "$pp" '[1-9][0-9]*' || die "--pp must be a positive integer" +matches "$spec" 'none|(mtp|eagle|eagle3|ngram|draft):[1-9][0-9]*' || + die "--spec must be none or METHOD:N (mtp|eagle|eagle3|ngram|draft), e.g. mtp:5" +matches "$thinking" 'off|on|low|medium|high|default' || + die "--thinking must be off|on|low|medium|high|default (the server-side mode)" +matches "$power_limit" 'stock|[0-9]+(\.[0-9]+)?' || die "--power-limit must be watts or 'stock'" +for f in quant kv submitter; do + eval "v=\${$f}" + matches "$v" '[^[:space:]=]+' || die "--$f must be one word without '='" +done +if [ -n "$server_cmd_file" ]; then [ -r "$server_cmd_file" ] || die "cannot read $server_cmd_file"; fi +if [ -n "$env_file" ]; then [ -r "$env_file" ] || die "cannot read $env_file"; fi + +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT INT TERM + +hdr="$tmp/hdr" +if [ -n "${BETTERBENCH_API_KEY:-}" ]; then printf 'Authorization: Bearer %s\n' "$BETTERBENCH_API_KEY" > "$hdr" +else printf 'Accept: application/json\n' > "$hdr"; fi + +# ---------------------------------------------------------------- warm up +# The first request through llama-swap loads the model (minutes); it must not +# land inside a timed pass, and the engine probe needs it loaded anyway. +echo "warming up $model (a cold model behind llama-swap takes minutes to load) ..." >&2 +body=$(python3 -c 'import json, sys; print(json.dumps({"model": sys.argv[1], "max_tokens": 1, + "messages": [{"role": "user", "content": "hi"}]}))' "$model") +code=$(curl -s -m "${WARM_TIMEOUT:-900}" -o "$tmp/warm" -w '%{http_code}' -H @"$hdr" \ + -H 'Content-Type: application/json' -d "$body" "${endpoint%/}/chat/completions") || code=000 +case "$code" in 2*) ;; *) die "warm-up request failed (HTTP $code): $(head -c 300 "$tmp/warm" 2>/dev/null)" ;; esac + +# ---------------------------------------------------------------- collect +if [ -n "$env_file" ]; then + cp "$env_file" "$tmp/env" +else + sh "$here/collect-env.sh" --endpoint "$endpoint" --model "$model" \ + --server-cmd-out "$tmp/cmd.auto" > "$tmp/env" +fi + +# Mandatory fields first, collected ones after; one key=value per line. +{ + printf 'submitter=%s\ntp=%s\npp=%s\nquant=%s\nkv=%s\nspec=%s\nthinking=%s\npower_limit=%s\n' \ + "$submitter" "$tp" "$pp" "$quant" "$kv" "$spec" "$thinking" "$power_limit" + printf 'bench_standard=%s\nrun_mode=%s\nconcurrency=%s\n' "$STANDARD_VERSION" \ + "$([ $quick = 1 ] && echo quick || echo full)" "$([ $no_conc = 1 ] && echo off || echo on)" +} > "$tmp/mandatory" +grep -Ev '^[[:space:]]*(#|$)' "$tmp/env" > "$tmp/collected" || true +if grep -Evq '^[a-z0-9_]+=' "$tmp/collected"; then + die "malformed line in collected env (want key=value, lowercase keys)" +fi +for k in $(cut -d= -f1 "$tmp/mandatory"); do + if grep -q "^$k=" "$tmp/collected"; then die "collected env must not set mandatory key '$k'"; fi +done +cat "$tmp/mandatory" "$tmp/collected" > "$tmp/notes" + +get() { sed -n "s/^$1=//p" "$tmp/notes" | head -n1; } +engine=$(get engine) gpu=$(get gpu_model) count=$(get gpu_count) ctx=$(get ctx) pl=$(get gpu_power_limit_w) +[ "$engine" != unknown ] || echo "bench.sh: warning: engine not detected; result is hard to compare" >&2 +if [ "$power_limit" != stock ] && matches "$pl" '[0-9.]+' && + [ "$(awk -v a="$pl" -v b="$power_limit" 'BEGIN{print (a-b>1||b-a>1)}')" = 1 ]; then + echo "bench.sh: warning: --power-limit $power_limit W but the GPU reports $pl W" >&2 +fi +matches "$count" '[2-9]|[1-9][0-9]+' && gpu="${count}x-$gpu" +slug() { tr 'A-Z' 'a-z' | sed -e 's/[^a-z0-9.]\{1,\}/-/g' -e 's/^-//' -e 's/-$//'; } +name=$(printf '%s-%s-%s' "$model" "$engine" "$gpu" | slug) + +run_dir="$results_dir/$(date +%Y%m%d-%H%M%S)-$(printf '%s' "$submitter" | slug)-$name" + +# ---------------------------------------------------------------- run +set -- run --no-update-check --endpoint "$endpoint" --model "$model" \ + --config "$here/config.json" --name "$name" --out "$run_dir/results.json" +[ $quick = 1 ] && set -- "$@" --quick +[ $no_conc = 1 ] && set -- "$@" --no-concurrency +# Through a proxy /v1/models often lacks the context size; hand over what the +# engine itself reported so prefill depths that don't fit are skipped cleanly. +matches "$ctx" '[1-9][0-9]*' && set -- "$@" --max-model-len "$ctx" +while IFS= read -r line; do set -- "$@" --note "$line"; done < "$tmp/notes" + +if [ $dry = 1 ]; then + echo "dry run - would write $run_dir/ and run:" + printf ' betterbench'; printf ' %s' "$@"; echo + exit 0 +fi + +mkdir -p "$results_dir" +mkdir "$run_dir" || die "cannot create $run_dir" + +# Launch command: the user's file wins, else what llama-swap reports. +# Secrets in env vars / flags are redacted either way. +cmd_src="" +if [ -n "$server_cmd_file" ]; then cmd_src="file:$(basename "$server_cmd_file")"; cp "$server_cmd_file" "$tmp/cmd" +elif [ -s "$tmp/cmd.auto" ]; then cmd_src="llama-swap /running"; cp "$tmp/cmd.auto" "$tmp/cmd"; fi +if [ -n "$cmd_src" ]; then + python3 - "$tmp/cmd" "$run_dir/server-cmd.txt" <<'PY' +import re, sys +s = open(sys.argv[1], encoding="utf-8", errors="replace").read() +s = re.sub(r'(?i)\b([A-Z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API_?KEY)[A-Z0-9_]*=)\S+', r'\1', s) +s = re.sub(r'(?i)(--(?:api-key|hf-token|token)[= ])\S+', r'\1', s) +open(sys.argv[2], "w", encoding="utf-8").write(s if s.endswith("\n") else s + "\n") +PY +fi + +STANDARD_VERSION=$STANDARD_VERSION CMD_SRC=$cmd_src ENDPOINT=$endpoint MODEL=$model NAME=$name \ +python3 - "$tmp/mandatory" "$tmp/collected" "$run_dir/meta.json" "$@" <<'PY' +import json, os, sys, time +def kv(path): + with open(path, encoding="utf-8") as f: + return dict(l.rstrip("\n").split("=", 1) for l in f if "=" in l) +src = os.environ["CMD_SRC"] +meta = { + "bench_standard": os.environ["STANDARD_VERSION"], + "created": time.strftime("%Y-%m-%dT%H:%M:%S%z"), + "endpoint": os.environ["ENDPOINT"], + "model": os.environ["MODEL"], + "name": os.environ["NAME"], + "mandatory": kv(sys.argv[1]), + "collected": kv(sys.argv[2]), + "server_cmd_file": "server-cmd.txt" if src else None, + "server_cmd_source": src or None, + "betterbench_argv": ["betterbench"] + sys.argv[4:], +} +with open(sys.argv[3], "w", encoding="utf-8") as f: + json.dump(meta, f, indent=2) + f.write("\n") +PY + +echo "running betterbench -> $run_dir" >&2 +if ! betterbench "$@"; then + mv "$run_dir" "$run_dir.failed" 2>/dev/null || true + die "betterbench failed; partial output kept in $run_dir.failed" +fi +echo +echo "done: $run_dir" +ls -1 "$run_dir" diff --git a/collect-env.sh b/collect-env.sh new file mode 100755 index 0000000..9acec09 --- /dev/null +++ b/collect-env.sh @@ -0,0 +1,198 @@ +#!/bin/sh +# collect-env.sh - run ON THE INFERENCE SERVER. Prints a flat key=value list +# describing the hardware and the inference engine behind an endpoint. +# Never aborts on detection: anything it cannot find is reported as "unknown". +# +# usage: collect-env.sh [--endpoint URL] [--model ID] [--api-key KEY] [--server-cmd-out FILE] +# --endpoint OpenAI-compatible base, e.g. http://localhost:8080/v1 (omit: hardware only) +# --model model id as sent to the endpoint (needed behind llama-swap) +# --server-cmd-out behind llama-swap: write the model's launch command (raw) to FILE +# env: BETTERBENCH_API_KEY, PROBE_TIMEOUT (s, default 10), LOAD_TIMEOUT (s, default 600) + +set -u +LC_ALL=C; export LC_ALL + +endpoint="" model="" api_key="${BETTERBENCH_API_KEY:-}" cmd_out="" +PROBE_TIMEOUT=${PROBE_TIMEOUT:-10} +LOAD_TIMEOUT=${LOAD_TIMEOUT:-600} + +need() { [ "$1" -ge 2 ] || { echo "collect-env: $2 needs a value" >&2; exit 2; }; } +while [ $# -gt 0 ]; do + case "$1" in + --endpoint) need $# "$1"; endpoint=$2; shift 2 ;; + --model) need $# "$1"; model=$2; shift 2 ;; + --api-key) need $# "$1"; api_key=$2; shift 2 ;; + --server-cmd-out) need $# "$1"; cmd_out=$2; shift 2 ;; + -h|--help) sed -n '2,10p' "$0"; exit 0 ;; + *) echo "collect-env: unknown argument: $1" >&2; exit 2 ;; + esac +done + +tmp=$(mktemp -d) || exit 1 +trap 'rm -rf "$tmp"' EXIT INT TERM +# Header via a file so the key never shows up in `ps`. +if [ -n "$api_key" ]; then printf 'Authorization: Bearer %s\n' "$api_key" > "$tmp/hdr" +else printf 'Accept: application/json\n' > "$tmp/hdr"; fi + +have() { command -v "$1" >/dev/null 2>&1; } + +# jget FILE EXPR - evaluate a python expression over the parsed JSON `j` +# (and `arg` = $JARG); prints nothing on any failure. Tolerates junk before +# the JSON (xpu-smi prints "[Error] ..." lines on stdout). +jget() { + have python3 || return 0 + python3 - "$1" "$2" <<'PY' 2>/dev/null +import json, os, sys +try: + raw = open(sys.argv[1], encoding="utf-8", errors="replace").read() + try: + j = json.loads(raw) + except ValueError: + j = json.loads(raw[raw.index("{"):]) + v = eval(sys.argv[2], {"j": j, "arg": os.environ.get("JARG", "")}) + if v is not None and v != "": + print(" ".join(str(v).split())) +except Exception: + pass +PY +} + +# fetch URL OUTFILE [TIMEOUT] - succeeds only on HTTP 2xx. +fetch() { + have curl || return 1 + code=$(curl -s -m "${3:-$PROBE_TIMEOUT}" -o "$2" -w '%{http_code}' -H @"$tmp/hdr" "$1" 2>/dev/null) || code=000 + case "$code" in 2*) return 0 ;; *) return 1 ;; esac +} + +# Strip vendor boilerplate so the same card reads the same everywhere. +norm_gpu() { + sed -e 's/([RT]M*)//g' -e 's/^ *Intel *//' -e 's/^ *NVIDIA *//' -e 's/^ *AMD *//' \ + -e 's/ Graphics *$//' -e 's/ */ /g' -e 's/^ //' -e 's/ $//' +} + +kv() { printf '%s=%s\n' "$1" "$(printf '%s' "${2:-unknown}" | tr '\n\r' ' ')"; } + +# ---------------------------------------------------------------- GPU +gpu_vendor=none gpu_model="" gpu_count=0 gpu_vram_gb="" gpu_driver="" gpu_power_limit_w="" +if have nvidia-smi && q=$(nvidia-smi --query-gpu=name,memory.total,driver_version,power.limit \ + --format=csv,noheader,nounits 2>/dev/null) && [ -n "$q" ]; then + gpu_vendor=nvidia + gpu_count=$(printf '%s\n' "$q" | grep -c .) + gpu_model=$(printf '%s\n' "$q" | cut -d, -f1 | norm_gpu | sort -u | paste -sd+ -) + first=$(printf '%s\n' "$q" | head -n1) + gpu_vram_gb=$(printf '%s' "$first" | cut -d, -f2 | awk '$1+0>0 {printf "%d", $1/1024+0.5}') + gpu_driver=$(printf '%s' "$first" | cut -d, -f3 | tr -d ' ') + gpu_power_limit_w=$(printf '%s' "$first" | cut -d, -f4 | awk '$1+0>0 {printf "%g", $1}') +elif have rocm-smi && rocm-smi --showproductname --json > "$tmp/rp" 2>/dev/null; then + gpu_vendor=amd + rocm-smi --showmeminfo vram --json > "$tmp/rm" 2>/dev/null + rocm-smi --showdriverversion --json > "$tmp/rd" 2>/dev/null + rocm-smi --showmaxpower --json > "$tmp/rw" 2>/dev/null + gpu_count=$(jget "$tmp/rp" 'len([k for k in j if k.startswith("card")])') + gpu_model=$(jget "$tmp/rp" '"+".join(sorted({v.get("Card Series") or v.get("Card series") or v.get("Card model", "") for k, v in j.items() if k.startswith("card")}))' | norm_gpu) + gpu_vram_gb=$(jget "$tmp/rm" 'round(int(next(v["VRAM Total Memory (B)"] for k, v in j.items() if k.startswith("card"))) / 2**30)') + gpu_driver=$(jget "$tmp/rd" 'j["system"]["Driver version"]') + gpu_power_limit_w=$(jget "$tmp/rw" '"%g" % float(next(v for k, v in next(c for n, c in j.items() if n.startswith("card")).items() if "Power" in k))') +elif have xpu-smi && xpu-smi discovery -j > "$tmp/xl" 2>/dev/null; then + gpu_vendor=intel + gpu_count=$(jget "$tmp/xl" 'len(j["device_list"])') + gpu_model=$(jget "$tmp/xl" '"+".join(sorted({d["device_name"] for d in j["device_list"]}))' | norm_gpu) + dev0=$(jget "$tmp/xl" 'j["device_list"][0]["device_id"]') + if [ -n "$dev0" ]; then + xpu-smi discovery -d "$dev0" -j > "$tmp/xd" 2>/dev/null + gpu_vram_gb=$(jget "$tmp/xd" 'round(int(j["memory_physical_size_byte"]) / 2**30)') + gpu_driver=$(jget "$tmp/xd" 'j["driver_version"]') + # Newer xpu-smi takes named metrics; the old numeric -m syntax is gone. + gpu_power_limit_w=$(xpu-smi dump --device "$dev0" --metrics power.limit --number 1 2>/dev/null \ + | awk -F', *' 'NR>1 && $3+0>0 {printf "%g", $3; exit}') + fi +fi +[ -n "$gpu_count" ] || gpu_count=unknown + +# ---------------------------------------------------------------- host +cpu_model=$(lscpu 2>/dev/null | sed -n 's/^Model name: *//p' | head -n1) +[ -n "$cpu_model" ] || cpu_model=$(sed -n 's/^model name[[:space:]]*: *//p' /proc/cpuinfo 2>/dev/null | head -n1) +ram_gb=$(awk '/^MemTotal:/ {printf "%d", $2/1048576+0.5}' /proc/meminfo 2>/dev/null) +os=$( (. /etc/os-release 2>/dev/null && printf '%s' "${PRETTY_NAME:-}") ) +[ -n "$os" ] || os=$(uname -s 2>/dev/null) +kernel=$(uname -r 2>/dev/null) + +# ---------------------------------------------------------------- engine +proxy=none engine=unknown engine_version="" model_file="" ctx="" engine_slots="" +if [ -n "$endpoint" ]; then + base=${endpoint%/}; base=${base%/v1} + prefix=$base + t1=$PROBE_TIMEOUT + if fetch "$base/running" "$tmp/running" && [ -n "$(jget "$tmp/running" '"running" in j and "y"')" ]; then + proxy=llama-swap + if [ -n "$model" ]; then + prefix="$base/upstream/$model" + export JARG="$model" + state=$(jget "$tmp/running" 'next((r.get("state") for r in j["running"] if r.get("model") == arg), "")') + if [ "$state" != ready ]; then + echo "collect-env: $model is not loaded; llama-swap loads it on this probe (up to ${LOAD_TIMEOUT}s)" >&2 + t1=$LOAD_TIMEOUT + fi + fi + fi + + if fetch "$prefix/props" "$tmp/props" "$t1" \ + && [ -n "$(jget "$tmp/props" '("build_info" in j or "default_generation_settings" in j) and "y"')" ]; then + engine=llama.cpp + engine_version=$(jget "$tmp/props" 'j.get("build_info")') + model_file=$(jget "$tmp/props" 'j.get("model_path")') + ctx=$(jget "$tmp/props" '(j.get("default_generation_settings") or {}).get("n_ctx") or j.get("n_ctx")') + engine_slots=$(jget "$tmp/props" 'j.get("total_slots")') + elif fetch "$prefix/version" "$tmp/version" "$t1" \ + && v=$(jget "$tmp/version" 'j.get("version")') && [ -n "$v" ]; then + engine_version=$v + if fetch "$prefix/v1/models" "$tmp/models"; then + export JARG="$model" + # Behind a proxy the served name differs from the routed id, so a single + # entry is taken as is. + pick='next((m for m in j["data"] if m.get("id") == arg), j["data"][0] if len(j["data"]) == 1 else {})' + [ "$(jget "$tmp/models" "($pick).get('owned_by')")" = vllm ] && engine=vllm + ctx=$(jget "$tmp/models" "($pick).get('max_model_len')") + model_file=$(jget "$tmp/models" "($pick).get('root')") + fi + fi + + # Behind llama-swap the launch command is known: keep it, and map a + # container path (-v HOST:/model) back to the host path. + if [ "$proxy" = llama-swap ] && [ -n "$model" ] && fetch "$base/running" "$tmp/running"; then + export JARG="$model" + jget "$tmp/running" 'next((r.get("cmd") for r in j["running"] if r.get("model") == arg), "")' > "$tmp/cmd" + if [ -s "$tmp/cmd" ]; then + [ -n "$cmd_out" ] && cp "$tmp/cmd" "$cmd_out" + if [ -n "$model_file" ] && have python3; then + host=$(python3 - "$tmp/cmd" "$model_file" <<'PY' 2>/dev/null +import re, sys +cmd, path = open(sys.argv[1]).read(), sys.argv[2] +for src, dst in re.findall(r'(?:-v|--volume)[ =](\S+?):(/[^\s:]*)', cmd): + if path == dst or path.startswith(dst.rstrip("/") + "/"): + print(src + path[len(dst):]); break +PY +) + [ -n "$host" ] && model_file=$host + fi + fi + fi +fi + +kv gpu_vendor "$gpu_vendor" +kv gpu_model "$gpu_model" +kv gpu_count "$gpu_count" +kv gpu_vram_gb "$gpu_vram_gb" +kv gpu_driver "$gpu_driver" +kv gpu_power_limit_w "$gpu_power_limit_w" +kv cpu_model "$cpu_model" +kv ram_gb "$ram_gb" +kv os "$os" +kv kernel "$kernel" +kv proxy "$proxy" +kv engine "$engine" +kv engine_version "$engine_version" +kv engine_slots "$engine_slots" +kv model_file "$model_file" +kv ctx "$ctx" +exit 0 diff --git a/config.json b/config.json new file mode 100644 index 0000000..76d5fc1 --- /dev/null +++ b/config.json @@ -0,0 +1,21 @@ +{ + "temperature": 0.7, + "top_p": 0.95, + "top_k": 20, + "greedy": false, + "warmup": 3, + "runs_per_category": 20, + "unique_nonce": true, + "run_concurrency": true, + "concurrency_levels": [1, 2, 4, 8], + "concurrency_requests": 48, + "weights": { + "code": 0.30, "reasoning": 0.20, "prose": 0.15, + "json": 0.15, "file_edit": 0.10, "summarization": 0.10 + }, + "conf": 0.95, + "target_mde_pct": 1.0, + "ab_max_pairs": 200, + "ab_min_pairs": 12, + "timeout_s": 600.0 +} diff --git a/models.md b/models.md new file mode 100644 index 0000000..d8a715b --- /dev/null +++ b/models.md @@ -0,0 +1,33 @@ +# Models + +**TBD by the group.** Fill in exact checkpoints; nobody benchmarks a file whose hash +doesn't match this table. + +| model | format | HF repo | file(s) | SHA256 | +|---|---|---|---|---| +| ~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) | + +Open: which quant(s) of Qwen3.8-27B are standard. + +## Verify + +Single file (GGUF): + +```sh +sha256sum /path/to/model.gguf +``` + +Directory (safetensors) - one hash over the per-file hashes, in name order: + +```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 +``` diff --git a/standard.env b/standard.env new file mode 100644 index 0000000..2824a81 --- /dev/null +++ b/standard.env @@ -0,0 +1,4 @@ +# Pins for this version of the group standard. Bump STANDARD_VERSION whenever +# config.json, the pinned BetterBench or the mandatory fields change. +STANDARD_VERSION=0.1.0 +BETTERBENCH_VERSION=0.6.1