Multi-token prediction

On this page 7

Multi-token prediction is a training objective for language models in which the network learns to predict several future tokens at once from each position in a sequence, instead of only the single next token. In artificial intelligence research, it extends the classic next-token objective with additional output heads that forecast tokens two, three or more steps ahead.

The technique serves two distinct goals. During training, it supplies a denser learning signal that encourages the model to plan beyond the immediate word. During inference, the extra heads can act as built-in draft predictors for self-speculative decoding, which can raise generation speed substantially without changing the final output distribution.

How multi-token prediction extends the training objective

Multi-token prediction replaces the single cross-entropy loss of an autoregressive model with a sum of losses over n future offsets. A shared transformer trunk produces a hidden representation at each position, and n independent output heads read that representation to predict tokens at offsets t+1, t+2 up to t+n.

Each head usually contains one extra transformer layer followed by the shared unembedding matrix, so the parameter overhead stays small. Some designs chain the heads sequentially, so that the head for offset t+2 also sees the embedding of the predicted or true token at t+1, which preserves a causal chain between predictions.

The following table lists the main architectural components and the role each one plays in a typical implementation.

ComponentFunctionTypical design choice
Shared trunkBuilds contextual representationsStandard decoder-only transformer
Prediction headsForecast tokens at offsets 1 to nOne transformer block per head
Unembedding matrixMaps hidden states to vocabulary logitsShared across all heads
Loss aggregationCombines per-head cross-entropyEqual or decaying weights
Memory scheduleLimits peak activation memorySequential head forward and backward passes
Components of a multi-token prediction model

A practical detail matters for large vocabularies: computing logits for every head simultaneously would multiply peak memory. Implementations therefore run the forward and backward pass head by head, accumulating gradients in the trunk, which keeps memory close to that of a single-head model.

Why predicting further ahead helps learning

Next-token prediction rewards a model for getting the immediate token right, even when that token is trivially predictable. Multi-token prediction places more weight on consequential decision points, where one choice determines several subsequent tokens, because an error there is penalized by multiple heads.

This effect is often described as a mitigation of teacher forcing mismatch. A model trained only on one-step targets never practices looking past ground-truth prefixes, while auxiliary heads force the trunk to encode longer-range structure such as the shape of a code block or the direction of an argument.

Reported benefits depend strongly on scale and domain. Gains tend to appear on code generation and algorithmic tasks, and they grow with model size; small models of a few hundred million parameters may show no improvement or a slight loss on standard language benchmarks.

Several methods share the goal of producing more than one token per step, but they differ in when the extra predictions are learned and whether the output is exact. The table contrasts the most common approaches.

ApproachExtra predictions learnedOutput identical to base modelMain purpose
Next-token predictionNoneYes, by definitionStandard pretraining
Multi-token predictionDuring pretrainingYes, with verificationBetter representations and faster decoding
Medusa-style headsFine-tuned after pretrainingYes, with verificationInference acceleration
Separate draft modelIndependent smaller modelYes, with verificationSpeculative decoding
Non-autoregressive decodingWhole sequence in parallelNoLow-latency generation
Diffusion language modelIterative denoising of spansNoParallel refinement
Approaches to predicting more than one token

The key distinction is that multi-token prediction is a pretraining objective first and an acceleration method second. Post-hoc heads such as Medusa add speed to an existing model, whereas multi-token training changes what the trunk itself learns.

Using the extra heads for faster inference

At inference time, the model can run in self-speculative decoding mode. The heads propose a short continuation of n tokens in one forward pass, and the next pass verifies those proposals with the next-token head, accepting the longest correct prefix.

Because verification uses the standard next-token distribution, the accepted output matches what ordinary autoregressive decoding would produce under the same sampling rules. The speedup depends on the acceptance rate, which is high for repetitive or structured text and lower for creative prose at high temperature.

The table summarizes how the main parameters influence training quality and decoding speed.

ParameterCommon rangeEffect when increased
Number of heads n2 to 8Stronger planning signal, lower acceptance per extra token
Head depth1 to 2 layersBetter far-offset accuracy, more parameters
Loss weight on far heads0.1 to 1.0More influence of long-range targets on the trunk
Sampling temperature0 to 1Lower acceptance rate during speculative decoding
Model sizeHundreds of millions to hundreds of billions of parametersLarger benefit from auxiliary heads
Key parameters and their effects

Published results report decoding speedups of roughly two to three times for code models with four heads under greedy decoding, while gains for open-ended chat are usually smaller. These figures vary with hardware, batch size and implementation.

Limitations and common misconceptions

Multi-token prediction is not a universal improvement, and several practical limitations affect its adoption in production systems.

MisconceptionAccurate view
It generates whole sentences in parallelAccepted tokens are still verified autoregressively
It always improves benchmark scoresBenefits are scale and domain dependent
It changes the output distributionVerified decoding keeps the base model distribution
More heads are always betterFar heads become noisy and rarely accepted
Frequent misunderstandings and the accurate view
  • Training cost rises modestly because each head adds compute, even with a shared unembedding matrix.
  • Batched serving reduces the speed benefit, since GPUs are already compute bound at large batch sizes.
  • Far-offset heads may learn generic high-frequency tokens, which lowers acceptance rates.
  • Fine-tuning a multi-token model with a standard objective can erode the auxiliary heads unless they are trained jointly.

A non-technical view

Most chatbots write one small piece of text at a time. They guess the next word, add it, and then guess again. Multi-token prediction teaches the model to guess several words ahead during training. This is like a chess player who thinks three moves ahead instead of one.

Thinking ahead helps the model plan its sentences better. It also allows a shortcut later. The model can write a few words in one step and then quickly check them. If the check passes, the text appears faster with the same result.

A concrete example

A software team runs an internal code assistant on a single GPU server for about forty developers. The base model is a decoder-only code model of roughly seven billion parameters, pretrained with four prediction heads instead of one.

When a developer asks for a function that parses a configuration file, much of the output is predictable boilerplate: imports, a function signature, error handling and a return statement. The extra heads propose four tokens per step, and the verification pass accepts an average of about two and a half tokens per forward pass.

The team measures response latency before and after enabling self-speculative decoding with greedy settings. Typical completions of 300 tokens arrive about twice as fast, and a side-by-side comparison confirms that the generated code is identical to standard decoding. For free-form documentation requests at higher temperature, the speedup drops to roughly 1.3 times.