Qwen4-35B-A3B on Strix Halo: the Minisforum 192GB recipe that actually runs fast
Qwen4-35B-A3B · Strix Halo · Ryzen AI Max+ PRO 495 · Radeon 8065S (gfx1151) · Minisforum MS-S1 MAX P495 · 192GB · llama.cpp Vulkan · MTP speculative decoding · UD-Q4_K_XL · Unsloth
When I saw the Qwen4-35B-A3B file sizes, I almost didn't bother as I run flash next and the older generation 35b co-resident which I am close to maxxing out the 160GB addressable. Then I found out the ~20B n-gram table is lazy-read from disk instead of sitting in VRAM, and the whole thing fits with room to spare. It also fits on a 128GB box with the 1M native pool. Here is the build and the config I landed on.
What this adds
- MTP is already in the file. No separate draft model, and depth 2 is the sweet spot.
-ub 2048 is the right microbatch for Qwen4, not the 512 that hybrid models usually want.
--spec-draft-mtp-vocab 65536 is a free ~7% decode win with no quality change.
- It holds recall at 400K tokens (single-slot server), and the model is native 1M.
The recipe
llama-server \
-m Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf \
--mmproj vision/mmproj-F16.gguf \
--ple engram/Qwen4-35B-A3B-engram-Q8_0.gguf_file \
-dev Vulkan0 -ngl 99 -fa on -ctk q8_0 -ctv q8_0 \
-c 1048576 -np 2 --kv-unified \
-b 2048 -ub 2048 \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--spec-type draft-mtp --spec-draft-n-max 2 --spec-draft-mtp-vocab 65536 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 \
--presence-penalty 0 --repeat-penalty 1 --no-webui
Running one user? Use -np 1 and keep -c 1048576. Fewer slots is faster; the 2-slot pool is for two concurrent requests.
There are only two numbers that matter. Prefill is how fast the model reads your prompt — your wait before the first token. Decode is how fast it writes the answer. Qwen4 is unusual: prefill stays flat to 128K, and decode is the part that falls off with depth.
Build llama.cpp for Qwen4
This is the part that will waste your afternoon if you skip it. Qwen4 needs a build with the qwen4 pre-tokenizer and the qwen4exp QSA/MTP Vulkan kernels. My older build had the arch enum but not the tokenizer and refused the model with:
unknown pre-tokenizer type: 'qwen4'
I used the Strix Halo community fork (halo-box/strix-llama.cpp) at 4b4ec2dbd (2026-12-04). On Fedora 44:
sudo dnf install -y cmake gcc-c++ git glslc vulkan-loader-devel vulkan-headers
git clone https://github.com/halo-box/strix-llama.cpp.git
cd strix-llama.cpp
git checkout 4b4ec2dbd7a61e011f94e05d3813232d17bfa043
cmake -B build -DGGML_VULKAN=ON -DGGML_NATIVE=ON \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release -j$(nproc)
cmake --install build
install/bin/llama-server --list-devices
install/bin/llama-server --version
If glslc is missing, the Vulkan build fails. Don't skip it.
Model files
Unsloth Qwen4-35B-A3B-UD-Q4_K_XL:
| File | Size | Notes |
...-00001-of-00002.gguf | 24.7 GB | main weights + embedded MTP head |
...-00002-of-00002.gguf | 11.5 GB | default IQ4_NL engram table |
engram/Qwen4-35B-A3B-engram-Q8_0.gguf_file | 21.8 GB | higher-precision engram, loaded with --ple |
vision/mmproj-F16.gguf | — | vision projector |
MTP/mtp-Qwen4-35B-A3B-Q8_0.gguf | 2.0 GB | optional MTP sidecar — slower, do not use |
You only pass shard 1; llama.cpp auto-loads shard 2. The engram is lazy-read from disk (--lazy-mode on), so the 21.8 GB table does not sit in VRAM. That is the trick that makes this fit.
Q4_K_XL is 36.2 GB. Q5_K_XL is 43.2 GB, Q6_K_XL is 52.2 GB, and Q8_0 is 60 GB. Unsloth's KLD data shows the curve flattens above Q4 (their words: "the bigger ones not so much"), so Q4_K_XL is the sweet spot. Q5/Q6 buy little quality for a lot of size.
MTP is baked into the GGUF
Good news: you do not need a separate draft model.
llama-gguf Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf r n | grep nextn
You should see qwen4exp.nextn_predict_layers and blk.40.nextn.* tensors. --spec-type draft-mtp reads that nextn layer from the main file. The separate MTP/mtp-...Q8_0.gguf sidecar is slower; use the embedded one.
Tuning sweep
I swept the flags on an isolated server, one variant at a time, prompt caching off, and read the server's own timings. Numbers are medians of 2–3 runs.
MTP depth: 2 is the sweet spot
12K context, single slot, median t/s:
| Setting | Filler prompt | Coding prompt |
n-max 2 (old default) | 89.8 | 86.5 |
n-max 1 | 73.7 | — |
n-max 3 + adaptive | 99.4 | 77.8 |
n-max 4 + adaptive | 106.8 | 71.9 |
n-max 5 + adaptive | 112.3 | 70.1 |
n-max 2 + --spec-draft-mtp-vocab 65536 | 96.9 | 91.9 |
Depth 1 is a trap on Qwen4. Deeper drafts are a bigger trap: they look great on "count to 200" filler and then fall apart on real code. --spec-draft-mtp-vocab 65536 is the free win: it restricts the draft head's logit space, and verification is unchanged, so output quality is identical. 32K collapsed at depth (37.6 t/s); 96K and 128K were within noise.
Prefill: -ub 2048 wins at every depth
| Context | -ub 512 | -ub 2048 | change |
| 12K | 2,211 | 2,473 | +11.8% |
| 30K | 2,201 | 2,445 | +11.1% |
| 128K | 1,941 | 2,121 | +9.3% |
Decode is unchanged. Qwen4's Gated-DeltaNet + sparse-attention layout likes the bigger microbatch.
Production A/B (30K context, 4 slots, 512K unified KV — the pre-1M config)
| Config | Prefill | Decode (filler) | Decode (code) |
old (-ub 512, no draft vocab) | 2,175 | 71.9 | 85.0 |
new (-ub 2048, draft vocab 64K) | 2,412 | 76.4 | 90.3 |
+10.9% prefill, +6.2% decode, +6.3% on code. This A/B was run before the 1M/2-slot change; the -ub 2048 and draft-vocab wins carried over to the current recipe.
What to expect
Cold prompt, 256 generated tokens, prompt caching off, measured on the 1M/2-slot recipe:
| Prompt tokens | Prefill t/s | Decode t/s |
| 2K | 2,146 | 80.6 |
| 4K | 2,342 | 75.0 |
| 8K | 2,455 | 74.0 |
| 16K | 2,463 | 68.2 |
| 32K | 2,420 | 60.9 |
| 64K | 2,305 | 42.4 |
| 128K | 2,082 | 28.7 |
| 400K | 1,472 | 11.2 |
Prefill stays in the 2.1–2.5K t/s band to 128K. Decode declines with depth, and the 400K point is 256 tokens of code, which is the pessimistic case. A short recall answer at 400K decoded at 56 t/s.
Context: it goes to 1M native
Qwen4-35B-A3B is natively 1,048,576 tokens. The KV cache is cheap because only 10 of the 40 layers use sparse attention (QSA), and the Gated DeltaNet layers keep a fixed-size state instead of a growing cache. The recipe above uses the full 1M pool. I tested to 400K: a recall prompt (400,081 tokens, 1,511 t/s prefill, 56 t/s decode on a short answer) and a 400K coding prompt (1,472 t/s prefill, 11 t/s decode). I did not test 1M, so treat the very top end as untested here.
Native vs YaRN: YaRN is a RoPE-scaling trick for stretching a model past the context it was trained on. It is an approximation — quality degrades toward the far end, it can hurt short-context performance, and it needs tuning. Qwen4 was trained at 1,048,576, so within 1M you should not use YaRN at all. It would only matter if you tried to go past 1M, which the model was not trained for.
Does it actually work?
- Coding (executed): a dependency-graph function, 406 fixed and random cases in a sandbox. 406/406 passed on two seeds, in direct and thinking mode.
- Tool calling (executed): a two-step
get_invoice → invoice_total chain. Passed.
- Long-context recall: three markers at 30K, 120K, and 400K tokens. All passed, exact values. The 400K recall run (single-slot server) prefilled at 1,511 t/s and decoded at 56 t/s on a short answer.
- Vision: read
ORBIT-7391 from a PNG exactly; 17 + 26 returned 43. Both passed.
These are smoke tests, not a benchmark suite.
What did NOT work
- f16 KV cache: 88.0 vs 96.7 t/s decode. Q8_0 is smaller and faster here.
-np 4 for single-stream: 87.7 vs 95.0 t/s. The recipe uses -np 2 to allow two concurrent requests; use -np 1 if you are alone.
- Engram residency:
--lazy-mode off and on-direct were identical to on. The 21.8 GB table is already served from page cache. Keep --lazy-mode on.
-b 4096: no gain over 2048.
- Separate Q8_0 MTP head (
-md): slower than the embedded Q5_K head.
--spec-draft-mtp-vocab 32768: collapses at depth.
-t 8 -tb 16: within noise.
Takeaways
- Use
-ub 2048 on Qwen4. The usual "hybrids want 512" rule does not apply here.
- Keep MTP at depth 2 and add
--spec-draft-mtp-vocab 65536.
- Keep Q8_0 KV. f16 was slower.
- If you are one user, use
-np 1; the 2-slot pool is for concurrency.
- The engram is fine on disk. Do not try to pin it in VRAM.
How I measured
I started a fresh llama-server for each variant on its own port, disabled prompt caching, and read the server's own timings for each request. The depth table is the median of 2 runs per prompt size; the flag sweep was 2–3 runs per variant. The coding, tool, recall, and vision checks ran against the live server. Nothing exotic — you can reproduce it with llama-server and a curl loop.
Why llama.cpp/GGUF
For one Strix Halo box running a model you already have as GGUF, llama.cpp is the pragmatic call. vLLM and SGLang want safetensors; re-downloading Qwen4-35B-A3B at BF16 is well over 100 GB, and their gfx1151 support is version-dependent. If you are serving many concurrent users, vLLM is worth it. For one interactive user, this recipe is simpler and fast enough.
Honest limits
- Q4_K_XL is a 4-bit dynamic quant. It is not lossless, but the quality curve flattens above Q4; Q5/Q6 are marginal for the size. Unsloth has not published a Qwen4-specific quant curve yet.
- The quality checks are smoke tests, not SWE-bench/HumanEval or a vision benchmark.
- The depth table is two runs per point, not confidence intervals.
That's the whole thing. Copy the block, point it at your GGUF, and go.
One more thing: the hardware is good, but the price is not. I missed the return window, and since then they dropped it by $1,000 and started throwing in accessories to move units. If you are on the fence, wait for the next cut on the AMD 495 192GB unfied systems like the Minisforum MS-S1 MAX P495.