Skip to content
The 38 guidesFREN中文
Guides
Part 4 · guide 9 of 11 Level: Advanced Reading time: 11 min

Speeding up local models with MTP and speculative decoding

Make a local model generate text 30 to 70% faster while keeping the same answers. Here's how multi-token prediction works, what we measured on RTX Spark and MacBook Pro M5 Max, and the llama.cpp command to enable it.

In this guide
  1. 01Why local models generate text slowly
  2. 02Guess first, then check
  3. 03What we measured
  4. 04Enabling MTP in llama.cpp
  5. 05When it’s worth it
  6. 06Frequently asked questions

In short

On a mini-PC, a local model generates text slowly because it has to read all its weights from memory for every token. Speculative decoding works around that bottleneck by guessing several tokens ahead and letting the model check them all in one pass. With MTP (Multi-Token Prediction), heads trained alongside the model make the guesses. In our November 9, 2026 tests with Qwen3.8 Flash-Next and llama.cpp, generation was 33 to 72% faster depending on the task and machine, with the biggest gains in code and math and the smallest in free-form French writing. MTP does not speed up reading a long document. To enable it in llama.cpp, use --spec-type draft-mtp. Ollama has yet to offer official support.

Do this first: Ollama & local modelsChoosing and sizing your model

You’ve installed a good local model. Its answers are accurate, but it puts out 30 words per second while Claude churns out three times as many. Before buying a pricier machine, try speculative decoding. It can speed up generation by 30 to 70% while keeping the answers the same. On recent models, MTP is the most effective version.

Why local models generate text slowly

To produce each word (each token, to be precise), the model has to read all its weights from memory. With a 98 GB model, that’s 98 GB to move for a single token. The math itself is quick. Moving the data out of memory is the bottleneck. On a Ryzen AI Max+ 395, memory bandwidth is about 256 GB/s. That sets a ceiling no tuning knob can raise.

Checking four tokens together, though, requires moving almost as much data as generating one. That’s the idea behind speculative decoding.

Guess first, then check

Speculative decoding works in two steps:

  1. A fast drafter guesses the next three or four tokens.
  2. The main model checks all of them in one pass. It keeps the tokens it would have generated itself, rejects the first mismatch and replaces it with its own token.

If the drafter guesses right, you get four tokens for the price of one. If it guesses wrong, you spend a little extra compute. The final text is still what the main model would have written on its own.

What we measured

On November 9, 2026, we ran Qwen3.8 Flash-Next (about 98 GB of open weights) with and without MTP on two 128 GB machines, an Nvidia RTX Spark (in French) laptop and a MacBook Pro M5 Max (in French). We used the same llama.cpp build (b11617), guessed three tokens per round, ran three prompts three times each, and took the medians.

TaskRTX Spark, without → with MTPGainM5 Max, without → with MTPGain
Writing code31.5 → 50.9 tokens/s+62%47.9 → 82.6 tokens/s+72%
Step-by-step math31.5 → 53.1 tokens/s+69%48.2 → 81.0 tokens/s+68%
Free-form writing in French30.8 → 42.0 tokens/s+37%47.9 → 63.7 tokens/s+33%

Three things stood out:

  • More predictable text means bigger gains. Code and calculations follow a logical sequence, so the heads often guess right. Free-form French writing leaves more options at each word, and more guesses get rejected.
  • MTP only speeds up generation. With a 13,750-token document, the total time was about the same with and without MTP (21.3 versus 20.9 seconds on the Spark). Reading the document accounted for most of the time.
  • A smaller model still responds faster. On that same long document, Qwen3.6 35B without MTP answered about three times as fast as Flash-Next. MTP makes a large model feel more responsive, while a smaller one is still quicker.

Enabling MTP in llama.cpp

As of November 17, 2026, Ollama has yet to offer official MTP support. Use llama-server, the llama.cpp server, which exposes the same OpenAI-compatible API. Your agents connect to it the way they connect to Ollama. Just change the address.

0 of 4 steps done Your ticks stay in this browser.

  1. Get llama.cpp and both files

    You’ll need a recent version of llama.cpp (MTP arrived in May 2026), the model in GGUF format, and the MTP heads file released alongside it (from Unsloth for Flash-Next). Check the SHA-256 hashes listed on the download page.

  2. Start the server with MTP

    # The filenames are examples. Use the files you downloaded.
    # --spec-type draft-mtp : draft tokens come from the MTP heads in the specified file
    # --spec-draft-n-max 3  : tokens guessed per round (3 by default)
    llama-server \
      -m ~/modeles/Qwen3.8-Flash-Next-Q4_K_M.gguf \
      --spec-type draft-mtp \
      --spec-draft-model ~/modeles/mtp-Qwen3.8-Flash-Next-Q8_0.gguf \
      --spec-draft-n-max 3 \
      -c 32768 --port 8080
    
  3. Compare both modes

    Restart with --spec-type none, ask the same question three times in each mode, and compare the tokens per second reported by llama-server. Test it on your tasks. The speedup you see for code will be different from the one you see for email.

  4. Connect your agent

    OpenCode, Codex and Hermes can talk to http://localhost:8080/v1 just as they would to any OpenAI-compatible server. See Ollama and local models for how the connection works.

When it’s worth it

  • Yes for a large model (more than 30 billion active parameters) on a machine with unified memory: Ryzen AI Max, RTX Spark, DGX Spark, Mac. Bandwidth is the biggest constraint there, so the improvement is easiest to see.
  • Yes for coding agents, which generate a lot of predictable text.
  • Less so for free-form writing. For long document analysis, reading takes most of the time, so there’s no meaningful gain.
  • You can skip it if your small model already generates text quickly. The relative speedup is there, but you’re unlikely to feel it.

To see what fits on your hardware, check the machine pages on QUELLE IA, such as the 128 GB Ryzen AI Max+ 395. For help picking the model, see Choosing your local model.

Frequently asked questions

Does MTP change the model's answers?

In principle, no. The main model checks every token proposed by the MTP heads and rejects the first one it would not have generated itself. You save time while keeping the main model's output quality. In practice, small numerical differences can crop up depending on the machine, just as they can without MTP.

How much faster is MTP on a mini-PC?

In our Qwen3.8 Flash-Next tests, generation speed rose by 62 to 72% for code, 68 to 69% for math, and 33 to 37% for free-form French text, across an RTX Spark PC and a MacBook Pro M5 Max. The gain depends on how predictable the text is. The more obvious the next tokens are, the more guesses the model accepts.

Does Ollama support MTP?

There was no official support as of November 17, 2026, and no Ollama release notes had announced it. Ollama is built on llama.cpp, which has supported it since May 2026 with --spec-type draft-mtp. vLLM supports it through the mtp method. To use it today, run llama-server yourself.

Do all models have MTP heads?

No. You need a model trained with them, such as recent Qwen models (Qwen3.6, Qwen3.8 Flash-Next) or DeepSeek, and a heads file in the format your version of llama.cpp expects. Other models can still use speculative decoding with a small draft model from the same family or with n-gram methods that require no extra model.

Terms in this guide: MTPTokenMemory bandwidthOpen-weight modelOllamaAPIParametersUnified memory

Spotted a mistake?

A command stopped working, a price changed?

Tools change every month. Tell me what is wrong in this chapter and I will fix it and update its date.

Only the page, your message and the optional contact are kept. Nothing else.

Guide 28 of 38 · part 4 no guides read yet Open the list of guides