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.

Serve: EXL3_STATE_REBASE=1 by default in the GLM and Qwen serve envs

YanissAmz2011b3dd4f40
diff --git a/tools/glm/serve.py b/tools/glm/serve.py
index 580f5fc..aed559f 100644
--- a/tools/glm/serve.py
+++ b/tools/glm/serve.py
@@ -130,6 +130,9 @@ SPEED_ENV = {
# recurrent-state stashes (mid-prompt checkpoints, prompt-end tail) copy to pinned host memory without a host sync: bitwise
# (first-token + tail-resume logits equal, 5 reps x 8K/32K, base vs on); removes ~33 x 0.6 ms of idle at the end of a prefill. 0 = off.
"EXL3_NC2_ASYNC_STASH": "1",
+ # a speculative rewind records the accepted recurrent-state history index in a per-slot base instead of copying
+ # it back to index 0 (272 MiB, ~1.3 ms per launch): bit-exact (ids equal off vs on, GLM KDA depth 2). 0 = copy.
+ "EXL3_STATE_REBASE": "1",
# 14/10: verify of 5..8 rows (GLM_NGRAM lookup rounds of 4..7 copied tokens), the Qwen server's switches: MoE row split,
# one-launch 8-row fused MoE, one-launch 6-row dense GEMV. Bit-identical per row, rows <= 4 untouched (--num-draft 2 rounds).
# Harness, one load each: 6-row round +6.9 % (RM6), 8-row round +2.6 %, ids equal. 0 = off.
diff --git a/tools/qwen/serve.py b/tools/qwen/serve.py
index a9389dd..6eda111 100644
--- a/tools/qwen/serve.py
+++ b/tools/qwen/serve.py
@@ -599,6 +599,9 @@ SERVE_ENV = (("EXL3_HOST_LEAN", "1"), ("EXL3_HOST_CUTS", "1"), # batched verif
# thread settles them before any reader): the 72 per-layer .cpu() syncs of an 8K prompt drained the queue twice (idle 55-64 ms
# of a 5.2 s prefill); bitwise (first-token + tail-resume logits equal, base vs on). 0 = the synchronous stash.
("EXL3_NC2_ASYNC_STASH", "1"),
+ # a speculative rewind records the accepted recurrent-state history index in a per-slot base instead of copying
+ # it back to index 0: bit-exact (ids equal off vs on, Qwen GDN ndt 7). 0 = copy.
+ ("EXL3_STATE_REBASE", "1"),
# a turn that resumes mid-page (tail checkpoint) and adds 1024..4095 tokens in one chunk no longer pays a separate
# last-page forward: follow-up after a 12K conversation 1.47 -> 1.26 s (+1536 tokens), 2.37 -> 2.11 s (+3072), first-token
# KLD vs a cold prefill 2.1e-3 / 1.9e-3 (shipped 4.8e-3 / 3.8e-3), top-1 equal; 768 and 6144 appends unchanged (bitwise).