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.

Qwen server: MTP draft prefill runs with the target prefill by default (EXL3_PF_DEFER=0)

YanissAmzd7d2582a287f
diff --git a/tools/qwen/SERVE.md b/tools/qwen/SERVE.md
index 0fdf991..ecace4c 100644
--- a/tools/qwen/SERVE.md
+++ b/tools/qwen/SERVE.md
@@ -50,7 +50,7 @@ Environment: the server sets the measured Qwen configuration with `setdefault` b
`SERVE_ENV` in `serve.py`; the start-up log prints the effective `EXL3_*` / `MPW*` environment). It covers decode and
verify (`EXL3_MOE_FUSED`, `EXL3_MOE_VALU`, `EXL3_VERIFY_*`, `EXL3_GEMV_R_DEC1`, `EXL3_MTP_FUSE_CATCHUP=0`), prefill
(`EXL3_PLE_HIP`, `EXL3_DQ_HIP`, `EXL3_GR_HIP`, `EXL3_GDN_FUSE`, `EXL3_PF_SKIP`, `EXL3_PREFILL_CHUNK=4096`,
-`EXL3_PF_DEFER`, `EXL3_PF_GR_FUSE`, `EXL3_MPW_GLUE`), `EXL3_MOE_CFG=2`, `EXL3_HIP_PREFILL_MIN_ROWS=2`, `EXL3_QSA_ROWINV`, `EXL3_ROLL_CKPT` and the int8 mixer with group
+`EXL3_PF_DEFER=0` (the MTP draft prefill runs chunk by chunk with the target prefill; `1` defers it behind the first token), `EXL3_PF_GR_FUSE`, `EXL3_MPW_GLUE`), `EXL3_MOE_CFG=2`, `EXL3_HIP_PREFILL_MIN_ROWS=2`, `EXL3_QSA_ROWINV`, `EXL3_ROLL_CKPT` and the int8 mixer with group
scales (`EXL3_GR_GS=1`; `hc_gs_sidecar.safetensors` in the model directory is picked up when present). Your own
environment wins. The engine modules read several of these when they are imported, so the server refuses to start if
`exllamav3` was imported before they were set.
diff --git a/tools/qwen/serve.py b/tools/qwen/serve.py
index 936846d..54a4662 100644
--- a/tools/qwen/serve.py
+++ b/tools/qwen/serve.py
@@ -503,9 +503,9 @@ SERVE_ENV = (("EXL3_MOE_FUSED", "1"), ("EXL3_MOE_VALU", "1"), ("EXL3_VERIFY_ATTN
("EXL3_VERIFY_GEMV_R", "1"), ("EXL3_GEMV_R_DEC1", "1"), ("EXL3_MTP_FUSE_CATCHUP", "0"),
("EXL3_PLE_HIP", "1"), ("EXL3_DQ_HIP", "1"), ("EXL3_GR_HIP", "1"), ("EXL3_GDN_FUSE", "1"), ("EXL3_PF_SKIP", "1"),
# 4096-row prefill chunks (one MoE pass per 4096 rows, no 2048 + 2048 + tail split below 4097 tokens) and the
- # draft prefill deferred behind the first token (first round is a plain target step; flushed before the second round,
- # at job end and on rewind, so the draft cache stays complete). 0 for either goes back.
- ("EXL3_PREFILL_CHUNK", "4096"), ("EXL3_PF_DEFER", "1"),
+ # draft prefill run chunk by chunk with the target prefill (K/V and indexer planes only). EXL3_PF_DEFER=1 defers it behind the
+ # first token instead; that lands the whole draft prefill (2.4 s at 256K) inside the first decode steps. 0 for either goes back.
+ ("EXL3_PREFILL_CHUNK", "4096"), ("EXL3_PF_DEFER", "0"),
# the last prefill chunk runs to the end of the prompt (a tail of up to 1024 rows beyond the 4096-row chunk is merged
# into it) instead of a second forward pass that reads every expert again; the last-page recurrent state is written from
# inside the chunk. 0 for EXL3_PF_NO_TAIL goes back. Tuned dense-GEMM solutions for the larger row classes ship in
diff --git a/tools/qwen/test_serve.py b/tools/qwen/test_serve.py
index 0bd2852..0c401ee 100644
--- a/tools/qwen/test_serve.py
+++ b/tools/qwen/test_serve.py
@@ -628,7 +628,7 @@ class ServeEnvDefaultsTest(unittest.TestCase):
d = dict(serve.SERVE_ENV)
for k in ("EXL3_PLE_HIP", "EXL3_DQ_HIP", "EXL3_GR_HIP", "EXL3_GDN_FUSE", "EXL3_PF_SKIP"):
self.assertEqual(d[k], "1")
- self.assertEqual(d["EXL3_PF_DEFER"], "1")
+ self.assertEqual(d["EXL3_PF_DEFER"], "0")
self.assertEqual(d["EXL3_PREFILL_CHUNK"], "4096")
self.assertEqual(len(d), len(serve.SERVE_ENV)) # no key twice
saved = os.environ.get("EXL3_GDN_FUSE"); os.environ["EXL3_GDN_FUSE"] = "0"