Training Objectives advanced 7 min read 10 flashcards

Multi-Token Prediction

Training a language model to predict the next n tokens at once from a shared trunk, which densifies the training signal and hands you free draft heads for self-speculative decoding.

A 13B model trained to predict four tokens at a time solves 12% more HumanEval problems and 17% more MBPP problems than the identical model trained to predict one — same trunk, same data, no extra parameters at inference time. That result, from Gloeckle et al. (2024), is awkward for the assumption that next-token prediction is simply the language modelling objective rather than one choice among several.

The one-scalar-per-position problem

Standard causal pretraining gives each position exactly one supervision signal: the cross-entropy of the true token \(x_{t+1}\) under the distribution read off the hidden state \(h_t\). Everything the trunk learns at that position is whatever reduces that single term.

The trouble is that local statistics get you most of the way there. Closing a quote, completing a morpheme, finishing a common bigram — these dominate the loss, so the gradient rewards a representation tuned to the immediate next symbol. Decisions whose consequences land five or fifty tokens later (opening a function signature that must eventually be closed, committing to a proof strategy, choosing a variable name you will need again) are learned only through the indirect pressure of many positions downstream.

The objective

Multi-token prediction replaces the single head with \(n\) heads on a shared trunk, each predicting one step further out:

\[\mathcal{L}_{\text{MTP}} = -\sum_{t} \sum_{i=1}^{n} \log P_\theta\!\left(x_{t+i} \mid x_{1:t}\right)\]

The heads are thin — typically one transformer layer each — and the unembedding matrix is shared with the main head. Almost all capacity stays in the trunk, which is the point: the trunk is what must now encode enough about position \(t\) to say something useful about \(t+4\).

graph LR
    X["Context tokens up to t"] --> T["Shared trunk<br/>(all transformer layers)"]
    T --> Z["Latent z_t"]
    Z --> H1["Head 1"] --> P1["P(next token)"]
    Z --> H2["Head 2"] --> P2["P(token t+2)"]
    Z --> H3["Head 3"] --> P3["P(token t+3)"]
    Z --> H4["Head 4"] --> P4["P(token t+4)"]

The obvious implementation blows up memory: \(n\) logit tensors of shape (batch, sequence, vocab) is enormous when the vocabulary is 32k–128k and dwarfs the activations of the trunk itself. The fix is ordering. Run the trunk once, then for each head in turn do its forward pass, backpropagate into the trunk's gradient accumulator, and free its logits before starting the next head. Peak activation memory becomes that of a single head, not \(n\) of them, at the cost of a longer backward pass.

Two payoffs from one change

Better representations. The accuracy gains are real but conditional. They grow with model scale — the paper reports benefit at 7B and 13B while small models can be hurt — and they are largest on code, where the continuation is more algorithmically determined than in open-ended prose.

Free draft heads. Heads 2 through \(n\) are exactly what self-speculative decoding needs: cheap guesses at future tokens that the main head can verify in a single forward pass. Because they sit on the same trunk and reuse its KV cache, there is no second model to load or keep resident. Gloeckle et al. measure up to 3× faster inference from 4-token models, and the speedup survives large batch sizes.

The production variant: DeepSeek-V3

DeepSeek-V3 uses a deliberately conservative version. Only one extra token is predicted (\(D = 1\)), and rather than independent parallel heads it chains a sequential MTP module: the module combines the trunk's hidden state at position \(i\) with the embedding of the token at \(i+1\) before predicting \(i+2\), keeping the prediction chain causal instead of asking one latent to fan out into independent futures. Embedding and output layers are shared with the main model. The auxiliary loss is weighted \(\lambda = 0.3\) for the first 10T training tokens and dropped to \(0.1\) for the remaining 4.8T, annealing the auxiliary pressure as pretraining matures.

At inference the module can be discarded entirely — the main model is unchanged — or kept for speculation. DeepSeek reports the second token being accepted 85–90% of the time, worth roughly 1.8× tokens per second.

Tradeoffs

  • Scale-dependent. Below a few billion parameters the extra heads compete for capacity and can cost you accuracy. This is not a technique to validate at 125M and assume transfers.
  • Choosing \(n\). Four is the reported sweet spot at 7B–13B. Push it further and the distant targets approach noise — genuinely unpredictable at that horizon — so their gradients dilute the useful signal rather than adding to it.
  • A pretraining-time commitment. "No added inference cost" is true only because you paid during training, in head parameters, a longer backward pass, and a hyperparameter (\(n\), or \(\lambda\) and \(D\)) that you cannot cheaply re-tune part-way through a multi-trillion-token run.

Versus speculative decoding

They are easy to confuse and are not substitutes. Classical speculative decoding is a pure inference-time trick: bolt a separate small draft model onto a finished large one, change nothing about training, get exact-distribution outputs faster. Multi-token prediction changes the objective, so it can improve the model itself — but you must decide before pretraining, and the payoff is uncertain until the run is done. The lineage runs back to blockwise parallel decoding (Stern et al., NeurIPS 2018, arXiv:1811.03115), which added future-position heads purely for speed; MTP's claim is that the same heads, trained from scratch, also make the trunk smarter.

References

  • Gloeckle, Youbi Idrissi, Rozière, Lopez-Paz, Synnaeve. Better & Faster Large Language Models via Multi-token Prediction. ICML 2024. arXiv:2404.19737
  • Stern, Shazeer, Uszkoreit. Blockwise Parallel Decoding for Deep Autoregressive Models. NeurIPS 2018. arXiv:1811.03115
  • DeepSeek-AI. DeepSeek-V3 Technical Report. 2024.
Check yourself

10 flashcards for this concept

Click a card to reveal the answer.

Drill the whole track