Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

README: short front page with the three models, line charts and contributors; detail moved to doc/

YanissAmz89888d481d10
diff --git a/README.md b/README.md
index a85cbe8..bb3a33d 100644
--- a/README.md
+++ b/README.md
@@ -1,109 +1,63 @@
-<p align="center"><img src="assets/yamz-banner.svg" alt="Yamz" width="720"></p>
+<p align="center"><img src="assets/yamz-banner.svg" alt="Yamz" width="640"></p>
-# Kyojin
+<h1 align="center">Kyojin</h1>
+<p align="center"><b>Large language models on an AMD Strix Halo mini PC.</b><br>
+An inference engine built on <a href="https://github.com/turboderp-org/exllamav3">ExLlamaV3</a>, with speculative decoding, for 100 GB-class models in 128 GB.</p>
-Kyojin is the Yamz inference engine for AMD Strix Halo, built on [ExLlamaV3](https://github.com/turboderp-org/exllamav3) by turboderp. It adds a ROCm decode and prefill path for the AMD Ryzen AI Max+ 395 (Radeon 8060S, gfx1151, unified memory) and serving for two large MoE models with multi-token prediction.
+<p align="center">
+<a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/licence-MIT-3FD0B0"></a>
+<img alt="gfx1151" src="https://img.shields.io/badge/AMD-gfx1151%20%7C%20ROCm%207-9C8CFF">
+<img alt="Python" src="https://img.shields.io/badge/python-3.12-6F7F9A">
+<a href="https://huggingface.co/yamz-labs"><img alt="Hugging Face" src="https://img.shields.io/badge/weights-Hugging%20Face-F0B04A"></a>
+<a href="https://x.com/YamzLabs"><img alt="X" src="https://img.shields.io/badge/news-%40YamzLabs-101014"></a>
+</p>
-The AMD work starts from [vcruz305/exllamav3-amd](https://github.com/vcruz305/exllamav3-amd) (first gfx1151 port) and [sdougbrown/exllamav3](https://github.com/sdougbrown/exllamav3) (ROCm decode path for gfx12). Full credits are [below](#credits-and-licence).
+<table align="center">
+<tr><th align="left">Model</th><th>Pack</th><th>Prefill</th><th>Speculative decode</th></tr>
+<tr><td><b>Qwen3.8-Flash-Next</b></td><td align="right">95 GB</td><td align="right">1494 at 8K</td><td align="right"><b>44.5 to 59.1</b></td></tr>
+<tr><td><b>GLM-5.3-Flash</b></td><td align="right">99.73 GB</td><td align="right">584 at 14K</td><td align="right"><b>27.6 to 30.3</b></td></tr>
+<tr><td><b>MiMo-V2.6-Flash</b></td><td align="right">105.8 GB</td><td align="right">812 at 8K</td><td align="right"><b>29.1 to 38.9</b></td></tr>
+</table>
-The two models:
+<p align="center"><sub>Tokens per second on one Ryzen AI Max+ 395 with 128 GB. Prefill at the context shown in each cell, speculative decode across chat, prose and code prompts. Method, sources and full tables: <a href="doc/benchmarks.md">doc/benchmarks.md</a>.</sub></p>
-- GLM-5.3-Flash (`glm_moe_dsa`: MLA attention, sparse indexer, MTP)
-- MiMo-V2.6-Flash (`mimo_v2`, DFlash drafter)
+<p align="center">
+<img src="doc/img/prefill.svg" alt="Prefill speed against context length" width="49%">
+<img src="doc/img/decode.svg" alt="Speculative decode speed by kind of text" width="49%">
+</p>
-The CUDA paths of upstream are kept. AMD additions sit behind `USE_ROCM` and architecture guards. This repository holds the engine, the serving scripts and the benchmark harnesses. The quantisation pipeline that produced the model packs is not part of it.
+These are first versions. Speed, context length and model support keep improving.
-Measured on one Strix Halo machine: GLM-5.3-Flash prefills at 546 to 584 tok/s (3.5K to 64K context) and decodes at 26 to 30 tok/s with MTP; MiMo-V2.6-Flash decodes at 32 to 44 tok/s with speculative decoding on (29 tok/s plain) and prefills at about 650 tok/s (numbers and sources below). Both models run in 128 GB.
+## Contributors
-Weights: [Yamz on Hugging Face](https://huggingface.co/yamz-labs) - `yamz-labs/GLM-5.3-Flash-EXL3-Yamz`, `yamz-labs/MiMo-V2.6-Flash-MOPD-EXL3-Yamz`.
+Thank you to everyone who tests Kyojin on their own machine and writes precise reports.
-## Quickstart (Strix Halo, ROCm)
-Requirements: Linux (Ubuntu/Debian tested), a gfx1151 machine with 128 GB, Python 3.12, `gcc`, a ROCm 7 `libhsa-runtime64.so.1` (the PyTorch copy segfaults on gfx1151 and Ubuntu's own `libhsa-runtime64-1` is ROCm 5.7, too old; `tools/strix_halo/env.sh` finds the one inside the SDK wheel below first, then /opt/rocm, or take `EXL3_HSA_LIB=<path>`), ROCm 7.0 or newer (ROCm 6.4 has no gfx1151 code), a ROCm build of PyTorch for gfx1151, and a ROCm SDK devel tree with the `hipsparse/` and `thrust/` headers (the `rocm-sdk-devel` wheel).
+- [@felladrin](https://github.com/felladrin): pull requests for the GLM start-up, the GPU target lookup, the bench tool tests, the troubleshooting page, `--sessions` in the Qwen server and `tools/bench.sh --json`; bug reports, an independent benchmark and issue triage.
+- [@nobert](https://github.com/nobert): the Prometheus `/metrics` endpoint, merged for GLM and MiMo.
+- [@morrisfamily](https://github.com/morrisfamily): benchmark report on a BOSGAME Beyond-Max.
+- [@ChrisC381](https://github.com/ChrisC381): reported the GLM difference between paired jobs.
+- [@dturini12](https://github.com/dturini12): reported streaming without `finish_reason`; fixed and confirmed.
+- [@mostlygeek](https://github.com/mostlygeek): proposal for a container setup.
-```bash
-git clone https://github.com/Yamz-Labs/kyojin && cd kyojin
-python3 -m venv .venv && source .venv/bin/activate
-# 1. ROCm torch + SDK first (AMD gfx1151 wheels; plain `pip install torch` gives a CUDA/CPU build that cannot run here):
-pip install --pre torch rocm-sdk-devel --index-url https://rocm.nightlies.amd.com/v2/gfx1151/
-pip install -r requirements.txt
-rocm-sdk init # expands the devel headers (about 12 GB on disk)
-export EXL3_ROCM_SDK=$(rocm-sdk path --root) # or the path of your own devel tree
-source tools/strix_halo/env.sh # run from the repository root; sets LD_PRELOAD and PYTHONPATH (torch needs it to import)
-./build.sh # compiles the extension for gfx1151 into the repo root (exllamav3_ext*.so)
-bash tools/strix_halo/env.sh --check # prints versions, runs a small GPU matmul (needs a free GPU)
-hf download yamz-labs/GLM-5.3-Flash-EXL3-Yamz --local-dir ./glm-pack
-python tools/glm/serve.py --model ./glm-pack --port 8000 -c 131072 --num-draft 2
-curl http://localhost:8000/v1/models
-```
-In every new shell, before serving: activate the venv, run `export EXL3_ROCM_SDK=$(rocm-sdk path --root)` again, then `source tools/strix_halo/env.sh`. Without the export, `env.sh` falls back to a system ROCm that may not match the wheel (`undefined symbol: hsa_ext_image_create_v2`).
-If a step fails, see [doc/troubleshooting.md](doc/troubleshooting.md).
-Status: build and MiMo serving were verified from a fresh clone on a second Strix Halo machine (build in 8 to 10 minutes). Both published packs were checked there against `SHA256SUMS` and served (one chat request each); `env.sh --check` has not been run there yet. The first request after a build is slow while the kernels warm up.
-
-First GLM launch: the server tunes its dense GEMM kernels before it opens the port. This takes about 10 minutes, and the port stays closed during that time (the log prints a progress line every 30 seconds). The next one or two launches can repeat it for the shapes still missing; later launches start fast.
-
-GLM reasons at maximum effort by default. With a small `max_tokens`, the reasoning can use the whole budget: `content` is then empty and `finish_reason` is `length`. Send `"reasoning_effort": "low"` in the request (or start the server with `--default-reasoning-effort low`), or allow at least 1000 tokens. The server defaults to greedy sampling when a request gives no temperature; set the sampling values of the model card in your client, or with `--default-temperature` and `--default-top-p`.
-
-GLM: the pack ships `mtp_eh_proj.st`, an unquantized MTP `eh_proj` (64 MiB). The server loads it automatically from the model folder; it raises draft acceptance and decode speed (26.7 -> 31.6 tok/s greedy on the card protocol). Details in `tools/glm/SERVE.md`.
-
-Memory: GLM at `-c 131072` leaves about 10 GiB free on a 128 GB machine. Close browsers and other large processes first, or use a smaller `-c`.
-
-MiMo: `hf download yamz-labs/MiMo-V2.6-Flash-MOPD-EXL3-Yamz --local-dir ./mimo-pack`, then `python tools/mimo/serve.py --model ./mimo-pack --port 8000 -c 131072`. Speculative decoding (DFlash, 4 bpw drafter, confidence-truncated drafts) is on by default: the server uses the pack's `drafter/` directory (or `$MIMO_DRAFTER`, or `--drafter <dir>`). Without a drafter it logs one line and decodes plain. Set `MIMO_SPEC=0` in the lane script (`tools/lanes/serve_mimo.sh`) or pass `--no-dflash` to `serve.py` for plain decode. Greedy output under speculation is token-identical to plain decode (exact verify arithmetic). `EXL3_MIMO_LOSSLESS=0` selects a slightly faster verify that is not token-identical: near-tied logits can flip. A loaded drafter costs 2 to 4 % prefill. Details: `tools/mimo/SERVE.md`.
+## Quickstart
-Qwen3.8-Flash-Next (125B MoE, 6B active): `hf download yamz-labs/Qwen3.8-Flash-Next-EXL3-Yamz --local-dir ./qwen-pack`, then `python tools/qwen/serve.py --model ./qwen-pack --port 8000 -c 131072`. Speculative decoding is on by default and returns the same tokens as plain decoding. The pack needs about 113 GiB of the 128 GB; start to ready takes about 90 s once the pack is in the page cache; the very first start reads 95 GB from disk and can take 7 to 8 minutes. Details: `tools/qwen/SERVE.md`.
+Install ROCm torch and build once ([doc/install.md](doc/install.md)), then:
-## Measured numbers
-One machine: Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB LPDDR5X, ROCm. Other GPUs are untested.
-
-| Model / pack | Context | Prefill tok/s | Decode tok/s | Source |
-|---|---|---|---|---|
-| GLM-5.3-Flash, 82 GB pack, MTP 2 | 4K / 16K / 64K / 128K | 644.6 / 620.9 / 617.7 / 608.2 | 32.1 prose, 33.8 chat, 35.8 code; 38.9 chat at 128K context | run |
-| GLM-5.3-Flash (99.7 GB pack), MTP 2, `-c 524288`, raw server | 3.7K / 14.2K | 611.9 / 585.0 | 27.1 default sampling, 28.1 greedy | run, single runs |
-| same, through an OpenAI-style proxy | 3.7K / 14.4K | 590.0 / 589.8 | 29.1 default sampling, 28.1 greedy | run, single runs |
-| GLM-5.3-Flash, 99 GB pack, MTP 2, `-c 131072` | 24K | 609.0 | 28.1 (28.12, 28.09) | run, same harness as the next row |
-| GLM-5.3-Flash, 82 GB pack, hook off, today's engine, `-c 131072`, client temperature 0, mean of 3 | 3.5K / 14K | 661 / 645 | 32.0 prose, 33.6 chat, 35.7 code | run, second machine (same CPU) |
-| GLM-5.3-Flash (99.7 GB), hook on + agent-lane flags, `-c 98304`, prefill mean of 3, decode mean of 6 | 3.5K / 14K / 64K | 580 / 584 / 546 | 29.0 / 30.3 / 27.6 at temperature 0; 26.0 / 28.5 / 26.4 at temperature 1.0, top-p 0.95 | run |
-| MiMo-V2.6-Flash-MOPD, 105 GB pack, speculative decoding on (default), 4 bpw drafter (702 MB), `-c 32768`, client temperature 0, decode medians of 6 runs over two loads, 128 tokens | - | 32.1 prose, 34.8 chat, 44.3 code (plain: 28.9 on all three, 1.11x / 1.21x / 1.53x) | run, public tree |
-| MiMo-V2.6-Flash-MOPD, 105 GB pack, plain decode (no draft), 32K window, client temperature 0 | 4.1K / 23.7K | 594 / 613 | 25.2 to 27.8 | run, single runs |
-
-**First launch.** The engine tunes its dense GEMM kernels on the first requests and keeps the result in a cache. On a fresh install the first GLM prefills run at 200 to 240 tok/s; speed reaches the figures above within a few requests and stays there on later launches.
-
-llama.cpp (ROCm, UD-IQ1_S 1.56 bpw, `-fa 1 -ub 2048`, no MTP), same machine: pp4096 197.9, pp16384 158.3, tg128 16.74, tg at 64K 7.19 tok/s. Coarser quant: engine and format are compared together.
-
-Quality against the official FP8 weights (129 held-out rows): see the model cards.
-
-## Share your numbers
-Start a server from the quickstart, then run `tools/bench.sh` (standard library only, `--base` and `--model` select the server). It measures prefill on a prompt of about 3.5K tokens and decode on prose, chat and code with the prompts behind the table above, and prints one Markdown block with your hardware and versions (`--json` adds the same numbers, with every run, as a JSON block).
-Paste it into a [benchmark report](https://github.com/Yamz-Labs/kyojin/issues/new?template=benchmark_report.yml). Results from other gfx1151 machines and other ROCm GPUs are the most useful contribution. See `CONTRIBUTING.md`.
-
-## Optional refusal hook
-The engine can project one fixed direction out of the residual stream at run time. It edits no weights and no quantised data. Off unless `EXL3_ABLIT_RUNTIME=/path/to/spec.json` is set or the model folder contains `uncensor_spec.json`.
-- Bundled spec: if `<model_dir>/uncensor_spec.json` exists (with `uncensor_direction.st` next to it, or `uncensor_spec.safetensors`), the engine applies it at load and logs ` -- ablit runtime: spec <path> active (bundled in the model directory)`. An explicit `EXL3_ABLIT_RUNTIME=<path>` wins. `EXL3_ABLIT_RUNTIME=off` or `--no-uncensor` (GLM and MiMo servers) disables it. A missing or malformed spec stops the load with an error that names the file.
-- The spec is a JSON file (`hidden`, `n_layers`, per-layer weights `attn_w[L]`, `mlp_w[L]`) plus a unit vector `r` in `spec.safetensors`.
-- After each attention and MLP block of layer L the output becomes `y - w_L * r * (r . y)`.
-- `EXL3_ABLIT_TORCH=1` forces the PyTorch path instead of the Triton kernel.
-- A direction fitted on refusals makes the model refuse less. Whoever uses a spec is responsible for it. This repository contains no spec file. Steering presets are published separately in the Yamz presets repository (https://github.com/yamz-labs/yamz-presets).
-- Code: `exllamav3/modules/ablit_runtime.py`. Test: `tests/test_ablit_runtime_cpu.py`, `tests/test_uncensor_bundled_cpu.py`.
-
-## Tests
```bash
-pip install pytest
-for t in tests/test_ablit_runtime_cpu.py tests/test_uncensor_bundled_cpu.py tools/glm/test_serve.py tools/mimo/test_serve.py tools/mimo/test_toolcalls.py; do PYTHONPATH=. pytest -q $t; done
+git clone https://github.com/Yamz-Labs/kyojin && cd kyojin
+hf download yamz-labs/Qwen3.8-Flash-Next-EXL3-Yamz --local-dir ./qwen-pack
+python tools/qwen/serve.py --model ./qwen-pack --port 8000 -c 131072
```
-Run each file separately because two files share a name (`test_serve.py`). These tests need no GPU and no built extension. GPU tests need a built extension and a free GPU.
-## Build on CUDA
-The CUDA build is the upstream one and is unchanged. Install a CUDA 12.4 or newer build of PyTorch, then `pip install -r requirements.txt && pip install .`. `README.upstream.md` has the full upstream guide (wheels, PyPI, uv, Windows, architecture list, conversion tool, examples). `README.strix-halo.md` has the kernel notes and benchmark harnesses.
+The server speaks the OpenAI API on port 8000. GLM and MiMo commands: [doc/models.md](doc/models.md).
-## Credits and licence
-ExLlamaV3 by turboderp (MIT, `LICENSE` unchanged). ROCm decode path for gfx12 from sdougbrown/exllamav3; first gfx1151 port from vcruz305/exllamav3-amd. `exllamav3/vendor/fla` is flash-linear-attention (MIT). GLM-5.3-Flash is by Z.ai, MiMo-V2.6-Flash by Xiaomi; check each base licence before redistributing weights. Additions: MIT. This project is not affiliated with Z.ai, Xiaomi or turboderp.
+## Read more
-## Thanks
-To [@felladrin](https://github.com/felladrin) for the first community contributions: CPU tests for the bench tool,
-the troubleshooting page, a faster GLM start, and field notes on running Kyojin in containers.
+- [Install and first launch](doc/install.md): requirements, build, per-shell setup, first-launch tuning
+- [Models](doc/models.md): Qwen, GLM and MiMo weights, serve commands, options
+- [Benchmarks](doc/benchmarks.md): how the figures are measured, where each comes from, full tables, share yours with `tools/bench.sh`
+- [Troubleshooting](doc/troubleshooting.md), [refusal hook](doc/refusal_hook.md), [development](doc/development.md), [credits and licence](doc/credits.md)
-To the people who test Kyojin on their own machines and take the time to write precise reports:
-[@felladrin](https://github.com/felladrin) (install, HIP runtime lookup, MiMo finish reason, client disconnects),
-[@dturini12](https://github.com/dturini12) (streaming API), [@morrisfamily](https://github.com/morrisfamily) (benchmarks),
-[@nobert](https://github.com/nobert) (metrics endpoint). Reports and pull requests are welcome.
+Reports and pull requests are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). Kernel notes: [README.strix-halo.md](README.strix-halo.md). Upstream guide: [README.upstream.md](README.upstream.md).
-News and benchmarks: [@YamzLabs on X](https://x.com/YamzLabs).
+MIT licence. Built on [ExLlamaV3](https://github.com/turboderp-org/exllamav3) by turboderp, with the first AMD ports by [vcruz305](https://github.com/vcruz305/exllamav3-amd) and [sdougbrown](https://github.com/sdougbrown/exllamav3): [full credits](doc/credits.md). News: [@YamzLabs on X](https://x.com/YamzLabs).
diff --git a/README.tmpl.md b/README.tmpl.md
new file mode 100644
index 0000000..f656bfb
--- /dev/null
+++ b/README.tmpl.md
@@ -0,0 +1,58 @@
+<p align="center"><img src="assets/yamz-banner.svg" alt="Yamz" width="640"></p>
+
+<h1 align="center">Kyojin</h1>
+<p align="center"><b>Large language models on an AMD Strix Halo mini PC.</b><br>
+An inference engine built on <a href="https://github.com/turboderp-org/exllamav3">ExLlamaV3</a>, with speculative decoding, for 100 GB-class models in 128 GB.</p>
+
+<p align="center">
+<a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/licence-MIT-3FD0B0"></a>
+<img alt="gfx1151" src="https://img.shields.io/badge/AMD-gfx1151%20%7C%20ROCm%207-9C8CFF">
+<img alt="Python" src="https://img.shields.io/badge/python-3.12-6F7F9A">
+<a href="https://huggingface.co/yamz-labs"><img alt="Hugging Face" src="https://img.shields.io/badge/weights-Hugging%20Face-F0B04A"></a>
+<a href="https://x.com/YamzLabs"><img alt="X" src="https://img.shields.io/badge/news-%40YamzLabs-101014"></a>
+</p>
+
+{{TABLE}}
+
+<p align="center"><sub>Tokens per second on one Ryzen AI Max+ 395 with 128 GB. Prefill at the context shown in each cell, speculative decode across chat, prose and code prompts. Method, sources and full tables: <a href="doc/benchmarks.md">doc/benchmarks.md</a>.</sub></p>
+
+<p align="center">
+<img src="doc/img/prefill.svg" alt="Prefill speed against context length" width="49%">
+<img src="doc/img/decode.svg" alt="Speculative decode speed by kind of text" width="49%">
+</p>
+
+These are first versions. Speed, context length and model support keep improving.
+
+## Contributors
+
+Thank you to everyone who tests Kyojin on their own machine and writes precise reports.
+
+- [@felladrin](https://github.com/felladrin): pull requests for the GLM start-up, the GPU target lookup, the bench tool tests, the troubleshooting page, `--sessions` in the Qwen server and `tools/bench.sh --json`; bug reports, an independent benchmark and issue triage.
+- [@nobert](https://github.com/nobert): the Prometheus `/metrics` endpoint, merged for GLM and MiMo.
+- [@morrisfamily](https://github.com/morrisfamily): benchmark report on a BOSGAME Beyond-Max.
+- [@ChrisC381](https://github.com/ChrisC381): reported the GLM difference between paired jobs.
+- [@dturini12](https://github.com/dturini12): reported streaming without `finish_reason`; fixed and confirmed.
+- [@mostlygeek](https://github.com/mostlygeek): proposal for a container setup.
+
+## Quickstart
+
+Install ROCm torch and build once ([doc/install.md](doc/install.md)), then:
+
+```bash
+git clone https://github.com/Yamz-Labs/kyojin && cd kyojin
+hf download yamz-labs/Qwen3.8-Flash-Next-EXL3-Yamz --local-dir ./qwen-pack
+python tools/qwen/serve.py --model ./qwen-pack --port 8000 -c 131072
+```
+
+The server speaks the OpenAI API on port 8000. GLM and MiMo commands: [doc/models.md](doc/models.md).
+
+## Read more
+
+- [Install and first launch](doc/install.md): requirements, build, per-shell setup, first-launch tuning
+- [Models](doc/models.md): Qwen, GLM and MiMo weights, serve commands, options
+- [Benchmarks](doc/benchmarks.md): how the figures are measured, where each comes from, full tables, share yours with `tools/bench.sh`
+- [Troubleshooting](doc/troubleshooting.md), [refusal hook](doc/refusal_hook.md), [development](doc/development.md), [credits and licence](doc/credits.md)
+
+Reports and pull requests are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). Kernel notes: [README.strix-halo.md](README.strix-halo.md). Upstream guide: [README.upstream.md](README.upstream.md).
+
+MIT licence. Built on [ExLlamaV3](https://github.com/turboderp-org/exllamav3) by turboderp, with the first AMD ports by [vcruz305](https://github.com/vcruz305/exllamav3-amd) and [sdougbrown](https://github.com/sdougbrown/exllamav3): [full credits](doc/credits.md). News: [@YamzLabs on X](https://x.com/YamzLabs).
diff --git a/doc/benchmarks.md b/doc/benchmarks.md
new file mode 100644
index 0000000..4523f96
--- /dev/null
+++ b/doc/benchmarks.md
@@ -0,0 +1,73 @@
+# Benchmarks
+
+## How these figures are measured
+
+One machine: Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB LPDDR5X, ROCm. Other GPUs are untested.
+
+The Qwen and MiMo figures on the front page come from a run set up like yours (GLM: see below):
+
+- the public code at the commit named in `doc/figures.json`, built from the README install;
+- an empty home directory, the published packs downloaded from the hub, the default environment (no private flags);
+- greedy decoding, thinking off, the four card prompts for each of chat, prose and code, 256 tokens, median of 3 repetitions (`tools/bench.sh` runs the same prompts);
+- prefill and decode by context: cold prompts of 8K and 32K tokens (Qwen also 64K, 128K, 256K), a long essay request; prefill is the engine-reported prompt speed, decode the speculative decode speed over the reply. GLM and MiMo: median of 3 requests after a warm-up request, speed from the server timing; Qwen: one request per depth, essay of 256 tokens, as `ladder.py --chat`;
+- speculative decode is the default server mode and returns the same tokens as plain decode.
+- the server log of each run has no `fallback`, `disabled`, `unavailable`, `not tuned` or `No module` line.
+
+## Qwen3.8-Flash-Next and MiMo-V2.6-Flash
+
+Tokens per second; prefill by context, speculative decode by kind of text.
+
+| Model | Pack | Prefill 8K | Prefill 32K | Prefill 64K | Prefill 128K | Prefill 256K | Spec prose | Spec chat | Spec code |
+|---|---|---|---|---|---|---|---|---|---|
+| Qwen3.8-Flash-Next | 95 GB | 1494 | 1478 | 1457 | 1395 | 1277 | 44.5 | 49.8 | 59.1 |
+| MiMo-V2.6-Flash | 105.8 GB | 812 | 698 | - | - | - | 29.1 | 32.4 | 38.9 |
+
+
+## GLM-5.3-Flash
+
+The GLM figures were published before this page and are quoted as published (99.7 GB pack, MTP with 2 drafts, `-c 98304`, hook on with the agent-lane server flags, prefill mean of 3, decode mean of 6, temperature 0):
+
+| Context | Prefill tok/s | Decode tok/s |
+|---|---|---|
+| 3.5K | 580 | 29.0 |
+| 14K | 584 | 30.3 |
+| 64K | 546 | 27.6 |
+
+At temperature 1.0 and top-p 0.95 decode is 26.0 / 28.5 / 26.4 tok/s. The GLM figures were not re-run with the new-user recipe above, so they are left out of the by-text-kind decode chart (the chart needs chat, prose and code figures for the same pack).
+
+## Where each figure comes from
+
+- Qwen3.8-Flash-Next (V1.2) prefill (1494 / 1478 / 1457 / 1395 / 1277 tok/s at 8K / 32K / 64K / 128K / 256K) and speculative decode on the card prompts (49.8 chat, 44.5 prose, 59.1 code): runs with the recipe above, at the commit named in `doc/figures.json`. The model card on the hub still carries the earlier V1.1 figures.
+- MiMo-V2.6-Flash: the same recipe and commit.
+- GLM-5.3-Flash: the "Measured numbers" table of the previous README (kept below) and the Speed section of the hub card, `yamz-labs/GLM-5.3-Flash-EXL3-Yamz`.
+- Charts and the front-page table are built from `doc/figures.json` with `tools/make_charts.py` and `tools/make_readme_table.py`.
+
+Caveats, once: one machine, one OS image; prefill is the engine-reported prompt speed; contexts differ between models because each figure keeps the context at which it was published or measured. These are first versions and improvements are coming.
+
+**First launch.** The engine tunes its dense GEMM kernels on the first requests and keeps the result in a cache. On a fresh install the first GLM prefills run at 200 to 240 tok/s; speed reaches the figures above within a few requests and stays there on later launches.
+
+## Earlier runs (previous README, kept as published)
+
+One machine: Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB LPDDR5X, ROCm. Other GPUs are untested.
+
+| Model / pack | Context | Prefill tok/s | Decode tok/s | Source |
+|---|---|---|---|---|
+| GLM-5.3-Flash, 82 GB pack, MTP 2 | 4K / 16K / 64K / 128K | 644.6 / 620.9 / 617.7 / 608.2 | 32.1 prose, 33.8 chat, 35.8 code; 38.9 chat at 128K context | run |
+| GLM-5.3-Flash (99.7 GB pack), MTP 2, `-c 524288`, raw server | 3.7K / 14.2K | 611.9 / 585.0 | 27.1 default sampling, 28.1 greedy | run, single runs |
+| same, through an OpenAI-style proxy | 3.7K / 14.4K | 590.0 / 589.8 | 29.1 default sampling, 28.1 greedy | run, single runs |
+| GLM-5.3-Flash, 99 GB pack, MTP 2, `-c 131072` | 24K | 609.0 | 28.1 (28.12, 28.09) | run, same harness as the next row |
+| GLM-5.3-Flash, 82 GB pack, hook off, today's engine, `-c 131072`, client temperature 0, mean of 3 | 3.5K / 14K | 661 / 645 | 32.0 prose, 33.6 chat, 35.7 code | run, second machine (same CPU) |
+| GLM-5.3-Flash (99.7 GB), hook on + agent-lane flags, `-c 98304`, prefill mean of 3, decode mean of 6 | 3.5K / 14K / 64K | 580 / 584 / 546 | 29.0 / 30.3 / 27.6 at temperature 0; 26.0 / 28.5 / 26.4 at temperature 1.0, top-p 0.95 | run |
+| MiMo-V2.6-Flash-MOPD, 105 GB pack, speculative decoding on (default), 4 bpw drafter (702 MB), `-c 32768`, client temperature 0, decode medians of 6 runs over two loads, 128 tokens | - | 32.1 prose, 34.8 chat, 44.3 code (plain: 28.9 on all three, 1.11x / 1.21x / 1.53x) | run, public tree |
+| MiMo-V2.6-Flash-MOPD, 105 GB pack, plain decode (no draft), 32K window, client temperature 0 | 4.1K / 23.7K | 594 / 613 | 25.2 to 27.8 | run, single runs |
+
+## Other engines
+
+llama.cpp (ROCm, UD-IQ1_S 1.56 bpw, `-fa 1 -ub 2048`, no MTP), same machine: pp4096 197.9, pp16384 158.3, tg128 16.74, tg at 64K 7.19 tok/s. Coarser quant: engine and format are compared together.
+
+Quality against the official FP8 weights (129 held-out rows): see the model cards.
+
+## Share your numbers
+
+Start a server from the quickstart, then run `tools/bench.sh` (standard library only, `--base` and `--model` select the server). It measures prefill on a prompt of about 3.5K tokens and decode on prose, chat and code with the prompts behind the table above, and prints one Markdown block with your hardware and versions (`--json` adds the same numbers, with every run, as a JSON block).
+Paste it into a [benchmark report](https://github.com/Yamz-Labs/kyojin/issues/new?template=benchmark_report.yml). Results from other gfx1151 machines and other ROCm GPUs are the most useful contribution. See `CONTRIBUTING.md`.
diff --git a/doc/benchmarks.tmpl.md b/doc/benchmarks.tmpl.md
new file mode 100644
index 0000000..e749088
--- /dev/null
+++ b/doc/benchmarks.tmpl.md
@@ -0,0 +1,69 @@
+# Benchmarks
+
+## How these figures are measured
+
+One machine: Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB LPDDR5X, ROCm. Other GPUs are untested.
+
+The Qwen and MiMo figures on the front page come from a run set up like yours (GLM: see below):
+
+- the public code at the commit named in `doc/figures.json`, built from the README install;
+- an empty home directory, the published packs downloaded from the hub, the default environment (no private flags);
+- greedy decoding, thinking off, the four card prompts for each of chat, prose and code, 256 tokens, median of 3 repetitions (`tools/bench.sh` runs the same prompts);
+- prefill and decode by context: cold prompts of 8K and 32K tokens (Qwen also 64K, 128K, 256K), a long essay request; prefill is the engine-reported prompt speed, decode the speculative decode speed over the reply. GLM and MiMo: median of 3 requests after a warm-up request, speed from the server timing; Qwen: one request per depth, essay of 256 tokens, as `ladder.py --chat`;
+- speculative decode is the default server mode and returns the same tokens as plain decode.
+- the server log of each run has no `fallback`, `disabled`, `unavailable`, `not tuned` or `No module` line.
+
+## Qwen3.8-Flash-Next and MiMo-V2.6-Flash
+
+Tokens per second; prefill by context, speculative decode by kind of text.
+
+{{TABLE}}
+
+## GLM-5.3-Flash
+
+The GLM figures were published before this page and are quoted as published (99.7 GB pack, MTP with 2 drafts, `-c 98304`, hook on with the agent-lane server flags, prefill mean of 3, decode mean of 6, temperature 0):
+
+| Context | Prefill tok/s | Decode tok/s |
+|---|---|---|
+| 3.5K | 580 | 29.0 |
+| 14K | 584 | 30.3 |
+| 64K | 546 | 27.6 |
+
+At temperature 1.0 and top-p 0.95 decode is 26.0 / 28.5 / 26.4 tok/s. The GLM figures were not re-run with the new-user recipe above, so they are left out of the by-text-kind decode chart (the chart needs chat, prose and code figures for the same pack).
+
+## Where each figure comes from
+
+- Qwen3.8-Flash-Next (V1.2) prefill (1494 / 1478 / 1457 / 1395 / 1277 tok/s at 8K / 32K / 64K / 128K / 256K) and speculative decode on the card prompts (49.8 chat, 44.5 prose, 59.1 code): runs with the recipe above, at the commit named in `doc/figures.json`. The model card on the hub still carries the earlier V1.1 figures.
+- MiMo-V2.6-Flash: the same recipe and commit.
+- GLM-5.3-Flash: the "Measured numbers" table of the previous README (kept below) and the Speed section of the hub card, `yamz-labs/GLM-5.3-Flash-EXL3-Yamz`.
+- Charts and the front-page table are built from `doc/figures.json` with `tools/make_charts.py` and `tools/make_readme_table.py`.
+
+Caveats, once: one machine, one OS image; prefill is the engine-reported prompt speed; contexts differ between models because each figure keeps the context at which it was published or measured. These are first versions and improvements are coming.
+
+**First launch.** The engine tunes its dense GEMM kernels on the first requests and keeps the result in a cache. On a fresh install the first GLM prefills run at 200 to 240 tok/s; speed reaches the figures above within a few requests and stays there on later launches.
+
+## Earlier runs (previous README, kept as published)
+
+One machine: Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB LPDDR5X, ROCm. Other GPUs are untested.
+
+| Model / pack | Context | Prefill tok/s | Decode tok/s | Source |
+|---|---|---|---|---|
+| GLM-5.3-Flash, 82 GB pack, MTP 2 | 4K / 16K / 64K / 128K | 644.6 / 620.9 / 617.7 / 608.2 | 32.1 prose, 33.8 chat, 35.8 code; 38.9 chat at 128K context | run |
+| GLM-5.3-Flash (99.7 GB pack), MTP 2, `-c 524288`, raw server | 3.7K / 14.2K | 611.9 / 585.0 | 27.1 default sampling, 28.1 greedy | run, single runs |
+| same, through an OpenAI-style proxy | 3.7K / 14.4K | 590.0 / 589.8 | 29.1 default sampling, 28.1 greedy | run, single runs |
+| GLM-5.3-Flash, 99 GB pack, MTP 2, `-c 131072` | 24K | 609.0 | 28.1 (28.12, 28.09) | run, same harness as the next row |
+| GLM-5.3-Flash, 82 GB pack, hook off, today's engine, `-c 131072`, client temperature 0, mean of 3 | 3.5K / 14K | 661 / 645 | 32.0 prose, 33.6 chat, 35.7 code | run, second machine (same CPU) |
+| GLM-5.3-Flash (99.7 GB), hook on + agent-lane flags, `-c 98304`, prefill mean of 3, decode mean of 6 | 3.5K / 14K / 64K | 580 / 584 / 546 | 29.0 / 30.3 / 27.6 at temperature 0; 26.0 / 28.5 / 26.4 at temperature 1.0, top-p 0.95 | run |
+| MiMo-V2.6-Flash-MOPD, 105 GB pack, speculative decoding on (default), 4 bpw drafter (702 MB), `-c 32768`, client temperature 0, decode medians of 6 runs over two loads, 128 tokens | - | 32.1 prose, 34.8 chat, 44.3 code (plain: 28.9 on all three, 1.11x / 1.21x / 1.53x) | run, public tree |
+| MiMo-V2.6-Flash-MOPD, 105 GB pack, plain decode (no draft), 32K window, client temperature 0 | 4.1K / 23.7K | 594 / 613 | 25.2 to 27.8 | run, single runs |
+
+## Other engines
+
+llama.cpp (ROCm, UD-IQ1_S 1.56 bpw, `-fa 1 -ub 2048`, no MTP), same machine: pp4096 197.9, pp16384 158.3, tg128 16.74, tg at 64K 7.19 tok/s. Coarser quant: engine and format are compared together.
+
+Quality against the official FP8 weights (129 held-out rows): see the model cards.
+
+## Share your numbers
+
+Start a server from the quickstart, then run `tools/bench.sh` (standard library only, `--base` and `--model` select the server). It measures prefill on a prompt of about 3.5K tokens and decode on prose, chat and code with the prompts behind the table above, and prints one Markdown block with your hardware and versions (`--json` adds the same numbers, with every run, as a JSON block).
+Paste it into a [benchmark report](https://github.com/Yamz-Labs/kyojin/issues/new?template=benchmark_report.yml). Results from other gfx1151 machines and other ROCm GPUs are the most useful contribution. See `CONTRIBUTING.md`.
diff --git a/doc/credits.md b/doc/credits.md
new file mode 100644
index 0000000..30cbbcc
--- /dev/null
+++ b/doc/credits.md
@@ -0,0 +1,7 @@
+# Credits and licence
+
+ExLlamaV3 by turboderp (MIT, `LICENSE` unchanged). The AMD work starts from [vcruz305/exllamav3-amd](https://github.com/vcruz305/exllamav3-amd) (first gfx1151 port) and [sdougbrown/exllamav3](https://github.com/sdougbrown/exllamav3) (ROCm decode path for gfx12). `exllamav3/vendor/fla` is flash-linear-attention (MIT). GLM-5.3-Flash is by Z.ai, MiMo-V2.6-Flash by Xiaomi; check each base licence before redistributing weights. Additions: MIT. This project is not affiliated with Z.ai, Xiaomi or turboderp.
+
+The CUDA paths of upstream are kept; AMD additions sit behind `USE_ROCM` and architecture guards. This repository holds the engine, the serving scripts and the benchmark harnesses; the quantisation pipeline that produced the packs is not part of it.
+
+News and benchmarks: [@YamzLabs on X](https://x.com/YamzLabs).
diff --git a/doc/development.md b/doc/development.md
new file mode 100644
index 0000000..98b4611
--- /dev/null
+++ b/doc/development.md
@@ -0,0 +1,11 @@
+# Development: tests and CUDA build
+
+## Tests
+```bash
+pip install pytest
+for t in tests/test_ablit_runtime_cpu.py tests/test_uncensor_bundled_cpu.py tools/glm/test_serve.py tools/mimo/test_serve.py tools/mimo/test_toolcalls.py; do PYTHONPATH=. pytest -q $t; done
+```
+Run each file separately because two files share a name (`test_serve.py`). These tests need no GPU and no built extension. GPU tests need a built extension and a free GPU.
+
+## Build on CUDA
+The CUDA build is the upstream one and is unchanged. Install a CUDA 12.4 or newer build of PyTorch, then `pip install -r requirements.txt && pip install .`. `README.upstream.md` has the full upstream guide (wheels, PyPI, uv, Windows, architecture list, conversion tool, examples). `README.strix-halo.md` has the kernel notes and benchmark harnesses.
diff --git a/doc/figures.json b/doc/figures.json
new file mode 100644
index 0000000..c331338
--- /dev/null
+++ b/doc/figures.json
@@ -0,0 +1,86 @@
+{
+ "_comment": "Single source for the README table and the charts. null = not published/measured (left out of the chart). Qwen and MiMo: new-user recipe at commit a3ac00d. GLM: figures already published (see source). Rebuild: python3 tools/make_charts.py && python3 tools/make_readme_table.py",
+ "machine": "Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB",
+ "method": "new-user install, published packs, default environment, card prompts, greedy, engine-reported prefill",
+ "date": "2026-10-06",
+ "commit": "a3ac00d",
+ "models": [
+ {
+ "id": "qwen",
+ "name": "Qwen3.8-Flash-Next",
+ "pack_gb": 95.0,
+ "prefill": {
+ "8192": 1494,
+ "32768": 1478,
+ "65536": 1457,
+ "131072": 1395,
+ "262144": 1277
+ },
+ "spec": {
+ "prose": 44.5,
+ "chat": 49.8,
+ "code": 59.1
+ },
+ "decode": {
+ "8192": 43.4,
+ "32768": 40.2,
+ "65536": 36.7,
+ "131072": 31.9,
+ "262144": 20.4
+ },
+ "table": {
+ "prefill": "1494 at 8K",
+ "decode": "44.5 to 59.1"
+ }
+ },
+ {
+ "id": "glm",
+ "name": "GLM-5.3-Flash",
+ "pack_gb": 99.73,
+ "prefill": {
+ "3500": 580,
+ "14000": 584,
+ "65536": 546
+ },
+ "spec": {
+ "prose": null,
+ "chat": null,
+ "code": null
+ },
+ "decode": {
+ "3500": 29.0,
+ "14000": 30.3,
+ "65536": 27.6
+ },
+ "table": {
+ "prefill": "584 at 14K",
+ "decode": "27.6 to 30.3"
+ },
+ "source": "public README (Measured numbers, 99.7 GB row) and hub card yamz-labs/GLM-5.3-Flash-EXL3-Yamz, Speed section: -c 98304, hook on, agent-lane flags, MTP 2, prefill mean of 3, decode mean of 6 at temperature 0"
+ },
+ {
+ "id": "mimo",
+ "name": "MiMo-V2.6-Flash",
+ "pack_gb": 105.8,
+ "prefill": {
+ "8192": 812,
+ "32768": 698
+ },
+ "spec": {
+ "prose": 29.1,
+ "chat": 32.4,
+ "code": 38.9
+ },
+ "decode": {
+ "8192": 35.1,
+ "32768": 27.2
+ },
+ "table": {
+ "prefill": "812 at 8K",
+ "decode": "29.1 to 38.9"
+ }
+ }
+ ],
+ "headline_prompt": "chat",
+ "headline_prefill_ctx": "8192"
+}
\ No newline at end of file
diff --git a/doc/img/decode.svg b/doc/img/decode.svg
new file mode 100644
index 0000000..27848c3
--- /dev/null
+++ b/doc/img/decode.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="560" height="380" viewBox="0 0 560 380" font-family="'Ubuntu Sans','DejaVu Sans',Helvetica,Arial,sans-serif"><rect width="560" height="380" rx="16" fill="#18181F" stroke="#2E2E38"/><text x="26" y="44" fill="#F4F2EC" font-size="25" text-anchor="start" font-weight="700">Qwen decode: 44.5 to 59.1 tok/s</text><text x="26" y="70" fill="#9A98A3" font-size="16" text-anchor="start" font-weight="400">Higher is better.</text><line x1="64" x2="532" y1="316.0" y2="316.0" stroke="#2E2E38"/><text x="54" y="321.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">0</text><line x1="64" x2="532" y1="281.0" y2="281.0" stroke="#2E2E38"/><text x="54" y="286.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">20</text><line x1="64" x2="532" y1="246.0" y2="246.0" stroke="#2E2E38"/><text x="54" y="251.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">40</text><line x1="64" x2="532" y1="211.0" y2="211.0" stroke="#2E2E38"/><text x="54" y="216.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">60</text><line x1="64" x2="532" y1="176.0" y2="176.0" stroke="#2E2E38"/><text x="54" y="181.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">80</text><text x="132.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">Prose</text><text x="298.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">Chat</text><text x="464.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">Code</text><rect x="26" y="86" width="14" height="14" rx="3" fill="#9C8CFF"/><text x="48" y="98" fill="#F4F2EC" font-size="16" text-anchor="start" font-weight="400">Qwen3.8-Flash-Next</text><polyline fill="none" stroke="#9C8CFF" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="132.0,238.1 298.0,228.8 464.0,212.6"/><circle cx="132.0" cy="238.1" r="5.5" fill="#9C8CFF"/><text x="132.0" y="226.125" fill="#9C8CFF" font-size="16" text-anchor="middle" font-weight="700">44.5</text><circle cx="298.0" cy="228.8" r="5.5" fill="#9C8CFF"/><circle cx="464.0" cy="212.6" r="5.5" fill="#9C8CFF"/><text x="464.0" y="200.575" fill="#9C8CFF" font-size="16" text-anchor="middle" font-weight="700">59.1</text><rect x="26" y="108" width="14" height="14" rx="3" fill="#2E2E38"/><text x="48" y="120" fill="#9A98A3" font-size="16" text-anchor="start" font-weight="400">GLM-5.3-Flash (per context in the table)</text><rect x="26" y="130" width="14" height="14" rx="3" fill="#3FD0B0"/><text x="48" y="142" fill="#F4F2EC" font-size="16" text-anchor="start" font-weight="400">MiMo-V2.6-Flash</text><polyline fill="none" stroke="#3FD0B0" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="132.0,265.1 298.0,259.3 464.0,247.9"/><circle cx="132.0" cy="265.1" r="5.5" fill="#3FD0B0"/><text x="132.0" y="253.075" fill="#3FD0B0" font-size="16" text-anchor="middle" font-weight="700">29.1</text><circle cx="298.0" cy="259.3" r="5.5" fill="#3FD0B0"/><circle cx="464.0" cy="247.9" r="5.5" fill="#3FD0B0"/><text x="464.0" y="235.925" fill="#3FD0B0" font-size="16" text-anchor="middle" font-weight="700">38.9</text><text x="26" y="362" fill="#9A98A3" font-size="14" text-anchor="start" font-weight="400">Speculative decode by kind of text; same machine, 128 GB.</text></svg>
\ No newline at end of file
diff --git a/doc/img/prefill.svg b/doc/img/prefill.svg
new file mode 100644
index 0000000..14c93ac
--- /dev/null
+++ b/doc/img/prefill.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="560" height="380" viewBox="0 0 560 380" font-family="'Ubuntu Sans','DejaVu Sans',Helvetica,Arial,sans-serif"><rect width="560" height="380" rx="16" fill="#18181F" stroke="#2E2E38"/><text x="26" y="44" fill="#F4F2EC" font-size="25" text-anchor="start" font-weight="700">Qwen prefill: 1,277+ tok/s to 256K</text><text x="26" y="70" fill="#9A98A3" font-size="16" text-anchor="start" font-weight="400">Higher is better.</text><line x1="64" x2="532" y1="316.0" y2="316.0" stroke="#2E2E38"/><text x="54" y="321.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">0</text><line x1="64" x2="532" y1="281.0" y2="281.0" stroke="#2E2E38"/><text x="54" y="286.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">500</text><line x1="64" x2="532" y1="246.0" y2="246.0" stroke="#2E2E38"/><text x="54" y="251.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">1,000</text><line x1="64" x2="532" y1="211.0" y2="211.0" stroke="#2E2E38"/><text x="54" y="216.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">1,500</text><line x1="64" x2="532" y1="176.0" y2="176.0" stroke="#2E2E38"/><text x="54" y="181.0" fill="#9A98A3" font-size="15" text-anchor="end" font-weight="400">2,000</text><text x="76.42222552808543" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400"></text><text x="92.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">4K</text><text x="160.66666666666669" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">8K</text><text x="213.75555886141876" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400"></text><text x="229.33333333333334" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">16K</text><text x="298.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">32K</text><text x="366.6666666666667" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">64K</text><text x="435.3333333333333" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">128K</text><text x="504.0" y="344" fill="#9A98A3" font-size="16" text-anchor="middle" font-weight="400">256K</text><rect x="26" y="86" width="14" height="14" rx="3" fill="#9C8CFF"/><text x="48" y="98" fill="#F4F2EC" font-size="16" text-anchor="start" font-weight="400">Qwen3.8-Flash-Next</text><polyline fill="none" stroke="#9C8CFF" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="160.7,211.4 298.0,212.5 366.7,214.0 435.3,218.3 504.0,226.6"/><circle cx="160.7" cy="211.4" r="5.5" fill="#9C8CFF"/><text x="160.66666666666669" y="199.42000000000002" fill="#9C8CFF" font-size="16" text-anchor="middle" font-weight="700">1,494</text><circle cx="298.0" cy="212.5" r="5.5" fill="#9C8CFF"/><circle cx="366.7" cy="214.0" r="5.5" fill="#9C8CFF"/><circle cx="435.3" cy="218.3" r="5.5" fill="#9C8CFF"/><circle cx="504.0" cy="226.6" r="5.5" fill="#9C8CFF"/><text x="504.0" y="214.61" fill="#9C8CFF" font-size="16" text-anchor="middle" font-weight="700">1,277</text><rect x="26" y="108" width="14" height="14" rx="3" fill="#F0B04A"/><text x="48" y="120" fill="#F4F2EC" font-size="16" text-anchor="start" font-weight="400">GLM-5.3-Flash</text><polyline fill="none" stroke="#F0B04A" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="76.4,275.4 213.8,275.1 366.7,277.8"/><circle cx="76.4" cy="275.4" r="5.5" fill="#F0B04A"/><text x="76.42222552808543" y="263.4" fill="#F0B04A" font-size="16" text-anchor="middle" font-weight="700">580</text><circle cx="213.8" cy="275.1" r="5.5" fill="#F0B04A"/><circle cx="366.7" cy="277.8" r="5.5" fill="#F0B04A"/><text x="366.6666666666667" y="265.78" fill="#F0B04A" font-size="16" text-anchor="middle" font-weight="700">546</text><rect x="26" y="130" width="14" height="14" rx="3" fill="#3FD0B0"/><text x="48" y="142" fill="#F4F2EC" font-size="16" text-anchor="start" font-weight="400">MiMo-V2.6-Flash</text><polyline fill="none" stroke="#3FD0B0" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="160.7,259.2 298.0,267.1"/><circle cx="160.7" cy="259.2" r="5.5" fill="#3FD0B0"/><text x="160.66666666666669" y="247.15999999999997" fill="#3FD0B0" font-size="16" text-anchor="middle" font-weight="700">812</text><circle cx="298.0" cy="267.1" r="5.5" fill="#3FD0B0"/><text x="298.0" y="255.14" fill="#3FD0B0" font-size="16" text-anchor="middle" font-weight="700">698</text><text x="26" y="362" fill="#9A98A3" font-size="14" text-anchor="start" font-weight="400">Prompt tokens per second against context; one Ryzen AI Max+ 395, 128 GB.</text></svg>
\ No newline at end of file
diff --git a/doc/install.md b/doc/install.md
new file mode 100644
index 0000000..52460e8
--- /dev/null
+++ b/doc/install.md
@@ -0,0 +1,28 @@
+# Install and first launch (Strix Halo, ROCm)
+
+Requirements: Linux (Ubuntu/Debian tested), a gfx1151 machine with 128 GB, Python 3.12, `gcc`, a ROCm 7 `libhsa-runtime64.so.1` (the PyTorch copy segfaults on gfx1151 and Ubuntu's own `libhsa-runtime64-1` is ROCm 5.7, too old; `tools/strix_halo/env.sh` finds the one inside the SDK wheel below first, then /opt/rocm, or take `EXL3_HSA_LIB=<path>`), ROCm 7.0 or newer (ROCm 6.4 has no gfx1151 code), a ROCm build of PyTorch for gfx1151, and a ROCm SDK devel tree with the `hipsparse/` and `thrust/` headers (the `rocm-sdk-devel` wheel).
+
+```bash
+git clone https://github.com/Yamz-Labs/kyojin && cd kyojin
+python3 -m venv .venv && source .venv/bin/activate
+# 1. ROCm torch + SDK first (AMD gfx1151 wheels; plain `pip install torch` gives a CUDA/CPU build that cannot run here):
+pip install --pre torch rocm-sdk-devel --index-url https://rocm.nightlies.amd.com/v2/gfx1151/
+pip install -r requirements.txt
+rocm-sdk init # expands the devel headers (about 12 GB on disk)
+export EXL3_ROCM_SDK=$(rocm-sdk path --root) # or the path of your own devel tree
+source tools/strix_halo/env.sh # run from the repository root; sets LD_PRELOAD and PYTHONPATH (torch needs it to import)
+./build.sh # compiles the extension for gfx1151 into the repo root (exllamav3_ext*.so)
+bash tools/strix_halo/env.sh --check # prints versions, runs a small GPU matmul (needs a free GPU)
+hf download yamz-labs/GLM-5.3-Flash-EXL3-Yamz --local-dir ./glm-pack
+python tools/glm/serve.py --model ./glm-pack --port 8000 -c 131072 --num-draft 2
+curl http://localhost:8000/v1/models
+```
+In every new shell, before serving: activate the venv, run `export EXL3_ROCM_SDK=$(rocm-sdk path --root)` again, then `source tools/strix_halo/env.sh`. Without the export, `env.sh` falls back to a system ROCm that may not match the wheel (`undefined symbol: hsa_ext_image_create_v2`).
+If a step fails, see [troubleshooting.md](troubleshooting.md).
+Status: build and MiMo serving were verified from a fresh clone on a second Strix Halo machine (build in 8 to 10 minutes). Both published packs were checked there against `SHA256SUMS` and served (one chat request each); `env.sh --check` has not been run there yet. The first request after a build is slow while the kernels warm up.
+
+First GLM launch: the server tunes its dense GEMM kernels before it opens the port. This takes about 10 minutes, and the port stays closed during that time (the log prints a progress line every 30 seconds). The next one or two launches can repeat it for the shapes still missing; later launches start fast.
+
+Memory: GLM at `-c 131072` leaves about 10 GiB free on a 128 GB machine. Close browsers and other large processes first, or use a smaller `-c`.
+
+Problems: [troubleshooting.md](troubleshooting.md).
diff --git a/doc/models.md b/doc/models.md
new file mode 100644
index 0000000..b17017c
--- /dev/null
+++ b/doc/models.md
@@ -0,0 +1,32 @@
+# Models: weights, serve commands, options
+
+Weights: [Yamz on Hugging Face](https://huggingface.co/yamz-labs). Serve commands assume the venv, `EXL3_ROCM_SDK` and `env.sh` from [install.md](install.md).
+
+## Qwen3.8-Flash-Next
+
+`hf download yamz-labs/Qwen3.8-Flash-Next-EXL3-Yamz --local-dir ./qwen-pack`, then `python tools/qwen/serve.py --model ./qwen-pack --port 8000 -c 131072`. Speculative decoding is on by default and returns the same tokens as plain decoding. The pack needs about 113 GiB of the 128 GB; start to ready takes about 90 s once the pack is in the page cache; the very first start reads 95 GB from disk and can take 7 to 8 minutes. Details: `tools/qwen/SERVE.md`.
+
+## GLM-5.3-Flash
+
+Architecture: `glm_moe_dsa` (MLA attention, sparse indexer, MTP). Pack: `yamz-labs/GLM-5.3-Flash-EXL3-Yamz`.
+
+```bash
+hf download yamz-labs/GLM-5.3-Flash-EXL3-Yamz --local-dir ./glm-pack
+python tools/glm/serve.py --model ./glm-pack --port 8000 -c 131072 --num-draft 2
+```
+
+GLM reasons at maximum effort by default. With a small `max_tokens`, the reasoning can use the whole budget: `content` is then empty and `finish_reason` is `length`. Send `"reasoning_effort": "low"` in the request (or start the server with `--default-reasoning-effort low`), or allow at least 1000 tokens. The server defaults to greedy sampling when a request gives no temperature; set the sampling values of the model card in your client, or with `--default-temperature` and `--default-top-p`.
+
+GLM: the pack ships `mtp_eh_proj.st`, an unquantized MTP `eh_proj` (64 MiB). The server loads it automatically from the model folder; it raises draft acceptance and decode speed (26.7 -> 31.6 tok/s greedy on the card protocol). Details in `tools/glm/SERVE.md`.
+
+## MiMo-V2.6-Flash
+
+Architecture: `mimo_v2` with a DFlash drafter. Pack: `yamz-labs/MiMo-V2.6-Flash-MOPD-EXL3-Yamz`.
+
+`hf download yamz-labs/MiMo-V2.6-Flash-MOPD-EXL3-Yamz --local-dir ./mimo-pack`, then `python tools/mimo/serve.py --model ./mimo-pack --port 8000 -c 131072`. Speculative decoding (DFlash, 4 bpw drafter, confidence-truncated drafts) is on by default: the server uses the pack's `drafter/` directory (or `$MIMO_DRAFTER`, or `--drafter <dir>`). Without a drafter it logs one line and decodes plain. Set `MIMO_SPEC=0` in the lane script (`tools/lanes/serve_mimo.sh`) or pass `--no-dflash` to `serve.py` for plain decode. Greedy output under speculation is token-identical to plain decode (exact verify arithmetic). `EXL3_MIMO_LOSSLESS=0` selects a slightly faster verify that is not token-identical: near-tied logits can flip. A loaded drafter costs 2 to 4 % prefill. Details: `tools/mimo/SERVE.md`.
+
+## Options shared by the servers
+
+- `--sessions N` (Qwen server): decode up to N requests together; the default is 1. Details and measurements: `tools/qwen/SERVE.md`.
+- `GET /metrics` (Qwen, GLM and MiMo servers): Prometheus text with llama.cpp-style `llamacpp:*` names, for scraping. Details: the `SERVE.md` next to each server.
+- Measure your own machine with `tools/bench.sh` (`--json` adds the numbers as a JSON block); see [benchmarks.md](benchmarks.md).
diff --git a/doc/refusal_hook.md b/doc/refusal_hook.md
new file mode 100644
index 0000000..3b698f3
--- /dev/null
+++ b/doc/refusal_hook.md
@@ -0,0 +1,9 @@
+# Optional refusal hook
+
+The engine can project one fixed direction out of the residual stream at run time. It edits no weights and no quantised data. Off unless `EXL3_ABLIT_RUNTIME=/path/to/spec.json` is set or the model folder contains `uncensor_spec.json`.
+- Bundled spec: if `<model_dir>/uncensor_spec.json` exists (with `uncensor_direction.st` next to it, or `uncensor_spec.safetensors`), the engine applies it at load and logs ` -- ablit runtime: spec <path> active (bundled in the model directory)`. An explicit `EXL3_ABLIT_RUNTIME=<path>` wins. `EXL3_ABLIT_RUNTIME=off` or `--no-uncensor` (GLM and MiMo servers) disables it. A missing or malformed spec stops the load with an error that names the file.
+- The spec is a JSON file (`hidden`, `n_layers`, per-layer weights `attn_w[L]`, `mlp_w[L]`) plus a unit vector `r` in `spec.safetensors`.
+- After each attention and MLP block of layer L the output becomes `y - w_L * r * (r . y)`.
+- `EXL3_ABLIT_TORCH=1` forces the PyTorch path instead of the Triton kernel.
+- A direction fitted on refusals makes the model refuse less. Whoever uses a spec is responsible for it. This repository contains no spec file. Steering presets are published separately in the Yamz presets repository (https://github.com/yamz-labs/yamz-presets).
+- Code: `exllamav3/modules/ablit_runtime.py`. Test: `tests/test_ablit_runtime_cpu.py`, `tests/test_uncensor_bundled_cpu.py`.
diff --git a/tools/make_charts.py b/tools/make_charts.py
new file mode 100644
index 0000000..6d8115d
--- /dev/null
+++ b/tools/make_charts.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+"""Build the README charts (SVG, standard library only) from doc/figures.json.
+usage: python3 tools/make_charts.py [figures.json] [out_dir]
+Two line charts, one idea each: prefill against context length (log scale), and speculative decode by kind of text (higher is better).
+Dark card background, so they read the same on GitHub light and dark themes.
+A model without published values is listed in the legend and not drawn."""
+import json, sys, os
+root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+src = sys.argv[1] if len(sys.argv) > 1 else os.path.join(root, "doc", "figures.json")
+out = sys.argv[2] if len(sys.argv) > 2 else os.path.join(root, "doc", "img")
+F = json.load(open(src)); M = F["models"]
+CARD, GRID, TXT, SUB = "#18181F", "#2E2E38", "#F4F2EC", "#9A98A3"
+COL = {"qwen": "#9C8CFF", "glm": "#F0B04A", "mimo": "#3FD0B0"}
+SHORT = {"qwen": "Qwen3.8-Flash-Next", "glm": "GLM-5.3-Flash", "mimo": "MiMo-V2.6-Flash"}
+FONT = "font-family=\"'Ubuntu Sans','DejaVu Sans',Helvetica,Arial,sans-serif\""
+def fmt(v): return f"{v:,.0f}" if v >= 100 else f"{v:.1f}"
+def ck(c): return f"{int(c) // 1024}K"
+def t(x, y, s, size, fill=TXT, anchor="start", weight="400"):
+ return f'<text x="{x}" y="{y}" fill="{fill}" font-size="{size}" text-anchor="{anchor}" font-weight="{weight}">{s}</text>'
+
+import math
+def frame(headline, sub):
+ W, H = 560, 380
+ return (f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}" {FONT}>'
+ f'<rect width="{W}" height="{H}" rx="16" fill="{CARD}" stroke="{GRID}"/>'
+ + t(26, 44, headline, 25, TXT, "start", "700") + t(26, 70, sub, 16, SUB)), W, H
+def draw(key, headline, footer, xs, label, pos, getter, note=None):
+ """xs: sorted x keys; pos: x key -> pixel; getter(model) -> {x key: value}. Models without points get a muted legend line."""
+ s, W, H = frame(headline, "Higher is better.")
+ x0, x1, y0, y1 = 64, W - 28, 176, 316
+ vals = [v for m in M for v in getter(m).values() if v]
+ top = max(vals) * 1.15 if vals else 100
+ step = next(st for st in (5, 10, 20, 50, 100, 200, 250, 500) if top / st <= 4)
+ top = step * -(-top // step)
+ for i in range(int(top // step) + 1):
+ v = i * step; y = y1 - (y1 - y0) * v / top
+ s += f'<line x1="{x0}" x2="{x1}" y1="{y}" y2="{y}" stroke="{GRID}"/>' + t(x0 - 10, y + 5, f"{v:,.0f}", 15, SUB, "end")
+ px = pos(x0 + 28, x1 - 28)
+ for c in xs: s += t(px[c], y1 + 28, label(c), 16, SUB, "middle")
+ for i, m in enumerate(M):
+ col = COL[m["id"]]; g = getter(m)
+ pts = [(px[c], y1 - (y1 - y0) * g[c] / top, g[c]) for c in xs if g.get(c)]
+ ly = 98 + 22 * i
+ txt = SHORT[m["id"]] + ("" if pts else " (" + (note or "see table") + ")")
+ s += f'<rect x="26" y="{ly-12}" width="14" height="14" rx="3" fill="{col if pts else GRID}"/>' + t(48, ly, txt, 16, TXT if pts else SUB)
+ if len(pts) > 1: s += f'<polyline fill="none" stroke="{col}" stroke-width="4" stroke-linejoin="round" stroke-linecap="round" points="{" ".join(f"{a:.1f},{b:.1f}" for a, b, _ in pts)}"/>'
+ for k, (a, b, v) in enumerate(pts):
+ s += f'<circle cx="{a:.1f}" cy="{b:.1f}" r="5.5" fill="{col}"/>'
+ if k in (0, len(pts) - 1): s += t(a, b - 12, fmt(v), 16, col, "middle", "700")
+ return s + t(26, H - 18, footer, 14, SUB) + "</svg>"
+
+def prefill_chart():
+ ticks = [4096, 8192, 16384, 32768, 65536, 131072, 262144]
+ allx = sorted({int(c) for m in M for c, v in m["prefill"].items() if v})
+ xs = sorted(set(ticks) | set(allx)); lo, hi = math.log2(ticks[0]), math.log2(ticks[-1])
+ pos = lambda a, b: {c: a + (b - a) * (math.log2(c) - lo) / (hi - lo) for c in xs}
+ qv = [v for v in M[0]["prefill"].values() if v]; cmax = max(int(c) for c, v in M[0]["prefill"].items() if v)
+ head = f"Qwen prefill: {fmt(min(qv))}+ tok/s to {ck(cmax)}"
+ foot = f'Prompt tokens per second against context; one {F["machine"].split(",")[0]}, 128 GB.'
+ return draw("prefill", head, foot, xs, lambda c: ck(c) if c in ticks else "", pos, lambda m: {int(c): v for c, v in m["prefill"].items() if v})
+
+def decode_chart():
+ kinds = ["prose", "chat", "code"]
+ pos = lambda a, b: {k: a + 40 + (b - a - 80) * i / 2 for i, k in enumerate(kinds)}
+ allv = [v for m in M for v in m["spec"].values() if v]
+ head = f"Qwen decode: {fmt(min(M[0]['spec'].values()))} to {fmt(max(M[0]['spec'].values()))} tok/s"
+ foot = "Speculative decode by kind of text; same machine, 128 GB."
+ return draw("decode", head, foot, kinds, str.capitalize, pos, lambda m: {k: v for k, v in m["spec"].items() if v}, "per context in the table")
+
+os.makedirs(out, exist_ok=True)
+for name, svg in (("prefill", prefill_chart()), ("decode", decode_chart())): open(os.path.join(out, name + ".svg"), "w").write(svg)
+print("wrote", out)
diff --git a/tools/make_readme_table.py b/tools/make_readme_table.py
new file mode 100644
index 0000000..db80bdb
--- /dev/null
+++ b/tools/make_readme_table.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+"""Fill the {{TABLE}} field of README.md and doc/benchmarks.md from doc/figures.json.
+Templates: README.tmpl.md, doc/benchmarks.tmpl.md. usage: python3 tools/make_readme_table.py"""
+import json, os
+root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+F = json.load(open(os.path.join(root, "doc", "figures.json"))); HP, HC = F["headline_prompt"], F["headline_prefill_ctx"]
+def f(v): return "n/a" if v is None else (f"{v:.1f}" if v < 100 else f"{v:.0f}")
+rows = "".join(f'<tr><td><b>{m["name"]}</b></td><td align="right">{m["pack_gb"]:g} GB</td><td align="right">{m["table"]["prefill"]}</td><td align="right"><b>{m["table"]["decode"]}</b></td></tr>\n' for m in F["models"])
+table = ('<table align="center">\n<tr><th align="left">Model</th><th>Pack</th><th>Prefill</th><th>Speculative decode</th></tr>\n' + rows + '</table>')
+CT = sorted({int(c) for m in F["models"] if m["id"] != "glm" for c in m["prefill"]})
+def row(m): return f'| {m["name"]} | {m["pack_gb"]:g} GB | ' + " | ".join(f(m["prefill"].get(str(c))) if str(c) in m["prefill"] else "-" for c in CT) + f' | {f(m["spec"]["prose"])} | {f(m["spec"]["chat"])} | {f(m["spec"]["code"])} |\n'
+full = "| Model | Pack | " + " | ".join(f"Prefill {c//1024}K" for c in CT) + " | Spec prose | Spec chat | Spec code |\n|" + "---|" * (len(CT) + 5) + "\n" + "".join(row(m) for m in F["models"] if m["id"] != "glm")
+for tmpl, dst, tb in (("README.tmpl.md", "README.md", table), ("doc/benchmarks.tmpl.md", "doc/benchmarks.md", full)):
+ s = open(os.path.join(root, tmpl)).read().replace("{{TABLE}}", tb)
+ open(os.path.join(root, dst), "w").write(s)
+print("ok")