Recipe · 4 or 6 DGX Sparks
The full GLM 5.3, with a Cyber lane.
Serve Z.ai's full GLM-5.3 from four NVIDIA DGX Sparks on one switch, or from six, with TensorFold at tensor-parallel 4 (or 6), through an OpenAI-compatible API. Two 4-bit EXL3 checkpoints run with the same settings: wrldsuksgo2mars's K4 (the default) and the DERISKED (Cyber) lane, my own quant of Blackfrost Research's GLM-5.3-Derisked. A 262,144-token window on four Sparks, and on six a 847,872-token pool that four streams share. The checkpoint lives on the first Spark only; the others read it over NFS.
The checkpoints
Two 4-bit checkpoints, one set of settings.
MODEL_FORMAT picks the checkpoint, and ./start.sh gives K4 and Derisked the same serving defaults. Both keep GLM-5.3's routed experts at 4 bits in EXL3 and pack the BF16 dense core to 8 bits at load, so either takes about 110 GiB a rank on four Sparks.
The DERISKED (Cyber) lane
Mia-AiLab/GLM-5.3-DERISKED-Cyber-EXL3-4bpw is my EXL3 quantization of Blackfrost Research's GLM-5.3-Derisked, a fine-tune of GLM-5.3 made for security firms, red teams and AI-safety labs.
- Only the routed experts are quantized, at 4 bits on the mul1 codebook. Attention, shared experts, the dense layers, the embedding and the head are copied byte for byte from the BF16 release.
- About 391.6 GiB (420.4 GB), downloaded on the first start at a pinned revision.
- Calibrated on my own English set: code, tool calls, maths, chat, and defensive and offensive security.
MODEL_FORMAT=derisked ./start.shserves it, asGLM-5.3-Derisked-EXL3-4bpw.
K4, the default
wrldsuksgo2mars/GLM-5.3-EXL3-K4-MC, wrldsuksgo2mars's K4 quant of stock GLM-5.3, at revision e28931c9.
- Only its
originalview is fetched: 99 shards and the config, about 418 GB. The repository's k8 and k6-compact cores are skipped, because this engine cannot load them. - EXL3 4-bit routed experts and a BF16 dense core packed to 8 bits at load.
./start.shserves it, asGLM-5.3-EXL3-K4.
Also supported: nvfp4, NVIDIA's GLM-5.3-NVFP4 on six Sparks, and exlr8, a gr8 (EXLR8) quant by kindlingai that you prepare yourself. Neither is downloaded or started unless you ask for it.
Quantization error, against each build's own parent
From the Derisked model card: the GLM-5.3 eval suite's 72-window panel and its 8K code panel, KL divergence over the parent's top 20 tokens. Each build is scored against the model it was quantized from, so this compares quantizations, not models.
| Build (parent) | Top-20 KL | Top-1 | 8K code KL |
|---|---|---|---|
| Derisked, EXL3 4 bpw (GLM-5.3-Derisked) | 0.057 | 93.19% | 0.008 |
| EXLR8 up1 (GLM-5.3) | 0.059 | 93.11% | 0.011 |
| EXLR8 bit338 (GLM-5.3) | 0.092 | 91.43% | 0.013 |
| K4 (GLM-5.3) | 0.112 | 90.56% | 0.021 |
| NVFP4 (GLM-5.3) | 0.116 | 90.32% | 0.021 |
Performance
Measured, not promised.
Derisked's numbers above. Measured with sparkDash on 2026-11-25, the unified and neon optimizations on, GPU clocks ~2,190 MHz, DFlash2 drafts on; prose at temperature 0.7, top_k 20, thinking on. Four Sparks ran a 294,912-token window and six a 868,352-token pool, both at a 3 GiB reserve; the defaults are now 262,144 and 847,872 tokens at 4 GiB. The K4 rows were measured on GLM-5.3-EXL3-K4-v1, which has the same K4 experts as today's K4-MC but kept GLM-5.3's FP8 dense core; they have not been re-measured yet.
Decode, four Sparks
One stream, DFlash2 drafts. Time to first token in brackets.
| K4 | Derisked | |
|---|---|---|
| Prose | 38.8 (0.31 s) | 38.9 (0.31 s) |
| Prose at 64K context | 33.3 (3.54 s) | 35.6 (3.46 s) |
| Code | 52.5 (0.40 s) | 45.8 (0.39 s) |
The code rows ran with different sampling, so they don't compare with each other: K4 at temperature 0 with thinking off, Derisked at 0.7 with thinking on.
Decode, six Sparks
Prose, by streams at once: together, then each stream and its time to first token.
| Streams | K4 | Derisked |
|---|---|---|
| 1 | 49.1 (0.26 s) | 49.3 (0.24 s) |
| 2 | 59.8 (30.8, 0.41 s) | 56.0 (28.8, 0.42 s) |
| 3 | 67.3 (24.1, 0.54 s) | 69.2 (24.5, 0.55 s) |
| 4 | 76.4 (20.1, 0.68 s) | 73.5 (19.3, 0.69 s) |
Every optimization in the stack keeps replies bit-identical to the build without it, checked on both checkpoints.
Prefill, four Sparks
How fast a prompt is read, in tok/s, and the time to first token.
| Prompt | K4 | Derisked |
|---|---|---|
| 2K | 1,571 (1.7 s) | 1,582 (1.7 s) |
| 8K | 1,404 (6.2 s) | 1,399 (6.2 s) |
| 32K | 1,366 (24.4 s) | 1,365 (24.4 s) |
| 128K | 1,301 (101.2 s) | 1,278 (102.9 s) |
| 256K | n/a | 1,233 (213.0 s) |
Prefill, six Sparks
The same prompts, on the shared pool.
| Prompt | K4 | Derisked |
|---|---|---|
| 2K | 1,741 (1.5 s) | 1,767 (1.4 s) |
| 8K | 1,556 (5.6 s) | 1,540 (5.6 s) |
| 32K | 1,511 (22.0 s) | 1,486 (22.3 s) |
| 128K | 1,440 (91.3 s) | 1,388 (94.8 s) |
| 256K | 1,387 (189.3 s) | 1,308 (200.7 s) |
Every prompt length, 2K to 256K, is in the README.
Speed preview
What 49.3 tok/s feels like.
Sample text played at the measured speed of Derisked on six Sparks, at about four characters a token: one stream at 49.3 tok/s, or four at once at 19.3 tok/s each (73.5 together). On four Sparks one stream runs at 38.9.
Window and streams
More Sparks, more room.
The 8-bit KV cache (int8 codes) costs about 50 KB a token on every rank: the latent rows are not split across ranks, so more Sparks free weight memory for the cache but don't divide it. The defaults keep 4 GiB free on every Spark.
| Start | Window | KV a rank | Streams | Left after the reserve | |
|---|---|---|---|---|---|
| Four Sparks | ./start.sh | 262,144 tokens | ~12.5 GiB | 1 | ~0.7 GiB |
| Six Sparks | TP6_RANKS=6 ./start-tp6.sh | 847,872 tokens, one shared pool | 40.4 GiB | up to 4 | 1.3 GiB |
Both rows hold for K4 and Derisked. KV_SPLIT=1 on four Sparks keeps each token's rows on one rank instead: 540,672 tokens on K4, about 10% slower, one stream.
Four streams, one pool
On six Sparks the streams share one KV pool the size of a single window: each takes room only as far as its prompt and reply reach, so one stream alone still gets the whole window. Their decode rows share one verify window a round, and each stream past the first costs about 48 MiB. Replies are the same as the same request served alone.
Derisked on six Sparks with an 868,352-token pool found a needle in an 800,672-token prompt, with every Spark at 3.48 GiB available or more. On four Sparks the pool is off by default, because the first Spark has little memory to spare; SHARED_KV=1 PARALLEL=2 ./start.sh turns it on.
Slot resume, for agent loops
There is no prompt cache at the default window, so an agent loop would read its whole conversation again every turn. Slot resume (SLOT_RESUME=1, on by default) starts a new prompt where the slot's previous prompt still matches, with nothing copied and no memory set aside.
On K4, a 12-turn agent loop's time to first token went from 33-53 s to 3-7 s a turn, and cold and resumed replies were identical. Reused rows are reported as cached_tokens.
The engine
Powered by TensorFold.
TensorFold, by Ash Hart, is an open-source engine that serves language models on Apple Silicon and NVIDIA GPUs through an OpenAI-compatible API. Each model family brings its own kernels and its own draft verification, tuned for that model instead of one generic path for all.
Exact decoding
Drafts make it fast without changing a word: a draft is accepted only when it equals the token the same engine would produce one at a time. Replies are the same with drafts on or off.
Apple Silicon and NVIDIA
MLX on Macs, and CUDA on NVIDIA GPUs from compute capability 8.9: Ada (RTX 40), Hopper and Blackwell, including the DGX Spark's GB10 and the RTX 50 series.
The quality fix
Full GLM-5.3 has no SwiGLU clamp, but every MLP had clamped at GLM-5.3-Flash's limit of 10. Removing it (patch 0183) took K4's top-1 agreement with BF16 from 90.45% to 93.06%.
In this recipe
TensorFold at commit f350cd3e plus 231 patches (numbered 0001-0242), built into one Docker image every rank runs: full GLM-5.3 with DSA sparse attention, RoCE gathers for decode, 8-bit KV, slot resume, the shared pool, Inco AI's DFlash2 drafter, and the unified and neon stacks (prefill +9-12%, decode +1-12%, every reply bit-identical).
What you need
Four Sparks, one switch.
Four DGX Sparks (or six)
GB10 with 128 GB of unified memory each. Each rank holds about 110 GiB of weights on four Sparks, so keep heavy work off the first Spark while it serves: it runs the API and has the least to spare.
One switch
Every Spark's ConnectX-7 ports on one RoCE subnet, through a switch. A Spark's QSFP port shows up as two netdevs and two HCAs, and the start hands all of them to NCCL and the engine's RoCE path.
Key-based ssh and Docker
ssh without a password from the first Spark to the others, and Docker with the NVIDIA runtime on every Spark. The image is built once on the first Spark and copied to the workers.
Disk on the first Spark, NFS to the rest
About 418 GB for K4 or 391.6 GiB for Derisked, on the first Spark only. It exports the checkpoint read-only over NFS to the workers, so nothing is copied to them.
Quick start
One command, on the first Spark.
Clone and name the workers
git clone https://github.com/MiaAI-Lab/GLM-5.3-DERISKED-Cyber-DGX-Sparks-TensorFold.git
cd GLM-5.3-DERISKED-Cyber-DGX-Sparks-TensorFold
cp scripts/local.sh.example scripts/local.sh # WORKER, WORKER2, WORKER3 = spark2, spark3, spark4; PORT
For six Sparks, set WORKER4 and WORKER5 too.
Export the checkpoint to the workers
The first start downloads the checkpoint on the first Spark: K4 into the Hugging Face cache, Derisked into ~/models/GLM-5.3-Derisked-EXL3-4bpw. Export that folder read-only to your ConnectX-7 subnet:
# /etc/exports on spark1
/home/<you>/.cache/huggingface/hub/models--wrldsuksgo2mars--GLM-5.3-EXL3-K4-MC 10.80.0.0/16(ro,no_subtree_check)
/home/<you>/models/GLM-5.3-Derisked-EXL3-4bpw 10.80.0.0/16(ro,no_subtree_check) # the DERISKED lane
sudo exportfs -ra
Start it
DRY_RUN=1 ./start.sh # the plan and every rank's command; changes nothing
./start.sh # K4 on four Sparks
MODEL_FORMAT=derisked ./start.sh # the DERISKED (Cyber) lane
TP6_RANKS=6 MODEL_FORMAT=derisked ./start-tp6.sh # six Sparks, four streams
./stop-tp6.sh # stop every rank and archive their logs
The first start builds the image on the first Spark and copies it to the workers, then every rank hashes the checkpoint once. Every rank must report the same checkpoint and settings before the first Spark opens the port, and a smoke test runs at the end. Later starts take a few minutes; ./start.sh restart replaces a running server.
Talk to it
Any OpenAI client works with base_url = "http://<spark1>:8020/v1" and the model GLM-5.3-Derisked-EXL3-4bpw (or GLM-5.3-EXL3-K4). Thinking is off by default; a request can turn it on.
curl -s http://<spark1>:8020/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "GLM-5.3-Derisked-EXL3-4bpw",
"messages": [{"role": "user", "content": "Write a Python fibonacci function."}],
"max_tokens": 2000
}'
Settings
The ones you might change.
Every setting and its default is in scripts/config.sh. Your overrides go in scripts/local.sh or the environment. The full list is in the README.
| Variable | Default | Meaning |
|---|---|---|
MODEL_FORMAT | k4 | The checkpoint: k4, derisked (the Cyber lane), nvfp4 (six Sparks) or exlr8 |
CONTEXT | 262144 (847872 on six Sparks) | The window. Change it by arithmetic, about 50 KB a token a rank, not by probing: CONTEXT=auto can get a rank killed here |
MEMORY_RESERVE_GIB | 4 | Memory each Spark keeps free beyond the model and the window |
DRAFTER | dflash2 | Inco AI's DFlash2; dspark Red Hat AI's DSpark speculator; mtp the checkpoint's MTP head; none |
SHARED_KV / PARALLEL | 1 / 4 on six Sparks, 0 / 1 on four | Streams at once on one shared KV pool |
KV_SPLIT | 0 | 1: each token's KV rows on one rank, 2.5x the window, about 10% slower |
SLOT_RESUME | 1 | A new prompt on the same slot resumes where the previous one still matches |
THINKING | 0 | The default thinking mode; requests can override it |
NEON_STACK | 1 | The unified and neon optimization switches; 0 turns them all off |
MEMGUARD | 1 | Stops the server when a Spark stays under 2 GiB available |
Memory, watched
A Spark's GPU and CPU share one memory pool, and an overshoot thrashes it until the kernel's OOM killer acts, which can take ten minutes. So the start sizes everything from each Spark's available memory, and a guard stops the server before a Spark runs out. If it fires, raise MEMORY_RESERVE_GIB or lower CONTEXT.
Known limits
One stream by default on four Sparks, since memory on the first Spark is the limit; six serve four. All Sparks must share one RoCE subnet. Six Sparks are not an upstream-supported width: they work here, through ./start-tp6.sh.
Licenses
Free, with a few rules.
- The recipe is Apache License 2.0. Its patches modify TensorFold at commit
f350cd3e, whose code stays under TensorFold's licenses (Apache 2.0 from v0.6.0, and the MIT notice of earlier code). - No weights are in the repository. Each checkpoint is downloaded under its own terms: GLM-5.3 and its quants under the GLM-5.3 License, and the Derisked lane also under Blackfrost Research's terms.
- EXLR8 (supported, not bundled): CC BY 4.0 covers only its packing, manifests and error tables; the weights stay under the GLM-5.3 License.
Credits
Built on the work of others.
- TensorFold by Ash Hart and its contributors; the native EXL3 experts build on justincasey's #837
- GLM-5.3 by Z.ai; the Derisked fine-tune by Blackfrost Research; K4 by wrldsuksgo2mars; EXLR8 by Matt Mastracci (kindlingai)
- DFlash2 by Inco AI, extending Z Lab's DFlash; the DSpark speculator by Red Hat AI
- Patches by Adam Hillson, ajensenwaud, Bizuayeu, SvangenStudios, Cameron Basham, Robert Wojciechowski, Peter Jurik, devopsfortunato and laidick, and Ash Hart and wangtianwen07; the rest by Mia's AI Lab
- Ideas the patches follow: knapcio's GLM-5.3 gr8 recipe, kindlingai's gr8 pooled KV, BobClawblaw's EXL3 prompt experts, RS91Dev's slot resume, b12x's RoCE exchange, tfolkman's lock fix, and turboderp's ExLlamaV3
Every patch and its author, and the runtime stack, are in the recipe's CREDITS.md and NOTICE.md.
Run it on your Sparks.
Free and open, with every patch and every number published.