Skip to content
/ airelien.dev
Go back
Aurélien AMSELLEM

Qwen3.6-27B on upstream llama.cpp: +123% free with MTP, zero fork to maintain

MTP finally lands in llama.cpp upstream (PR #22673 by am17an, May 4). Bench on Olares One RTX 5090M sm_120: 78 t/s with an MTP-enabled GGUF, +123% vs baseline. No Lucebox, no Genesis, no permanent custom fork.

Hi there.

Last night on r/LocalLLaMA, u/ilintar announced that am17an’s MTP PR had gone into beta. 334 upvotes in a few hours, and this line to close it: “expect most performance gaps between llama.cpp and vLLM… to be erased.”

On my machine, plain llama.cpp runs at 35 t/s (tokens per second; a token is a piece of a word, about 3/4 of an English word). With PR #22673 and the right model file, I get 78 t/s, which is +123%. And I didn’t need any of the hacks I usually stack (Genesis, Lucebox, HAMi). Here’s how it went.

Background: MTP was in vLLM, not in llama.cpp

Two inference engines come up all the time on this blog. llama.cpp is a C++ engine that loads GGUF files and is very good for a single user; llama-server is its OpenAI-compatible HTTP server. vLLM is a Python/CUDA engine built to serve many users at once, heavier, and faster under concurrency.

MTP (Multi-Token Prediction) is a form of speculative decoding. The idea behind speculative decoding: a small, fast “drafter” guesses the next few tokens, the big model checks them all in one pass and keeps the ones it agrees with. The output is the same as normal generation, but there are fewer expensive steps. With MTP, the drafter isn’t a separate model: it’s a prediction head built into the model and trained to predict several tokens ahead. If a good share of the guessed tokens gets accepted (that share is the acceptance rate), you go roughly 2× faster.

Qwen trained Qwen3.6 with this MTP head. vLLM has been able to use it for a while (--speculative-config '{"method":"mtp","num_speculative_tokens":3}'). llama.cpp couldn’t, until Aman Gupta’s PR #22673, opened May 4, 2026. A PR is a proposed change on GitHub; until it’s “merged”, it isn’t in the main code.

The PR adds:

Aman tests on a DGX Spark, and the Reddit community jumped in fast:

Nobody had tested it on a consumer Blackwell GPU yet. My Olares One is a good candidate: it’s a mini-PC running Olares (a self-hosted OS built on Kubernetes), with an RTX 5090 Laptop GPU (which I call the 5090M), 24 GB of VRAM, and the consumer Blackwell architecture, whose technical name is sm_120.

The build: am17an/mtp-clean + sm_120

PR #22673 lives on the mtp-clean branch of the am17an/llama.cpp fork. Five commits:

1a4fe4e  llama: allow partial seq_rm for GDN models for spec decoding
589490f  add enum for part sequence removal
c5e0227  rename rollback to rs_seq
10829db  llama + spec: MTP support
f8c6b03  add qwen35moe_mtp

I usually run buun-llama-cpp, a llama.cpp fork that adds DFlash (more on that below). Rather than cherry-picking these commits into it, I built straight from am17an’s branch in minimal mode: just llama-server for Qwen3.6 27B, compiled natively for sm_120.

FROM nvidia/cuda:13.1.0-devel-ubuntu22.04 AS build
RUN git clone --depth 1 --branch mtp-clean \
    https://github.com/am17an/llama.cpp /src/llama.cpp
WORKDIR /src/llama.cpp
RUN cmake -B build \
    -DGGML_CUDA=ON -DGGML_CUDA_NO_VMM=ON \
    -DCMAKE_CUDA_ARCHITECTURES=120 \
    -DLLAMA_CURL=ON \
    -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath-link,/usr/local/cuda/lib64/stubs" \
    -DCMAKE_BUILD_TYPE=Release && \
    cmake --build build -j$(nproc) --target llama-server

2h of cross-compile on OrbStack on my Mac. The result is the image aamsellem/llamacpp-mtp:0.1.0, 2.62 GB. No Genesis patches, no DFlash custom kernels, no Lucebox: llama.cpp plus one PR, that’s all.

The GGUF: RDson/Qwen3.6-27B-MTP-Q4_K_M-GGUF

GGUF is the file format llama.cpp loads. To fit in 24 GB, you use a quantized version of the model: the weights are stored with fewer bits (Q4_K_M is about 4 bits per weight instead of 16).

To use MTP with llama.cpp, the GGUF has to contain the MTP head. The standard Qwen3.6-27B Q4_K_M from unsloth doesn’t, because standard quantization strips it out.

Luckily, RDson made a quant with ik_llama that keeps it:

am17an also published a Q8_0 on his repo, but at 28 GB it doesn’t fit in 24GB.

llama-server config

llama-server \
  --model /models/Qwen3.6-27B-MTP-Q4_K_M.gguf \
  --host 0.0.0.0 --port 8000 \
  --n-gpu-layers 99 \
  --ctx-size 32000 \
  --threads 16 \
  --batch-size 256 --ubatch-size 64 \
  --parallel 1 \
  --flash-attn on --jinja \
  --spec-type mtp \
  --spec-draft-n-max 4 \
  --chat-template-kwargs '{"enable_thinking": false}'

What matters in that command:

The bench

Three Space Invaders prompts (I ask the model to write the game in HTML), max_tokens=800, temp=0.6, top_p=0.95:

Run 1: 800 tok in 10.68s = 74.91 t/s
Run 2: 800 tok in  9.93s = 80.60 t/s
Run 3: 800 tok in 10.15s = 78.78 t/s

Average: 78.1 t/s [74.9-80.6]. That’s generation (decode) speed, meaning how fast the answer gets written.

Same-machine comparison (Olares One, RTX 5090M 24GB sm_120)

In this table, the middle column is average generation speed and the last one says what you have to maintain to run the stack.

Stackt/s avgStack complexity
llama.cpp standard (no spec)33-36pure upstream
llama.cpp + MTP (PR #22673)78.1pure upstream + 1 PR
buun-llama-cpp DFlash + Q8_0 GGUF drafter80llama.cpp fork
vLLM Turbo (Genesis 28 patches + TurboQuant K8V4 + MTP n=3)88.0vLLM + 28 patches + custom image
Lucebox v1.6.0 (PR #94 + q4_0 KV + DDTree 22)88.7custom engine + libvgpu hot-swap + 4 workarounds

Some pointers for the bottom rows. DFlash is another speculative decoding method, with a separate small drafter model that predicts a block of tokens; buun-llama-cpp is the llama.cpp fork that implements it. Genesis is a set of 28 patches I apply to vLLM to get it running on this card. Lucebox is a custom engine that, on Olares, needs a hot-swapped libvgpu.so (the library from HAMi, the layer that shares and limits the GPU between pods).

MTP in llama.cpp gives +123% over baseline. That’s more than alexandrupetraru’s +75% on Strix Halo. My guess: on the 5090M the baseline starts lower because it’s more bound by memory bandwidth (more than sm_122), so there’s more to gain.

Why 78 and not 88

MTP gives about 2× over baseline (around 75% acceptance on 4 guessed tokens). Well-tuned DFlash, with a dedicated drafter and custom kernels, gives more like 2.5 to 3×. Above MTP in llama.cpp, I have:

All three need a fork or patches. MTP in llama.cpp is the only one of these that will be merged into the official code, as soon as the PR review wraps up.

What changes once the PR is merged

Once PR #22673 lands in ggml-org/llama.cpp master, anyone can pull ghcr.io/ggml-org/llama.cpp:server-cudaXY-bNNNN, download a Qwen3.6 GGUF with the MTP head, and get around 78 t/s on a 24GB consumer mobile Blackwell, with no fork to maintain.

It’s not the record (Lucebox is at 88.7), but it’s reproducible with one docker pull and one huggingface-cli download. It’s also maintainable, because upstream llama.cpp won’t break under you the way a fork can. And it works with LM Studio, Open WebUI or Ollama, which consume official llama.cpp.

For end users, that’s what really matters. Forks stay the right answer for record benchmarks; upstream MTP will be the right answer for wide distribution.

May 6 update: pushing to 128K context, 65 t/s

I bumped the llamacppqwen36mtpone app to v1.0.3 with two changes:

  1. I switched the GGUF to froggeric/Qwen3.6-27B-MTP-GGUF (instead of RDson). It became the community’s reference quant after the May 6 post that hit 678 upvotes (ex-arman68 relaying froggeric).
  2. I pushed the context to 128K (from 32K), with --cache-type-k q4_0 --cache-type-v q4_0 and --spec-draft-n-max 5. 128K tokens is about a 300-page book.

The KV cache is the model’s memory of what it has already read in the conversation; it grows with the context and takes VRAM. The q4_0 options store it in 4 bits to fit more context, at a small cost in speed or quality.

Ouch: froggeric’s official table says “24 GB | Q4_K_M | q4_0 | 262K | 22.8 GB”, but it doesn’t count the MTP draft compute buffer, the working memory the MTP head needs. At 262K my pod crashes with graph_reserve: failed to allocate compute buffers / failed to create MTP context, and the server falls back to non-MTP mode at 37 t/s.

At 128K it holds:

prompt eval time =  94.28 ms /   22 tokens (   4.29 ms per token, 233.36 tokens per second)
       eval time =  44.86 s   / 2921 tokens (  15.36 ms per token,  65.11 tokens per second)
draft acceptance rate = 64.15% (2226/3470)

The eval time line gives generation speed and the last line gives the acceptance rate of the guessed tokens. Result: 65 t/s at 128K with 64% acceptance. That’s 17% slower than at 32K, but with 4× the context, which is a good trade for coding agents that read large codebases.

The real VRAM math on 24GB with Q4_K_M and MTP:

At 262K the KV cache eats 4.3 GB and there’s nothing left for the MTP draft buffer. To go further, you’d switch to IQ4_XS (-1.5 GB on the model) or IQ3_M (-3 GB), two slightly more compact quantizations.

To follow the merge

Credits

That’s it! If you run on a 5090M / 4080M / 3090 24GB and reproduce these 78 t/s (or beat them with a --spec-draft-n-max sweep), send me your numbers. See you next time!


Disclosure — All the benchmarks in this post run on my own Olares One. If the content was useful and you’re considering one, ordering through this referral link gets you $300 off ($4,699 instead of $4,999), stackable with the $300 Black Friday discount starting November 17: $600 off in total ($4,399). I’m mentioning this out of transparency — and yes, incidentally, it helps keep the blog alive (hosting, domain, and the time I spend writing here).

Share this post on:

Comments