Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
bench: community results for an RX 6800 on Windows (0.1.39 against 0.1.38) (#815)
did-technomancer0b65d593c38b
diff --git a/bench/results/2026-10-04-community-rx-6800-windows/README.md b/bench/results/2026-10-04-community-rx-6800-windows/README.mdnew file mode 100644index 000000000..8a9816364--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/README.md@@ -0,0 +1,212 @@+# Community benchmark: RX 6800 (Windows), 0.1.39 against 0.1.38++Measured on 2026-10-04 by [did-technomancer](https://github.com/did-technomancer).++```text+GPU AMD Radeon RX 6800 16 GB (gfx1030), also drives two monitors+PCIe engine probe 28.2 GB/s (pcie_frac 0.55)+CPU AMD Ryzen 7 5700X3D, 8 cores / 16 threads, AVX2, no AVX-512+RAM 64 GB DDR4-3200 (4x16)+Storage NVMe SSD (PCIe 3.0), not the system drive+OS Windows 11 Pro for Workstations 26H2 (build 26300), system-managed page file+Driver AMD 32.0.21043.10005+ROCm 10.2.0a20260930, hipBLASLt 1.5.0 (no tuning table for gfx1030)+Load no other workloads, no power limits+0.1.38 release strata-windows-x64-hip.zip (99f3dbd); the same commit built here gave the same numbers+0.1.39 tag v0.1.39 (6f32ec0) built here, tools\hip\build_windows.bat, STRATA_HIP_ARCHS=gfx1030+Model ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF @ ed59f92: IQ2_XS, IQ3_XXS, Q2_0+```++tok/s. A cell with several values lists separate runs, median in brackets. "0.1.39s" = 0.1.39 with `STRATA_SH_STREAM=0`.++**Versions, IQ2_XS**++| Engine | Runs | English | Ukrainian | Code | Prompt 7.9K | Prompt 30.3K |+| --- | ---: | --- | --- | --- | ---: | ---: |+| 0.1.38, release zip | 2 | 50.5 / 55.2 (52.9) | 40.8 / 42.3 (41.6) | 57.2 / 55.8 (56.5) | 319 / 326 | 309 / 310 |+| 0.1.38, built here | 1 | 54.2 | 41.7 | 56.6 | 319 | 310 |+| 0.1.39 | 2 | 42.6 / 42.5 (42.6) | 32.9 / 32.5 (32.7) | 49.2 / 50.2 (49.7) | 326 / 326 | 310 / 311 |+| 0.1.39 + `STRATA_SH_STREAM=0` | 4 | 56.4 / 57.0 / 55.5 / 54.2 (56.0) | 43.5 / 44.3 / 43.2 / 43.0 (43.4) | 62.7 / 62.9 / 60.5 / 61.5 (62.1) | 326 | 311 |++Expert cache 5,361-5,486 slots (7.2-7.4 GiB), 1,729-1,761 MiB of VRAM free with everything loaded.++Limitations:++- One PC; most configurations ran once (fewer than three); repeat runs differed by up to 9% (English), 4% (Ukrainian, code)+- The 0.1.39 release zip was not run+- Generated token counts per request were not saved; RAM was not measured+- Not tested: long prompts in `"parallel"` slots, the conversation cache, images, contexts above 128K on 0.1.39, IQ3_S++<details>+<summary>Configuration and method</summary>++```text+strata.exe --pack <data>\packs\iq2_xs+ --native <data>\models\IQ2_XS\Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf+ --ple-gguf <data>\models\IQ2_XS\Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf+ --expert-profile data\expert-profile.bin --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5+ --mtp <data>\mtp\rt --max-context 131072 --kv int8 --kv-resident 32768 --vision --vram-reserve-mib 2048+```++- Pack, MTP layer, expert profile and draft vocabularies: the bundled ones, as setup prepared them+- Low-RAM mode off; 7 pool workers; calibration and speed projection off; the CPU image encoder was loaded, not used+- [ab.py](ab.py): each arm restarts the server with one change; the expert cache as filled from the profile+- Requests: `/v1/chat/completions`, `reasoning_effort none`, `temperature 0`, every prompt starts with a random id+ (0 reused tokens)+- Decode: median of 3 English explanations (420-token cap), 2 Ukrainian (520), 1 Python module (700),+ `timings.predicted_per_second`+- Prompt: 7,858 and 30,348 tokens cut from `serve/server.py`, 40-token answer cap; "decode only" arms skip it+- Memory: expert cache slots and free VRAM from the engine's start-up log (a snapshot, not a peak); model loading is+ not in any timing+- [par.py](par.py): N streamed requests sent together, 300-token cap (246-287 generated); first token = the first+ non-empty answer delta, at the client++</details>++<details>+<summary>Versions, IQ3_XXS with `--draft-vocab cyrillic` (decode only, 1 run each)</summary>++| Engine | English | Ukrainian | Code | Expert cache slots |+| --- | ---: | ---: | ---: | ---: |+| 0.1.38, release zip | 42.2 | 45.7 | 42.8 | 3,895 |+| 0.1.39 + `STRATA_SH_STREAM=0` | 49.2 | 55.2 | 52.0 | 4,219 |++</details>++<details>+<summary>0.1.39 decode switches, turned off one at a time (IQ2_XS, decode only, 1 run each)</summary>++| Changed | English | Ukrainian | Code |+| --- | ---: | ---: | ---: |+| nothing | 42.5 | 32.5 | 50.2 |+| `STRATA_SH_STREAM=0` | 56.4 | 43.5 | 62.7 |+| `STRATA_IQ_STAGE_GRID=0` | 43.5 | 34.6 | 51.8 |+| `STRATA_PLE_BATCH=0` | 41.6 | 33.0 | 49.0 |+| `STRATA_OLD_IQ_MMVQ=1` | 43.3 | 32.5 | 47.9 |+| `STRATA_DEC_BATCH=0` | 40.0 | 31.8 | 45.4 |++</details>++<details>+<summary>Settings (1 run each; "—" is the same engine's base)</summary>++| Engine, model | Setting | English | Ukrainian | Code | Drafts accepted |+| --- | --- | ---: | ---: | ---: | ---: |+| 0.1.38, IQ2_XS | — (2 runs) | 50.5 / 55.2 | 40.8 / 42.3 | 57.2 / 55.8 | 63% / 65% |+| 0.1.38, IQ2_XS | `--draft-vocab cyrillic` | 56.6 | 61.4 | 57.3 | 75% |+| 0.1.38, IQ2_XS | `--pool-workers 11` | 50.6 | 40.1 | 57.6 | 62% |+| 0.1.38, IQ2_XS | `--pool-workers 15` | 37.7 | 28.6 | 39.1 | 63% |+| 0.1.39s, IQ2_XS | — | 57.0 | 44.3 | 62.9 | 63% |+| 0.1.39s, IQ2_XS | `--draft-vocab cyrillic` | 58.0 | 63.2 | 63.4 | 73% |+| 0.1.39s, IQ2_XS | `--spec 6` | 51.4 | 40.6 | 59.3 | 55% |+| 0.1.39s, IQ2_XS | `--spec-min-p 0.7` | 56.0 | 45.3 | 63.1 | 70% |+| 0.1.39s, IQ2_XS | `--pcie-frac 0` | 54.7 | 42.4 | 58.3 | 67% |+| 0.1.39s, IQ2_XS | `STRATA_ADAPT_NOWAIT=1` | 55.8 | 43.5 | 62.1 | 64% |+| 0.1.39s, IQ2_XS | `STRATA_RING_BYTES=0` | 58.2 | 43.3 | 61.6 | 63% |+| 0.1.39s, IQ3_XXS | — | 46.7 | 38.5 | 52.5 | 60% |+| 0.1.39s, IQ3_XXS | `--draft-vocab cyrillic` | 49.2 | 55.2 | 52.0 | 68% |+| 0.1.39s, IQ3_XXS | `STRATA_IQ256_GATHER=1` | 46.5 | 38.5 | 50.9 | 60% |++With the Cyrillic vocabulary 160-180 MiB more VRAM stayed free. `STRATA_RING_BYTES=0`: the 30.3K prompt read at+304 tok/s against 311.++</details>++<details>+<summary>Requests at once (0.1.39s, IQ2_XS, 1 round each)</summary>++| | Queue | `"parallel": 2` | `"parallel": 4` |+| --- | --- | --- | --- |+| 4 requests: all done in | 21.9 s | 23.5 s | 22.9 s |+| 4 requests: together | 46.6 tok/s | 46.0 tok/s | 46.6 tok/s |+| 4 requests: first token | 0.7 / 6.6 / 11.8 / 17.7 s | 0.8 / 1.6 / 12.3 / 13.6 s | 0.8 / 3.3 / 3.3 / 3.3 s |+| 2 requests: all done in | 11.9 s | 12.8 s | 13.3 s |+| 2 requests: first token | 0.8 / 7.0 s | 1.1 / 2.0 s | 1.0 / 1.9 s |+| 1 request: English / Ukrainian / code | 57.0 / 44.3 / 62.9 | 54.2 / 42.2 / 59.5 | 49.6 / 40.5 / 55.3 |+| 1 request: prompt 7.9K / 30.3K | 326 / 311 | 324 / 308 | 270 / 306 |+| Expert cache slots | 5,484 | 4,394 | 3,278 |++</details>++<details>+<summary>Model sizes (0.1.39s, default draft vocabulary; IQ2_XS 4 runs, the others 1)</summary>++| | Q2_0 | IQ2_XS | IQ3_XXS |+| --- | --- | --- | --- |+| English / Ukrainian / code | 55.8 / 45.1 / 65.6 | 54.2-57.0 / 43.0-44.3 / 60.5-62.9 | 46.7 / 38.5 / 52.5 |+| Prompt 7.9K / 30.3K | 336 / 321 | 326 / 311 | 324 / 309 |+| Expert cache slots | 5,656 (7.28 GiB) | 5,361-5,484 (7.2-7.4 GiB) | 4,218 (6.86 GiB) |++</details>++<details>+<summary>Context size (0.1.38, IQ2_XS, 2026-10-03)</summary>++| Context | VRAM reserve | Cache slots | Decode (3 runs) | Prompt 2.2K | Prompt 7.9K | Prompt 30.3K |+| --- | ---: | ---: | --- | ---: | ---: | ---: |+| 8K | 700 MiB | 6,288 | 52.8 / 59.7 / 61.0 | 206 | not measured | not measured |+| 128K | 2,048 MiB | 5,583 | 47.1 / 53.0 / 54.9 | 223 | 327 | 306 |+| 256K | 2,048 MiB | 4,791 | 45.5 / 53.0 / 55.0 | 203 | 325 | 302 |+| 512K (yarn, x2) | 2,048 MiB | 4,420 | 46.9 / 48.5 / 50.2 | 205 | 328 | 304 |++Long prompts (five "secret codes" at 10/30/50/70/90% of the length, 1 run, 0 reused tokens):++| Context | Prompt tokens | Read time | Read tok/s | Decode | Codes found |+| --- | ---: | ---: | ---: | ---: | ---: |+| 128K | 118,410 | 375 s | 316 | 36.2 | 5 of 5 |+| 256K | 249,365 | 825 s | 302 | 48.7 | 5 of 5 |+| 512K | 512,194 | 1,968 s | 260 | 33.0 | 5 of 5 |++Reused prefix (128K, a 64,885-token file): first question 198.1 s (328 tok/s), five follow-ups of 25-33 new tokens+0.3-0.5 s each.++No request failed or was cancelled.++</details>++<details>+<summary>Correctness tasks (0.1.39s, reasoning off, 1 run, `strata_eval2.py hard js sql regex`)</summary>++| Set | Task | Q2_0 | IQ2_XS | IQ3_XXS |+| --- | --- | --- | --- | --- |+| Python | topo_sort | ✓ 8.0 s | ✓ 9.2 s | ✓ 9.8 s |+| Python | wildcard_match | ✓ 5.7 s | ✓ 6.6 s | ✓ 7.0 s |+| Python | min_window | ✓ 3.7 s | ✓ 4.0 s | ✓ 5.5 s |+| Python | json_pointer | ✗ 8.8 s | ✓ 18.9 s | ✓ 22.9 s |+| Python | nqueens | ✓ 3.3 s | ✓ 3.6 s | ✓ 5.8 s |+| Python | semver_sort | ✓ 14.6 s | ✓ 7.4 s | ✓ 22.7 s |+| Python | edit_distance | ✓ 3.5 s | ✓ 2.7 s | ✓ 4.4 s |+| Python | gather_limited | ✓ 3.9 s | ✓ 4.9 s | ✓ 6.2 s |+| Python | trie | ✓ 6.1 s | ✓ 6.7 s | ✓ 9.4 s |+| Python | bowling | ✗ 5.8 s | ✓ 5.8 s | ✓ 7.3 s |+| Python | palindrome | ✓ 3.0 s | ✓ 3.2 s | ✓ 4.8 s |+| Python | normpath | ✓ 6.7 s | ✓ 19.4 s | ✓ 11.0 s |+| JavaScript | groupBy | ✓ | ✓ | ✓ |+| JavaScript | deepEqual | ✗ | ✗ | ✓ |+| JavaScript | parseQuery | ✓ | ✓ | ✓ |+| JavaScript | chunk | ✓ | ✓ | ✓ |+| SQL | customers without orders | ✓ | ✓ | ✓ |+| SQL | the two customers with the highest total | ✓ | ✓ | ✓ |+| SQL | order total per customer | ✓ | ✓ | ✓ |+| regex | IPv4 | ✗ | ✗ | ✓ |+| regex | CSS color `#rrggbb` | ✓ | ✓ | ✓ |+| regex | date YYYY-MM-DD | ✗ | ✓ | ✓ |+| **Total** | | **17 of 22** | **20 of 22** | **22 of 22** |++</details>++<details>+<summary>Files</summary>++- [ab.py](ab.py): the arms+- [ab.jsonl](ab.jsonl): every arm's numbers; fields `arm`, `en` / `uk` / `code` (tok/s of each request),+ `read8k` / `read30k` (prompt tok/s), `expert_slots`, `cache_gib`, `vram_free_mib`, `draft_accept`; the last row+ (IQ3_XXS on 0.1.38) also `model` and `vocab`+- [run_all.py](run_all.py): the helpers `ab.py` imports, and the 2026-10-03 context-size runs+- `run_all.json`, `run_all-part1.json`, `run_all.log`: the context-size data+- [par.py](par.py): requests at once+- [par.jsonl](par.jsonl): per request `first_s`, `done_s`, `tok_s`, `out_n`+- [strata_eval.py](strata_eval.py), [strata_eval2.py](strata_eval2.py): the correctness tasks+- [correctness.json](correctness.json): the task results per size++</details>diff --git a/bench/results/2026-10-04-community-rx-6800-windows/TRIMMED.md b/bench/results/2026-10-04-community-rx-6800-windows/TRIMMED.mdnew file mode 100644index 000000000..5479ea281--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/TRIMMED.md@@ -0,0 +1,12 @@+# Trimmed files++Ported from PR #815 for 0.1.40.2. Raw dumps, logs and binaries were left out to keep the repository small;+the README, summaries, configs and per-run results are unchanged. The files below were in the original PR.++3 files, 0.0 MB:++| file | bytes | why |+|---|---:|---|+| `ab.jsonl` | 7,400 | log/raw dump |+| `par.jsonl` | 2,453 | log/raw dump |+| `run_all.log` | 4,911 | log/raw dump |diff --git a/bench/results/2026-10-04-community-rx-6800-windows/ab.py b/bench/results/2026-10-04-community-rx-6800-windows/ab.pynew file mode 100644index 000000000..6a7da0746--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/ab.py@@ -0,0 +1,215 @@+"""bench-local/ab.py - short A/B arms against the installed IQ2_XS model: one setting changed per arm, the server+restarted for each, the same fixed requests, results appended to ab.jsonl.++ python ab.py base workers15 base cyr ... (arm names from ARMS, run in the order given)+ python ab.py --quick v139 v139-stage0 ... (decode only, without the prompt reads)+"""+from __future__ import annotations++import json+import os+import shutil+import statistics+import subprocess+import sys+import time+import uuid+from pathlib import Path++sys.path.insert(0, str(Path(__file__).parent))+import run_all as R # noqa: E402++HERE = Path(__file__).parent+ROOT = HERE.parent+BASE_CFG = HERE / "base-iq2_xs.json" # the configuration every arm starts from+RT = Path(r"D:\Strata-data\mtp\rt")+BUILD = Path(r"D:\Strata-build")++EN = ["Explain in detail how a hash map works: hashing, collisions, resizing, complexity. About 300 words.",+ "Describe how TCP establishes and closes a connection, and what each flag means. About 300 words.",+ "Compare processes and threads: memory, scheduling, communication, failure isolation. About 300 words."]+UK = ["Поясни докладно, як працює хеш-таблиця: хешування, колізії, розширення, складність. Приблизно 300 слів.",+ "Опиши, як TCP встановлює і закриває з'єднання і що означає кожен прапорець. Приблизно 300 слів."]+CODE = ["Write a complete Python module implementing an LRU cache class with get/put, a TTL option, type hints, "+ "docstrings and a small unittest suite. Code only."]+++def set_arg(args, flag, value):+ args = list(args)+ if flag in args:+ args[args.index(flag) + 1] = value+ else:+ args += [flag, value]+ return args+++def local_engine(name):+ """exe + library folders of a local build (D:\\Strata-build\\dist-<name>, unpacked from its zip)."""+ d = BUILD / f"dist-{name}" / "engine"+ return {"exe": str(d / "strata.exe"), "lib_dirs": [str(d / "rocm" / "bin")]}+++QUICK = "--quick" in sys.argv # decode only: no 8K / 30K prompt reads (an arm in ~2 min instead of ~4)+QSETS = ("hard", "js", "sql", "regex") # strata_eval2.py's suites an arm with "quality" runs+V139 = {"engine": "139", "root": "src-139"}+++def v139s(env=None, **more):+ """A 0.1.39 arm with STRATA_SH_STREAM=0, plus this arm's own environment and settings."""+ return {**V139, **more, "env": {"STRATA_SH_STREAM": "0", **(env or {})}}++ARMS = {+ "base": {},+ "workers11": {"args": {"--pool-workers": "11"}},+ "workers15": {"args": {"--pool-workers": "15"}},+ "cyr": {"draft_vocab": "draft_vocab_cyrillic.bin"},+ "en": {"draft_vocab": "draft_vocab_en.bin"},+ "prefill16k": {"args": {"--prefill": "auto:16384"}},+ # MMQ is already on by default (prefill.cpp mmq_plan), so the A/B is turning it off: the FP16 expert path.+ # STRATA_PF_FUSED=1 is not an arm: on HIP the fused kernels fall back to MMQ (moe_fused.hpp).+ "mmq0": {"env": {"STRATA_PREFILL_MMQ": "0"}},+ "ring96": {"env": {"STRATA_PREFILL_RING": "96"}},+ "pcie30": {"args": {"--pcie-frac": "0.3"}},+ "pcie80": {"args": {"--pcie-frac": "0.8"}},+ "spec3": {"args": {"--spec": "3"}},+ "spec5": {"args": {"--spec": "5"}},+ "minp30": {"args": {"--spec-min-p": "0.3"}},+ "minp70": {"args": {"--spec-min-p": "0.7"}},+ # local builds+ "build-base": {"engine": "base"},+ "build-prs": {"engine": "prs"},+ "prs-pipeline": {"engine": "prs", "env": {"STRATA_POOL_PIPELINE": "1"}},+ "prs-kvprefetch": {"engine": "prs", "env": {"STRATA_KV_PREFETCH": "1"}},+ "prs-hcq8": {"engine": "prs", "env": {"STRATA_HC_Q8": "1"}},+ "prs-16k": {"engine": "prs", "args": {"--prefill": "auto:16384"}},+ "prs-all": {"engine": "prs", "args": {"--prefill": "auto:16384"},+ "env": {"STRATA_POOL_PIPELINE": "1", "STRATA_KV_PREFETCH": "1", "STRATA_HC_Q8": "1"}},+ # 0.1.39 (released 2026-10-04): its engine built here for gfx1030 and its own server, from D:\Strata-build\src-139+ "v139": {**V139},+ # 0.1.39 decodes slower than 0.1.38 here: its new decode steps turned off one at a time (each is default on)+ "v139-stage0": {**V139, "env": {"STRATA_IQ_STAGE_GRID": "0"}}, # i-quant grids not staged in shared memory+ "v139-decbatch0": {**V139, "env": {"STRATA_DEC_BATCH": "0"}}, # the window's rows token by token+ "v139-plebatch0": {**V139, "env": {"STRATA_PLE_BATCH": "0"}}, # the PLE block token by token+ "v139-shstream0": {**V139, "env": {"STRATA_SH_STREAM": "0"}},+ "v139-oldmmvq": {**V139, "env": {"STRATA_OLD_IQ_MMVQ": "1"}}, # the per-column i-quant kernels+ # v139s = 0.1.39 with STRATA_SH_STREAM=0 (the shared expert on the window's own stream): measured here+ # 56.4 / 43.5 / 62.7 tok/s (en / uk / code) against 42.5 / 32.5 / 50.2 with the forked stream. The arms below+ # change one more thing each.+ "v139s": v139s(),+ "v139s-queue": v139s(par=[2, 4]), # one at a time: the others wait in the queue+ "v139s-par2": v139s(cfg={"parallel": 2}, par=[1, 2, 4]), # what 2 batch slots cost a request alone+ "v139s-par4": v139s(cfg={"parallel": 4}, par=[1, 2, 4]),+ "v139s-cyr": v139s(draft_vocab="draft_vocab_cyrillic.bin"),+ "v139s-ring0": v139s({"STRATA_RING_BYTES": "0"}), # 0.1.38's prompt ring (#583 off)+ "v139s-stage0": v139s({"STRATA_IQ_STAGE_GRID": "0"}),+ "v139s-nowait": v139s({"STRATA_ADAPT_NOWAIT": "1"}),+ "v139s-spec6": v139s(args={"--spec": "6"}), # issue #775's settings, one at a time+ "v139s-minp70": v139s(args={"--spec-min-p": "0.7"}),+ "v139s-pcie0": v139s(args={"--pcie-frac": "0.0"}),+ # the model sizes side by side on the same engine: speed, and the correctness suites with reasoning off+ "v139s-qual": v139s(quick=True, quality=True), # IQ2_XS, the installed size+ "v139s-q20": v139s(model="q2_0", quality=True),+ "v139s-iq3xxs": v139s(model="iq3_xxs", quality=True),+ # IQ3_XXS: 0.1.39's opt-in AVX2 gather for the IQ3 grids on the CPU (#622, bit-exact), and the Cyrillic drafts+ "v139s-iq3xxs-g": v139s({"STRATA_IQ256_GATHER": "1"}, model="iq3_xxs"),+ "v139s-iq3xxs-cyr": v139s(model="iq3_xxs", draft_vocab="draft_vocab_cyrillic.bin"),+}+++def start(arm):+ spec = ARMS[arm]+ # another model size: its own config as setup wrote it (strata-<model>.json), with this script's one engine log+ base = ROOT / f"strata-{spec['model']}.json" if spec.get("model") else BASE_CFG+ cfg = json.loads(base.read_text(encoding="utf-8"))+ cfg["log"] = str(ROOT / "strata-iq2_xs.log")+ for flag, value in spec.get("args", {}).items():+ cfg["args"] = set_arg(cfg["args"], flag, value)+ if spec.get("env"):+ cfg["env"] = {**(cfg.get("env") or {}), **spec["env"]}+ if spec.get("engine"):+ cfg.update(local_engine(spec["engine"]))+ cfg.update(spec.get("cfg", {}))+ root = BUILD / spec["root"] if spec.get("root") else ROOT # the checkout whose server and data/ the arm runs+ if root != ROOT:+ cfg["cwd"] = str(root)+ cfg["args"] = set_arg(cfg["args"], "--expert-profile", str(root / "data" / "expert-profile.bin"))+ R.stop_server()+ vocab = spec.get("draft_vocab", "draft_vocab.bin") # the default subset unless the arm names another+ shutil.copyfile(root / "data" / vocab, RT / "draft_vocab.bin")+ R.CFG.write_text(json.dumps(cfg, indent=1), encoding="utf-8")+ return R.start_server() if root == ROOT else start_server(root)+++def start_server(root):+ """R.start_server with another checkout's server (a newer version's worktree); the same wait for /health."""+ out = open(ROOT / "server.out", "w")+ err = open(ROOT / "server.err", "w")+ proc = subprocess.Popen([R.PY, "serve/server.py", "--engine", "strata", "--config", str(R.CFG), "--port", "8080"],+ cwd=root, stdout=out, stderr=err, creationflags=subprocess.CREATE_NO_WINDOW)+ t = time.time()+ while time.time() - t < 1200:+ if R.health().get("loaded"):+ return round(time.time() - t)+ if proc.poll() is not None:+ return None+ time.sleep(3)+ return None+++def measure(arm):+ rec = {"arm": arm, "time": time.strftime("%H:%M:%S")}+ for name, prompts, mt in (("en", EN, 420), ("uk", UK, 520), ("code", CODE, 700)):+ runs = [R.ask(f"[{uuid.uuid4().hex[:8]}] " + p, mt) for p in prompts]+ rec[name] = [r.get("tok_s") for r in runs]+ src = (ROOT / "serve" / "server.py").read_text(encoding="utf-8")+ rec.update({"read8k": None, "read30k": None})+ for name, kb in () if QUICK or ARMS[arm].get("quick") else (("read8k", 30), ("read30k", 125)):+ r = R.ask(f"Run {uuid.uuid4().hex}.\n\n" + src[:kb * 1000] + "\n\nIn one sentence: what is this code?", 40)+ rec[name] = r.get("prompt_tok_s")+ rec[name + "_err"] = r.get("error")+ rec.update(R.engine_facts())+ log = (ROOT / "strata-iq2_xs.log").read_text(encoding="utf-8", errors="replace")[-60000:]+ acc = [(int(a), int(b)) for a, b in __import__("re").findall(r"drafts accepted (\d+) of (\d+)", log)][-8:]+ rec["draft_accept"] = round(sum(a for a, _ in acc) / max(1, sum(b for _, b in acc)), 3)+ return rec+++def main():+ if not BASE_CFG.exists():+ shutil.copyfile(R.CFG, BASE_CFG)+ for arm in [a for a in sys.argv[1:] if not a.startswith("--")]:+ secs = start(arm)+ if secs is None:+ rec = {"arm": arm, "failed_to_start": True}+ tail = (ROOT / "server.err").read_text(encoding="utf-8", errors="replace")[-400:]+ print(f"AB {arm}: FAILED TO START | {tail.splitlines()[-1] if tail.strip() else ''}", flush=True)+ else:+ rec = measure(arm)+ med = lambda v: round(statistics.median([x for x in v if x]), 1) if any(v) else None # noqa: E731+ print(f"AB {arm}: en {med(rec['en'])} uk {med(rec['uk'])} code {med(rec['code'])} tok/s | read 8K "+ f"{rec['read8k']} 30K {rec['read30k']} tok/s | slots {rec.get('expert_slots')} free "+ f"{rec.get('vram_free_mib')} MiB | drafts {rec['draft_accept']}", flush=True)+ if ARMS[arm].get("par"): # several requests at once against this arm's server: par.py's PAR lines+ subprocess.run([R.PY, str(HERE / "par.py"), *map(str, ARMS[arm]["par"])], cwd=HERE)+ if ARMS[arm].get("quality"): # the small correctness suites (strata_eval2.py), reasoning off+ res = f"results2-{arm}.json"+ with (HERE / f"eval2-{arm}.log").open("w", encoding="utf-8") as out:+ subprocess.run([R.PY, str(HERE / "strata_eval2.py"), "hard", "js", "sql", "regex"], cwd=HERE,+ stdout=out, stderr=subprocess.STDOUT,+ env={**os.environ, "EFFORTS": "none", "RESULTS2": res, "PYTHONIOENCODING": "utf-8"})+ q = json.loads((HERE / res).read_text(encoding="utf-8"))+ failed = [x.get("task") or x.get("q") or x.get("what") for k in QSETS for x in q[k] if not x.get("pass")]+ secs = [x["wall"] for x in q["hard"] if x.get("wall")]+ print(f"QUAL {arm}: " + ", ".join(f"{k} {sum(1 for x in q[k] if x.get('pass'))}/{len(q[k])}"+ for k in QSETS) ++ f" | hard tasks {min(secs, default=0)}-{max(secs, default=0)} s | failed: {failed}", flush=True)+ with (HERE / "ab.jsonl").open("a", encoding="utf-8") as f:+ f.write(json.dumps(rec, ensure_ascii=False) + "\n")+ if "--no-restore" in sys.argv: # another ab.py run follows at once+ return+ start("base") # leave the default configuration running+ print("AB done; base configuration restored", flush=True)+++if __name__ == "__main__":+ main()diff --git a/bench/results/2026-10-04-community-rx-6800-windows/correctness.json b/bench/results/2026-10-04-community-rx-6800-windows/correctness.jsonnew file mode 100644index 000000000..3e6a8925a--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/correctness.json@@ -0,0 +1,650 @@+{+ "Q2_0": {+ "hard": [+ {+ "task": "topo_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 8.0,+ "out_tokens": 372,+ "tok_s": 60.0,+ "finish": "stop"+ },+ {+ "task": "wildcard_match",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 5.7,+ "out_tokens": 336,+ "tok_s": 69.9,+ "finish": "stop"+ },+ {+ "task": "min_window",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.7,+ "out_tokens": 205,+ "tok_s": 71.6,+ "finish": "stop"+ },+ {+ "task": "json_pointer",+ "effort": "none",+ "pass": false,+ "err": "timeout",+ "wall": 8.8,+ "out_tokens": 460,+ "tok_s": 68.2,+ "finish": "stop"+ },+ {+ "task": "nqueens",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.3,+ "out_tokens": 188,+ "tok_s": 77.1,+ "finish": "stop"+ },+ {+ "task": "semver_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 14.6,+ "out_tokens": 928,+ "tok_s": 68.2,+ "finish": "stop"+ },+ {+ "task": "edit_distance",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.5,+ "out_tokens": 203,+ "tok_s": 72.4,+ "finish": "stop"+ },+ {+ "task": "gather_limited",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.9,+ "out_tokens": 137,+ "tok_s": 64.6,+ "finish": "stop"+ },+ {+ "task": "trie",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 6.1,+ "out_tokens": 319,+ "tok_s": 74.8,+ "finish": "stop"+ },+ {+ "task": "bowling",+ "effort": "none",+ "pass": false,+ "err": "AssertionError",+ "wall": 5.8,+ "out_tokens": 340,+ "tok_s": 69.0,+ "finish": "stop"+ },+ {+ "task": "palindrome",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.0,+ "out_tokens": 158,+ "tok_s": 70.4,+ "finish": "stop"+ },+ {+ "task": "normpath",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 6.7,+ "out_tokens": 333,+ "tok_s": 69.5,+ "finish": "stop"+ }+ ],+ "js": [+ {+ "task": "groupBy",+ "pass": true,+ "err": "",+ "wall": 1.9+ },+ {+ "task": "deepEqual",+ "pass": false,+ "err": "node:internal/assert/utils:77",+ "wall": 5.1+ },+ {+ "task": "parseQuery",+ "pass": true,+ "err": "",+ "wall": 5.2+ },+ {+ "task": "chunk",+ "pass": true,+ "err": "",+ "wall": 2.9+ }+ ],+ "sql": [+ {+ "q": "Names of customers who have no orders, sorted by name. One c",+ "pass": true,+ "got": [+ [+ "Dee"+ ]+ ],+ "err": ""+ },+ {+ "q": "The two customers with the highest total order amount: name ",+ "pass": true,+ "got": [+ [+ "Bob",+ 200.0+ ],+ [+ "Ann",+ 120.0+ ]+ ],+ "err": ""+ },+ {+ "q": "For each customer who has orders: name and the amount of the",+ "pass": true,+ "got": [+ [+ "Ann",+ 70.0+ ],+ [+ "Bob",+ 200.0+ ],+ [+ "Cid",+ 20.0+ ]+ ],+ "err": ""+ }+ ],+ "regex": [+ {+ "what": "an IPv4 address in dotted decimal, each ",+ "pass": false,+ "pattern": "```\n(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}\n```"+ },+ {+ "what": "a CSS hex color: '#' followed by exactly",+ "pass": true,+ "pattern": "#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})"+ },+ {+ "what": "a date YYYY-MM-DD with month 01-12 and d",+ "pass": false,+ "pattern": "```\n\\d{4}-0[1-9]|1[0-2]-0[1-9]|[12]\\d|3[01]\n```"+ }+ ],+ "agent": [],+ "qa": [],+ "longgen": []+ },+ "IQ2_XS": {+ "hard": [+ {+ "task": "topo_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 9.2,+ "out_tokens": 361,+ "tok_s": 54.8,+ "finish": "stop"+ },+ {+ "task": "wildcard_match",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 6.6,+ "out_tokens": 392,+ "tok_s": 69.2,+ "finish": "stop"+ },+ {+ "task": "min_window",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 4.0,+ "out_tokens": 215,+ "tok_s": 68.8,+ "finish": "stop"+ },+ {+ "task": "json_pointer",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 18.9,+ "out_tokens": 974,+ "tok_s": 58.9,+ "finish": "stop"+ },+ {+ "task": "nqueens",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.6,+ "out_tokens": 175,+ "tok_s": 66.5,+ "finish": "stop"+ },+ {+ "task": "semver_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 7.4,+ "out_tokens": 444,+ "tok_s": 69.2,+ "finish": "stop"+ },+ {+ "task": "edit_distance",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 2.7,+ "out_tokens": 146,+ "tok_s": 71.9,+ "finish": "stop"+ },+ {+ "task": "gather_limited",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 4.9,+ "out_tokens": 191,+ "tok_s": 68.6,+ "finish": "stop"+ },+ {+ "task": "trie",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 6.7,+ "out_tokens": 322,+ "tok_s": 70.1,+ "finish": "stop"+ },+ {+ "task": "bowling",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 5.8,+ "out_tokens": 323,+ "tok_s": 65.8,+ "finish": "stop"+ },+ {+ "task": "palindrome",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 3.2,+ "out_tokens": 173,+ "tok_s": 69.3,+ "finish": "stop"+ },+ {+ "task": "normpath",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 19.4,+ "out_tokens": 1013,+ "tok_s": 58.8,+ "finish": "stop"+ }+ ],+ "js": [+ {+ "task": "groupBy",+ "pass": true,+ "err": "",+ "wall": 2.2+ },+ {+ "task": "deepEqual",+ "pass": false,+ "err": "node:internal/assert/utils:77",+ "wall": 5.6+ },+ {+ "task": "parseQuery",+ "pass": true,+ "err": "",+ "wall": 5.2+ },+ {+ "task": "chunk",+ "pass": true,+ "err": "",+ "wall": 3.2+ }+ ],+ "sql": [+ {+ "q": "Names of customers who have no orders, sorted by name. One c",+ "pass": true,+ "got": [+ [+ "Dee"+ ]+ ],+ "err": ""+ },+ {+ "q": "The two customers with the highest total order amount: name ",+ "pass": true,+ "got": [+ [+ "Bob",+ 200.0+ ],+ [+ "Ann",+ 120.0+ ]+ ],+ "err": ""+ },+ {+ "q": "For each customer who has orders: name and the amount of the",+ "pass": true,+ "got": [+ [+ "Ann",+ 70.0+ ],+ [+ "Bob",+ 200.0+ ],+ [+ "Cid",+ 20.0+ ]+ ],+ "err": ""+ }+ ],+ "regex": [+ {+ "what": "an IPv4 address in dotted decimal, each ",+ "pass": false,+ "pattern": "(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"+ },+ {+ "what": "a CSS hex color: '#' followed by exactly",+ "pass": true,+ "pattern": "#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6}"+ },+ {+ "what": "a date YYYY-MM-DD with month 01-12 and d",+ "pass": true,+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"+ }+ ],+ "agent": [],+ "qa": [],+ "longgen": []+ },+ "IQ3_XXS": {+ "hard": [+ {+ "task": "topo_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 9.8,+ "out_tokens": 371,+ "tok_s": 48.6,+ "finish": "stop"+ },+ {+ "task": "wildcard_match",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 7.0,+ "out_tokens": 342,+ "tok_s": 57.6,+ "finish": "stop"+ },+ {+ "task": "min_window",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 5.5,+ "out_tokens": 282,+ "tok_s": 62.2,+ "finish": "stop"+ },+ {+ "task": "json_pointer",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 22.9,+ "out_tokens": 1080,+ "tok_s": 52.9,+ "finish": "stop"+ },+ {+ "task": "nqueens",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 5.8,+ "out_tokens": 274,+ "tok_s": 57.5,+ "finish": "stop"+ },+ {+ "task": "semver_sort",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 22.7,+ "out_tokens": 1182,+ "tok_s": 54.9,+ "finish": "stop"+ },+ {+ "task": "edit_distance",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 4.4,+ "out_tokens": 203,+ "tok_s": 57.4,+ "finish": "stop"+ },+ {+ "task": "gather_limited",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 6.2,+ "out_tokens": 213,+ "tok_s": 52.9,+ "finish": "stop"+ },+ {+ "task": "trie",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 9.4,+ "out_tokens": 445,+ "tok_s": 61.3,+ "finish": "stop"+ },+ {+ "task": "bowling",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 7.3,+ "out_tokens": 368,+ "tok_s": 59.5,+ "finish": "stop"+ },+ {+ "task": "palindrome",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 4.8,+ "out_tokens": 227,+ "tok_s": 58.1,+ "finish": "stop"+ },+ {+ "task": "normpath",+ "effort": "none",+ "pass": true,+ "err": "",+ "wall": 11.0,+ "out_tokens": 469,+ "tok_s": 53.8,+ "finish": "stop"+ }+ ],+ "js": [+ {+ "task": "groupBy",+ "pass": true,+ "err": "",+ "wall": 2.4+ },+ {+ "task": "deepEqual",+ "pass": true,+ "err": "",+ "wall": 9.0+ },+ {+ "task": "parseQuery",+ "pass": true,+ "err": "",+ "wall": 7.2+ },+ {+ "task": "chunk",+ "pass": true,+ "err": "",+ "wall": 3.5+ }+ ],+ "sql": [+ {+ "q": "Names of customers who have no orders, sorted by name. One c",+ "pass": true,+ "got": [+ [+ "Dee"+ ]+ ],+ "err": ""+ },+ {+ "q": "The two customers with the highest total order amount: name ",+ "pass": true,+ "got": [+ [+ "Bob",+ 200.0+ ],+ [+ "Ann",+ 120.0+ ]+ ],+ "err": ""+ },+ {+ "q": "For each customer who has orders: name and the amount of the",+ "pass": true,+ "got": [+ [+ "Ann",+ 70.0+ ],+ [+ "Bob",+ 200.0+ ],+ [+ "Cid",+ 20.0+ ]+ ],+ "err": ""+ }+ ],+ "regex": [+ {+ "what": "an IPv4 address in dotted decimal, each ",+ "pass": true,+ "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])$"+ },+ {+ "what": "a CSS hex color: '#' followed by exactly",+ "pass": true,+ "pattern": "#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?"+ },+ {+ "what": "a date YYYY-MM-DD with month 01-12 and d",+ "pass": true,+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"+ }+ ],+ "agent": [],+ "qa": [],+ "longgen": []+ }+}\ No newline at end of filediff --git a/bench/results/2026-10-04-community-rx-6800-windows/par.py b/bench/results/2026-10-04-community-rx-6800-windows/par.pynew file mode 100644index 000000000..310c19b38--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/par.py@@ -0,0 +1,78 @@+"""bench-local/par.py - several requests at once against the running server: what each one gets and what they get+together. The server's "parallel" setting is whatever the running config has (ab.py's v139-par* arms set it).++ python par.py 1 2 4 (requests at once, one round each; a line per round, results appended to par.jsonl)+"""+from __future__ import annotations++import json+import sys+import threading+import time+import uuid+from pathlib import Path++import requests++HERE = Path(__file__).parent+BASE = "http://127.0.0.1:8080"+TOPICS = ["how a hash map works: hashing, collisions, resizing, complexity",+ "how TCP establishes and closes a connection, and what each flag means",+ "processes and threads: memory, scheduling, communication, failure isolation",+ "how a B-tree index speeds up a database query, and what it costs on writes",+ "how garbage collection works: reference counting, mark and sweep, generations",+ "how TLS sets up an encrypted connection: certificates, key exchange, session keys",+ "how virtual memory works: pages, page tables, the TLB, swapping",+ "how a compiler turns source into machine code: parsing, IR, optimisation, codegen"]+++def one(i, out, t0):+ """One streamed request: the time to its first token and its own decode rate (the server's timings)."""+ body = {"model": "strata", "max_tokens": 300, "temperature": 0, "reasoning_effort": "none", "stream": True,+ "stream_options": {"include_usage": True},+ "messages": [{"role": "user", "content": f"[{uuid.uuid4().hex[:8]}] Explain in detail {TOPICS[i % 8]}. "+ "About 220 words."}]}+ rec = {"i": i}+ try:+ with requests.post(BASE + "/v1/chat/completions", json=body, stream=True, timeout=1800) as r:+ for raw in r.iter_lines():+ if not raw.startswith(b"data: ") or raw == b"data: [DONE]":+ continue+ ev = json.loads(raw[6:])+ delta = (ev.get("choices") or [{}])[0].get("delta") or {}+ if "first_s" not in rec and (delta.get("content") or delta.get("reasoning_content")):+ rec["first_s"] = round(time.time() - t0, 2)+ if ev.get("timings"):+ rec["tok_s"] = ev["timings"].get("predicted_per_second")+ rec["out_n"] = ev["timings"].get("predicted_n")+ if ev.get("usage") and "out_n" not in rec:+ rec["out_n"] = ev["usage"].get("completion_tokens")+ except Exception as e:+ rec["error"] = f"{type(e).__name__}: {e}"[:200]+ rec["done_s"] = round(time.time() - t0, 2)+ out[i] = rec+++def main():+ label = json.loads(requests.get(BASE + "/v1/status", timeout=10).text).get("concurrency", {})+ for k in [int(x) for x in sys.argv[1:]]:+ out, t0 = [None] * k, time.time()+ threads = [threading.Thread(target=one, args=(i, out, t0)) for i in range(k)]+ for t in threads:+ t.start()+ for t in threads:+ t.join()+ wall = time.time() - t0+ toks = sum(r.get("out_n") or 0 for r in out)+ rec = {"time": time.strftime("%H:%M:%S"), "requests": k, "server": label, "wall_s": round(wall, 1),+ "total_tok_s": round(toks / wall, 1), "runs": out}+ firsts = sorted(r.get("first_s") or -1 for r in out)+ print(f"PAR {k} at once (server {label.get('serving', '?')}): together {rec['total_tok_s']} tok/s, all done in "+ f"{rec['wall_s']} s | first token after {firsts} s | each "+ f"{[r.get('tok_s') for r in out]} tok/s | errors {sum(1 for r in out if r.get('error'))}", flush=True)+ with (HERE / "par.jsonl").open("a", encoding="utf-8") as f:+ f.write(json.dumps(rec, ensure_ascii=False) + "\n")+++if __name__ == "__main__":+ main()diff --git a/bench/results/2026-10-04-community-rx-6800-windows/run_all-part1.json b/bench/results/2026-10-04-community-rx-6800-windows/run_all-part1.jsonnew file mode 100644index 000000000..c13ed05b9--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/run_all-part1.json@@ -0,0 +1,283 @@+{+ "speed": [+ {+ "label": "8K reserve 700",+ "decode_tok_s": [+ 52.8,+ 59.7,+ 61.0+ ],+ "decode_median": 59.7,+ "read": {+ "2K": {+ "prompt_n": 2189,+ "prompt_s": 10.6,+ "prompt_tok_s": 205.9,+ "tok_s": 47.0,+ "error": null+ }+ },+ "expert_slots": 6288,+ "cache_gib": 8.43,+ "vram_free_mib": 361+ },+ {+ "label": "256K reserve 2048",+ "decode_tok_s": [+ 45.5,+ 53.0,+ 55.0+ ],+ "decode_median": 53.0,+ "read": {+ "2K": {+ "prompt_n": 2185,+ "prompt_s": 10.7,+ "prompt_tok_s": 203.4,+ "tok_s": 40.4,+ "error": null+ },+ "8K": {+ "prompt_n": 7855,+ "prompt_s": 24.2,+ "prompt_tok_s": 324.6,+ "tok_s": 49.9,+ "error": null+ },+ "32K": {+ "prompt_n": 30345,+ "prompt_s": 100.5,+ "prompt_tok_s": 301.9,+ "tok_s": 44.0,+ "error": null+ }+ },+ "expert_slots": 4791,+ "cache_gib": 6.43,+ "vram_free_mib": 1740+ },+ {+ "label": "512K (asked 512K) reserve 2048",+ "decode_tok_s": [+ 46.9,+ 48.5,+ 50.2+ ],+ "decode_median": 48.5,+ "read": {+ "2K": {+ "prompt_n": 2187,+ "prompt_s": 10.7,+ "prompt_tok_s": 204.7,+ "tok_s": 38.2,+ "error": null+ },+ "8K": {+ "prompt_n": 7857,+ "prompt_s": 23.9,+ "prompt_tok_s": 328.2,+ "tok_s": 50.0,+ "error": null+ },+ "32K": {+ "prompt_n": 30347,+ "prompt_s": 99.8,+ "prompt_tok_s": 304.0,+ "tok_s": 42.0,+ "error": null+ }+ },+ "expert_slots": 4420,+ "cache_gib": 5.93,+ "vram_free_mib": 1738+ }+ ],+ "longctx": [+ {+ "label": "128K config",+ "target": 118000,+ "found": 5,+ "by_depth": {+ "red": true,+ "green": true,+ "blue": true,+ "amber": true,+ "violet": true+ },+ "prompt_n": 118410,+ "prompt_s": 375.1,+ "prompt_tok_s": 315.7,+ "tok_s": 36.2,+ "wall": 377.3,+ "error": null,+ "answer": "```json\n{\"red\": \"775783\", \"green\": \"914857\", \"blue\": \"794627\", \"amber\": \"762090\", \"violet\": \"877804\"}\n```"+ },+ {+ "label": "256K config",+ "target": 248000,+ "found": 5,+ "by_depth": {+ "red": true,+ "green": true,+ "blue": true,+ "amber": true,+ "violet": true+ },+ "prompt_n": 249365,+ "prompt_s": 824.5,+ "prompt_tok_s": 302.4,+ "tok_s": 48.7,+ "wall": 827.1,+ "error": null,+ "answer": "```json\n{\n \"red\": \"977109\",\n \"green\": \"757221\",\n \"blue\": \"708704\",\n \"amber\": \"688532\",\n \"violet\": \"175348\"\n}\n```"+ }+ ],+ "vision": [+ {+ "label": "300 image tokens",+ "image": "1600x900 16px",+ "exact": 2,+ "of": 5,+ "prompt_tokens": 304,+ "wall": [+ 7.9,+ 3.5,+ 3.5,+ 3.4,+ 3.4+ ]+ },+ {+ "label": "300 image tokens",+ "image": "3840x2160 16px",+ "exact": 0,+ "of": 5,+ "prompt_tokens": 304,+ "wall": [+ 9.0,+ 4.0,+ 4.0,+ 4.0,+ 4.0+ ]+ },+ {+ "label": "300 image tokens",+ "image": "3840x2160 28px",+ "exact": 0,+ "of": 5,+ "prompt_tokens": 304,+ "wall": [+ 8.1,+ 3.2,+ 3.2,+ 3.3,+ 3.3+ ]+ },+ {+ "label": "1024 image tokens",+ "image": "1600x900 16px",+ "exact": 5,+ "of": 5,+ "prompt_tokens": 1036,+ "wall": [+ 30.6,+ 8.0,+ 7.8,+ 7.8,+ 7.8+ ]+ },+ {+ "label": "1024 image tokens",+ "image": "3840x2160 16px",+ "exact": 0,+ "of": 5,+ "prompt_tokens": 1036,+ "wall": [+ 30.6,+ 7.9,+ 7.9,+ 7.9,+ 7.8+ ]+ },+ {+ "label": "1024 image tokens",+ "image": "3840x2160 28px",+ "exact": 5,+ "of": 5,+ "prompt_tokens": 1036,+ "wall": [+ 29.6,+ 7.8,+ 7.7,+ 7.7,+ 7.7+ ]+ }+ ],+ "config": [+ {+ "asked_context": 8192,+ "reserve_mib": 700,+ "vision_tokens": null,+ "start_s": 31,+ "max_context": 8192,+ "setup_exit": 0,+ "notes": [+ "[ok] context: 8192 tokens",+ "[!] no hipBLASLt tuning table for gfx1030 with hipBLASLt 100500: the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: docs/AMD_HIP.md, Tuning table)"+ ],+ "expert_slots": 6288,+ "cache_gib": 8.43,+ "vram_free_mib": 361+ },+ {+ "asked_context": 262144,+ "reserve_mib": 2048,+ "vision_tokens": 1024,+ "start_s": 32,+ "max_context": 262144,+ "setup_exit": 0,+ "notes": [+ "[ok] context: 262144 tokens",+ "[ok] KV streaming on: the context's KV cache lives in RAM (3.6 GB), more experts fit in VRAM",+ "[!] no hipBLASLt tuning table for gfx1030 with hipBLASLt 100500: the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: docs/AMD_HIP.md, Tuning table)"+ ],+ "expert_slots": 4791,+ "cache_gib": 6.43,+ "vram_free_mib": 1740+ },+ {+ "asked_context": 524288,+ "reserve_mib": 2048,+ "vision_tokens": null,+ "start_s": 32,+ "max_context": 524288,+ "setup_exit": 0,+ "notes": [+ "[ok] rope scaling: yarn, factor 2 (final context / trained 262144; override with --rope-scale)",+ "[ok] context: 524288 tokens",+ "[ok] KV streaming on: the context's KV cache lives in RAM (7.2 GB), more experts fit in VRAM",+ "[!] no hipBLASLt tuning table for gfx1030 with hipBLASLt 100500: the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: docs/AMD_HIP.md, Tuning table)"+ ],+ "expert_slots": 4420,+ "cache_gib": 5.93,+ "vram_free_mib": 1738+ }+ ],+ "suites": [+ {+ "tag": "eval2-qa",+ "exit": 0,+ "minutes": 3.4+ },+ {+ "tag": "eval2-hard",+ "exit": 0,+ "minutes": 32.7+ }+ ]+}\ No newline at end of filediff --git a/bench/results/2026-10-04-community-rx-6800-windows/run_all.json b/bench/results/2026-10-04-community-rx-6800-windows/run_all.jsonnew file mode 100644index 000000000..a60e8b26f--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/run_all.json@@ -0,0 +1,61 @@+{+ "speed": [],+ "longctx": [+ {+ "label": "512K config",+ "target": 510288,+ "found": 5,+ "by_depth": {+ "red": true,+ "green": true,+ "blue": true,+ "amber": true,+ "violet": true+ },+ "prompt_n": 512194,+ "prompt_s": 1968.4,+ "prompt_tok_s": 260.2,+ "tok_s": 33.0,+ "wall": 1972.8,+ "error": null,+ "answer": "```json\n{\n \"red\": \"198025\",\n \"green\": \"408113\",\n \"blue\": \"747384\",\n \"amber\": \"564131\",\n \"violet\": \"380097\"\n}\n```"+ }+ ],+ "vision": [],+ "config": [+ {+ "asked_context": 524288,+ "reserve_mib": 2048,+ "vision_tokens": null,+ "start_s": 31,+ "max_context": 524288,+ "setup_exit": 0,+ "notes": [+ "[ok] rope scaling: yarn, factor 2 (final context / trained 262144; override with --rope-scale)",+ "[ok] context: 524288 tokens",+ "[ok] KV streaming on: the context's KV cache lives in RAM (7.2 GB), more experts fit in VRAM",+ "[!] no hipBLASLt tuning table for gfx1030 with hipBLASLt 100500: the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: docs/AMD_HIP.md, Tuning table)"+ ],+ "expert_slots": 4435,+ "cache_gib": 5.95,+ "vram_free_mib": 1714+ },+ {+ "asked_context": 131072,+ "reserve_mib": 2048,+ "vision_tokens": 1024,+ "start_s": 30,+ "max_context": 131072,+ "setup_exit": 0,+ "notes": [+ "[ok] context: 131072 tokens",+ "[ok] KV streaming on: the context's KV cache lives in RAM (1.8 GB), more experts fit in VRAM",+ "[!] no hipBLASLt tuning table for gfx1030 with hipBLASLt 100500: the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: docs/AMD_HIP.md, Tuning table)"+ ],+ "expert_slots": 4752,+ "cache_gib": 6.37,+ "vram_free_mib": 1398+ }+ ],+ "suites": []+}\ No newline at end of filediff --git a/bench/results/2026-10-04-community-rx-6800-windows/run_all.py b/bench/results/2026-10-04-community-rx-6800-windows/run_all.pynew file mode 100644index 000000000..8e4f002c6--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/run_all.py@@ -0,0 +1,259 @@+"""bench-local/run_all.py - the full local benchmark: quality suites, speed per configuration, the longest contexts.++Runs detached; restarts the Strata server with other settings between phases and restores 128K / 2048 MiB at the+end. Progress: run_all.log; numbers: run_all.json.+"""+from __future__ import annotations++import base64+import io+import json+import random+import re+import statistics+import subprocess+import sys+import time+import uuid+from pathlib import Path++import psutil+import requests++HERE = Path(__file__).parent+ROOT = HERE.parent+PY = sys.executable+BASE = "http://127.0.0.1:8080"+CFG = ROOT / "strata-iq2_xs.json"+LOG = HERE / "run_all.log"+RES: dict = {"speed": [], "longctx": [], "vision": [], "config": [], "suites": []}+++def log(msg):+ line = f"{time.strftime('%H:%M:%S')} {msg}"+ with LOG.open("a", encoding="utf-8") as f:+ f.write(line + "\n")+ (HERE / "run_all.json").write_text(json.dumps(RES, ensure_ascii=False, indent=1), encoding="utf-8")+++# ------------------------------------------------------------------------------------------------ the server+def stop_server():+ for p in psutil.process_iter(["name", "cmdline"]):+ try:+ cl = " ".join(p.info["cmdline"] or [])+ if p.info["name"] in ("strata.exe", "strata-vision.exe") or ("serve" in cl and "server.py" in cl):+ p.kill()+ except (psutil.NoSuchProcess, psutil.AccessDenied):+ pass+ time.sleep(5)+++def health():+ try:+ return requests.get(BASE + "/health", timeout=5).json()+ except Exception:+ return {}+++def start_server():+ out = open(ROOT / "server.out", "w")+ err = open(ROOT / "server.err", "w")+ proc = subprocess.Popen([PY, "serve/server.py", "--engine", "strata", "--config", str(CFG), "--port", "8080"],+ cwd=ROOT, stdout=out, stderr=err, creationflags=subprocess.CREATE_NO_WINDOW)+ t = time.time()+ while time.time() - t < 1200:+ if health().get("loaded"):+ return round(time.time() - t)+ if proc.poll() is not None:+ return None+ time.sleep(3)+ return None+++def engine_facts():+ text = (ROOT / "strata-iq2_xs.log").read_text(encoding="utf-8", errors="replace")[-200000:]+ slots = re.findall(r"expert cache (\d+) slots, ([\d.]+) GiB", text)+ free = re.findall(r"(\d+) MiB of VRAM free with everything loaded", text)+ return {"expert_slots": int(slots[-1][0]) if slots else None, "cache_gib": float(slots[-1][1]) if slots else None,+ "vram_free_mib": int(free[-1]) if free else None}+++def configure(ctx, reserve, vision_tokens=None):+ stop_server()+ p = subprocess.run([PY, "setup.py", "--setup", "--yes", "--family", "qwen", "--model", "IQ2_XS", "--context",+ str(ctx), "--vram-reserve-mib", str(reserve), "--vision", "cpu", "--data-dir",+ r"D:\Strata-data", "--no-start"], cwd=ROOT, stdin=subprocess.DEVNULL, capture_output=True,+ text=True, encoding="utf-8", errors="replace")+ notes = [ln.strip()[:220] for ln in p.stdout.splitlines() if "[!]" in ln or "context" in ln.lower() or "rope" in ln.lower()]+ if vision_tokens:+ cfg = json.loads(CFG.read_text(encoding="utf-8"))+ cfg["vision"]["max_tokens"] = vision_tokens+ CFG.write_text(json.dumps(cfg, indent=1), encoding="utf-8")+ secs = start_server()+ h = health()+ rec = {"asked_context": ctx, "reserve_mib": reserve, "vision_tokens": vision_tokens, "start_s": secs,+ "max_context": h.get("max_context"), "setup_exit": p.returncode, "notes": notes[-8:], **engine_facts()}+ RES["config"].append(rec)+ log(f"CONFIG ctx {ctx} reserve {reserve}: started in {secs} s, max_context {h.get('max_context')}, {engine_facts()}")+ for n in notes[-8:]:+ log(" setup: " + n)+ return secs is not None+++# ------------------------------------------------------------------------------------------------ requests+def ask(content, max_tokens=300, effort="none", timeout=7200):+ t = time.time()+ try:+ r = requests.post(BASE + "/v1/chat/completions", timeout=timeout, json={+ "model": "strata", "messages": [{"role": "user", "content": content}], "max_tokens": max_tokens,+ "reasoning_effort": effort, "temperature": 0}).json()+ except Exception as e:+ return {"error": f"{type(e).__name__}: {e}"[:300]}+ if "choices" not in r:+ return {"error": json.dumps(r)[:300]}+ tm = r.get("timings", {})+ return {"content": r["choices"][0]["message"].get("content") or "", "wall": round(time.time() - t, 1),+ "prompt_n": tm.get("prompt_n"), "prompt_s": round(tm.get("prompt_ms", 0) / 1000, 1),+ "prompt_tok_s": tm.get("prompt_per_second"), "out_n": tm.get("predicted_n"),+ "tok_s": tm.get("predicted_per_second")}+++def speed(label):+ dec = [ask(f"[{uuid.uuid4().hex[:8]}] Explain in detail how a hash map works: hashing, collisions, resizing, "+ "complexity. About 300 words.", 420) for _ in range(3)]+ src = (ROOT / "serve" / "server.py").read_text(encoding="utf-8")+ reads = {}+ for name, kb in (("2K", 8), ("8K", 30), ("32K", 125)):+ mc = health().get("max_context") or 0+ if kb * 280 > mc - 2000: # ~280 tokens per KB of this file+ continue+ r = ask(f"Run {uuid.uuid4().hex}.\n\n" + src[:kb * 1000] + "\n\nIn one sentence: what is this code?", 60)+ reads[name] = {k: r.get(k) for k in ("prompt_n", "prompt_s", "prompt_tok_s", "tok_s", "error")}+ ok = [d["tok_s"] for d in dec if d.get("tok_s")]+ rec = {"label": label, "decode_tok_s": ok, "decode_median": statistics.median(ok) if ok else None, "read": reads,+ **engine_facts()}+ RES["speed"].append(rec)+ log(f"SPEED {label}: decode {ok} tok/s; read " ++ ", ".join(f"{k} {v.get('prompt_n')} tok at {v.get('prompt_tok_s')} tok/s" for k, v in reads.items()))+++# ------------------------------------------------------------------------------------------------ long context+WORDS = ("river mountain engine garden window bridge market signal harbor library forest station valley mirror "+ "ladder castle meadow tunnel beacon anchor copper marble velvet thunder lantern compass orchard glacier "+ "pepper cotton ribbon basket candle feather hammer island jacket kettle lemon magnet needle ocean pillow "+ "quartz rocket saddle timber violet walnut yarn zipper").split()+COLORS = ["red", "green", "blue", "amber", "violet"]+++def filler(rng, n_chars):+ out, size, i = [], 0, 0+ while size < n_chars:+ i += 1+ s = f"Section {i}. " + " ".join(+ f"The {rng.choice(WORDS)} near the {rng.choice(WORDS)} was moved to the {rng.choice(WORDS)} on day "+ f"{rng.randint(1, 365)}." for _ in range(6)) + "\n"+ out.append(s)+ size += len(s)+ return out+++def longctx(target_tokens, label):+ rng = random.Random(target_tokens)+ cal = ask("".join(filler(rng, 40000)) + "\nReply OK.", 5)+ if cal.get("error"):+ log(f"LONGCTX {label}: calibration failed {cal['error']}")+ return+ per_tok = 40000 / cal["prompt_n"]+ paras = filler(rng, int(target_tokens * per_tok))+ codes = {c: str(rng.randint(100000, 999999)) for c in COLORS}+ for c, depth in zip(COLORS, (0.1, 0.3, 0.5, 0.7, 0.9)):+ paras.insert(int(len(paras) * depth), f"Important: the secret code for {c} is {codes[c]}.\n")+ q = ("\nQuestion: the text above contains five secret codes, one each for red, green, blue, amber and violet. "+ "Reply with only JSON like {\"red\": \"...\", \"green\": \"...\", \"blue\": \"...\", \"amber\": \"...\", "+ "\"violet\": \"...\"}.")+ r = ask(f"Document {uuid.uuid4().hex}:\n\n" + "".join(paras) + q, 200, timeout=14400)+ found = {c: (codes[c] in r.get("content", "")) for c in COLORS}+ rec = {"label": label, "target": target_tokens, "found": sum(found.values()), "by_depth": found,+ **{k: r.get(k) for k in ("prompt_n", "prompt_s", "prompt_tok_s", "tok_s", "wall", "error")},+ "answer": r.get("content", "")[:200]}+ RES["longctx"].append(rec)+ log(f"LONGCTX {label}: {r.get('prompt_n')} tok read in {r.get('prompt_s')} s ({r.get('prompt_tok_s')} tok/s), "+ f"found {sum(found.values())}/5 {found}, decode {r.get('tok_s')} tok/s {r.get('error', '')}")+ if not r.get("error"): # a follow-up in the same conversation is not possible through ask(); a new short+ r2 = ask("What is 12 * 12? Number only.", 20) # request shows the server still answers after the long one+ log(f" after it, a short request: {r2.get('content', r2.get('error'))!r} in {r2.get('wall')} s")+++# ------------------------------------------------------------------------------------------------ pictures+def vision(label):+ from PIL import Image, ImageDraw, ImageFont+ for name, size, px, rows in (("1600x900 16px", (1600, 900), 16, 40), ("3840x2160 16px", (3840, 2160), 16, 95),+ ("3840x2160 28px", (3840, 2160), 28, 60)):+ rng = random.Random(px + size[0])+ font = ImageFont.truetype("consola.ttf", px)+ lines = [f"{i:02d} cfg.{rng.choice(['port', 'retries', 'timeout', 'workers', 'limit', 'depth'])}_{i} = "+ f"{rng.randint(1000, 9999)}" for i in range(1, rows + 1)]+ img = Image.new("RGB", size, (30, 30, 30))+ d = ImageDraw.Draw(img)+ for i, s in enumerate(lines):+ d.text((40, 20 + i * int(px * 1.35)), s, font=font, fill=(220, 220, 220))+ buf = io.BytesIO()+ img.save(buf, "PNG")+ b64 = base64.b64encode(buf.getvalue()).decode()+ hits, walls, ptoks = 0, [], None+ picks = [3, rows // 3, rows // 2, (2 * rows) // 3, rows - 2]+ for ln in picks:+ r = ask([{"type": "text", "text": f"This is a screenshot of code. Copy line {ln:02d} exactly."},+ {"type": "image_url", "image_url": {"url": "data:image/png;base64," + b64}}], 80)+ want = lines[ln - 1].split(" ", 1)[1]+ hits += want in r.get("content", "")+ walls.append(r.get("wall"))+ ptoks = r.get("prompt_n") or ptoks+ RES["vision"].append({"label": label, "image": name, "exact": hits, "of": len(picks), "prompt_tokens": ptoks,+ "wall": walls})+ log(f"VISION {label} {name}: {hits}/{len(picks)} lines exact, {ptoks} prompt tokens, {walls} s")+++def suite(script, tag, args=()):+ t = time.time()+ with (HERE / f"{tag}.log").open("w", encoding="utf-8") as f:+ p = subprocess.run([PY, str(HERE / script), *args], cwd=ROOT, stdout=f, stderr=subprocess.STDOUT,+ env={**__import__("os").environ, "PYTHONIOENCODING": "utf-8"})+ RES["suites"].append({"tag": tag, "exit": p.returncode, "minutes": round((time.time() - t) / 60, 1)})+ log(f"SUITE {tag} finished in {(time.time() - t) / 60:.1f} min (exit {p.returncode})")+++def main():+ log("=== run_all started")+ try:+ if not health().get("loaded"):+ configure(131072, 2048)+ # 1. the everyday configuration: 128K, 2048 MiB kept free+ # (the 128K speed test and the round-1 suites were measured before; only what is still missing runs here)+ vision("300 image tokens")+ suite("strata_eval2.py", "eval2-qa", ["qa"])+ suite("strata_eval2.py", "eval2-hard", ["hard"])+ longctx(118000, "128K config")+ # 2. the upper speed limit: a small context and the smallest VRAM reserve+ if configure(8192, 700):+ speed("8K reserve 700")+ # 3. the trained maximum, and pictures with more tokens+ if configure(262144, 2048, vision_tokens=1024):+ speed("256K reserve 2048")+ vision("1024 image tokens")+ longctx(248000, "256K config")+ # 4. past the trained range (experimental rope scaling)+ if configure(524288, 2048):+ mc = health().get("max_context") or 0+ speed(f"{mc // 1024}K (asked 512K) reserve 2048")+ if mc > 270000:+ longctx(mc - 14000, f"{mc // 1024}K config")+ except Exception as e:+ log(f"CRASHED {type(e).__name__}: {e}")+ finally:+ configure(131072, 2048)+ log("=== run_all finished; server restored to 128K / 2048 MiB")+++if __name__ == "__main__":+ main()diff --git a/bench/results/2026-10-04-community-rx-6800-windows/strata_eval.py b/bench/results/2026-10-04-community-rx-6800-windows/strata_eval.pynew file mode 100644index 000000000..6f2520e07--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/strata_eval.py@@ -0,0 +1,269 @@+"""bench-local/strata_eval.py - a small capability check of a running Strata server (http://127.0.0.1:8080).++Sections: coding tasks with hidden tests, reasoning puzzles per thinking level, tool calling, JSON output,+conversation follow-up (prefix reuse) and a Ukrainian check. Writes results.json next to this file.+"""+from __future__ import annotations++import json+import re+import subprocess+import sys+import tempfile+import time+from pathlib import Path++import requests++URL = "http://127.0.0.1:8080/v1/chat/completions"+HERE = Path(__file__).parent+OUT = {"coding": [], "reasoning": [], "tools": [], "json": [], "followup": [], "ukrainian": []}+++def chat(messages, effort="none", max_tokens=4000, **extra):+ t = time.time()+ r = requests.post(URL, json={"model": "strata", "messages": messages, "max_tokens": max_tokens,+ "reasoning_effort": effort, "temperature": 0, **extra}, timeout=1800).json()+ wall = time.time() - t+ if "choices" not in r:+ return {"error": json.dumps(r)[:400], "wall": wall}+ m, tm = r["choices"][0]["message"], r.get("timings", {})+ return {"content": m.get("content") or "", "reasoning": m.get("reasoning_content") or "",+ "tool_calls": m.get("tool_calls"), "finish": r["choices"][0].get("finish_reason"), "wall": round(wall, 1),+ "out_tokens": tm.get("predicted_n"), "tok_s": tm.get("predicted_per_second"),+ "prompt_n": tm.get("prompt_n"), "cache_n": tm.get("cache_n"), "prompt_s": round(tm.get("prompt_ms", 0) / 1000, 1)}+++# ------------------------------------------------------------------------------------------------ coding+CODING = [+ ("merge_intervals", "Write `merge_intervals(intervals)`: takes a list of [start, end] pairs (any order), merges "+ "overlapping or touching ones and returns them sorted as a list of lists.",+ "assert merge_intervals([[1,3],[2,6],[8,10],[15,18]]) == [[1,6],[8,10],[15,18]]\n"+ "assert merge_intervals([[1,4],[4,5]]) == [[1,5]]\nassert merge_intervals([]) == []\n"+ "assert merge_intervals([[5,7],[1,2],[2,3],[6,6]]) == [[1,3],[5,7]]\n"),+ ("lru_cache", "Write a class `LRUCache(capacity)` with `get(key)` (returns -1 when missing) and `put(key, value)`; "+ "both O(1); the least recently used key is evicted when over capacity.",+ "c = LRUCache(2); c.put(1,1); c.put(2,2); assert c.get(1) == 1; c.put(3,3); assert c.get(2) == -1\n"+ "c.put(4,4); assert c.get(1) == -1 and c.get(3) == 3 and c.get(4) == 4\n"+ "c.put(3,30); c.put(5,5); assert c.get(4) == -1 and c.get(3) == 30\n"),+ ("parse_duration", "Write `parse_duration(s)`: parses strings like '1d2h30m15s', '90m', '45s' (units d, h, m, s, "+ "each at most once, in that order, any subset) and returns total seconds as int. Raise ValueError for anything "+ "else (empty string, unknown unit, wrong order, repeated unit, negative numbers, spaces).",+ "assert parse_duration('1d2h30m15s') == 95415\nassert parse_duration('90m') == 5400\n"+ "assert parse_duration('45s') == 45\nassert parse_duration('2h5s') == 7205\n"+ "for bad in ['', '5x', '30m1h', '1h1h', '-5m', '1h 5m', 'h', '10']:\n"+ " try:\n parse_duration(bad); raise AssertionError(bad)\n except ValueError:\n pass\n"),+ ("top_k_frequent", "Write `top_k_frequent(words, k)`: the k most frequent words, most frequent first; ties broken "+ "alphabetically.",+ "assert top_k_frequent(['i','love','leetcode','i','love','coding'], 2) == ['i','love']\n"+ "assert top_k_frequent(['b','a','c','a','b','c'], 2) == ['a','b']\n"+ "assert top_k_frequent(['x'], 1) == ['x']\n"),+ ("eval_expr", "Write `eval_expr(s)`: evaluates an arithmetic expression string with + - * /, parentheses, unary "+ "minus, integers and decimals, and spaces. Standard precedence, / is true division. Do not use eval or exec. "+ "Return a float.",+ "assert abs(eval_expr('1 + 2 * 3') - 7) < 1e-9\nassert abs(eval_expr('(1 + 2) * 3') - 9) < 1e-9\n"+ "assert abs(eval_expr('-3 + 5') - 2) < 1e-9\nassert abs(eval_expr('2 * -(3 + 1) / 4') + 2) < 1e-9\n"+ "assert abs(eval_expr('10 / 4 - 0.5') - 2) < 1e-9\nassert abs(eval_expr('2 - 3 - 4') + 5) < 1e-9\n"+ "assert abs(eval_expr('((2))*(3+(4*5))') - 46) < 1e-9\n"),+ ("int_to_roman", "Write `int_to_roman(n)` for 1 <= n <= 3999 and `roman_to_int(s)` as its inverse.",+ "assert int_to_roman(1994) == 'MCMXCIV' and int_to_roman(3999) == 'MMMCMXCIX' and int_to_roman(4) == 'IV'\n"+ "assert all(roman_to_int(int_to_roman(i)) == i for i in range(1, 4000))\n"),+ ("dijkstra", "Write `dijkstra(graph, src)`: graph is a dict {node: {neighbor: weight}} with non-negative weights "+ "(directed). Return a dict of shortest distances from src to every node that appears in the graph (as a key or "+ "as a neighbor); unreachable nodes get float('inf').",+ "g = {'a': {'b': 1, 'c': 4}, 'b': {'c': 2, 'd': 6}, 'c': {'d': 3}, 'e': {'a': 1}}\n"+ "d = dijkstra(g, 'a')\nassert d == {'a': 0, 'b': 1, 'c': 3, 'd': 6, 'e': float('inf')}, d\n"),+ ("bsearch_fix", "This function should return the index of the LEFTMOST occurrence of x in the sorted list a, or "+ "-1. It has bugs. Return the fixed function, same name.\n\n```python\ndef bsearch(a, x):\n lo, hi = 0, len(a)\n"+ " while lo < hi:\n mid = (lo + hi) // 2\n if a[mid] <= x:\n lo = mid\n else:\n"+ " hi = mid - 1\n return lo if a[lo] == x else -1\n```",+ "assert bsearch([1,2,2,2,3], 2) == 1\nassert bsearch([], 1) == -1\nassert bsearch([1,3,5], 4) == -1\n"+ "assert bsearch([1,3,5], 5) == 2\nassert bsearch([2,2,2], 2) == 0\nassert bsearch([1,3,5], 0) == -1\n"+ "assert bsearch([1,3,5], 9) == -1\n"),+ ("flatten_json", "Write `flatten_json(obj, sep='.')`: flattens nested dicts and lists into one dict; list items "+ "use their index as the key part. Empty dicts and empty lists are kept as values.",+ "assert flatten_json({'a': {'b': 1, 'c': [10, {'d': 2}]}, 'e': 3}) == {'a.b': 1, 'a.c.0': 10, 'a.c.1.d': 2, 'e': 3}\n"+ "assert flatten_json({'a': {}, 'b': []}) == {'a': {}, 'b': []}\n"+ "assert flatten_json({'x': {'y': {'z': None}}}, sep='/') == {'x/y/z': None}\n"),+ ("lcs", "Write `lcs(a, b)`: returns one longest common subsequence of two strings (as a string).",+ "def ok(a, b, n):\n r = lcs(a, b)\n def sub(s, t):\n it = iter(t)\n return all(ch in it for ch in s)\n"+ " assert len(r) == n and sub(r, a) and sub(r, b), r\n"+ "ok('ABCBDAB', 'BDCABA', 4); ok('', 'abc', 0); ok('abc', 'abc', 3); ok('AGGTAB', 'GXTXAYB', 4)\n"),+ ("rate_limiter", "Write a class `RateLimiter(max_calls, period)` with `allow(now)`: returns True and records the "+ "call if fewer than max_calls were allowed in the half-open window (now - period, now], else False. `now` is a "+ "float in seconds and never decreases.",+ "r = RateLimiter(2, 10)\nassert r.allow(0) and r.allow(1) and not r.allow(2)\nassert not r.allow(9.9)\n"+ "assert r.allow(10)\nassert not r.allow(10.5)\nassert r.allow(11) and not r.allow(11)\n"),+ ("csv_parse", "Write `parse_csv_line(line)`: splits one CSV line into fields. Fields may be quoted with double "+ "quotes; quoted fields may contain commas and doubled quotes (\"\") meaning one quote. No csv module.",+ "assert parse_csv_line('a,b,c') == ['a','b','c']\nassert parse_csv_line('a,\"b,c\",d') == ['a','b,c','d']\n"+ "assert parse_csv_line('\"he said \"\"hi\"\"\",x') == ['he said \"hi\"','x']\n"+ "assert parse_csv_line('a,,') == ['a','','']\nassert parse_csv_line('') == ['']\n"),+]+++def extract_code(text):+ blocks = re.findall(r"```(?:python|py)?\s*\n(.*?)```", text, re.S)+ return max(blocks, key=len) if blocks else text+++def run_tests(code, tests):+ with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False, encoding="utf-8") as f:+ f.write(code + "\n\n" + tests + "\nprint('PASS')\n")+ path = f.name+ try:+ p = subprocess.run([sys.executable, "-I", path], capture_output=True, text=True, timeout=20)+ return "PASS" in p.stdout, (p.stderr.strip().splitlines() or [""])[-1][:200]+ except subprocess.TimeoutExpired:+ return False, "timeout"+ finally:+ Path(path).unlink(missing_ok=True)+++def coding():+ for effort in ("none", "medium"):+ for name, task, tests in CODING:+ r = chat([{"role": "user", "content": task + "\n\nPython 3, standard library only. Reply with one "+ "```python code block containing the complete solution."}], effort, 6000)+ ok, err = (False, r["error"]) if "error" in r else run_tests(extract_code(r["content"]), tests)+ OUT["coding"].append({"task": name, "effort": effort, "pass": ok, "err": err,+ **{k: r.get(k) for k in ("wall", "out_tokens", "tok_s", "finish")}})+ print(f"coding {effort:6} {name:16} {'PASS' if ok else 'FAIL'} {r.get('wall')} s {r.get('out_tokens')} tok {err}", flush=True)+++# ------------------------------------------------------------------------------------------------ reasoning+PUZZLES = [+ ("A bat and a ball cost 1.10 in total. The bat costs 1.00 more than the ball. How much does the ball cost?", "0.05"),+ ("Sally has 3 brothers. Each brother has 2 sisters. How many sisters does Sally have?", "1"),+ ("If 5 machines take 5 minutes to make 5 widgets, how many minutes do 100 machines take to make 100 widgets?", "5"),+ ("Today is Wednesday. What day of the week is it 100 days from now? Answer with the English day name.", "friday"),+ ("Скільки разів літера 'р' зустрічається у слові 'прапорщик'? Відповідь числом.", "2"),+ ("Compute 487 * 263. Answer with the number.", "128081"),+ ("A farmer has chickens and rabbits: 35 heads and 94 legs. How many rabbits?", "12"),+ ("I have 3 apples. Yesterday I ate 2 apples. How many apples do I have now?", "3"),+ ("Three boxes: one has two gold coins, one two silver, one a gold and a silver. You pick a box at random and "+ "draw a gold coin. What is the probability the other coin in that box is gold? Answer as a fraction a/b.", "2/3"),+ ("A snail climbs a 10 m wall: up 3 m each day, slides down 2 m each night. On which day does it reach the top? "+ "Answer with the number.", "8"),+ ("Alice is taller than Bob. Bob is taller than Carol. Dave is shorter than Carol. Eve is taller than Alice. "+ "Who is the second tallest? Answer with the name.", "alice"),+ ("What is the smallest positive integer divisible by each of 1 through 10? Answer with the number.", "2520"),+]+++def reasoning():+ for effort in ("none", "low", "high"):+ for q, want in PUZZLES:+ r = chat([{"role": "user", "content": q + "\nEnd your reply with a line 'ANSWER: <answer>'."}], effort, 8000)+ m = re.findall(r"ANSWER:\s*(.+)", r.get("content", ""))+ got = m[-1].strip().strip(".*` ").lower().replace(",", "").replace(" ", "").lstrip("$") if m else ""+ ok = bool(re.match(re.escape(want) + r"(?![0-9/.])", got))+ OUT["reasoning"].append({"q": q[:50], "effort": effort, "pass": ok, "got": got[:30],+ **{k: r.get(k) for k in ("wall", "out_tokens", "tok_s")}})+ print(f"reason {effort:5} {'PASS' if ok else 'FAIL'} {r.get('wall')} s {r.get('out_tokens')} tok {q[:40]!r} -> {got[:20]!r}", flush=True)+++# ------------------------------------------------------------------------------------------------ tools+TOOLS = [+ {"type": "function", "function": {"name": "read_file", "description": "Read a text file from the project.",+ "parameters": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}}},+ {"type": "function", "function": {"name": "run_command", "description": "Run a shell command and return its output.",+ "parameters": {"type": "object", "properties": {"command": {"type": "string"}}, "required": ["command"]}}},+ {"type": "function", "function": {"name": "web_search", "description": "Search the web.",+ "parameters": {"type": "object", "properties": {"query": {"type": "string"},+ "max_results": {"type": "integer"}}, "required": ["query"]}}},+]+TOOL_CASES = [+ ("Open src/main.py and tell me what the entry function is called.", "read_file", "path", "main.py"),+ ("How many Python files are in this repository? Use the shell.", "run_command", "command", ""),+ ("What is the latest stable version of Rust? Look it up.", "web_search", "query", "rust"),+ ("Знайди в інтернеті, яка зараз остання версія Python.", "web_search", "query", "python"),+ ("What is 2 + 2?", None, None, None),+]+++def tools():+ for q, want, arg, needle in TOOL_CASES:+ r = chat([{"role": "user", "content": q}], "none", 1500, tools=TOOLS)+ calls = r.get("tool_calls") or []+ name = calls[0]["function"]["name"] if calls else None+ try:+ args = json.loads(calls[0]["function"]["arguments"]) if calls else {}+ valid = True+ except ValueError:+ args, valid = {}, False+ ok = name == want and valid and (want is None or (arg in args and needle.lower() in str(args[arg]).lower()))+ OUT["tools"].append({"q": q[:50], "want": want, "got": name, "args": args, "pass": ok, "wall": r.get("wall")})+ print(f"tools {'PASS' if ok else 'FAIL'} want {want} got {name} {args}", flush=True)+ # a two-step round trip: the call, its result, then the answer+ msgs = [{"role": "user", "content": "Read config.toml and tell me which port the server listens on."}]+ r = chat(msgs, "none", 1500, tools=TOOLS)+ calls = r.get("tool_calls") or []+ ok = False+ if calls:+ msgs += [{"role": "assistant", "content": r["content"], "tool_calls": calls},+ {"role": "tool", "tool_call_id": calls[0].get("id", "call_0"),+ "content": "[server]\nhost = \"0.0.0.0\"\nport = 9137\nworkers = 4\n"}]+ r2 = chat(msgs, "none", 1500, tools=TOOLS)+ ok = "9137" in r2.get("content", "")+ OUT["tools"].append({"q": "round trip (read_file -> answer)", "pass": ok})+ print(f"tools round trip {'PASS' if ok else 'FAIL'}", flush=True)+++# ------------------------------------------------------------------------------------------------ JSON+def json_out():+ schema = {"type": "object", "properties": {"name": {"type": "string"}, "year": {"type": "integer"},+ "languages": {"type": "array", "items": {"type": "string"}}}, "required": ["name", "year", "languages"],+ "additionalProperties": False}+ text = ("Guido van Rossum started Python in 1989 and released it in 1991. He also worked with C and ABC. "+ "Extract: the person's name, the release year, and the languages mentioned.")+ for label, extra in (("json_schema", {"response_format": {"type": "json_schema", "json_schema":+ {"name": "person", "schema": schema, "strict": True}}}),+ ("prompt only", {})):+ r = chat([{"role": "user", "content": text + ("" if extra else " Reply with JSON only: "+ "{\"name\": str, \"year\": int, \"languages\": [str]}")}],+ "none", 600, **extra)+ try:+ d = json.loads(re.sub(r"^```(?:json)?|```$", "", r.get("content", "").strip(), flags=re.M).strip())+ ok = d.get("year") == 1991 and "rossum" in d.get("name", "").lower() and len(d.get("languages", [])) == 3+ except ValueError:+ d, ok = r.get("content", r.get("error", ""))[:200], False+ OUT["json"].append({"mode": label, "pass": ok, "got": d})+ print(f"json {label} {'PASS' if ok else 'FAIL'} {d}", flush=True)+++# ------------------------------------------------------------------------------------------------ follow-up+def followup():+ src = (HERE.parent / "serve" / "mcp.py").read_text(encoding="utf-8")[:30000]+ msgs = [{"role": "user", "content": "Here is a Python file:\n\n" + src + "\n\nName the main class in one line."}]+ r1 = chat(msgs, "none", 200)+ msgs += [{"role": "assistant", "content": r1.get("content", "")},+ {"role": "user", "content": "Which transports does it implement? One line."}]+ r2 = chat(msgs, "none", 200)+ for label, r in (("first turn", r1), ("follow-up", r2)):+ OUT["followup"].append({"turn": label, **{k: r.get(k) for k in ("prompt_n", "cache_n", "prompt_s", "wall",+ "tok_s", "content")}})+ print(f"followup {label}: read {r.get('prompt_n')} tok in {r.get('prompt_s')} s, reused {r.get('cache_n')}, "+ f"wall {r.get('wall')} s | {r.get('content', '')[:120]!r}", flush=True)+++# ------------------------------------------------------------------------------------------------ Ukrainian+def ukrainian():+ qs = ["Поясни трьома реченнями, чим процес відрізняється від потоку в операційній системі.",+ "Переклади українською: 'The quick brown fox jumps over the lazy dog, but the dog had already filed a "+ "bug report about it.'",+ "Напиши commit message українською для зміни: додано перевірку заголовка Host у HTTP-сервері проти DNS "+ "rebinding. Один рядок заголовка і два речення опису."]+ for q in qs:+ r = chat([{"role": "user", "content": q}], "none", 500)+ OUT["ukrainian"].append({"q": q, "a": r.get("content"), "tok_s": r.get("tok_s"), "wall": r.get("wall")})+ print(f"uk {r.get('tok_s')} tok/s | {r.get('content', '')[:300]!r}", flush=True)+++if __name__ == "__main__":+ want = sys.argv[1:] or ["tools", "json", "followup", "ukrainian", "coding", "reasoning"]+ for name in want:+ {"coding": coding, "reasoning": reasoning, "tools": tools, "json": json_out, "followup": followup,+ "ukrainian": ukrainian}[name]()+ (HERE / "results.json").write_text(json.dumps(OUT, ensure_ascii=False, indent=1), encoding="utf-8")+ print("DONE", flush=True)diff --git a/bench/results/2026-10-04-community-rx-6800-windows/strata_eval2.py b/bench/results/2026-10-04-community-rx-6800-windows/strata_eval2.pynew file mode 100644index 000000000..2e2d73b94--- /dev/null+++ b/bench/results/2026-10-04-community-rx-6800-windows/strata_eval2.py@@ -0,0 +1,413 @@+"""bench-local/strata_eval2.py - round 2: harder coding, JavaScript, SQL, regex, a tool-using agent loop on a small+project, fact questions over a ~60K-token file, a long generation. Writes results2.json next to this file."""+from __future__ import annotations++import json+import re+import shutil+import sqlite3+import subprocess+import sys+import tempfile+from pathlib import Path++sys.path.insert(0, str(Path(__file__).parent))+import strata_eval as E # noqa: E402++HERE = Path(__file__).parent+OUT = {"hard": [], "js": [], "sql": [], "regex": [], "agent": [], "qa": [], "longgen": []}+ASK = "\n\nPython 3, standard library only. Reply with one ```python code block containing the complete solution."++HARD = [+ ("topo_sort", "Write `topo_sort(edges)`: edges is a list of (a, b) string pairs meaning a must come before b. "+ "Return all nodes in a valid order; among valid orders return the lexicographically smallest one. Raise "+ "ValueError if there is a cycle.",+ "assert topo_sort([('b','c'),('a','c'),('c','d')]) == ['a','b','c','d']\n"+ "assert topo_sort([('x','a'),('b','a')]) == ['b','x','a']\nassert topo_sort([]) == []\n"+ "try:\n topo_sort([('a','b'),('b','a')]); raise AssertionError('cycle')\nexcept ValueError:\n pass\n"),+ ("wildcard_match", "Write `wildcard_match(s, p)`: '?' matches exactly one character, '*' matches any sequence "+ "(including empty); the whole string must match.",+ "T = [('aa','a',False),('aa','*',True),('cb','?a',False),('adceb','*a*b',True),('acdcb','a*c?b',False),"+ "('','*',True),('','?',False),('abc','a**c',True),('a'*30+'b','*'+'a*'*10+'c',False)]\n"+ "for s, p, w in T:\n assert wildcard_match(s, p) is w, (s, p)\n"),+ ("min_window", "Write `min_window(s, t)`: the shortest substring of s containing every character of t (with "+ "multiplicity); '' if none.",+ "assert min_window('ADOBECODEBANC','ABC') == 'BANC'\nassert min_window('a','a') == 'a'\n"+ "assert min_window('a','aa') == ''\nassert min_window('aab','aab') == 'aab'\n"),+ ("json_pointer", "Write `json_pointer(doc, pointer)` implementing RFC 6901 lookup: '' returns the whole document, "+ "'/a/0' descends into dicts and lists, '~1' decodes to '/', '~0' decodes to '~'. Raise KeyError for any path "+ "that does not exist (including a list index out of range).",+ "d = {'foo': ['bar', 'baz'], '': 0, 'a/b': 1, 'm~n': 8, ' ': 7}\n"+ "assert json_pointer(d, '') == d and json_pointer(d, '/foo') == ['bar','baz'] and json_pointer(d, '/foo/0') == 'bar'\n"+ "assert json_pointer(d, '/') == 0 and json_pointer(d, '/a~1b') == 1 and json_pointer(d, '/m~0n') == 8\n"+ "assert json_pointer(d, '/ ') == 7\n"+ "for bad in ['/foo/5', '/nope', '/foo/x']:\n try:\n json_pointer(d, bad); raise AssertionError(bad)\n"+ " except KeyError:\n pass\n"),+ ("nqueens", "Write `nqueens(n)`: the number of ways to place n non-attacking queens on an n x n board.",+ "assert [nqueens(n) for n in (1, 4, 6, 8)] == [1, 2, 4, 92]\n"),+ ("semver_sort", "Write `semver_sort(versions)`: sorts semantic version strings ascending by the SemVer 2.0.0 "+ "precedence rules, including pre-release identifiers (no build metadata).",+ "v = ['1.0.0','1.0.0-alpha','1.0.0-alpha.1','1.0.0-beta','1.0.0-rc.1','0.9.9','1.0.0-alpha.beta','1.0.0-beta.2',"+ "'1.0.0-beta.11','2.0.0']\n"+ "assert semver_sort(v) == ['0.9.9','1.0.0-alpha','1.0.0-alpha.1','1.0.0-alpha.beta','1.0.0-beta','1.0.0-beta.2',"+ "'1.0.0-beta.11','1.0.0-rc.1','1.0.0','2.0.0'], semver_sort(v)\n"),+ ("edit_distance", "Write `edit_distance(a, b)`: the Levenshtein distance.",+ "assert edit_distance('kitten','sitting') == 3 and edit_distance('','abc') == 3\n"+ "assert edit_distance('flaw','lawn') == 2 and edit_distance('intention','execution') == 5\n"),+ ("gather_limited", "Write `async def gather_limited(coro_fns, limit)`: coro_fns is a list of zero-argument "+ "callables that each return a coroutine. Run them with at most `limit` running at the same time and return their "+ "results in the input order.",+ "import asyncio\nasync def _t():\n running = 0; peak = 0\n async def job(i):\n nonlocal running, peak\n"+ " running += 1; peak = max(peak, running)\n await asyncio.sleep(0.01 * (5 - i % 5))\n"+ " running -= 1\n return i * i\n"+ " res = await gather_limited([lambda i=i: job(i) for i in range(12)], 3)\n"+ " assert res == [i * i for i in range(12)], res\n assert 2 <= peak <= 3, peak\nasyncio.run(_t())\n"),+ ("trie", "Write a class `Trie` with `insert(word)`, `search(word)` (exact word), `starts_with(prefix)` and "+ "`delete(word)`: delete removes the word and prunes nodes no other word uses; deleting a missing word does "+ "nothing.",+ "t = Trie(); t.insert('apple'); t.insert('app')\n"+ "assert t.search('app') and t.search('apple') and not t.search('appl') and t.starts_with('appl')\n"+ "t.delete('apple'); assert not t.search('apple') and t.search('app') and not t.starts_with('appl')\n"+ "t.delete('zzz'); t.delete('app'); assert not t.starts_with('a')\n"),+ ("bowling", "Write `bowling_score(rolls)`: the total score of a complete ten-pin bowling game given the list of "+ "pins knocked down per roll.",+ "assert bowling_score([10]*12) == 300 and bowling_score([9,1]*10+[9]) == 190 and bowling_score([0]*20) == 0\n"+ "assert bowling_score([3,4]*10) == 70\n"+ "assert bowling_score([10,7,3,9,0,10,0,8,8,2,0,6,10,10,10,8,1]) == 167\n"),+ ("palindrome", "Write `longest_palindrome(s)`: a longest palindromic substring of s.",+ "assert longest_palindrome('babad') in ('bab','aba') and longest_palindrome('cbbd') == 'bb'\n"+ "assert longest_palindrome('') == '' and longest_palindrome('a') == 'a'\n"+ "assert longest_palindrome('forgeeksskeegfor') == 'geeksskeeg'\n"),+ ("normpath", "Write `normalize(path)` for POSIX-style paths without using os.path or pathlib: collapse repeated "+ "slashes, resolve '.' and '..', drop a trailing slash. An absolute path never goes above '/'. A relative path "+ "keeps leading '..' parts it cannot resolve. An empty result is '.' for a relative path.",+ "T = {'/a/./b/../../c/': '/c', '/../': '/', '/home//foo/': '/home/foo', 'a/b/../c': 'a/c', '../a': '../a', "+ "'': '.', 'a/..': '.', 'a/../../b': '../b', '/': '/'}\n"+ "for k, w in T.items():\n assert normalize(k) == w, (k, normalize(k))\n"),+]+++def hard():+ import os+ for effort in os.environ.get("EFFORTS", "none,high").split(","):+ for name, task, tests in HARD:+ r = E.chat([{"role": "user", "content": task + ASK}], effort, 12000)+ ok, err = (False, r["error"]) if "error" in r else E.run_tests(E.extract_code(r["content"]), tests)+ OUT["hard"].append({"task": name, "effort": effort, "pass": ok, "err": err,+ **{k: r.get(k) for k in ("wall", "out_tokens", "tok_s", "finish")}})+ print(f"hard {effort:5} {name:15} {'PASS' if ok else 'FAIL'} {r.get('wall')} s {r.get('out_tokens')} tok {err}", flush=True)+++JS = [+ ("groupBy", "Write `groupBy(arr, fn)`: returns an object mapping fn(item) to the array of items with that key, "+ "in input order.",+ "assert.deepStrictEqual(groupBy([1,2,3,4,5], x => x % 2 ? 'odd' : 'even'), {odd: [1,3,5], even: [2,4]});\n"+ "assert.deepStrictEqual(groupBy([], x => x), {});\n"),+ ("deepEqual", "Write `deepEqual(a, b)`: structural equality for primitives, arrays, plain objects and Date "+ "objects; NaN equals NaN; key order does not matter.",+ "assert.ok(deepEqual({a: [1, {b: NaN}], c: new Date(5)}, {c: new Date(5), a: [1, {b: NaN}]}));\n"+ "assert.ok(!deepEqual({a: 1}, {a: 1, b: undefined}));\nassert.ok(!deepEqual([1, 2], [1, 2, 3]));\n"+ "assert.ok(!deepEqual(new Date(1), new Date(2)));\nassert.ok(deepEqual(null, null) && !deepEqual(null, {}));\n"+ "assert.ok(!deepEqual([1], {0: 1}));\n"),+ ("parseQuery", "Write `parseQuery(str)`: parses a URL query string (an optional leading '?') into an object; "+ "values are percent-decoded and '+' means space; a key that repeats becomes an array of its values; a key "+ "without '=' gets ''.",+ "assert.deepStrictEqual(parseQuery('?a=1&b=2&a=3&c=%20x+y&d'), {a: ['1','3'], b: '2', c: ' x y', d: ''});\n"+ "assert.deepStrictEqual(parseQuery(''), {});\n"),+ ("chunk", "Write `chunk(arr, n)`: splits an array into arrays of length n (the last may be shorter); throws "+ "RangeError when n < 1.",+ "assert.deepStrictEqual(chunk([1,2,3,4,5], 2), [[1,2],[3,4],[5]]);\nassert.deepStrictEqual(chunk([], 3), []);\n"+ "assert.throws(() => chunk([1], 0), RangeError);\n"),+]+++def js():+ node = shutil.which("node")+ for name, task, tests in JS:+ r = E.chat([{"role": "user", "content": task + "\n\nPlain JavaScript for Node.js, no modules or exports: "+ "define the function at the top level. Reply with one ```javascript code block."}], "none", 4000)+ m = re.findall(r"```(?:javascript|js)?\s*\n(.*?)```", r.get("content", ""), re.S)+ code = max(m, key=len) if m else r.get("content", "")+ with tempfile.NamedTemporaryFile("w", suffix=".js", delete=False, encoding="utf-8") as f:+ f.write(code + "\nconst assert = require('assert');\n" + tests + "console.log('PASS');\n")+ p = subprocess.run([node, f.name], capture_output=True, text=True, timeout=20)+ ok = "PASS" in p.stdout+ OUT["js"].append({"task": name, "pass": ok, "err": (p.stderr.strip().splitlines() or [""])[0][:160], "wall": r.get("wall")})+ print(f"js {name:11} {'PASS' if ok else 'FAIL'} {r.get('wall')} s", flush=True)+ Path(f.name).unlink(missing_ok=True)+++SCHEMA = """CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT);+CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER, amount REAL, created TEXT);+INSERT INTO customers VALUES (1,'Ann'),(2,'Bob'),(3,'Cid'),(4,'Dee');+INSERT INTO orders VALUES (1,1,50,'2026-01-01'),(2,1,70,'2026-02-01'),(3,2,200,'2026-01-15'),(4,3,20,'2026-03-01'),+(5,3,30,'2026-01-20');"""+SQL = [+ ("Names of customers who have no orders, sorted by name. One column.", [("Dee",)]),+ ("The two customers with the highest total order amount: name and total, highest first.",+ [("Bob", 200.0), ("Ann", 120.0)]),+ ("For each customer who has orders: name and the amount of their most recent order (by created), sorted by name.",+ [("Ann", 70.0), ("Bob", 200.0), ("Cid", 20.0)]),+]+++def sql():+ for q, want in SQL:+ r = E.chat([{"role": "user", "content": "SQLite schema:\n" + SCHEMA.split("INSERT")[0] + "\n" + q ++ "\nReply with one ```sql code block holding a single SELECT statement."}], "none", 1500)+ m = re.findall(r"```(?:sql)?\s*\n(.*?)```", r.get("content", ""), re.S)+ stmt = (m[-1] if m else r.get("content", "")).strip()+ db = sqlite3.connect(":memory:")+ db.executescript(SCHEMA)+ try:+ got = [tuple(float(x) if isinstance(x, (int, float)) else x for x in row) for row in db.execute(stmt)]+ ok, err = got == want, ""+ except sqlite3.Error as e:+ got, ok, err = None, False, str(e)[:120]+ OUT["sql"].append({"q": q[:60], "pass": ok, "got": got, "err": err})+ print(f"sql {'PASS' if ok else 'FAIL'} {q[:50]!r} {got} {err}", flush=True)+++REGEX = [+ ("an IPv4 address in dotted decimal, each part 0-255 (no leading zeros except '0' itself)",+ ["0.0.0.0", "255.255.255.255", "192.168.1.1", "10.0.0.1"],+ ["256.1.1.1", "1.1.1", "1.1.1.1.1", "a.b.c.d", "1.1.1.", "999.0.0.1", "01.1.1.1"]),+ ("a CSS hex color: '#' followed by exactly 3 or exactly 6 hex digits",+ ["#fff", "#FFFFFF", "#a1B2c3"], ["fff", "#ffff", "#ggg", "#12345", "#1234567"]),+ ("a date YYYY-MM-DD with month 01-12 and day 01-31 (no per-month day check)",+ ["2026-10-03", "1999-01-31", "2000-12-01"],+ ["2026-13-01", "2026-00-10", "2026-10-32", "2026-1-1", "26-10-03", "2026-10-00"]),+]+++def regex():+ for what, good, bad in REGEX:+ r = E.chat([{"role": "user", "content": f"Give a Python regular expression for re.fullmatch that matches {what}. "+ "Reply with only the pattern on one line inside single backticks."}], "none", 800)+ m = re.findall(r"`([^`\n]+)`", r.get("content", ""))+ pat = m[-1] if m else r.get("content", "").strip()+ try:+ ok = all(re.fullmatch(pat, g) for g in good) and not any(re.fullmatch(pat, b) for b in bad)+ except re.error:+ ok = False+ OUT["regex"].append({"what": what[:40], "pass": ok, "pattern": pat})+ print(f"regex {'PASS' if ok else 'FAIL'} {what[:35]!r} {pat}", flush=True)+++# ------------------------------------------------------------------------------------------------ agent loop+PRICING_BUG = '''def discount(total):+ """10% off for totals of 100 or more, 20% off for 500 or more."""+ if total > 500:+ return total * 0.2+ if total > 100:+ return total * 0.1+ return 0.0+++def tax(amount, rate=0.2):+ return round(amount * rate, 2)+'''+CART = '''from pricing import discount, tax+++class Cart:+ def __init__(self):+ self.items = []++ def add(self, name, price, qty=1):+ self.items.append((name, price, qty))++ def subtotal(self):+ return sum(%s for _, price, qty in self.items)++ def total(self):+ sub = self.subtotal()+ net = sub - discount(sub)+ return round(net + tax(net), 2)+'''+TESTS = '''import unittest+from cart import Cart+++class T(unittest.TestCase):+ def test_qty(self):+ c = Cart(); c.add('pen', 2.5, 4); self.assertEqual(c.subtotal(), 10.0)++ def test_no_discount(self):+ c = Cart(); c.add('book', 50); self.assertEqual(c.total(), 60.0)++ def test_discount_at_100(self):+ c = Cart(); c.add('lamp', 100); self.assertEqual(c.total(), 108.0)++ def test_discount_at_500(self):+ c = Cart(); c.add('tv', 250, 2); self.assertEqual(c.total(), 480.0)+++if __name__ == '__main__':+ unittest.main()+'''+HIDDEN_B = '''from cart import Cart+import coupons+c = Cart(); c.add('a', 10); c.add('b', 5); c.add('a', 1); assert c.remove('a') == 2 and c.subtotal() == 5+c = Cart(); c.add('book', 50); c.apply_coupon('SAVE5'); assert c.total() == 54.0, c.total()+c.apply_coupon('SAVE20'); assert c.total() == 36.0, c.total()+try:+ c.apply_coupon('NOPE'); raise AssertionError('unknown code')+except ValueError:+ pass+c = Cart(); c.add('x', 3); c.apply_coupon('SAVE20'); assert c.total() == 0.0+assert coupons.COUPONS['SAVE5'] == 5.0+print('PASS')+'''+AGENT_TOOLS = [+ {"type": "function", "function": {"name": "list_files", "description": "List the project's files.",+ "parameters": {"type": "object", "properties": {}}}},+ {"type": "function", "function": {"name": "read_file", "description": "Read a project file.",+ "parameters": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}}},+ {"type": "function", "function": {"name": "write_file", "description": "Write (replace) a project file.",+ "parameters": {"type": "object", "properties": {"path": {"type": "string"}, "content": {"type": "string"}},+ "required": ["path", "content"]}}},+ {"type": "function", "function": {"name": "run_tests", "description": "Run the project's unit tests.",+ "parameters": {"type": "object", "properties": {}}}},+]+++def run_py(root, args):+ p = subprocess.run([sys.executable, *args], cwd=root, capture_output=True, text=True, timeout=30)+ return p.returncode, (p.stdout + p.stderr)[-1500:]+++def agent_run(label, files, task, effort, check):+ root = Path(tempfile.mkdtemp(prefix="strata-agent-"))+ for n, c in files.items():+ (root / n).write_text(c, encoding="utf-8")+ msgs = [{"role": "system", "content": "You are a coding agent working in a small Python project. Use the tools "+ "to inspect and change files and to run the tests. When the task is done, reply with DONE."},+ {"role": "user", "content": task}]+ steps = calls = 0+ total_wall = 0.0+ for steps in range(1, 26):+ r = E.chat(msgs, effort, 6000, tools=AGENT_TOOLS)+ total_wall += r.get("wall", 0)+ if "error" in r:+ break+ tc = r.get("tool_calls") or []+ msgs.append({"role": "assistant", "content": r["content"], **({"tool_calls": tc} if tc else {})})+ if not tc:+ break+ for c in tc:+ calls += 1+ try:+ a = json.loads(c["function"]["arguments"] or "{}")+ except ValueError:+ a = None+ name = c["function"]["name"]+ if a is None:+ res = "error: arguments are not valid JSON"+ elif name == "list_files":+ res = "\n".join(sorted(p.name for p in root.iterdir() if p.is_file()))+ elif name in ("read_file", "write_file"):+ p = (root / str(a.get("path", ""))).resolve()+ if root.resolve() not in p.parents:+ res = "error: path outside the project"+ elif name == "read_file":+ res = p.read_text(encoding="utf-8") if p.exists() else "error: no such file"+ else:+ p.write_text(str(a.get("content", "")), encoding="utf-8")+ res = "written"+ elif name == "run_tests":+ res = run_py(root, ["-m", "unittest", "-q"])[1]+ else:+ res = "error: unknown tool"+ msgs.append({"role": "tool", "tool_call_id": c.get("id", "call"), "content": res})+ ok, note = check(root)+ shutil.rmtree(root, ignore_errors=True)+ OUT["agent"].append({"scenario": label, "effort": effort, "pass": ok, "note": note, "turns": steps,+ "tool_calls": calls, "wall": round(total_wall, 1)})+ print(f"agent {label:8} {effort:6} {'PASS' if ok else 'FAIL'} {steps} turns, {calls} tool calls, {total_wall:.0f} s {note}", flush=True)+++def agent():+ def check_a(root):+ rc, out = run_py(root, ["-m", "unittest", "-q"])+ same = (root / "test_cart.py").read_text(encoding="utf-8") == TESTS+ return rc == 0 and same, ("" if rc == 0 else out.strip().splitlines()[-1][:120]) + ("" if same else " tests modified")++ def check_b(root):+ (root / "_hidden.py").write_text(HIDDEN_B, encoding="utf-8")+ rc1, out1 = run_py(root, ["_hidden.py"])+ rc2, out2 = run_py(root, ["-m", "unittest", "-q"])+ added = (root / "test_cart.py").read_text(encoding="utf-8").count("def test_") > 4+ note = ("" if rc1 == 0 else "hidden: " + out1.strip().splitlines()[-1][:100]) + \+ ("" if rc2 == 0 else " own tests fail") + ("" if added else " no tests added")+ return rc1 == 0 and rc2 == 0 and added, note++ bug = {"pricing.py": PRICING_BUG, "cart.py": CART % "price", "test_cart.py": TESTS}+ good = {"pricing.py": PRICING_BUG.replace("> 500", ">= 500").replace("> 100", ">= 100"),+ "cart.py": CART % "price * qty", "test_cart.py": TESTS}+ feat = ("Add two things to Cart. 1) `remove(name)`: removes every line with that name and returns how many lines "+ "were removed. 2) `apply_coupon(code)`: coupon codes live in a new module coupons.py as "+ "COUPONS = {'SAVE5': 5.0, 'SAVE20': 20.0}; a valid coupon subtracts its value from the net amount (after "+ "the discount, before tax), never below 0; an unknown code raises ValueError; only one coupon applies, "+ "the latest one. Add tests for both to test_cart.py and make all tests pass.")+ for effort in ("none", "medium"):+ agent_run("bugfix", bug, "The unit tests fail. Find and fix the bugs in the code. Do not change the tests.",+ effort, check_a)+ agent_run("feature", good, feat, effort, check_b)+++# ------------------------------------------------------------------------------------------------ long-file QA+def qa():+ src = (HERE.parent / "setup.py").read_text(encoding="utf-8")+ msgs = [{"role": "user", "content": "Here is a Python file, setup.py:\n\n" + src ++ "\n\nI will ask short questions about it. Answer each in one short line. First: what is the value of "+ "the constant DESKTOP_RESERVE_MIB?"}]+ qs = [(None, "3072"),+ ("What is the default value of ROCM_VERSION (when the environment variable is not set)?", "7.10.0a20251120"),+ ("What is the value of WIN_HIP_ASSET?", "strata-windows-x64-hip.zip"),+ ("What is the name of the function that compiles the CPU image encoder beside the HIP engine?", "build_vision_cpu"),+ ("What is the value of the MMPROJ constant?", "mmproj-Qwen3.8-Flash-Next-BF16.gguf"),+ ("Is there a function named install_vulkan_sdk in the file? Answer yes or no.", "no")]+ for q, want in qs:+ if q:+ msgs.append({"role": "user", "content": q})+ r = E.chat(msgs, "none", 300)+ a = r.get("content", r.get("error", ""))+ msgs.append({"role": "assistant", "content": a})+ ok = want.lower() in a.lower() and not (want == "no" and "yes" in a.lower())+ OUT["qa"].append({"want": want, "got": a[:160], "pass": ok, **{k: r.get(k) for k in ("prompt_n", "cache_n",+ "prompt_s", "tok_s")}})+ print(f"qa {'PASS' if ok else 'FAIL'} read {r.get('prompt_n')} tok in {r.get('prompt_s')} s (reused "+ f"{r.get('cache_n')}), {r.get('tok_s')} tok/s | want {want!r} got {a[:90]!r}", flush=True)+++def longgen():+ r = E.chat([{"role": "user", "content": "Write a complete single-file Python command-line todo app, todo.py, "+ "using argparse and a todo.json file in the current directory. Commands: `add <text>`, `list`, "+ "`done <id>`, `remove <id>`, `clear-done`, `stats`. Ids are stable integers. `list` prints one line "+ "per item with its id, a [x] or [ ] mark and the text, and supports `--all` / `--pending` / `--done` "+ "filters. Handle a missing or corrupt todo.json. Include docstrings and type hints. Reply with one "+ "```python code block."}], "none", 8000)+ root = Path(tempfile.mkdtemp(prefix="strata-todo-"))+ (root / "todo.py").write_text(E.extract_code(r.get("content", "")), encoding="utf-8")+ rc1, _ = run_py(root, ["todo.py", "add", "buy milk"])+ rc2, _ = run_py(root, ["todo.py", "add", "write report"])+ rc3, _ = run_py(root, ["todo.py", "done", "1"])+ rc4, out = run_py(root, ["todo.py", "list", "--all"])+ ok = rc1 == rc2 == rc3 == rc4 == 0 and "buy milk" in out and "write report" in out and "[x]" in out and "[ ]" in out+ shutil.rmtree(root, ignore_errors=True)+ OUT["longgen"].append({"pass": ok, **{k: r.get(k) for k in ("wall", "out_tokens", "tok_s", "finish")}, "list": out[:200]})+ print(f"longgen {'PASS' if ok else 'FAIL'} {r.get('out_tokens')} tok in {r.get('wall')} s ({r.get('tok_s')} tok/s) | {out[:120]!r}", flush=True)+++if __name__ == "__main__":+ funcs = {"hard": hard, "js": js, "sql": sql, "regex": regex, "agent": agent, "qa": qa, "longgen": longgen}+ for name in sys.argv[1:] or ["js", "sql", "regex", "longgen", "agent", "qa", "hard"]:+ try:+ funcs[name]()+ except Exception as e: # one broken section must not lose the others+ print(f"{name} CRASHED {type(e).__name__}: {e}", flush=True)+ # RESULTS2: another file name, so that a run for another model or engine keeps the earlier results+ (HERE / __import__("os").environ.get("RESULTS2", "results2.json")).write_text(+ json.dumps(OUT, ensure_ascii=False, indent=1), encoding="utf-8")+ print("DONE", flush=True)