← Contents Volume IX · Lecture 20

Volume IX · Teaching at Scale

20

Guessing Several Tokens Ahead

Generating one token means streaming the model's weights out of memory to emit a piece of a word. Training asks each position in a sequence one question, what comes next, and then reveals the answer. Both habits date from the first transformer decoders. In 2024 and 2025 both were reopened by the same small change: ask for more than one token.

The mental model

Predicting several tokens ahead is one idea with two lives. In training it is an extra loss that makes each position plan. At inference the same extra head becomes a free drafter whose guesses the full model checks in a single pass. The two uses are independent: a laboratory can take either, both, or neither.

One token per pass, and one question per position

Decoding is sequential: token N+1 cannot be chosen until token N exists. Each step therefore runs the whole network once to produce one token, and, as Lecture 2 showed, decoding is bound by memory bandwidth rather than arithmetic. The pass spends its time moving weights and cache through the memory system, and the arithmetic units are mostly idle. Leviathan and colleagues built speculative decoding on exactly that slack: scoring several positions in one pass costs little more than scoring one, so if somebody could supply good guesses for the next few tokens, the full model could check them all at the price of one step.

Training has a mirror-image habit. With teacher forcing, a sequence of T tokens gives T supervised predictions, one per position, each asked only for the very next token. That is a rich signal, but a narrow one: the model is never rewarded for a hidden state that encodes where the sentence is heading, except to the extent that doing so helps the next token.

Multi-token prediction (MTP) widens the question. Each position is asked for its next token and for one or more tokens beyond it. This lecture follows that single change through its two consequences: what it does to what the model learns, and what it does to how fast the model can run.

Asking for more than the next token

The clean statement of the idea as a training objective is Gloeckle and colleagues' 2024 paper from Meta. They put a shared transformer trunk under n independent output heads. Head k predicts the token k positions ahead, all heads share the unembedding, and the training loss is the sum. At inference you can ignore the extra heads and use only the first, so the deployed model is an ordinary next-token model.

NEXT-TOKEN TARGET · EVERY POSITION the cat sat on the mat MTP TARGET · ONE STEP FURTHER
Figure 20a Each position's ordinary question is the short ink arc. MTP adds the long vermilion arc: the same hidden state must also say something about the token after next. The arcs stop at the end of the sequence, where no further target exists.

Their reported findings, all from their own experiments, are two. The benefit shows up on generative tasks such as code, and it grew with model size. And models trained to predict four tokens ahead can be decoded with those extra heads acting as a drafter, reportedly up to about three times faster than ordinary decoding.

Why should predicting further ahead improve the representation? Gloeckle et al. offer an information-theoretic argument that next-token training lets the model get by on local patterns, while a multi-token loss gives extra weight to the tokens that most constrain what follows. Read this as the authors' account of their result, not as an established mechanism; the evidence is the benchmarks.

DeepSeek-V3's version: a chain, not a fan

DeepSeek-V3 adopted MTP in a different shape. Gloeckle's heads fan out in parallel from one hidden state, each predicting independently. V3's MTP module is sequential, so that the causal chain is preserved at each depth. For the module at depth one, the input at position i is the trunk's final hidden state there, hi, combined with the embedding of the token that follows, ti+1. Both are normalised, concatenated, and projected back to model width; one transformer block processes the result; and the output goes through the same output head as the main model to predict ti+2.

MAIN MODEL embedding shared transformer trunk L layers output head shared predict t(i+1) main loss MTP MODULE · TRAINING norm · concat linear projection M 1 transformer block, own weights output head shared Emb(t(i+1)) h(i) predict t(i+2) MTP loss one extra loss term; its gradient flows into the shared embedding and the trunk
Figure 20b The module borrows the embedding and the output head, so its own parameters are one projection and one block. Feeding in the embedding of the very next token is what keeps the extra prediction causal.

The training objective adds the module's cross-entropy to the main loss, weighted by a coefficient. The V3 report gives its settings: a single extra depth, and a weight that is 0.3 for the first 10 trillion tokens of its 14.8-trillion-token pretraining and 0.1 for the rest.

The MTP objective (DeepSeek-V3; notation simplified) Lk = −(1/T) Σi log Pk( ti+k+1 | hi, ti+1, …, ti+k )
L = Lmain + (λ / D) · Σk=1…D Lk
D = 1 in V3;  λ = 0.3 for the first 10T tokens, then 0.1

The report states two things about the result. In its ablations, adding MTP improved performance on most of the benchmarks it tried, at two model sizes. And the module can be simply discarded at inference, leaving a model that runs exactly as a non-MTP model would. That second point is the hinge of the lecture: the default disposition of the extra head is that it is a training scaffold, removed before serving.

The same head as a drafter

The head does not have to be discarded. Speculative decoding, published independently by Leviathan, Kalman and Matias and by Chen and colleagues at DeepMind in 2022–23, needs exactly one thing from outside the main model: a cheap source of candidate next tokens. The target model then scores all the candidates in one forward pass and keeps the longest acceptable prefix. A rejection-sampling rule decides each candidate, and it is built so that the tokens that come out are distributed exactly as the target model alone would have produced them. This is the property to hold on to. Speculative decoding saves time and leaves the output distribution unchanged.

CONTEXT DRAFTED BY THE CHEAP HEAD context d₁ d₂ d₃ d₄ VERIFY ONE full-model pass scores every position VERDICT accept accept resample discard 3 tokens from one pass: 2 accepted + 1 drawn from the target
Figure 20c The first rejection ends the run. The rejected position is refilled from the target model's own (corrected) distribution, so every pass yields at least one token and at most one more than the number drafted.

What an MTP module adds is a drafter that costs nothing to acquire. A classical setup needs a separate small model that has to be trained, share the tokenizer, be hosted, and keep its own cache. The MTP module already exists, was trained alongside the trunk, and reads the trunk's own hidden state. One standard way to wire it is as follows; the V3 report itself gives only the headline numbers. At the end of a pass the trunk has produced hi and the model samples ti+1. The module consumes both and proposes ti+2. The next pass feeds in both tokens, and while computing what follows it checks the guess.

DeepSeek-V3's report states that the acceptance rate of the second-token prediction is between 85% and 90% across a range of generation topics, and that this gives about a 1.8 times improvement in decoding speed. This lecture's own arithmetic ties the two together. If each draft is accepted independently with probability α, then one pass with k drafts yields on average:

Expected tokens per target pass (Leviathan et al.) E[tokens] = (1 − αk+1) / (1 − α)
k = 1, α = 0.85 → 1.85;  k = 1, α = 0.90 → 1.90
k = 4, α = 0.80 → 3.36  (before paying for four drafts)

With one draft the ceiling is 1 + α, about 1.85 to 1.9 at the reported acceptance rates, so a measured 1.8 times after real overheads is what the formula says it should be. That is a consistency check by the author of this page, not a result from the report. It also shows why depth matters: with D = 1 the ceiling is two tokens per pass no matter how good the head is, and deeper chains pay a multiplicative price, since the probability that all k drafts survive is αk.

Two earlier systems attach drafters to a model after the fact. Medusa adds extra decoding heads to an existing model and verifies a tree of candidates in a single pass. EAGLE drafts in the space of the model's hidden features instead of its tokens. Both show that the head-on-a-trunk drafter works. The difference with MTP is where the head comes from: here it is trained from the first token of pretraining, and it doubles as a training objective.

Two uses, one head

Put the two lives side by side and the independence is plain. A model can be trained with an MTP loss and served without its modules, as V3's default describes. It can be trained without any MTP loss and still be served with speculative decoding, using a separate draft model or an after-the-fact head. And it can do both, using the head that shaped the trunk in training as the drafter in serving. What the MTP design buys is that the third option needs one set of extra parameters rather than two.

The same head, in its two roles
As a training signalAs a speculative drafter
What the head's output is forA loss term: cross-entropy against the dataProposed tokens, checked by the full model
Changes the trained weights?Yes. Gradients shape the trunk and the shared embedding.No. It reads the trained model and changes nothing in it.
Changes the output distribution?The model is a different model; it is judged on benchmarks.No. Rejection sampling preserves the target's distribution exactly.
CostAn extra module and loss during trainingAn extra module run each step, plus verification of drafts
How it failsWeight too high, or a model too small to benefitLow acceptance; the speedup shrinks but the output stays correct
Reported evidenceBenchmark gains: Gloeckle et al.; V3's ablations85–90% second-token acceptance and ~1.8× throughput (V3); up to ~3× for 4-token heads (Gloeckle et al.)

That asymmetry in the failure row is the practical difference. A badly trained training signal damages the model and shows up in the benchmarks. A badly performing drafter is safe: the verifier rejects its guesses, the model's behaviour does not change, and the only cost is that the speedup disappears.

Reading a report with this lecture

When a technical report says a model has "MTP", ask three things. Was it used as a training objective, and with what depth and loss weight? Is the module shipped in the released weights, or discarded after training? And if it is kept for inference, what acceptance rate and what end-to-end speedup does the report give, at what batch size? Several 2025–26 open models are described as shipping MTP layers for speculative decoding, GLM-4.5, Qwen3-Next and MiMo among them verify per model; whether a given release uses MTP for training alone, for serving, or for both is exactly the kind of detail that Lecture 23 says to read for rather than assume.

Volume IX has now covered two sides of teaching a model at scale: how to keep the run from breaking, and how to give it more to learn from each token. The next volume starts where pretraining stops, with the reinforcement-learning objective that taught DeepSeek-R1 to reason from scratch.

Read the primary source

❦