Instructions to use botdevhq/GLM-5.3-mtp-affine4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use botdevhq/GLM-5.3-mtp-affine4 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("botdevhq/GLM-5.3-mtp-affine4") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use botdevhq/GLM-5.3-mtp-affine4 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "botdevhq/GLM-5.3-mtp-affine4" --prompt "Once upon a time"
- Atomic Chat
GLM-5.3-mtp-affine4
4-bit affine (group_size=64) Multi-Token Prediction (MTP) draft head extracted from zai-org/GLM-5.3 (layer 78, revision ba32f8c19c87) for exact speculative decoding of Full 744B GLM-5.3 on Apple Silicon with botdevhq/mlx-serve.
This repository is a speculative draft head (5.6 GB), not a standalone language model. Pair it with:
- Base 744B 4-bit model:
mlx-community/GLM-5.3-4bit(rev 81ad9b73c618) - Optional parallel block-diffusion drafter (for hybrid MTP + DFlash2):
incoai/GLM-5.3-DFlash2(rev 8f02251dc71a) - Inference server (MIT):
botdevhq/mlx-serve(fork of David Dalcu'sddalcu/mlx-serve)
What's inside
.
โโโ LICENSE # Z.AI GLM-5.3 License (verbatim from zai-org/GLM-5.3)
โโโ README.md
โโโ SHA256SUMS
โโโ mtp/
โโโ config.json # Source model config from zai-org/GLM-5.3
โโโ mtp-residents.safetensors # Layer 78 MTP weights (32 tensors; routed experts quantized affine 4-bit, group_size=64)
The mtp/ subdirectory matches the exact layout expected by mlx-serve's mtp_pack setting, so you can point mtp_pack directly at the downloaded repository folder.
Measured performance (Apple M5 Ultra, 512 GB)
Measured on a single 512 GB Apple M5 Ultra Mac Studio running Full 744B mlx-community/GLM-5.3-4bit (zero-copy snapbank, all 75 routed MoE layers resident) on botdevhq/mlx-serve (v26.11.4-botdev.5), greedy T=0, exact row-exact verification (0 greedy & seeded stochastic diffs vs. plain drafting-off decode):
| Metric | Method | Measured result |
|---|---|---|
| Single-user decode (drafted, hybrid Q4 MTP + Q4 DFlash2) | mtp_depth=3, mtp_quant4=true, dflash_bits=4, dflash_block_size=8, hybrid_drafter=true, greedy T=0 |
48โ58 tok/s (up to 58 tok/s on structured code) |
| Single-user decode baseline (drafting off / plain) | Same 744B pack, drafting off, greedy T=0 |
27 tok/s (plain) |
Concurrent batched spec (N=2 / N=3 / N=4) |
max_slots=4, kv_pool_gib=24, --max-concurrent 4, batched MTP draftBatch + hybrid vqmv, greedy T=0 |
52.7 / 58.3 / 61.8โ62.2 tok/s aggregate (2.3ร plain, 0 greedy & seeded diffs) |
JSON-schema & <think> spec (response_format) |
Argmax-first constrained spec (prepareArgmax), strict schemas + json_object, greedy T=0 |
41.5โ43.3 tok/s agg (1.37โ1.43ร) ยท 46.6 strict schema ยท 55.2 json_object (1.81ร, 0 diffs) |
| 4-chat alternating warm prefix reuse | 4 separate ~550-token chats alternating turns, parked-slot reuse (>=64 tok strong hit) |
0.13 s TTFT on all 4 chats (0.79 s cold) |
| Cold prompt prefill (8K exact / 8K opt-in INT8 / 32K) | Resident NAX MoE prefill + dequantized MLA, 0% cached | 982 tok/s (exact) / 1,030 tok/s (INT8) / 961 tok/s (32K) |
| Output fidelity | Row-exact target verification (hybrid vqmv / vqmv3d) & batched spec vs. plain serial decode, greedy T=0 |
0 diffs (bit-exact greedy, solo, batched & JSON) |
| Memory footprint | 262,144 context window, 32,768 max output, 4-slot KV pool (24 GiB), all 75 MoE layers + Q4 MTP + Q4 DFlash2 resident |
~407โ409 GiB peak wired (under 444 GiB safe ceiling on 512 GB) |
Quickstart with botdevhq/mlx-serve
- Build
botdevhq/mlx-serve(macOS 26.2+, Xcode 26.2+ with Metal Toolchain, Homebrew):
git clone --recurse-submodules https://github.com/botdevhq/mlx-serve
cd mlx-serve
brew bundle install --file=Brewfile
./scripts/fetch-zig.sh
./scripts/fetch-llama.sh
./scripts/build-mlx.sh
./.zig-toolchain/zig build -Doptimize=ReleaseFast
- Download the base 744B weights, this MTP drafter, and (optionally) DFlash2, then build the zero-copy snapbank (takes ~41 s on Mac Studio SSD; keeps the 91 upstream shards in place and writes only the 9.9 GB resident pack + 4.6 MB manifest):
hf download mlx-community/GLM-5.3-4bit --revision 81ad9b73c6188f808737dbb52458f082d249dcbe --local-dir ./GLM-5.3-4bit
hf download botdevhq/GLM-5.3-mtp-affine4 --local-dir ./GLM-5.3-mtp-affine4
hf download incoai/GLM-5.3-DFlash2 --local-dir ./GLM-5.3-DFlash2
python3 scripts/glm53_pack.py snapshot --src ./GLM-5.3-4bit --dst ./GLM-5.3-4bit-snapbank --bits 4
- Configure
~/.mlx-serve/model-settings.jsonkeyed by the resolved absolute path of./GLM-5.3-4bit-snapbank(settingmax_slots: 4andkv_pool_gib: 24enables the multi-slot concurrent decode pool โ solo traffic runs full hybrid DFlash2 + MTP drafting, 2โ4 overlapping streams automatically run bit-exact batched speculative decoding, and returning to 1 stream immediately resumes solo hybrid drafting):
{
"/abs/path/to/GLM-5.3-4bit-snapbank": {
"ctx_size": 262144,
"max_output": 32768,
"prompt_cache_gib": 8,
"resident_scratch": true,
"fused_router": true,
"decode_expert_major": true,
"decode_commit_stride": 12,
"prefill_call_rows": 16384,
"resident_prefill": true,
"prefill_nax_moe": true,
"prefill_deq_mla": true,
"mtp_depth": 3,
"mtp_pack": "/abs/path/to/GLM-5.3-mtp-affine4",
"mtp_quant4": true,
"mtp_adaptive_p": 0.72,
"mtp_adaptive_cum_p": 0.9,
"dflash_pack": "/abs/path/to/GLM-5.3-DFlash2",
"dflash_bits": 4,
"dflash_block_size": 8,
"dflash_adaptive": true,
"dflash_pld": false,
"hybrid_drafter": true,
"max_slots": 4,
"kv_pool_gib": 24
}
}
- Raise the GPU wired limit (resets on reboot) and launch with the same resolved absolute path:
sudo sysctl iogpu.wired_limit_mb=458752
MLX_ENABLE_INT8_QMM=1 ./zig-out/bin/mlx-serve \
--model /abs/path/to/GLM-5.3-4bit-snapbank \
--serve \
--host 127.0.0.1 \
--port 8080 \
--ctx-size 262144 \
--max-concurrent 4
Provenance & Credits
- Original model & layer 78 MTP weights:
zai-org/GLM-5.3(ba32f8c19c87), governed by the GLM-5.3 License (included verbatim inLICENSE). - Base 4-bit MLX quantization:
mlx-community/GLM-5.3-4bit. - DFlash2 draft model:
incoai/GLM-5.3-DFlash2by Inco AI (@inco_ai). - Inference engine:
botdevhq/mlx-serve(fork of David Dalcu'sddalcu/mlx-serve, built on Apple MLX). - Published by: bot.dev (
@botdevhq, Chatlio LLC).
- Downloads last month
- -
Quantized
Model tree for botdevhq/GLM-5.3-mtp-affine4
Base model
zai-org/GLM-5.3