AI Techniques

Multi-Token Prediction (MTP)

Multi-token prediction trains a language model to predict several future tokens at each position instead of only the next one, using small extra prediction modules on top of the shared model trunk. The extra objective improves what the model learns during pretraining, and at inference time the same modules become a built-in draft model for speculative decoding, so a model can verify several of its own guesses in one forward pass.

Multi-token prediction (MTP) is a training objective in which a language model learns to predict not just the next token at every position, but the next several tokens, through a small set of extra prediction modules that sit on top of the model’s shared transformer trunk. It started as a way to make pretraining more sample-efficient, and it ended up as one of the most practical inference speedups of the 2025 to 2026 model generation: the same extra modules that helped the model learn can be reused at serving time as a free, perfectly matched draft model for speculative decoding. DeepSeek-V3 made the idea mainstream, and by late 2026 MTP heads ship inside the checkpoints of DeepSeek, Qwen3.5 and Qwen3.6, the GLM-5 line, and Step 3.5 Flash, with vLLM and SGLang able to switch them on with a single config flag. If you serve open-weight models, MTP is increasingly the first speculation method to try, because there is nothing extra to train, download, or keep in sync.

Next-Token Prediction and Its Blind Spot

A standard large language model is trained with one objective: given tokens 1 through t, put high probability on token t+1. Every training signal the model ever receives is about the very next step. That objective is simple and it scales, but it has two well-documented weaknesses.

The first is a learning weakness. Next-token loss is dominated by easy, local predictions (closing a bracket, finishing a common phrase), and gives relatively little gradient signal for the harder decisions that determine where a sequence is going several tokens later, such as choosing which variable to return or which branch of an argument to pursue. The model has to discover longer-range planning indirectly.

The second is a speed weakness. Decoding generates one token per full forward pass, and on a GPU each pass is limited by how fast the weights can be streamed from memory, not by arithmetic. A model that could emit more than one trustworthy token per pass would use the hardware far better.

# Scenario: the standard next-token objective, as used for pretraining
# almost every LLM. One target per position: the token immediately after.
import torch.nn.functional as F

hidden = trunk(input_ids)              # [batch, seq, d_model]
logits = lm_head(hidden)               # [batch, seq, vocab]
loss = F.cross_entropy(
    logits[:, :-1].reshape(-1, vocab),
    input_ids[:, 1:].reshape(-1),      # target is always t+1, nothing further
)

MTP addresses both weaknesses with the same mechanism: ask the model, during training, to also predict tokens t+2, t+3, and so on.

How MTP Works: Shared Trunk, Extra Heads

The design that started the modern wave of MTP research is from Meta’s Better & Faster Large Language Models via Multi-token Prediction (Gloeckle et al., ICML 2024). The model keeps one shared transformer trunk, but instead of a single output head it has n independent heads, each a small transformer layer plus the unembedding. Head 1 predicts token t+1, head 2 predicts t+2, and so on, all from the same trunk representation at position t. The total loss is the sum of the n cross-entropy losses.

# Scenario: Gloeckle-style MTP pretraining with n=4 parallel heads on a
# code corpus. Each head predicts a different offset from the SAME trunk state.
import torch
import torch.nn as nn
import torch.nn.functional as F

class ParallelMTP(nn.Module):
    def __init__(self, trunk, d_model, vocab, n_future=4):
        super().__init__()
        self.trunk = trunk
        self.heads = nn.ModuleList(
            [nn.TransformerEncoderLayer(d_model, nhead=16, batch_first=True)
             for _ in range(n_future)]
        )
        self.unembed = nn.Linear(d_model, vocab, bias=False)  # shared across heads
        self.n_future = n_future

    def loss(self, input_ids):
        h = self.trunk(input_ids)                       # computed once
        total = 0.0
        for k, head in enumerate(self.heads, start=1):  # k = how far ahead
            logits = self.unembed(head(h))[:, :-k]
            target = input_ids[:, k:]
            total = total + F.cross_entropy(
                logits.reshape(-1, logits.size(-1)), target.reshape(-1)
            )
        return total / self.n_future

The paper reports two results that explain why everyone paid attention. At 13B parameters, MTP models solved 12% more HumanEval problems and 17% more MBPP problems than comparable next-token models, with the advantage growing as models get larger. And models trained with 4-token prediction ran up to 3x faster at inference using the extra heads for self-speculative decoding, without a separate draft model.

DeepSeek’s sequential variant

DeepSeek-V3 changed the design in a way most later models copied. Instead of independent parallel heads, it chains sequential MTP modules. Module k takes the representation produced for depth k-1, combines it with the embedding of the actual token at that offset, runs one transformer block, and predicts the next token from there. The embedding table and output head are shared with the main model, so each module costs roughly one extra transformer layer. Because module 2 conditions on what module 1 was predicting about, the chain keeps a causal link between successive predictions, which parallel heads lack.

# Scenario: one DeepSeek-V3-style sequential MTP module. It predicts token
# t+k+1 from the previous depth's hidden state plus the embedding of token t+k.
class SequentialMTPModule(nn.Module):
    def __init__(self, d_model, shared_embed, shared_head):
        super().__init__()
        self.norm_h = nn.RMSNorm(d_model)
        self.norm_e = nn.RMSNorm(d_model)
        self.proj = nn.Linear(2 * d_model, d_model, bias=False)
        self.block = nn.TransformerEncoderLayer(d_model, nhead=16, batch_first=True)
        self.embed = shared_embed   # same table as the main model
        self.head = shared_head     # same output projection as the main model

    def forward(self, prev_hidden, next_token_ids):
        e = self.embed(next_token_ids)
        x = self.proj(torch.cat([self.norm_h(prev_hidden), self.norm_e(e)], dim=-1))
        h = self.block(x)
        return h, self.head(h)      # h feeds the next module in the chain

DeepSeek used MTP depth 1 (one extra module) during training and reported that, when reused for speculative decoding, the second token’s acceptance rate sat between 85% and 90% across generation topics, giving about 1.8x the tokens per second of plain decoding.

%%{init: {'theme': 'base'}}%%
graph LR
    classDef default fill:#ffffff,stroke:#4338CA,stroke-width:2px,color:#0F172A,rx:8px,ry:8px;
    classDef data    fill:#EEF0F7,stroke:#0D9488,stroke-width:2px,color:#0F172A,rx:8px,ry:8px;
    classDef process fill:#F7F8FC,stroke:#6366F1,stroke-width:2px,color:#0F172A,rx:8px,ry:8px;
    classDef output  fill:#4338CA,stroke:#4338CA,stroke-width:2px,color:#ffffff,rx:8px,ry:8px;

    subgraph TRAIN[Training: extra loss terms]
        T1([Tokens 1..t]):::data --> TR[Shared trunk]:::process
        TR --> H1[Main head: predict t+1]:::process
        TR --> M1[MTP module 1: predict t+2]:::process
        M1 --> M2[MTP module 2: predict t+3]:::process
    end

    subgraph SERVE[Serving: same modules become the drafter]
        S1([Context]):::data --> MAIN[Main model emits t+1]:::process
        MAIN --> DR[MTP modules draft t+2, t+3]:::process
        DR --> VER[Next main pass verifies drafts in parallel]:::process
        VER --> OUT([Accepted tokens streamed]):::output
    end

From Training Trick to Built-In Draft Model

Ordinary speculative decoding needs a separate small draft model that shares the target’s tokenizer and imitates its distribution closely enough to get guesses accepted. Finding or training that drafter is real work, and a drafter tuned for one checkpoint drifts out of alignment when the target is fine-tuned.

MTP removes that problem. The draft modules were trained jointly with the target, on the same data, from the same hidden states, so they are as well matched as a drafter can be. Serving works like this: the main model produces token t+1 as usual, the MTP path cheaply drafts the following few tokens, and the next forward pass of the main model verifies every draft at once. Each accepted draft is a token that cost almost nothing; the first rejected one is replaced by the main model’s own sample, which keeps the output distribution identical to normal decoding. The detailed accept/reject rule is the same as in any speculative decoder.

# Scenario: exposing an OpenAI-compatible endpoint for a DeepSeek-family
# model with its native MTP head drafting 2 tokens per verification step.
vllm serve deepseek-ai/DeepSeek-V3 \
  --tensor-parallel-size 8 \
  --speculative-config '{"method": "mtp", "num_speculative_tokens": 2}'

Two practical consequences follow. There is no "model" key in the config, because the drafter lives inside the checkpoint. And the drafter costs roughly one transformer layer per drafted token, far less than even a small separate model, so the overhead of a rejected guess is small.

The Two Numbers That Matter: Draft Length and Acceptance

MTP speedups come down to two quantities. Draft length (num_speculative_tokens, often written N) is how many tokens the MTP path proposes per step. Per-position acceptance is the probability that each drafted token survives verification, and it falls off with depth: the first drafted token is usually accepted most of the time, the fourth much less often, and a draft can only be kept if every draft before it was kept too.

The vLLM team’s August 2026 benchmark on AMD MI300X and MI355X GPUs shows the shape clearly. On Qwen3.5-122B-A10B with MATH500 and N=7, the first position was accepted about 95% of the time and the last about 46%, for a mean accepted length of about 5.9 tokens per step and a 2.2x speedup. Smaller and different-shaped models from the same family peaked at different N: Qwen3.6-27B was best around N=5 (about 1.8x), Qwen3.6-35B-A3B around N=6 (1.3x to 1.5x). Throughput generally rises over the first few N values and then plateaus, because each extra draft position is less likely to survive and still costs a little to produce and verify.

The widget below models this. Expected tokens per step is 1 plus the sum of the survival probabilities of each draft position, and the speedup is that number divided by the relative cost of one step (main pass plus MTP drafting plus verification overhead, which grows once the GPU is busy with a large batch).

Interactive: draft length, acceptance decay, and batch size vs. MTP speedup

0.0tokens per main-model pass
0.0xspeedup vs. plain decoding
N=0best N for these settings

Try this: leave batch size at 1 and drag N from 1 to 7. The speedup climbs, then flattens as deep positions stop surviving. Now drop "acceptance kept per extra depth" to about 40% (an untuned head reused recursively) and watch the best N collapse to 1 or 2. Finally push batch size to 128: verification stops being free and MTP turns into a slowdown, which is why servers switch speculation off under heavy load. The cost model is illustrative, not a benchmark.

The Recursive Reuse Problem, and FastMTP

There is a catch the widget’s “head quality” slider stands in for. Most providers train and ship only one MTP module (DeepSeek-V3 used depth 1). To draft N greater than 1, the serving engine runs that single module repeatedly, feeding its own predictions back in. But the module was trained to predict from ground-truth inputs, not from its own possibly wrong guesses, so errors compound and acceptance falls off steeply after the first draft.

FastMTP (Cai et al., September 2025) measured how bad this is and fixed it by fine-tuning the single shared head the way servers actually use it: recursively, on self-distilled data generated by the model itself. Compared with plain reuse of the shipped head, acceptance rose from 70% to 81% at the first draft position, from 11% to 56% at the second, and from 2% to 36% at the third, and the average speedup across seven benchmarks went from 1.21x to 2.03x on 7B models. The paper also trims the MTP head’s vocabulary per language to make each draft step cheaper.

# Scenario: FastMTP-style recursive fine-tuning of a single shipped MTP head.
# The head is unrolled K steps on its OWN predictions, the way vLLM runs it,
# and later steps get less weight so early positions stay strong.
import torch
import torch.nn.functional as F

def recursive_mtp_loss(main_model, mtp_head, input_ids, K=3, beta=0.6):
    with torch.no_grad():
        hidden = main_model.hidden_states(input_ids)       # frozen verifier
        teacher = main_model.lm_head(hidden)               # self-distillation targets
    weights = torch.tensor([beta ** k for k in range(K)])
    weights = weights / weights.sum()                      # about 0.51, 0.31, 0.18 for K=3

    h, tokens, total = hidden, input_ids, 0.0
    for k in range(K):
        h, logits = mtp_head(h[:, :-1], tokens[:, 1:])     # predict one more step ahead
        target = teacher[:, k + 1 : k + 1 + logits.size(1)].softmax(-1)
        total = total + weights[k] * F.kl_div(
            logits[:, : target.size(1)].log_softmax(-1), target, reduction="batchmean"
        )
        tokens = logits.argmax(-1)                         # feed back the head's own guesses
    return total

Red Hat’s Speculators library added this recipe in its 0.6.0 release (September 2026) for Qwen3-Next and Qwen3.5 models. It extracts the native mtp.* weights from the checkpoint, fine-tunes them with the recursive loss (exponentially decaying step weights of roughly 0.51, 0.31 and 0.18 over three steps), and writes the result back in the key format vllm serve expects. On Qwen3-Next-80B-A3B-Instruct with GSM8K, third-position acceptance went from 0.476 to 0.616 after a short run, for up to 1.25x better median inter-token latency on top of the base MTP gains.

MTP vs. Other Ways to Draft

Drafting methodWhere the drafter comes fromExtra training neededTypical strengthMain limitation
Separate draft modelA smaller model in the same familyNone if one existsWorks with any target that has a siblingTokenizer must match; alignment drifts after fine-tuning
Medusa headsHeads bolted onto a frozen targetShort head training runCheap to addParallel heads ignore each other, acceptance drops fast
EAGLE-3Lightweight draft layer trained on target featuresDedicated training runVery high acceptance, broad model supportMust be trained and published per checkpoint
Native MTPModules trained jointly in pretrainingNone to serveBest-matched drafter, zero setupOnly exists if the lab pretrained with MTP
MTP + FastMTP tuningNative MTP head, fine-tuned recursivelyShort fine-tuneFixes deep-position acceptanceLimited model support so far

The rule of thumb in 2026: if a checkpoint ships MTP weights, start there; if it does not, use an EAGLE-3 draft head where one is published. The speculative decoding entry covers the shared verification math behind all of these.

Tuning MTP in Production

Three settings decide whether MTP helps or hurts in a real deployment.

Start small and sweep N. The vLLM guidance is to begin with num_speculative_tokens at 1, confirm outputs match plain decoding, then sweep 2 through 7 on traffic that looks like yours. Math and code, which are repetitive and predictable, tolerate long drafts; open-ended creative writing usually peaks earlier.

Turn it off under heavy load. Speculation trades spare compute for latency. At small batch sizes decoding is memory-bound and verifying extra tokens is nearly free; at large batch sizes the GPU is already busy and every rejected draft is wasted work. Serving stacks therefore let you disable speculation above a batch threshold.

# Scenario: a shared inference cluster that serves an interactive IDE plugin
# by day (low concurrency) and a bulk evaluation job by night (high concurrency).
from vllm import LLM

llm = LLM(
    model="Qwen/Qwen3.5-122B-A10B",
    tensor_parallel_size=4,
    speculative_config={
        "method": "mtp",
        "num_speculative_tokens": 4,
        # Above this many in-flight requests, skip drafting entirely:
        # the GPU is compute-bound and rejected drafts just burn FLOPs.
        "disable_by_batch_size": 64,
    },
)

Measure acceptance, not just throughput. A sudden drop in acceptance length after a fine-tune is the classic sign that the MTP head was not updated along with the main weights. If you fine-tune the base model, fine-tune (or at least re-validate) the MTP module too.

# Scenario: a quick offline sweep before rollout, measuring output tokens/sec
# for each draft length on a sample of real production prompts.
import time
from vllm import LLM, SamplingParams

prompts = [line.strip() for line in open("sampled_prod_prompts.txt")]
params = SamplingParams(temperature=0.0, max_tokens=512)

for n in range(1, 8):
    llm = LLM(model="Qwen/Qwen3.6-27B",
              speculative_config={"method": "mtp", "num_speculative_tokens": n})
    start = time.perf_counter()
    outs = llm.generate(prompts, params)
    elapsed = time.perf_counter() - start
    produced = sum(len(o.outputs[0].token_ids) for o in outs)
    print(f"N={n}: {produced / elapsed:.1f} tok/s")
    del llm  # free GPU memory before the next configuration

What’s New (2025-2026)

  • MTP became a default architecture feature. After DeepSeek-V3, MTP heads shipped in DeepSeek V4, the Qwen 3.5 and Qwen3.6 families, GLM-5.2 (which refined the GLM-5 MTP head), and Step 3.5 Flash’s MTP-3 (see flash-tier sparse-linear architecture). Open-weight labs now treat “speculation support” as part of the release.
  • Engines made it a one-line switch. vLLM’s "method": "mtp" reuses the checkpoint’s own draft path, and the vLLM team’s August 2026 AMD benchmark showed up to 2.2x on Qwen3.5-122B-A10B with mean accepted lengths near 6 tokens at N=7.
  • Recursive fine-tuning closed the deep-draft gap. FastMTP and its integration into Red Hat’s Speculators 0.6.0 turned single shipped heads into usable multi-step drafters without retraining from scratch.
  • MTP without a verifier. Multi-Token Prediction via Self-Distillation (Kirchenbauer et al., February 2026) goes a step further: an online distillation objective converts an existing next-token model into a standalone multi-token predictor that keeps the original implementation and needs no separate verifier or special inference code, reporting over 3x faster decoding for under a 5% drop on GSM8K. Unlike speculative MTP, this trades a small amount of accuracy for speed rather than guaranteeing identical outputs.

Limitations Worth Knowing

  • You cannot add native MTP after the fact. The quality gains come from pretraining with the objective. For a model trained without it, post-hoc options (Medusa, EAGLE-3) are the substitute.
  • Gains are workload- and hardware-dependent. Even within one model family the best N differs (the vLLM sweep found different optima for 27B dense and 35B-A3B MoE Qwen models), and published speedups usually come from batch size 1 or low concurrency.
  • Memory is not free. MTP modules add parameters (DeepSeek-V3’s MTP module is about 14B parameters on top of the 671B main model), and drafted tokens take KV cache space during verification.
  • Fine-tunes can silently break it. If a downstream fine-tune updates the main weights but leaves the MTP module untouched, acceptance drops and the speedup quietly disappears even though outputs stay correct.
  • The pretraining benefit is uneven. Gloeckle et al. found the largest gains on code and at larger model sizes; on some natural-language benchmarks at small scale, MTP-trained models did not beat next-token baselines.

How to Use: Serve a model's native MTP head as a speculative drafter in vLLM

python
from vllm import LLM, SamplingParams

# Scenario: an internal coding assistant on a Qwen3.5 MoE checkpoint
# that already ships MTP weights. Most traffic is 1-16 concurrent users
# watching tokens stream, so per-token latency is what they notice.
llm = LLM(
    model="Qwen/Qwen3.5-122B-A10B",
    tensor_parallel_size=4,
    speculative_config={
        # "mtp" means: use the draft path baked into this checkpoint.
        # No separate "model" key, no extra download, same tokenizer.
        "method": "mtp",
        # How many tokens the MTP path drafts before each verify pass.
        # Start at 1, confirm outputs match, then sweep 2 to 7.
        "num_speculative_tokens": 3,
    },
)

params = SamplingParams(temperature=0.6, max_tokens=1024)
out = llm.generate("Write a Python function that merges overlapping intervals.", params)
print(out[0].outputs[0].text)

# The output distribution is the same as plain decoding: rejected
# draft tokens are replaced by the target model's own sample.

Ready to build?

Leverage AI technologies to build your product stack

Superteams can help you build, deploy and launch AI application stacks using open source technologies — from architecture through to production.

Talk to Superteams