MTP Speculative Decoding on a 16 GB GPU: About 1.9× for a Ternary Model and a Grafted MoE
· code
I tried llama.cpp’s multi-token prediction (MTP) drafting on two quantized models that fit in a 16 GB GPU:
- Ternary Bonsai 2.5 27B in the Q2_0 packing that stock llama.cpp runs, using the
-mtp.gguffile, which includes PrismML’s MTP head; - Qwen3.6-35B-A3B at IQ3_XXS, with an MTP head I took from a published MTP-only file and grafted onto my own quantized model.
On an RTX 5060 Ti with stock llama.cpp b12600, both decoded about 1.9× faster, and both still fit in 16 GB. Neither produced exactly the same tokens as decoding without MTP.
Short version:
- Bonsai 2.5 Q2_0: 44.3 → 82.6 t/s at
--spec-draft-n-max 2(1.87×, 95% CI 1.80–1.94). - Qwen3.6 with the grafted head: 110.1 → 208.3 t/s at
--spec-draft-n-max 3(1.89×, CI 1.85–1.93). With MTP off, the grafted file runs at the plain model’s speed (0.995×) and gives the same tokens. - Peak memory with MTP on was 8,568 MiB for Bonsai (n_max 2) and 14,730 MiB for Qwen (n_max 3). Qwen with MTP also started and generated at a 20k context, peaking at 15,102 MiB.
- My own estimate before the run was between 0.5 ms slower and 2.3 ms faster per token for Qwen. The cost of each draft-and-check step was about what I estimated. The acceptance rate was far higher than I’d guessed (0.95 at n_max 1).
- MTP changed the output. Repeated runs without MTP were token-identical, but under greedy decoding the MTP runs forked on 5–6 of 12 problems for Bonsai (n_max 2–3) and 10–12 of 12 for Qwen. The cause isn’t isolated.
Scope: one GPU, one session, one seed, and 12 hard MATH problems at up to 768 generated tokens each. Draft settings weren’t tuned. I didn’t grade answers or look for loops, so this says nothing about whether MTP changes accuracy.
Setup
- Hardware: RTX 5060 Ti 16 GB, with all layers on the GPU (
-ngl 99, no experts on the CPU). - Software: stock llama.cpp release b12600 (
29b52d398),llama-server -fa on -ub 512 -c 4096. - Single slot, no prompt cache:
-np 1 --no-cache-prompt --cache-ram 0. Every request sendscache_prompt: false, and every response was checked fortimings.cache_n == 0. - Draft settings:
--spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-p-min 0.1, from PrismML’s CUDA preset for Blackwell cards, with--spec-draft-n-max(n_max below) at 1, 2 and 3. The same settings were used for both models. - Prompts: 12 MATH problems from a hard subset I’d used for earlier runs, picked because they make the models think for a long time. They are not a random sample. Each run generates up to 768 tokens after a prompt of 46–285 tokens, so this is decode near the start of a long answer.
- Decoding: greedy (temperature 0), and sampled at T 0.6, top-p 0.95, top-k 20, min-p 0, with a fixed seed per problem.
- Speedup: the ratio of pooled decode t/s with and without MTP, with a paired bootstrap 95% CI over the 12 problems.
The host was busy with other work during the run (load average 7.0 at the start). Every configuration ran under the same conditions, and repeated runs matched to within 0.2 t/s, but absolute speeds on an idle machine may be higher.
Getting an MTP head for Qwen3.6
None of my Qwen3.6-35B-A3B GGUFs had an MTP head, and neither did the common community quants I’d downloaded. All have
733 tensors and no nextn layer. The full-model MTP GGUFs from ggml-org are 37.8 GB (Q8_0) and 71.1 GB (BF16), too
big to download casually and too big for the card.
llama.cpp can also load an MTP head on its own, as a separate --model-draft file. Several people have published
these MTP-only files:
| source | sizes | loads with --model-draft --spec-type draft-mtp? |
|---|---|---|
| a4lg/Qwen3.6-35B-A3B-MTP-ONLY-GGUF | Q4_K_M 1.62 GB, Q8_0 1.99 GB, BF16 3.74 GB | yes |
| lym00/Qwen3.6-35B-A3B-MTP-ONLY-GGUF | q4_0 1.19 GB, q8_0 1.99 GB, bf16 3.73 GB | yes |
| havenoammo/Qwen3.6-35B-A3B-MTP-GGUF | 0.90 GB | no: no token_embd, which the loader requires |
Two other things turned up while checking headers:
- unsloth’s full-model “UD-IQ3_XXS” MTP GGUF (14.07 GB) contains no IQ3_XXS tensors. Its experts are IQ2_S/IQ3_S.
- If you’d rather convert from Qwen’s own checkpoint, the MTP tensors are in only 3 of its 26 safetensors shards, 10.06 GB together.
Instead of running a separate draft file, I grafted a4lg’s BF16 head into a copy of my own model:
- What I did: I quantized the head’s block (block 40) and appended it to my
IQ3_XXSfile. The head shares the main model’s Q6_K embeddings and output layer. - The script: it copies every original tensor byte for byte and sets
block_countto 41 andnextn_predict_layersto 1. - The check: all 733 original tensors in the new file are identical to the source’s.
- Size: the head adds 464.4 MiB.
- Quant mismatch: its experts are Q4_K rather than IQ3_XXS, because IQ3_XXS needs an importance matrix and mine has no entries for block 40.
Speed
Bonsai 2.5 27B Q2_0 with its bundled head, against the plain Q2_0 file:
| n_max | decode speedup, greedy | acceptance | sampled |
|---|---|---|---|
| 1 | 1.59× | 0.86 | |
| 2 | 1.87× (44.3 → 82.6 t/s) | 0.76 | 1.81× (CI 1.75–1.88) |
| 3 | 1.86× | 0.67 |
Qwen3.6-35B-A3B IQ3_XXS with the grafted head, against the same model without a head:
| n_max | decode speedup, greedy | acceptance | sampled |
|---|---|---|---|
| 1 | 1.54× | 0.95 | |
| 2 | 1.80× | 0.92 | |
| 3 | 1.89× (110.1 → 208.3 t/s) | 0.86 | 1.86× (CI 1.81–1.91) |
- Per problem: Qwen’s speedup at n_max 3 ranged from 1.73× to 1.99×.
- Diminishing returns: acceptance falls as n_max grows. Bonsai’s speedup is flat from n_max 2 to 3 (1.87× vs 1.86×). Qwen’s still rose at 3 (1.80× → 1.89×), and I didn’t try anything larger.
- Bonsai’s shorter runs: Bonsai finished 6–7 of the 12 problems before 768 tokens, so its runs hold 6.5k–6.8k tokens against Qwen’s 9.2k.
Two checks on the baselines:
- Bonsai: the
-mtp.gguffile with MTP off ran at 44.3 t/s, the plain file’s speed. This was on 4 problems. - Qwen: the grafted file with MTP off ran at 0.995× the plain model (CI 0.991–1.000). Its greedy output was token-identical on all 12 problems, 9,216 tokens.
Memory
Peak GPU memory in use, sampled every 250 ms with nvidia-smi (90 MiB in use before the run):
| model | without MTP | with MTP |
|---|---|---|
| Bonsai 2.5 27B Q2_0 | 7,842 MiB | 8,568 MiB (n_max 2), 8,718 MiB (n_max 3) |
| Qwen3.6-35B-A3B IQ3_XXS | 13,900 MiB | 14,730 MiB (n_max 3, -c 4096) |
I checked the 20k context with one short request only. The grafted Qwen with MTP at n_max 3 and -c 20480 started
and generated a 32-token reply, peaking at 15,102 MiB. Memory use over a full 20k context wasn’t measured.
My estimate was wrong, and why
Before the run I estimated Qwen’s gain from the bytes each step reads. My concern was the MoE: checking several drafted tokens at once reads the union of the experts they route to.
- The estimate: between 0.5 ms slower and 2.3 ms faster per token than plain decoding.
- The assumption behind it: an n_max 1 step would cost 11.1–12.0 ms, and acceptance would be about 0.2–0.6.
- What I got: 9.08 → 4.80 ms per token at n_max 3.
Splitting each run into draft-and-check steps shows where the estimate went wrong:
| per step | tokens per step | per token | |
|---|---|---|---|
| Qwen, no MTP | 9.08 ms | 1 | 9.08 ms |
| Qwen, n_max 1 | 11.46 ms | 1.95 | 5.88 ms |
| Qwen, n_max 3 | 17.13 ms | 3.57 | 4.80 ms |
The step cost at n_max 1 landed inside my estimate. Acceptance didn’t: 0.95, not 0.2–0.6.
The MoE penalty is real but small. At n_max 1, a step costs 26% more than a plain token on Qwen and 17% more on Bonsai, a dense model (26.47 vs 22.60 ms). High acceptance easily pays for that.
MTP changes the output
Speculative decoding is often described as giving the same output as plain decoding. On this setup it didn’t.
First, the baselines:
- Plain vs plain: repeated runs were identical, 4 of 4 problems for each model.
- Head file with MTP off vs plain: identical too. That is 4 of 4 for Bonsai’s
-mtp.ggufand 12 of 12 for the Qwen graft.
With MTP on:
| Bonsai identical / 12 | Qwen identical / 12 | |
|---|---|---|
| greedy, n_max 1 | 10 | 2 |
| greedy, n_max 2 | 6 | 1 |
| greedy, n_max 3 | 7 | 0 |
| sampled, same seed (Bonsai n_max 2, Qwen n_max 3) | 2 | 0 |
- Where the forks happen:
- Greedy, Bonsai: between tokens 43 and 703.
- Greedy, Qwen: between tokens 19 and 559, with a median of 152–174 depending on n_max.
- Sampled: medians of 75.5 (Bonsai) and 48 (Qwen).
- Forks per token compared: counting tokens up to and including each fork (or all tokens, when a pair stays identical), the rate is 0.03–0.15% per token for Bonsai greedy and 0.29–0.43% for Qwen greedy. Sampled it is 0.44% and 1.09%.
The sampler isn’t the cause. The draft proposes tokens by argmax, and the target model checks each position by
sampling it with its own sampler. A drafted token is accepted only if it equals that sample; that’s
common_sampler_sample_and_accept_n in b12600, the default path (the probabilistic rejection-sampling option is
off by default). That sample is the argmax
at temperature 0. The target draws one random number per token it emits, as without MTP. So if the target’s logits
were the same as in plain decoding, the MTP run would reproduce the plain run, greedy or sampled. The greedy forks
alone show the logits differ.
Why they differ, I haven’t isolated. Two candidates:
- The arithmetic of the check batch. An MTP check is n_max + 1 tokens, 2–4 here. In a separate, not yet published test on the same card, no batch size I tried from 5 to 512 rows gave bit-identical results to one-token-at-a-time decoding. I didn’t test 2–4.
- How the drafting path handles model state, such as restoring the linear-attention state after a rejected draft. Both models have linear-attention layers.
The fork rates are the same order as that separate test’s: changing only the micro-batch size (-ub 512 vs -ub 1)
on the 35B model forked 19 of 20 prompts at 0.75% per token. That fits a batch-arithmetic explanation but doesn’t prove
it.
I didn’t measure whether the forks change answers. A commenter on llama.cpp #23335 (below) reports an extraction benchmark dropping from 100% to 97% with MTP on. I haven’t checked that.
Caveats
- One GPU, one session, one seed, 12 problems. Speedup CIs cover variation between problems only. The problems come from a hard subset, not a random sample.
- Shallow decode. At most 768 generated tokens per problem. Speed deep into a long reasoning trace wasn’t measured.
- Busy host. Every configuration saw the same load, but absolute t/s may be higher on an idle machine.
- Untuned. I used PrismML’s draft settings (
p_min 0.1,n_min 0) for both models, and-c 4096for the speed runs. The 20k-context check was a single 32-token request. - The graft’s head is Q4_K, not the main model’s IQ3_XXS. I didn’t compare it against a higher-precision head.
- No accuracy or loop measurements. Nothing was graded, and 768 tokens is too short to see reasoning loops.
Prior work
- llama.cpp support:
--spec-type draft-mtpand MTP-only draft files are upstream, from PR #22673. The Qwen3.6 MTP-only files are a4lg’s and lym00’s. - PrismML’s numbers: PrismML’s Ternary Bonsai 2.5 27B
ships an MTP draft head with every file. It claims 1.5–1.8× faster decode on NVIDIA GPUs.
- Those NVIDIA numbers are all for PTQ1_0, a packing that needs PrismML’s llama.cpp fork, measured on 24 GB cards and larger.
- The Q2_0 file that stock llama.cpp runs appears in their table only for a phone NPU (1.39×).
- PrismML also says output “matches decoding without drafting up to the rounding noise of checking several tokens at once”, with a mean KL divergence of 5.2 × 10⁻⁵ between drafting on and off, on an H200 with PTQ1_0.
- MTP changing output is already reported: llama.cpp
#23302 and
#23335 (May 2026, closed) report
draft-mtpchanging deterministic output on Qwen3.6-27B Q4_K_M under Metal. The reporter didn’t see it with Q8_0.- ggerganov replied: “This is expected - we use different kernels for different batch sizes.”
- arthw, later in the same thread: “MTP shouldn’t impact the content of output.”
- Speculative answer-flip rate in vLLM: arXiv:2611.29663 (2026-11-22) grades 3,380 requests on Qwen3-4B-Instruct in vLLM 0.33.0 and finds speculative decoding (n-gram, EAGLE, draft model) flips 1.47–1.78% of graded answers under default kernels, matching the 1.72% request-reordering floor, and 0% under batch-invariant kernels.
- External drafter on Bonsai 2.5 Q2_0: ARRANCORE/DFlash2-Ternary-Bonsai-2.5-27B-llama.cpp (2026-11-28) adapts a 5-layer DFlash2 drafter to Bonsai 2.5 27B Q2_0 on stock llama.cpp (
--spec-type draft-dflash) by un-rotating the Hadamard-folded embeddings offline.
What this adds:
- Q2_0 with MTP on stock llama.cpp on a 16 GB NVIDIA card, which PrismML’s table doesn’t cover;
- speed and acceptance for an MTP head grafted onto an MoE model, showing the MoE check overhead is small next to the acceptance rate;
- how often MTP changes the output, measured against repeat runs on the same setup, for both a dense and an MoE model.
Takeaways
- On a 16 GB card, MTP roughly doubled decode speed for both quantized models I tried: 1.87× for Bonsai 2.5 Q2_0 at n_max 2 and 1.89× for the grafted Qwen3.6 at n_max 3. It cost under 1 GB of extra memory.
- If your Qwen3.6 GGUF has no MTP head, a 1.2–3.7 GB MTP-only file from Hugging Face is enough. You don’t need a new full-model download.
- My bytes-based estimate had the step cost right and the acceptance rate badly wrong. Measure acceptance before ruling MTP out for an MoE.
- Don’t count on MTP giving the same tokens as plain decoding, even greedy. Whether that shifts graded accuracy on sub-4-bit GGUFs and long reasoning traces in llama.cpp is the next thing to measure.