Skip to content

Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.

Add bench/quick.sh: a 3-minute speed check with a paste-ready report (#7)

0xaron60fbb2debbc3
diff --git a/.github/ISSUE_TEMPLATE/measurement.md b/.github/ISSUE_TEMPLATE/measurement.md
index 75461fc..c37d403 100644
--- a/.github/ISSUE_TEMPLATE/measurement.md
+++ b/.github/ISSUE_TEMPLATE/measurement.md
@@ -7,7 +7,8 @@ about: Share speed numbers from a CPU we have not measured
**Output of `./install.sh --check`**
-**What you ran and what it printed** (the bench script if you can; otherwise the commands and the numbers)
+**What you ran and what it printed.** Easiest: `./bench/quick.sh --plain` (about 5 minutes; stop a running `./serve`
+first on an 8 GB machine) and paste the block it prints. Otherwise the commands and the numbers.
```
```
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 44bf6f9..418219a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Shell scripts parse
- run: for f in install.sh serve start scripts/package.sh scripts/verify-dispatch.sh scripts/cross-aarch64.sh patches/apply.sh docker/entrypoint.sh bench/box.sh bench/jobs.sh; do bash -n "$f"; done
+ run: for f in install.sh serve start scripts/package.sh scripts/verify-dispatch.sh scripts/cross-aarch64.sh patches/apply.sh docker/entrypoint.sh bench/box.sh bench/jobs.sh bench/quick.sh; do bash -n "$f"; done
- name: Python compiles
run: python3 -m py_compile scripts/graft_mtp.py bench/*.py
- name: Files the README links to exist
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7531f0a..e67fbcb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@ All notable changes to openset-llm. Dates are YYYY-MM-DD.
## Unreleased
+- `bench/quick.sh`: a 3-minute speed check that prints a block to paste into a "Measurement on my machine" issue.
+
## 0.1.0 (2026-11-25)
First public release.
diff --git a/README.md b/README.md
index 3be2fb6..5974f07 100644
--- a/README.md
+++ b/README.md
@@ -407,7 +407,8 @@ publish (the recorded agent session, the broader prompt set, the earlier build):
## Contributing
Bug reports, measurements on other CPUs and patches are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). A report is
-most useful with the output of `./install.sh --check` and the line `./serve` prints at start. Security issues:
+most useful with the output of `./install.sh --check` and the line `./serve` prints at start. For speed on your CPU,
+`./bench/quick.sh --plain` prints a ready-to-paste block in about five minutes. Security issues:
[SECURITY.md](SECURITY.md). Changes per release: [CHANGELOG.md](CHANGELOG.md).
## Licence
diff --git a/bench/README.md b/bench/README.md
index 97e41c6..6e796d4 100644
--- a/bench/README.md
+++ b/bench/README.md
@@ -7,6 +7,10 @@ script that prints the tables. Raw logs are not in this repo.
You need one or more x86 Linux boxes with AVX-512 (we used cloud boxes: 8 vCPU / 8 GB Ice Lake VMs, and an 8 vCPU / 16 GB
AMD EPYC 9354P box), sudo or root, ~15 GB of free disk, and a few hours per box. Compare arms only within one box.
+**Just want a number from your own machine?** `./bench/quick.sh` (add `--plain` for plain decoding too): it starts its
+own server, runs 6 of the prompts below at 128 tokens and prints a block you can paste into an issue. A few minutes, no
+sudo, no rivals. The rest of this page is the full harness.
+
## Run it
1. **On each box, put this package at `~/release`** (a clean checkout of the commit you test; `bench/` is inside it).
diff --git a/bench/quick.sh b/bench/quick.sh
new file mode 100755
index 0000000..394742a
--- /dev/null
+++ b/bench/quick.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+# bench/quick.sh: a 3-minute speed check of this engine on your machine, printed as a block you can paste into a
+# "Measurement on my machine" issue. Not the benchmark behind the README (that is bench/box.sh + jobs.sh, hours per box).
+#
+# ./bench/quick.sh # default settings (what ./serve runs), 6 prompts x 128 tokens, greedy
+# ./bench/quick.sh --plain # also measure plain decoding (./serve --no-spec)
+# ./bench/quick.sh --prompts 12 --tokens 256 --port 8191 --threads N
+#
+# It starts its own server on a spare port, so stop a running ./serve first on an 8 GB machine (two do not fit).
+set -euo pipefail
+HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
+PORT=8191; NP=6; NTOK=128; PLAIN=0; THREADS=
+while [ $# -gt 0 ]; do case $1 in
+ --plain) PLAIN=1 ;; --prompts) NP=$2; shift ;; --tokens) NTOK=$2; shift ;; --port) PORT=$2; shift ;;
+ --threads) THREADS=$2; shift ;;
+ -h|--help) sed -n 2,9p "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ *) echo "unknown option: $1" >&2; exit 2 ;; esac; shift; done
+command -v python3 >/dev/null || { echo "python3 is needed" >&2; exit 1; }
+PREFIX=${OPENSET_LLM_HOME:-$HOME/.openset-llm}
+[ -x "$PREFIX/bin/llama-server" ] || { echo "not installed: run ./install.sh (or ./start) first" >&2; exit 1; }
+if curl -sf "http://127.0.0.1:$PORT/health" >/dev/null 2>&1; then echo "port $PORT is in use; pass --port" >&2; exit 1; fi
+LOG=$(mktemp); PID=
+stop() { [ -n "$PID" ] && kill "$PID" 2>/dev/null && wait "$PID" 2>/dev/null; PID=; return 0; }
+trap 'stop; rm -f "$LOG"' EXIT
+
+arm() { # arm <label> <serve args...>: one server, NP prompts, one result line on stdout
+ local label=$1; shift
+ bash "$HERE/serve" --port "$PORT" --no-webui ${THREADS:+--threads "$THREADS"} "$@" >"$LOG" 2>&1 &
+ PID=$!
+ for _ in $(seq 1 300); do
+ curl -sf "http://127.0.0.1:$PORT/health" >/dev/null 2>&1 && break
+ kill -0 "$PID" 2>/dev/null || { echo "the server stopped while loading:" >&2; tail -5 "$LOG" >&2; exit 1; }
+ sleep 1
+ done
+ LABEL=$label MODE=$(grep -m1 '^serving on' "$LOG" | sed 's/.*(\(.*\))/\1/') \
+ python3 - "$HERE/bench/prompts24.jsonl" "$PORT" "$NP" "$NTOK" <<'PY'
+import json, os, statistics as st, sys, urllib.request
+path, port, n, ntok = sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv[4])
+P = [json.loads(l) for l in open(path)]
+P = P[:: max(1, len(P) // n)][:n]
+dec, pp, dn, da = [], [], 0, 0
+for p in P:
+ body = {"messages": p["messages"], "max_tokens": ntok, "temperature": 0, "cache_prompt": False}
+ rq = urllib.request.Request(f"http://127.0.0.1:{port}/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"})
+ t = json.load(urllib.request.urlopen(rq, timeout=1800))["timings"]
+ dec.append(t["predicted_per_second"]); pp.append(t["prompt_per_second"])
+ dn += t.get("draft_n") or 0; da += t.get("draft_n_accepted") or 0
+ print(".", end="", file=sys.stderr, flush=True)
+print(file=sys.stderr)
+acc = f", {100 * da / dn:.0f} % of drafts accepted" if dn else ""
+print(f"| {os.environ['LABEL']} | {st.median(dec):.2f} [{min(dec):.2f}–{max(dec):.2f}] | {st.median(pp):.1f} | {os.environ['MODE']}{acc} |")
+PY
+ stop
+}
+
+cpu=$(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2 | sed 's/^ //')
+flags=" $(grep -m1 '^flags' /proc/cpuinfo | cut -d: -f2) "
+simd=; for f in avx2 avx512f avx512bw avx512_vnni avx512vbmi; do case "$flags" in *" $f "*) simd="$simd $f" ;; esac; done
+cores=$(lscpu 2>/dev/null | awk -F: '/^Core\(s\) per socket/ {c=$2} /^Socket\(s\)/ {s=$2} END {if (c && s) print c * s}')
+ram=$(awk '/^MemTotal:/ {printf "%.1f", $2 / 1048576}' /proc/meminfo)
+commit=$(git -C "$HERE" rev-parse --short HEAD 2>/dev/null || echo "no git checkout")
+echo "measuring: $NP prompts x $NTOK tokens per row (a few minutes)..." >&2
+rows=$(arm "./serve"); [ "$PLAIN" = 1 ] && rows="$rows
+$(arm "./serve --no-spec" --no-spec)"
+cat <<OUT
+
+**openset-llm quick check** (\`bench/quick.sh\`, commit $commit, $(date -u +%Y-%m-%d))
+
+- CPU: $cpu, ${cores:-?} cores / $(nproc) threads${THREADS:+ (run with --threads $THREADS)}
+- SIMD:${simd:- none of avx2 / avx512}
+- RAM: $ram GiB, $(uname -sr)
+
+| setting | decode tok/s, median [min–max] | prompt tok/s, median | server mode |
+|---|---|---|---|
+$rows
+
+$NP prompts x $NTOK tokens, greedy, one run. Speed depends on the text and on what else the machine is doing.
+OUT