okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-144-ruben (RubenTorney's #1904 --adapt-async in the arena and #1905 pin by need, as opt-ins) into f-144-relc7cbf787a

main
19.5 KiB326 linesraw
1"""Tests of the patched Strata engine (branch perf/async-adapt-arena) against the release and the unpatched local build.
2Every session is a fresh engine; it is stopped at the end.  Run in the foreground (<= 10 min per call).
3  smoke <variant>                    one short request with STRATA_DECODE_TIMING=1; prints the async/adapt/ERR log lines
4  ab <v1,v2,...> <round> <out.jsonl> 12 distinct cold prompts per session (one request each, fixed seeds)
5  det <variant> <n> <out.jsonl>      greedy (temp 0), 6 prompts, n fresh engines: answers' sha256 compared
6  stress <variant>                   63k prompt then 4 follow-up turns in the same conversation
7  report <out.jsonl> <ref>           paired per-prompt ratios of every variant against <ref>
8Local exe: env STRATA_DEV_EXE (default strata-dev\\build-vs22\\strata.exe)."""
9import copy
10import hashlib
11import json
12import os
13import re
14import statistics as st
15import subprocess
16import sys
17import time
18import urllib.request
19import uuid
20from pathlib import Path
21
22STRATA = Path(r"C:\Users\urben\Documents\strata")
23DEV_EXE = os.environ.get("STRATA_DEV_EXE", r"C:\Users\urben\Documents\strata-dev\build-vs22\strata.exe")
24CUDA128 = r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin"
25DEV = r"C:\Users\urben\Documents\strata-dev"
26# the install config now runs the patched engine: variants are built from the pre-patch (release) config
27BASE_CFG = json.loads((STRATA / "strata-iq3_s.json.before-async").read_text(encoding="utf-8"))
28# the morning's starting point (engine 0.1.38 config before any tuning) is not reproducible: 0.1.38 is gone
29FIXTURE_262K = r"C:\Users\urben\Documents\folk\bench\fixtures\out\262k.jsonl"
30SCRATCH = Path(__file__).parent
31PORT = 8080
32LOCAL = {"exe": DEV_EXE, "lib_dirs": [CUDA128]}
33ASYNC = {"--adapt-async": "1"}
34# name: (config overrides, args, env)
35VARS = {
36    # the morning's starting point: engine 0.1.38 (kept by setup in engine/.previous) with the config before any tuning
37    "base0138": ({"_base": "strata-iq3_s.json.before-optim", "exe": str(STRATA / "engine/.previous/strata.exe")}, {}, {}),
38    "rel": ({}, {}, {}),
39    "loc": (LOCAL, {}, {}),
40    "async": (LOCAL, ASYNC, {}),
41    "asyncb": (LOCAL, ASYNC, {"STRATA_ADAPT_BOUNCE": "1"}),
42    "asyncbp": (LOCAL, ASYNC, {"STRATA_ADAPT_BOUNCE": "1", "STRATA_PCIE_MIN1": "1"}),
43    "pmin1": (LOCAL, {}, {"STRATA_PCIE_MIN1": "1"}),
44    "async_b16": (LOCAL, ASYNC, {"STRATA_ADAPT_ASYNC_BATCH": "16"}),
45    "async_b80": (LOCAL, ASYNC, {"STRATA_ADAPT_ASYNC_BATCH": "80"}),
46    "async_nowait": (LOCAL, ASYNC, {"STRATA_ADAPT_ASYNC_WAIT": "0"}),
47    "stack2prof": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
48                   {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
49                    "STRATA_IQ3S_MT1": "1", "STRATA_VERIFY_PROFILE": "1", "STRATA_SPEC_DEPTH": "1"}),
50    "stack3": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
51               {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
52                "STRATA_IQ3S_MT1": "1", "STRATA_GR_V3": "1", "STRATA_EXPERT_V2": "1", "STRATA_QFUSE": "1", "STRATA_MMVF_ROWS": "1"}),
53    "r2all": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
54              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
55               "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ADAPT_ASYNC_DEMAND": "1", "STRATA_GR_128": "1"}),
56    "r2allprof": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
57              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
58               "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ADAPT_ASYNC_DEMAND": "1", "STRATA_GR_128": "1",
59               "STRATA_VERIFY_PROFILE": "1"}),
60    "r2p23": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
61              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
62               "STRATA_IQ3S_MT1": "1", "STRATA_ADAPT_ASYNC_DEMAND": "1", "STRATA_GR_128": "1"}),
63    "r2p23prof": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
64              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
65               "STRATA_IQ3S_MT1": "1", "STRATA_ADAPT_ASYNC_DEMAND": "1", "STRATA_GR_128": "1", "STRATA_VERIFY_PROFILE": "1"}),
66    "p3": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
67           {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
68            "STRATA_IQ3S_MT1": "1", "STRATA_GR_128": "1"}),
69    "p3b16": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
70              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
71               "STRATA_IQ3S_MT1": "1", "STRATA_GR_128": "1", "STRATA_ADAPT_ASYNC_BATCH": "16"}),
72    "p1": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
73           {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
74            "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ARENA_PIN_GIB": "29"}),
75    "p1pm": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
76             {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
77              "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ARENA_PIN_GIB": "29", "STRATA_PCIE_MIN1": "1"}),
78    "p1pf6": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head", "--pcie-frac": "0.6"},
79              {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
80               "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ARENA_PIN_GIB": "29"}),
81    "p1both": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head", "--pcie-frac": "0.6"},
82               {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
83                "STRATA_IQ3S_MT1": "1", "STRATA_PIN_BY_NEED": "1", "STRATA_ARENA_PIN_GIB": "29", "STRATA_PCIE_MIN1": "1"}),
84    # bit-exact mode (docs/MULTI_GPU.md): STRATA_IQ_MT_MIN=1 --pcie-frac 0 --adapt-every 0, the PRs' options OFF
85    "x_v0142": ({"exe": DEV + r"\bin-v0142\strata.exe", "lib_dirs": [CUDA128]},
86                {"--pcie-frac": "0", "--adapt-every": "0"}, {"STRATA_IQ_MT_MIN": "1"}),
87    "x_pr1": ({"exe": DEV + r"\bin-pr1\strata.exe", "lib_dirs": [CUDA128]},
88              {"--pcie-frac": "0", "--adapt-every": "0"}, {"STRATA_IQ_MT_MIN": "1"}),
89    "x_pr2": ({"exe": DEV + r"\bin-pr2\strata.exe", "lib_dirs": [CUDA128]},
90              {"--pcie-frac": "0", "--adapt-every": "0"}, {"STRATA_IQ_MT_MIN": "1"}),
91    # the PR builds, options off / on
92    "v0142": ({"exe": DEV + r"\bin-v0142\strata.exe", "lib_dirs": [CUDA128]}, {}, {}),
93    "pr1_on": ({"exe": DEV + r"\bin-pr1\strata.exe", "lib_dirs": [CUDA128]}, ASYNC, {}),
94    "pr2_on": ({"exe": DEV + r"\bin-pr2\strata.exe", "lib_dirs": [CUDA128]}, {"--pcie-frac": "0.6"},
95               {"STRATA_PIN_BY_NEED": "1", "STRATA_ARENA_PIN_GIB": "29", "STRATA_PCIE_MIN1": "1"}),
96    "stack1": (LOCAL, ASYNC, {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1"}),
97    "stack2": (LOCAL, {**ASYNC, "--pool-tasks": "36", "--lookup-chain": "2", "--mtp-q4": "head"},
98               {"STRATA_GDN_SPLIT": "1", "STRATA_DF_BRANCH": "1", "STRATA_TSUM": "1", "STRATA_ATTN_LANECELL": "1",
99                "STRATA_IQ3S_MT1": "1"}),
100}
101VARS_X = dict(VARS)
102for _n in ("v0142", "pr1", "pr2"):
103    _o, _a, _e = VARS_X["x_" + _n]
104    VARS["y_" + _n] = (_o, {**_a, "--expert-cache": "8000"}, _e)
105COLD = [
106    "Explique le fonctionnement d'une pompe à chaleur en 6 phrases.",
107    "Write a Python class implementing an LRU cache with O(1) get and put, with a short usage example.",
108    "Describe the main causes of the fall of the Western Roman Empire.",
109    "Donne une recette détaillée de ratatouille pour 4 personnes.",
110    "Explain how mRNA vaccines work, step by step.",
111    "Écris une fonction JavaScript qui fait un debounce d'une autre fonction, avec des commentaires en français.",
112    "Write a short project status email announcing a two-week delay and its reasons.",
113    "Présente les principales caractéristiques géographiques de l'île de La Réunion.",
114    "Explain the difference between permutations and combinations with three worked examples.",
115    "Write a SQL query that returns the top 3 customers by revenue per country, and explain it.",
116    "Résume la pensée de Descartes sur le doute méthodique.",
117    "Compare TCP and UDP and give two use cases for each.",
118]
119WARM = ["Bonjour, présente-toi en une phrase.", "Say hello in one short sentence."]
120LINE = re.compile(r"prompt (\d+) tokens = (\d+) reused \+ (\d+) read in (\d+) ms \(([\d.]+) tok/s\), (\d+) generated in "
121                  r"(\d+) ms \(([\d.]+) tok/s\)(?:, drafts accepted (\d+) of (\d+))?")
122NOTE = re.compile(r"adapt|async|ERR|error|residency|bounce|PCIE_MIN1|decode timing|K/V grown|hit rate|GPU stages|stage|profile|spec depth|lookup chain|suffix", re.I)
123
124
125def free_gb() -> float:
126    out = subprocess.run(["powershell", "-NoProfile", "-Command",
127                          "(Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory"], capture_output=True, text=True)
128    return int(out.stdout.strip() or 0) / 1024 / 1024
129
130
131def strata_running() -> bool:
132    return "strata.exe" in subprocess.run(["tasklist", "/FI", "IMAGENAME eq strata.exe"], capture_output=True, text=True).stdout
133
134
135class Server:
136    def __init__(self, name: str, variant: str, extra_env: dict | None = None):
137        over, args, env = VARS[variant]
138        over = dict(over)
139        base = over.pop("_base", None)
140        cfg = json.loads((STRATA / base).read_text(encoding="utf-8")) if base else copy.deepcopy(BASE_CFG)
141        cfg.update(copy.deepcopy(over))
142        a = cfg["args"]
143        for flag, val in args.items():
144            if flag in a:
145                a[a.index(flag) + 1] = val
146            else:
147                a += [flag, val]
148        cfg.setdefault("env", {}).update(env)
149        cfg["env"].update(extra_env or {})
150        self.name, self.log = name, SCRATCH / f"ab2_{name}.log"
151        self.log.write_bytes(b"")
152        cfg["log"] = str(self.log)
153        path = STRATA / "strata-ab.json"
154        path.write_text(json.dumps(cfg, indent=1), encoding="utf-8")
155        for _ in range(60):
156            if not strata_running() and free_gb() > 50:
157                break
158            time.sleep(2)
159        print(f"[{name}] start ({variant}), free RAM {free_gb():.1f} GB", flush=True)
160        self.proc = subprocess.Popen([str(STRATA / ".venv/Scripts/python.exe"), "serve/server.py", "--engine", "strata",
161                                      "--config", str(path), "--port", str(PORT)], cwd=STRATA,
162                                     stdout=open(SCRATCH / f"ab2_{name}.out", "wb"), stderr=subprocess.STDOUT)
163        t0 = time.time()
164        while True:
165            try:
166                urllib.request.urlopen(f"http://127.0.0.1:{PORT}/v1/models", timeout=5).read()
167                break
168            except Exception:
169                if self.proc.poll() is not None or time.time() - t0 > 300:
170                    self.stop()
171                    tail = (SCRATCH / f"ab2_{name}.out").read_bytes()[-1500:].decode("utf-8", "replace")
172                    raise SystemExit(f"{name}: server did not start\n{tail}")
173                time.sleep(3)
174        for i, p in enumerate(WARM):
175            self.ask([{"role": "user", "content": p}], seed=7 + i, max_tokens=48)
176
177    def ask(self, messages: list, temp=0.7, seed=None, max_tokens=256) -> dict:
178        req = {"model": "strata", "messages": messages, "max_tokens": max_tokens, "temperature": temp,
179               "top_p": 0.8 if temp else 1.0, "stream": False, "chat_template_kwargs": {"enable_thinking": False}}
180        if seed:
181            req["seed"] = seed
182        start = self.log.stat().st_size
183        r = urllib.request.Request(f"http://127.0.0.1:{PORT}/v1/chat/completions", json.dumps(req).encode(),
184                                   {"Content-Type": "application/json"})
185        big = sum(len(m["content"]) for m in messages) > 20_000
186        with urllib.request.urlopen(r, timeout=900 if big else 150) as resp:
187            body = json.loads(resp.read())
188        time.sleep(0.5)
189        text = body["choices"][0]["message"].get("content") or ""
190        row = dict(session=self.name, text=text, sha=hashlib.sha256(text.encode()).hexdigest()[:16], notes=[])
191        for line in self.log.read_bytes()[start:].decode("utf-8", "replace").splitlines():
192            m = LINE.search(line)
193            if m:
194                row.update(prompt_tokens=int(m[1]), prefill_tps=float(m[5]), gen=int(m[6]), decode_tps=float(m[8]),
195                           acc=int(m[9]) if m[9] else 0, drafted=int(m[10]) if m[10] else 0)
196            elif NOTE.search(line):
197                row["notes"].append(line.strip()[:400])
198        return row
199
200    def stop(self) -> None:
201        subprocess.run(["taskkill", "/T", "/F", "/PID", str(self.proc.pid)], capture_output=True)
202        subprocess.run(["taskkill", "/F", "/IM", "strata.exe"], capture_output=True)
203        for _ in range(60):
204            if not strata_running():
205                break
206            time.sleep(1)
207
208
209def startup_notes(srv: Server) -> list:
210    return [l.strip()[:300] for l in srv.log.read_bytes().decode("utf-8", "replace").splitlines()
211            if re.search(r"adapt-async|asynchronous|bounce|PCIE_MIN1|is off|ERR|error|pin by need|ranked pairs|strata hc|differs|128|demand|arena", l, re.I)]
212
213
214cmd = sys.argv[1]
215if cmd == "smoke":
216    v = sys.argv[2]
217    srv = Server(f"smoke_{v}", v, {"STRATA_DECODE_TIMING": "1"})
218    try:
219        for l in startup_notes(srv):
220            print("  start:", l)
221        for i in (0, 1, 4):
222            r = srv.ask([{"role": "user", "content": COLD[i]}], seed=3000 + i)
223            print(f"  prompt {i}: decode {r.get('decode_tps')} tok/s, gen {r.get('gen')}, drafts {r.get('acc')}/{r.get('drafted')}")
224            for n in r["notes"][-6:]:
225                print("     ", n)
226    finally:
227        srv.stop()
228elif cmd == "ab":
229    out = Path(sys.argv[4])
230    for v in sys.argv[2].split(","):
231        srv = Server(f"{v}_r{sys.argv[3]}", v)
232        try:
233            vals = []
234            for i, p in enumerate(COLD):
235                r = srv.ask([{"role": "user", "content": p}], seed=3000 + i)
236                r.update(variant=v, round=sys.argv[3], prompt_i=i)
237                r.pop("text")
238                with out.open("a", encoding="utf-8") as f:
239                    f.write(json.dumps(r, ensure_ascii=False) + "\n")
240                if "decode_tps" in r:
241                    vals.append(r["decode_tps"])
242            vals.sort()
243            print(f"{v:14s} round {sys.argv[3]}: median {vals[len(vals) // 2]:.1f} tok/s (min {vals[0]:.1f}, max {vals[-1]:.1f})",
244                  flush=True)
245            errs = [l for l in startup_notes(srv) if re.search(r"ERR|error", l)]
246            if errs:
247                print("   errors:", errs[:3])
248        finally:
249            srv.stop()
250elif cmd == "det":
251    v, n, out = sys.argv[2], int(sys.argv[3]), Path(sys.argv[4])
252    shas = []
253    for k in range(n):
254        srv = Server(f"det_{v}_{k}", v)
255        try:
256            run = [srv.ask([{"role": "user", "content": COLD[i]}], temp=0)["sha"] for i in range(6)]
257        finally:
258            srv.stop()
259        shas.append(run)
260        with out.open("a", encoding="utf-8") as f:
261            f.write(json.dumps({"variant": v, "engine": k, "shas": run}) + "\n")
262        print(f"det {v} engine {k}: {run}", flush=True)
263    same = sum(len({s[i] for s in shas}) == 1 for i in range(6))
264    print(f"det {v}: {same}/6 prompts identical across {n} fresh engines", flush=True)
265elif cmd == "stress":
266    v = sys.argv[2]
267    srv = Server(f"stress_{v}", v)
268    try:
269        fixture = json.loads(open(r"C:\Users\urben\Documents\folk\bench\fixtures\out\112k.jsonl", encoding="utf-8").readline())
270        msgs = [{"role": "user", "content": f"[run {uuid.uuid4().hex}]\n" + fixture["messages"][0]["content"][:260_000]
271                 + "\n\nIn 5 sentences: what does this code base do?"}]
272        follow = ["Which module is the most complex, and why?", "List three possible bugs you would look for first.",
273                  "Résume ta réponse précédente en français en 3 points.", "Write a short unit test for one of them."]
274        for turn in range(5):
275            r = srv.ask(msgs, max_tokens=256)
276            print(f"turn {turn}: prompt {r.get('prompt_tokens')} prefill {r.get('prefill_tps')} decode {r.get('decode_tps')} "
277                  f"gen {r.get('gen')} | {r['text'][:90]!r}", flush=True)
278            for n in r["notes"]:
279                if re.search(r"ERR|error|residency|K/V grown", n, re.I):
280                    print("     ", n)
281            if turn < 4:
282                msgs += [{"role": "assistant", "content": r["text"]}, {"role": "user", "content": follow[turn]}]
283    finally:
284        srv.stop()
285elif cmd == "ctx":
286    v, sizes, out = sys.argv[2], [int(x) for x in sys.argv[3].split(",")], Path(sys.argv[4])
287    # the 262k fixture is ~235k tokens with this tokenizer: the 240k fixture's text follows it for the largest sizes
288    text = "".join(json.loads(open(f, encoding="utf-8").readline())["messages"][0]["content"]
289                   for f in (FIXTURE_262K, FIXTURE_262K.replace("262k", "240k")))
290    srv = Server(f"ctx_{v}_{sizes[0]}", v)
291    try:
292        for k in sizes:
293            prompt = (f"[run {uuid.uuid4().hex}]\n" + text[: int(k * 1024 * 3.53)]
294                      + "\n\nIn 5 sentences: what does this code base do?")
295            # one prompt read, then three answers with fixed seeds (the same for every variant) on the cached prefix
296            reps = []
297            for rep, seed in enumerate((1001, 1002, 1003)):
298                t0 = time.time()
299                r = srv.ask([{"role": "user", "content": prompt}], max_tokens=256, seed=seed)
300                r.update(variant=v, size_k=k, rep=rep, wall_s=round(time.time() - t0, 1))
301                r.pop("text")
302                with out.open("a", encoding="utf-8") as f:
303                    f.write(json.dumps(r, ensure_ascii=False) + "\n")
304                reps.append(r)
305            r = reps[0]
306            pt, pf = r.get("prompt_tokens", 0), r.get("prefill_tps") or 1
307            dec = [x["decode_tps"] for x in reps if x.get("decode_tps")]
308            print(f"{v} {k}k: prompt {pt} tok, prefill {pf} tok/s ({pt / pf:.1f} s), decode "
309                  f"{' / '.join(f'{d:.1f}' for d in dec)} tok/s (mean {sum(dec) / max(1, len(dec)):.1f})", flush=True)
310    finally:
311        srv.stop()
312elif cmd == "report":
313    rows = [json.loads(l) for l in open(sys.argv[2], encoding="utf-8")]
314    ref = sys.argv[3]
315    d = {}
316    for r in rows:
317        if "decode_tps" in r:
318            d.setdefault(r["variant"], {}).setdefault(r["prompt_i"], []).append(r["decode_tps"])
319    base = {i: st.mean(v) for i, v in d.get(ref, {}).items()}
320    for v, per in sorted(d.items()):
321        means = {i: st.mean(x) for i, x in per.items()}
322        ratios = [means[i] / base[i] for i in means if i in base]
323        allv = sorted(x for xs in per.values() for x in xs)
324        print(f"{v:14s} median {allv[len(allv) // 2]:6.1f} tok/s (n={len(allv)}), vs {ref}: ratio median "
325              f"{st.median(ratios):.3f}, prompts faster {sum(x > 1 for x in ratios)}/{len(ratios)}")
326(STRATA / "strata-ab.json").unlink(missing_ok=True)