LLM Architectures Explained
← /learn · 07

Multi-token prediction

Extra heads that draft the next tokens, and what they buy.

Check yourself ↓ three questions and what to remember, at the end

Concept

A language model is trained to predict the next token. Multi-token prediction (MTP) trains it to predict the next few as well. Gloeckle et al. (2024) did it with nn independent output heads on a shared trunk, as an auxiliary training task, and measured better sample efficiency. DeepSeek-V3 made the extra predictions sequential: its MTP module kk is one more Transformer block that takes the main model's state at depth k−1k - 1 and the embedding of the next token, and predicts one token further, so each prediction keeps the full causal chain (section 2.2, p. 10). The modules share the main model's embedding and output head.

The architecture choice shows up twice:

  • In training, as a denser signal. DeepSeek-V3's report says the MTP modules can simply be discarded at inference, leaving the main model unchanged (p. 11).
  • At inference, as a built-in draft model for speculative decoding. The modules propose the next tokens, the main model checks them in its next step, and every accepted draft is a token for free. DeepSeek-V3 reports that its second-token prediction is accepted 85% to 90% of the time, giving 1.8 times the tokens per second (section 5.4.3, p. 35).

The interactive puts numbers on both sides for any model in the data set that ships MTP layers. DeepSeek-V3's single module touches 688M weights per token, under 2% of the 37.6B the main model activates (both counted by this site's cost model). If each drafted token is accepted with probability aa, a step emits 1+a1 + a tokens with one module (1.85 at a=0.85a = 0.85). With decode memory-bound at batch 1, the step costs about what the main model's step costs plus the module's weights, so the idealised speed-up is 1.82× at a=0.85a = 0.85 and 1.87× at a=0.9a = 0.9, the same neighbourhood as the 1.8× DeepSeek reports.

Loading the interactive…

Concept

Things to try. Raise the depth: with a=0.85a = 0.85, the third and fourth drafted tokens are worth less and less (a3a^3, a4a^4), while every module adds its weights to every step. Then pick a model with several MTP layers (Step 3.5 Flash ships three) and compare.

MTP: 37 models in the data set

Multi-token prediction layers. Newest first; each links to its sourced page.

Maths

If the draft at depth jj is accepted with probability aa given that the ones before it were, a step with DD drafted tokens emits

E[tokens]=∑j=0Daj=1−aD+11−a.E[\text{tokens}] = \sum_{j=0}^{D} a^j = \frac{1 - a^{D+1}}{1 - a}.

At batch 1 a decode step is memory-bound: its time is about the bytes it reads, BmainB_{\text{main}} (active weights plus the KV cache) plus DD modules of PMTPP_{\text{MTP}} weights. The speed-up over plain decoding is

S=E[tokens]  BmainBmain+D PMTP b,S = \frac{E[\text{tokens}]\; B_{\text{main}}}{B_{\text{main}} + D\, P_{\text{MTP}}\, b},

with bb bytes per weight. One module is a block's mixer and active FFN, the d×2dd \times 2d projection that merges the state with the next token's embedding, and its norms.

Code

// src/lib/chapters/model.ts — the memory-bound speed-up (excerpt)
const main = decodeBytes(spec, context, weightBytes, kvBytes).total;
const extra = depth * mtpModuleActive(spec) * weightBytes;
const tokens = mtpExpectedTokens(acceptance, depth);
const step = main + extra;

Check yourself

Commit to an answer before you reveal it: a wrong guess you can explain teaches more than a right one you skimmed. Every number in the answers comes from the same tested model as the chapter’s.

Q1One MTP module whose drafted token is accepted 85% of the time: how many tokens does a step emit on average?
Reveal the answer

Answer: 1.85 (counted right within 2%)

1.85: 1+a1 + a, the main model's token plus the draft whenever it is accepted.

The numbers →

Commit to a number, then reveal.

Q2With decode memory-bound at batch 1, what is DeepSeek-V3's idealised speed-up at a = 0.85?
Reveal the answer

Answer: 1.82 (counted right within 5%)

1.82×, a little under 1.85 because every step also reads the module's weights: the same neighbourhood as the 1.8× DeepSeek reports.

The numbers →

Commit to a number, then reveal.

Q3Add a third and a fourth MTP module. What are they worth?
Reveal the answer

Answer: Each is worth less (a³, a⁴) while every module adds its weights to every step

Less and less: the kk-th draft counts only if all before it were accepted, probability aka^k, while each module's weights are read on every step.

Raising the depth →

Pick one, then reveal.