MTP (multi-token prediction) is a free speed-up for models that were trained with it, and llama.cpp has supported it since 16 May 2026. Some models, such as Qwen 3.6, Qwen4, Gemma 4 31B, GLM, DeepSeek and Nemotron, ship with an extra small layer that guesses the next few tokens. llama.cpp uses that layer as a built-in “draft model”: it guesses one to three tokens ahead, then the main model checks all of them in a single pass and keeps the ones it agrees with. The output is exactly what the model would have written anyway, only faster. You turn it on with --spec-type draft-mtp, usually with --spec-draft-n-max 2. In llama.cpp’s own tests, dense models such as Qwen 3.6 27B and Gemma 4 31B finished about 2.4 times faster. Mixture-of-experts models such as Qwen4-35B-A3B usually gain 1.1 to 1.5 times. When most of the model runs from system RAM the gain can drop to almost nothing.
Below I explain how MTP works in plain terms and how it compares with draft models, EAGLE-3 and n-gram drafting. I list every model family llama.cpp supports, with the date support arrived. Then come the exact commands, what each flag does, how to pick the draft length, every measured result I could find, the memory cost, and when MTP is not worth it. I also show how to measure the gain on your own PC and fix the common problems. Everything comes from llama.cpp’s speculative decoding documentation, its server README and the merged pull requests that added MTP, all checked on 6 December 2026. Where a number comes from a third party or from my own calculation, I say so.
What MTP is, in one minute
A normal language model writes one token at a time. Each token needs a full pass through the whole model, and on a home PC that pass is limited mostly by how fast the weights can be read from memory, not by how much maths the GPU can do. So the GPU often sits partly idle while it waits for data.
Multi-token prediction attacks that waste. During training, some model makers add one extra small layer (sometimes called the MTP head, the NextN layer or the MTP module) next to the normal output. It learns to predict the token after the next one, using the model’s own internal state. DeepSeek used it in DeepSeek-V3, and Qwen, Google (Gemma 4), Zhipu (GLM), Xiaomi (MiMo), NVIDIA (Nemotron) and others now ship it too. The main purpose in training is a slightly better model. The useful side effect for us is that the layer can guess ahead.
llama.cpp turns those guesses into speed with a method called speculative decoding. The MTP layer drafts a few tokens, the main model checks them all at once, and every correct guess is a token you did not have to wait a full pass for. Because the head is part of the same model and already sees the model’s internal state, its guesses are often right, usually 60 to 90 percent of the time for one or two tokens ahead.
More tokens per second while the model writes. The answer is the same as without MTP: with greedy sampling it is identical, and with normal sampling it follows the same probabilities.
A little extra memory for the MTP layer and its own small cache, a slightly slower start on long prompts, and nothing at all if your model file does not contain the layer.
A llama.cpp build from 16 May 2026 or later (later for some families), and a GGUF that includes the MTP layer or comes with a separate MTP file.
MTP is not the same as Qwen4’s n-gram table. Qwen4 also has a 20-billion-parameter n-gram embedding, which Unsloth calls the engram. That is part of the model itself and is read from your SSD. The MTP head is a separate, small layer used only for drafting. My Qwen4 guide covers the n-gram table.
How speculative decoding with MTP works
Speculative decoding relies on one simple fact. Checking several tokens in one batch costs almost the same as writing one token, because the expensive part, reading the weights, happens once either way. The llama.cpp documentation puts it this way: computing n tokens in a batch, as in prompt processing, is more efficient than computing n tokens one after another.
Here is what happens at each step:
- The main model writes a token.This is the normal, full pass. It also produces a hidden state, the model’s internal summary of everything so far.
- The MTP head drafts.From that hidden state, the small MTP layer guesses the next token, then the one after, up to the limit you set with
--spec-draft-n-max. Each guess is a tiny pass through one layer, so it is cheap. - The main model verifies.All the drafts go back into the main model as one batch, exactly like a short prompt. The model works out what it would have written at every position.
- Accept and correct.Drafts are compared one by one. The first mismatch ends the run: everything before it is kept, the rest is thrown away, and the main model’s own token for that position is added. So every step yields at least one token and at most n-max + 1.
Why the output does not change
With greedy sampling (temperature 0, always the top token), a draft is accepted only if it is exactly the token the main model would have picked. The final text is therefore identical to a normal run. With temperature above 0, llama.cpp uses rejection sampling for MTP and draft models since October 2026 (PR #27694). The pull request says the output distribution “is preserved exactly”. The MTP pull request also re-ran the AIME 2026 maths benchmark with MTP on and matched the score Qwen reported. In short, MTP is a speed feature, not a quality trade.
The maths of the gain
Suppose each draft token is right with probability p and you draft k tokens. The expected number of tokens from one verification pass is 1 + p + p² + … + pk. With p = 0.8:
| Drafts (n-max) | Expected tokens per pass | Extra cost per pass |
|---|---|---|
| 1 | 1.8 | one MTP pass + checking 2 tokens |
| 2 | 2.44 | two MTP passes + checking 3 tokens |
| 3 | 2.95 | three MTP passes + checking 4 tokens |
| 4 | 3.36 | four MTP passes + checking 5 tokens |
Each extra draft adds less than the one before, while the cost of drafting and checking keeps rising. That is why the best setting is usually 2 or 3, not 8. In the main MTP pull request, Qwen 3.6 27B at --spec-draft-n-max 3 accepted 72 percent of drafts. By my calculation that is about 3.2 tokens per pass, and the measured wall-clock time fell from 201 to 84 seconds, 2.4 times faster. So each pass cost about 1.3 times a normal one.
MTP vs draft models, EAGLE-3 and n-gram drafting
llama.cpp has several ways to produce the drafts. They all use the same verify-and-accept step, so the output is never worse. They differ in where the guesses come from.
| Method | Flag | Extra file | Typical acceptance | Best for |
|---|---|---|---|---|
| MTP | draft-mtp | No (or one small MTP file) | 60 to 90% | Any model that ships with an MTP layer |
| Draft model | draft-simple with -md | Yes, a whole small model | 50 to 70% | Families with a tiny sibling model, such as Qwen 3.5 0.8B |
| EAGLE-3 | draft-eagle3 | Yes, a small head | Higher than a draft model of the same size | Models someone has trained an EAGLE-3 head for |
| DFlash, DSpark and related | draft-dflash etc. | Yes | Varies | Models with those drafters (newer, more specialised) |
| n-gram | ngram-mod, ngram-simple and others | No | High on repeated text, low on new text | Editing code, rewriting documents, long repeated output |
The acceptance figures are my summary of the llama.cpp pull requests and documentation, not an official table. The interesting result from the MTP pull request is that a separate draft model is not automatically worse. On Qwen 3.6 27B, Qwen 3.5 0.8B as a draft model at 16 tokens finished in 81 seconds against 84 for MTP. But it needs a second download, its own VRAM and a tokenizer match, and many models have no small sibling at all. MTP is simply the easiest option when your model has it: no second file, no matching, one flag.
You can also combine MTP with n-gram drafting, which I cover in section 13.
Which models support MTP in llama.cpp
There is no single official list, so I built this one from the merged pull requests. The date is when support landed on llama.cpp’s main branch. Any release made after that date includes it. Your GGUF must also contain the MTP layer, which section 5 explains.
| Model family | Merged | Pull request | Notes |
|---|---|---|---|
| Qwen 3.6 27B and 35B-A3B (and models on the same architecture) | 16 May 2026 | #22673 | The first MTP support. Ready-made files: 27B, 35B-A3B |
| Gemma 4 31B and 26B-A4B | 7 June 2026 | #23398 | Not the small E4B/E2B models at first; later fixes mention E4B |
| MiMo 2 (Xiaomi) | 30 July 2026 | #26228 | |
| GLM-5.2 (GLM_DSA) | 29 July 2026 | #25980 | |
| DeepSeek V4 | 2 August 2026 | #25784 | Together with DSpark drafting |
| Qwen3-Next 80B-A3B | 3 August 2026 | #25589 | |
| DeepSeek V3.2 | 3 August 2026 | #26457 | |
| GLM-4.7-Flash | 3 August 2026 | #24868 | MTP files: GLM-4.7-Flash-MTP-GGUF |
| Nemotron (NVIDIA) | 10 August 2026 | #26725 | Extended on 17 September (#29018) |
| GLM-4.5-Air and GLM-4.5 | 23 August 2026 | #26534 | Separate MTP file: GLM-4.5-Air-MTP-GGUF |
| Qwen3.8-Flash-Next (qwen4exp) | 1 October 2026 | #29761 | Further fixes in early December |
| GLM5Next | 7 October 2026 | #29928 | |
| Mellum 2.1 | 16 October 2026 | #30612 | |
| Qwen4-35B-A3B | Works with Unsloth’s GGUFs | Unsloth guide | The MTP head is inside every Unsloth Qwen4 GGUF |
Two warnings. First, the family must be supported and your exact file must contain the layer. Many GGUFs made before support arrived, or converted with --no-mtp, leave it out. Second, a model on this list is not guaranteed to get faster on your hardware. Section 9 shows that results vary a lot.
Llama, Mistral, Phi and most older models were never trained with an MTP head, so MTP cannot help them. For those, use a draft model or n-gram drafting instead.
What you need before you start
- A recent llama.cpp. Use a release from after the date in section 4 for your model family. I recommend the newest release anyway, because many MTP fixes landed later: memory fitting (#26177, #26605), automatic type detection (#27005), CUDA graphs for the draft (#28549) and rejection sampling (#27694).
- A GGUF with the MTP layer. Either a combined file (the usual case: one GGUF with the MTP layer inside) or a normal file plus a small separate MTP-only GGUF.
- A little spare memory. Roughly 0.5 to 2GB for the MTP layer plus a small cache. See section 10.
- llama-server from llama.cpp itself. Apps built on llama.cpp may not expose the option yet. Section 15 explains what to do.
How to tell whether a GGUF contains the MTP layer
The easiest sign is the name or the model card. ggml-org’s Qwen 3.6 files say MTP in the repository name, and Unsloth’s Qwen4 guide says every Qwen4 GGUF includes the head. For a file you already have, open its metadata. Hugging Face shows it when you click a GGUF file, and the gguf-dump tool from the gguf Python package prints it locally. For most families, look for a key ending in nextn_predict_layers with a value of 1 or more, and for tensors with nextn in their names. If both are missing, the file has no MTP layer and --spec-type draft-mtp has nothing to use.
What about the Qwen 3.6 files I already have?
Qwen 3.6 came out in April 2026, a month before llama.cpp could run MTP. As far as I can tell, most of the GGUFs from that time do not contain the layer. ggml-org later published Qwen3.6-27B-MTP-GGUF and Qwen3.6-35B-A3B-MTP-GGUF with it. If your Qwen 3.6 file does not show the MTP metadata, download one of those or a newer re-upload that mentions MTP. My Qwen 3.6 guide covers the rest of the setup.
Converting a model yourself
If you convert from Hugging Face weights with convert_hf_to_gguf.py, supported models get the MTP layer in the same file by default. The --no-mtp option leaves it out, and --mtp writes a separate MTP-only file (PR #25641). Check python convert_hf_to_gguf.py --help on your copy, because the options were refactored in July 2026. Quantise as usual afterwards.
How to turn MTP on: the commands
All examples use llama-server. Add your usual options for GPU layers, context and so on. The MTP part is just one or two flags.
The basic command
llama-server -m Qwen3.6-27B-MTP-Q4_K_M.gguf -ngl 99 -c 32768 --spec-type draft-mtp --spec-draft-n-max 2
--spec-type draft-mtp tells llama.cpp to use the model’s own MTP layer as the drafter. --spec-draft-n-max 2 lets it guess up to two tokens ahead. The default is 3, which suits fast GPUs and code. I start everyone on 2 because it rarely makes things slower.
Straight from Hugging Face
llama-server -hf ggml-org/Qwen3.6-27B-MTP-GGUF --spec-type draft-mtp --spec-draft-n-max 2
If you do not need image input, add --no-mmproj. With -hf, llama.cpp otherwise downloads and loads the vision projector too, which costs VRAM you may want for the MTP layer. MTP itself works with image input: the original pull request says it is compatible with vision, and PR #30257 improved it in October.
Qwen4-35B-A3B on an 8GB to 16GB card
llama-server -m Qwen4-35B-A3B-UD-Q4_K_XL.gguf -ngl 99 --n-cpu-moe 30 -c 32768 -fa on --jinja --spec-type draft-mtp --spec-draft-n-max 2
The --n-cpu-moe number depends on your card. My Qwen4 guide has the right value for 8GB, 12GB and 16GB. Unsloth recommends a draft length of 2 for Qwen4. When most experts sit in system RAM, try 1 as well and keep whichever is faster.
A model with a separate MTP file
llama-server -m GLM-4.5-Air-trunk-only-Q4_K_M.gguf -md GLM-4.5-Air-MTP-Q4_K_M.gguf --spec-type draft-mtp --spec-draft-n-max 1
Some uploads keep the MTP layer in its own small GGUF. Load it as the draft model with -md. Since August 2026, llama.cpp detects that a draft file is an MTP layer by itself (PR #27005), but writing --spec-type draft-mtp explicitly does no harm. If you keep models in one folder for the router mode, files named mtp-*.gguf are now recognised as companions, like mmproj files (PR #24431).
MTP plus n-gram drafting
llama-server -m model-with-mtp.gguf --spec-default --spec-type draft-mtp --spec-draft-n-max 3
--spec-default switches on the ngram-mod drafter as well. The documentation says that when a draft model and a draftless method are combined, “the draftless decoding has higher precedence”. So when the text repeats something already in the context, the n-gram drafter can propose a long run, and otherwise MTP takes over. Section 13 explains when this helps.
Using environment variables
Every flag also has an environment variable, which is handy for Docker or service files: LLAMA_ARG_SPEC_TYPE=draft-mtp and LLAMA_ARG_SPEC_DRAFT_N_MAX=2.
Old guides use flags that no longer exist. --draft, --draft-max and --draft-min were replaced by the --spec-draft-* family. If you see “invalid argument”, check the flag names against the current README.
Every MTP flag explained
These are the options that matter for MTP, taken from the current llama.cpp server README and speculative decoding guide. Most people only ever change the first two.
| Flag | Default | What it does |
|---|---|---|
--spec-type draft-mtp | none | Turns MTP drafting on. Accepts a comma-separated list to combine methods. |
--spec-draft-n-max N | 3 | The most tokens to draft per step. The most important setting (section 8). |
--spec-draft-n-min N | 0 | The fewest tokens to draft. Leave at 0 so llama.cpp can draft less when unsure. |
--spec-draft-p-min P | 0.00 | Stops a draft early when the drafter’s confidence in the next token falls below P. Try 0.6 for mixed or creative text. |
--spec-draft-p-split P | 0.10 | The split probability used by speculative decoding. I leave it alone. |
--spec-draft-sampling | greedy | Set to probabilistic so the drafter samples too, which helps acceptance at temperature above 0 (newer builds). |
--spec-draft-backend-sampling | enabled | Runs draft sampling on the GPU. Turn off with --no-spec-draft-backend-sampling only for debugging. |
--spec-draft-n-ubatch N | 0 (same as -ub) | A smaller physical batch for the draft context, to spare VRAM. |
-ctkd / -ctvd TYPE | f16 | Cache type for the draft’s key and value cache, for example q8_0, to save memory. |
--spec-draft-device | auto | Which GPU runs the draft. Useful with several GPUs and -sm layer. |
-ngld N | auto | Draft layers to keep in VRAM. Mainly for separate draft files. |
--spec-default | off | Enables the default draftless drafter (ngram-mod). Combine with --spec-type draft-mtp. |
--spec-synth-len / --spec-synth-rates | off | Benchmarking only: fake acceptance. The output is not valid model output. |
Two of these are worth a closer look. --spec-draft-p-min cuts a draft short when the drafter is unsure, so you do not waste verification on guesses that will probably fail. In the Qwen3-Next pull request, adding --spec-draft-p-min 0.6 with n-max 2 raised acceptance from about 83 percent to over 95 percent. Creative writing sped up from 78 to 98 tokens per second, because fewer doomed guesses were checked. --spec-draft-sampling probabilistic came with the rejection-sampling work in October 2026. If you chat at temperature 0.7 or 1.0, test it against the default.
How to choose the draft length (n-max)
The draft length is a trade-off. Longer drafts can win more tokens per pass, but each extra position is less likely to be right and makes every pass more expensive. When too many guesses fail, MTP becomes slower than no MTP at all.
| Model and hardware | n-max 1 | n-max 2 | n-max 3 | Source |
|---|---|---|---|---|
| Qwen4-35B-A3B, acceptance | 0.89 | 0.68 | 0.48 to 0.51 | Unsloth |
| Qwen 3.6 27B Q8_0, DGX Spark, wall time | — | 90.4 s (2.22x) | 83.8 s (2.40x) | #22673 |
| GLM-4.7-Flash Q8_0, mean speed-up | 1.18x | 1.14x | 1.03x | #24868 |
| GLM-4.5-Air Q4_K_M, 4x RTX 3090 | 1.19x | 1.12x | 0.97x | #26534 |
| GLM-4.5-Air Q8_0, partly on CPU | 1.10x | 1.06x | 0.95x | #26534 |
| Qwen4-35B-A3B, RTX 5090, code | 1.28x | — | 1.27x | Unsloth |
| Qwen4-35B-A3B, RTX 5090, prose | 1.22x | — | 1.04x | Unsloth |
My rules, based on these results:
- Start with 2. It was close to the best setting in every test above, and Unsloth recommends it for Qwen4.
- Try 3 for a dense model that fits fully in VRAM, especially for code. Qwen 3.6 27B was faster at 3 than at 2, and the Gemma 4 31B test used 4.
- Try 1 for mixture-of-experts models, especially with experts in system RAM or with creative writing. Every GLM test was fastest at 1.
- Never go above 4 for MTP. Most models ship a single MTP layer, which llama.cpp runs again for each extra position, so accuracy falls fast. Long drafts like 16 or 64 make sense for draft models and n-gram methods, not MTP.
- Add
--spec-draft-p-min 0.6if your work is mixed. It lets the drafter stop early on hard text and keep going on easy text.
Why the type of text matters so much
Acceptance depends on how predictable the next tokens are. In the Qwen 3.6 27B test at n-max 3, Python code reached 0.91 acceptance, creative writing 0.62 and translation 0.54. In the Qwen3-Next test, step-by-step maths hit 0.99. Code, maths, JSON, summaries and factual answers are full of predictable tokens: brackets, keywords, names repeated from the prompt. Stories and poems are designed to surprise, so the guesses fail more often. If you mainly write fiction, expect the low end of every range in this article.
Real speed-ups: every measured result I could find
These are the results published in the llama.cpp pull requests and in Unsloth’s Qwen4 guide. They were measured by the developers on their own machines, so treat them as examples, not promises. All are single-user (-np 1) generation speed. Most use greedy sampling.
| Model | Hardware | n-max | Result | Speed-up | Source |
|---|---|---|---|---|---|
| Gemma 4 31B (dense) | DGX Spark | 4 | 290 s to 121 s wall, about 6 to 11-19 tok/s | 2.40x | #23398 |
| Qwen 3.6 27B Q8_0 (dense) | DGX Spark | 3 | 201 s to 84 s wall, 7 to 14-22 tok/s | 2.40x | #22673 |
| Qwen3.8-Flash-Next IQ4_XS (MoE) | DGX Spark | 3 | 28.4 to 43.9 tok/s | 1.55x | #29761 |
| Qwen4-35B-A3B UD-Q4_K_XL (MoE) | RTX 5090 | 1 | 174.9 to 224.0 tok/s (code) | 1.28x | Unsloth |
| Qwen4-35B-A3B UD-Q4_K_XL (MoE) | Mac M5 Max | 2 | code 1.40x, prose 1.21x | 1.21-1.40x | Unsloth |
| Qwen4-35B-A3B UD-Q4_K_XL (MoE) | RTX Spark | 3 | 62.8 to 84.9 tok/s (code) | 1.35x | Unsloth |
| GLM-4.5-Air Q4_K_M (MoE) | 4x RTX 3090 | 1 | 74.6 to 88.7 tok/s | 1.19x | #26534 |
| GLM-4.7-Flash Q8_0 (MoE) | not stated | 1 | 111.3 to 131.1 tok/s | 1.18x | #24868 |
| Qwen3-Next 80B-A3B Q4_K_M (MoE) | Mac M5 Max | 3 | 18.1 s to 15.5 s wall | 1.17x | #25589 |
| GLM-4.5 full, --n-cpu-moe 30 (MoE) | not stated | 1 | speed-up only | 1.07x | #26534 |
| Gemma 4 26B-A4B (MoE) | author’s system | — | “I don’t observe a speed-up” | about 1.0x | #23398 |
Why dense models gain more than MoE models
The pattern is clear: big dense models gain about 2.4 times, while mixture-of-experts models gain 1.1 to 1.5 times. The usual explanation, which matches these numbers, comes down to which weights each pass reads. A dense 27B or 31B model reads all of its weights for every pass. Checking three extra tokens reads them only once, so the check is almost free, and slow dense models are exactly where the gain is largest. A mixture-of-experts model picks different experts for each token. When it checks four tokens at once, it may need four different sets of experts, so the check reads much more data than a single token would. The bigger the model and the slower your memory, the less this costs in relative terms. That is why the DGX Spark tests look so good: its memory is slow compared with a desktop GPU, so the dense baseline was slow.
When experts sit in system RAM (--n-cpu-moe), the problem grows. Each extra expert read during verification comes over the slower RAM path. The full GLM-4.5 test with --n-cpu-moe 30 gained only 7 percent. If you run Qwen4 or Qwen 3.6 35B-A3B on an 8GB card with most experts on the CPU, expect something closer to 1.0 to 1.2 times than to the RTX 5090 figures. Test it with section 12.
How much memory MTP uses
MTP adds two things to memory: the MTP layer itself, and a small key and value cache for it. In llama.cpp, the MTP layer loads as a separate small model from the same GGUF, with its own context and cache. That is how the original pull request describes it.
| Qwen4 GGUF | MTP head stored as | Head size |
|---|---|---|
| Up to Q3 | Q4_K | 0.49GB |
| IQ4 and Q4 | Q5_K | 0.59GB |
| Q5 | Q6_K | 0.71GB |
| Q6 | Q8_0 | 0.92GB |
| Q8_K_XL | BF16 | 1.72GB |
These sizes come from Unsloth’s Qwen4 guide. They show the head is small, about 2 to 3 percent of a 35B model. The extra cache is the size of one more layer of the main model’s cache, which by my own calculation is small next to the main cache: for a model like Qwen 3.6 27B, up to about half a gigabyte at a 128K context in f16, and much less at normal lengths. Plan on 0.5 to 2GB of extra VRAM in total.
Ways to make it fit
- Update llama.cpp. Before late July 2026,
--fitdid not count the MTP layers. It offloaded one layer too few and left layer 0 on the CPU, which on Qwen 3.6 also disabled a fast fused kernel. Fixing that gave about 10 percent more speed (#26177, #26605). - Quantise the draft cache with
-ctkd q8_0 -ctvd q8_0. The default is f16. - Shrink the draft batch with
--spec-draft-n-ubatch 256or lower, to spare VRAM. - Drop the vision projector with
--no-mmprojif you only use text. - Move one more expert layer to the CPU (
--n-cpu-moeplus 1) if the MTP layer pushes you out of VRAM. Then compare speed with and without MTP, because on small cards the trade can go either way.
When MTP is off, you pay nothing. Since July 2026, llama.cpp only loads the MTP tensors if you ask for --spec-type draft-mtp (PR #26296). A file with an MTP layer is therefore not a memory penalty on its own.
For the much larger main cache, see my guide to how much RAM and VRAM a 1M-token context needs.
When MTP does not help, or makes things slower
The MTP pull request warns that prompt processing “typically takes a negative hit”, mainly because hidden states are copied from GPU to CPU. If you paste 50,000-token documents and want short answers, the slower start can eat the gain.
Parallel decoding with MTP works but, in the words of the pull request, is “not fully optimized yet”. With -np 4 or more the GPU is already busy, so there is less idle time for drafts to fill.
When most of the model runs from system RAM, verifying several tokens needs more expert weights over the slow path. Gains of 1.0 to 1.1 times are typical, and sometimes it is slower.
On Gemma 4 26B-A4B the MTP author saw no speed-up on their system, while the dense 31B more than doubled.
High temperature and fiction mean fewer correct guesses. At n-max 3, Qwen4 prose gained only 4 percent on an RTX 5090.
Llama, Mistral, Phi and most older models have no MTP layer. Use a draft model or n-gram drafting instead.
None of these makes the answers worse. At worst MTP wastes a little time and memory, and you can turn it off by removing one flag.
How to measure the gain on your own PC
Speed claims mean little until you test your own model, card and type of work. This takes about ten minutes.
- Start the server without MTP.Use your normal command, with
-np 1and thinking off (or a fixed thinking level), so runs are comparable. - Send the same prompt three times.Use temperature 0 and a fixed length of a few hundred tokens. Note the generation speed each time and ignore the first run, which includes warm-up.
- Restart with MTP.Add
--spec-type draft-mtp--spec-draft-n-max 2and repeat the same three runs. - Try n-max 1 and 3.Repeat once for each. Keep whichever setting is fastest for your work.
- Repeat with a prompt from your real work.A coding prompt and a writing prompt can give very different answers.
On Windows, this PowerShell command sends a test prompt to a running server and prints the timings. Look at predicted_per_second:
$body = @{ prompt = "Write a Python function that reads a CSV file and returns a list of dictionaries, with error handling."; n_predict = 400; temperature = 0 } | ConvertTo-Json
(Invoke-RestMethod -Uri http://127.0.0.1:8080/completion -Method Post -Body $body -ContentType "application/json").timings
On Linux or macOS:
curl -s http://127.0.0.1:8080/completion -H "Content-Type: application/json" \
-d '{"prompt":"Write a Python function that reads a CSV file and returns a list of dictionaries, with error handling.","n_predict":400,"temperature":0}' \
| python -c "import json,sys; t=json.load(sys.stdin)['timings']; print(round(t['predicted_per_second'],1), 'tok/s')"
Reading the acceptance rate
llama-server prints statistics in its log. The line to look for has this format:
draft acceptance rate = 0.57576 ( 171 accepted / 297 generated)
This means 171 of 297 drafted tokens were kept. As a rough guide from the tests above: above 0.7 is good and you may gain from a longer draft. Between 0.5 and 0.7 is normal at n-max 2 or 3. Below 0.5, shorten the draft or add --spec-draft-p-min 0.6. A high acceptance rate with no speed gain usually means verification is expensive on your setup, typically because of CPU offload.
Proper benchmarking
For a fuller test across many prompt types, llama.cpp includes the SPEED-Bench client. It runs against a running llama-server and can compare a baseline run with a speculative run, reporting throughput, latency and acceptance. Do not confuse it with --spec-synth-len and --spec-synth-rates: those fake the acceptance for benchmarking the machinery, and the documentation warns that the output “is not valid model output”.
Combining MTP with n-gram drafting
n-gram drafting needs no model at all. It notices that the last few tokens already appeared earlier in the conversation and proposes whatever followed them last time. That is very effective when the model rewrites something it has already seen: editing a file, fixing one function in a long code block, reformatting a document or repeating a JSON structure. On new text it rarely finds anything.
MTP is the opposite. It is good on new text and limited to a few tokens. Combining them gives you both:
llama-server -m model-with-mtp.gguf --spec-type ngram-mod,draft-mtp --spec-draft-n-max 3
or, equivalently for the n-gram part, --spec-default --spec-type draft-mtp. The llama.cpp documentation says that when a draftless method is combined with a draft model, the draftless one “has higher precedence”. When ngram-mod finds a match it drafts a long run, and otherwise MTP drafts as usual.
The ngram-mod pool is shared across all server slots, and its default lookup length is 24 tokens. If you mainly do coding-agent work, where the model constantly re-emits code from the context, this combination is worth testing. For plain chat, MTP alone is simpler.
Temperature, sampling and thinking with MTP
Acceptance is highest at temperature 0, because the drafter and the main model both pick their top token. As temperature rises, the main model starts picking other tokens, and an exact-match check rejects more drafts. The October 2026 change (PR #27694) addressed this in two ways. The main model now uses rejection sampling, accepting a draft with probability min(1, p/q) instead of requiring an exact match. And the drafter can sample too (--spec-draft-sampling probabilistic) instead of always offering its single safest guess.
Use temperature 0 to 0.3 and keep the default greedy drafter. This gives the highest acceptance.
Use the model’s recommended temperature (often 0.6 to 0.7) and test --spec-draft-sampling probabilistic against the default.
Expect a small gain. Use n-max 1 or 2 and --spec-draft-p-min 0.6.
Thinking models
MTP speeds up the thinking tokens too. They are generated like any other text, so the same rules apply: structured, step-by-step reasoning tends to be drafted well, rambling exploration less so. Qwen4 has four thinking levels and Qwen 3.6 has thinking on or off. When you compare speed, keep the thinking setting the same in both runs, because a different amount of thinking changes the total time far more than MTP does.
MTP in Ollama, LM Studio and other apps
Ollama, LM Studio, Jan, KoboldCpp and similar apps use llama.cpp code, or their own engines built in a similar way, but each decides which llama.cpp options to expose and when. At the time of writing I could not find official documentation of an MTP switch in Ollama or LM Studio, so I will not claim one exists. Check your app’s release notes for “MTP”, “multi-token prediction” or “speculative decoding”.
If your app does not have it, run llama-server yourself with MTP on and point the app at it. llama-server provides an OpenAI-compatible API at http://127.0.0.1:8080/v1, which Open WebUI, most coding agents, VS Code extensions and many chat apps can use as a “custom OpenAI” or “OpenAI-compatible” provider. You keep your favourite interface and get MTP from llama.cpp.
Ollama now runs llama.cpp’s llama-server underneath on Windows and Linux. My Ollama vs llama.cpp VRAM test shows the command it uses and which llama.cpp settings Ollama does and does not expose.
NVIDIA, AMD, Apple and multiple GPUs
| Setup | What to know |
|---|---|
| NVIDIA (CUDA) | The most tested. CUDA graphs for the MTP draft arrived in September 2026 (#28549), which cuts overhead. A Gemma E4B MTP FlashAttention fix landed in June. |
| Apple Silicon (Metal) | Tested in the Qwen3-Next pull request and Unsloth’s guide on an M5 Max: 1.17 times for Qwen3-Next, 1.21 to 1.40 times for Qwen4. Unified memory means the MTP layer simply comes out of the same pool. |
| AMD (ROCm, Vulkan) | MTP is part of the common code, not a CUDA-only feature, so it runs wherever the model runs. I found no published AMD MTP benchmarks, so measure your own. |
| CPU only | It works, but CPU inference is usually limited by memory bandwidth for both drafting and checking, so expect small gains. Try n-max 1. |
| Several GPUs | The pull request says MTP is compatible with tensor and pipeline parallelism. For Gemma 4 with several GPUs, the author notes you may need --spec-draft-device together with -sm layer to pick where the draft runs. |
Troubleshooting MTP
| Problem | Likely cause | Fix |
|---|---|---|
| “invalid argument” or unknown spec type | Old llama.cpp, or old flag names | Update to a current release and use --spec-type draft-mtp and --spec-draft-n-max |
| MTP is on but nothing is drafted | The GGUF has no MTP layer | Check the metadata (section 5) and download an MTP version |
| Slower with MTP than without | Draft too long, CPU offload, or creative text | Try n-max 1, add --spec-draft-p-min 0.6, and compare again |
| Out of memory after turning it on | The MTP layer and its cache no longer fit | Update for the --fit fixes, use -ctkd q8_0 -ctvd q8_0, lower --spec-draft-n-ubatch, reduce -c or add one --n-cpu-moe |
| Log says layer 0 is on CPU and a fused kernel is disabled | Older --fit did not count MTP layers | Update past late July 2026 (#26177) |
| First reply after a long paste is slow | Prompt processing is slower with MTP | Expected. Turn MTP off for mostly long-prompt, short-answer work |
| Acceptance drops at temperature 0.7 or higher | Exact-match drafting at high temperature | Use a build from October 2026 or later and try --spec-draft-sampling probabilistic |
| The MTP file loads as the main model | Router mode did not recognise the companion file | Name it mtp-*.gguf and update (#24431), or load it with -md |
| Slow or errors with several GPUs | Draft placed on the wrong device | Set --spec-draft-device and try -sm layer |
| Gemma 4 E2B or E4B will not use MTP | Not supported in the first Gemma 4 MTP version | Update and check the release notes, or use the 31B |
Frequently asked questions
Does MTP reduce answer quality?
No. A draft token is only kept if the main model accepts it. With greedy sampling the output is identical, and with normal sampling llama.cpp uses rejection sampling, which keeps the same output distribution. The MTP pull request re-ran AIME 2026 with MTP and matched Qwen’s reported score.
Is MTP the same as speculative decoding?
MTP is one way to do speculative decoding. Speculative decoding is the draft-then-verify method. MTP is where the drafts come from: a layer built into the model, instead of a second model or an n-gram lookup.
What is the difference between MTP and NextN?
Nothing for you as a user. NextN is the name llama.cpp and some model makers use for the same extra prediction layer. You may see nextn in tensor names and metadata.
Does every GGUF of a supported model have MTP?
No. Files made before support arrived, or converted with --no-mtp, leave the layer out. Check the metadata or download a version that mentions MTP.
Which n-max should I use?
Start with 2. Try 3 for dense models that fit in VRAM, and 1 for mixture-of-experts models with experts in system RAM. Keep whichever measures fastest.
How much faster will my PC be?
Between no gain and about 2.4 times. Dense models on slow-memory hardware gain most. Mixture-of-experts models usually gain 1.1 to 1.5 times. Heavy CPU offload often gains under 1.1 times.
Does MTP use more VRAM?
Yes, a little: the MTP layer (0.5 to 1.7GB for Qwen4 depending on the quant) plus a small cache. When MTP is off, recent llama.cpp does not load the layer at all.
Can I use MTP and a separate draft model at the same time?
The documented combination is one model-based drafter, such as MTP, plus a draftless method such as ngram-mod, which takes precedence when it finds a match. I have not seen two model-based drafters combined in the documentation or the tests, so I would not rely on it.
Does MTP work with images?
Yes. The original pull request says MTP is compatible with vision input, and a later change improved image input with MTP. Skip --no-mmproj if you need images.
Does MTP speed up prompt processing?
No. It only speeds up generation and can make prompt processing slightly slower.
Can I use MTP with Llama 3 or Mistral?
No, those models have no MTP layer. Use a draft model from the same family or n-gram drafting.
Is MTP worth it on an 8GB card?
Sometimes. If the model fits on the GPU, usually yes. With a 35B mixture-of-experts model mostly in system RAM, the gain is small, and the extra VRAM might be better used for more layers. Measure both ways with section 12.
Does MTP work on Windows?
Yes. Use the Windows build of llama.cpp from the releases page that matches your GPU (CUDA, Vulkan or CPU). The flags are the same on every system.
Does MTP help with many users at once?
It works with -np greater than 1, but the pull request says parallel MTP is not fully optimised yet. Measure before relying on it for a shared server.
Where do I see if MTP is working?
In the server log, look for the line draft acceptance rate. If it shows accepted and generated counts, MTP is drafting.
Does Qwen4 need MTP turned on to run properly?
No. It is optional. Qwen4 runs normally without it, and MTP only adds speed. My Qwen4 guide and my Qwen4 vs Qwen 3.6 comparison cover the rest.
Your next step
Update llama.cpp to the newest release and check that your model’s GGUF contains the MTP layer. Then run the ten-minute test in section 12 with --spec-type draft-mtp --spec-draft-n-max 2, and try 1 and 3. If MTP is faster on your own prompts, add the flags to your normal start command and forget about it. If it is not, you have lost nothing: remove the flag. If you are setting up Qwen from scratch, start with my Qwen4 guide for 8GB, 12GB and 16GB cards or my Qwen 3.6 guide.
Sources: llama.cpp speculative decoding docs, llama.cpp server README, PR #22673 MTP support, PR #23398 Gemma 4 MTP, PR #27694 rejection sampling, PR #26534 GLM-4.5-Air MTP, PR #24868 GLM-4.7-Flash MTP, PR #25589 Qwen3-Next MTP, PR #29761 Qwen4Exp MTP, PR #26177 MTP offload fix, PR #26296 load MTP only if used, Unsloth Qwen4 guide, ggml-org Qwen3.6-27B-MTP-GGUF, llama.cpp releases.