TAI BUI
Back to curriculum
BuildPython

Multi-Token Prediction (MTP)

Autoregressive LLMs from GPT-2 to Llama 3 train on one loss per position: predict the next token. DeepSeek-V3 added a second loss per position: predict the token after that. The extra 14B of parameters (on a 671B model) pushed gradient back into the main model, and the trained MTP heads were repurposed at inference as speculative-decoding drafters with 80%+ acceptance. The reported result was 1.8× generation throughput at inference. This lesson builds the sequential MTP module from the DeepSeek technical report, computes the loss and the shared-head parameter layout, and explains why MTP keeps the causal chain while Gloeckle et al.'s original parallel MTP broke it.

TIME: ~60 minutesPREREQUISITES: Phase 10 · 04 (pre-training a mini GPT), Phase 10 · 15 (speculative decoding)

Learning Objectives

  • State the MTP training objective and derive the joint loss across prediction depths.
  • Explain the difference between Gloeckle et al.'s parallel MTP heads (2024) and DeepSeek-V3's sequential MTP modules and why the sequential design preserves the causal chain.
  • Compute the parameter and memory overhead of adding MTP modules to a pre-training run.
  • Implement one MTP module from scratch: the shared embedding, the per-depth transformer block, the projection, and the shared output head.

The Problem

Next-token prediction is the standard LLM training objective. Every hidden state is supervised to predict exactly one thing: the immediately following token. That is a weak signal. Most of what matters in a sequence extends beyond one token: structure, coherence, factuality, the flow of an arithmetic problem. The model has to pick all of that up by accumulating one-token signals over trillions of tokens.

MTP asks: what if every hidden state were supervised to predict multiple future tokens at once? Gloeckle et al. (Meta, 2024) showed this helps. Their implementation put several independent output heads on top of the backbone, each predicting a different offset. The design is parallel and simple, but every head saw the same hidden state with no refinement between offsets. The predictions did not chain causally, so they could not serve as a speculative-decoding drafter.

DeepSeek-V3 (December 2024) re-designed MTP as sequential modules that keep the causal chain at each prediction depth. The model predicts t+1 from h_i^(0), then predicts t+2 from a new hidden state h_i^(1) that combines h_i^(0) with the E(t+1) embedding, and so on. Each depth is its own small transformer block. The shared embedding and shared output head keep parameter overhead modest. At DeepSeek-V3's scale that is 14B extra parameters across MTP modules on top of 671B main-model weights. About 2% overhead buys a denser training signal and a ready-made speculative-decoding draft at inference.

This lesson builds a single MTP module and the D-depth loss from scratch. The math is tidy, and the implementation is short enough to read in one sitting.

Warm-up0/3
1. In ordinary next-token pre-training of a mini GPT, how many target tokens does the loss supervise at each position?Warm-up
A row of five generic tokens with position i picked out, and an arrow pointing forward to loss target(s) left as a question mark. A question asks how many tokens the cross-entropy loss supervises against at this position.
Setup only, the ordinary training step from Phase 10 · 04; the count is the question.
2. In speculative decoding, what does the large target model do with a batch of drafted tokens?Warm-up
A box of draft tokens, a short batch proposed cheaply, with an arrow into a target model box whose action is left as a question mark. A question asks what the target model does with that batch.
The draft-then-check setup is Phase 10 · 15's own framing; the target model's action is the question.
3. What mainly determines how much speedup a speculative-decoding draft model delivers?Warm-up
A draft box proposing several tokens and a target box verifying them, with a loop arrow labelled repeat. A question asks what mainly determines how much speedup this round delivers.
The draft-verify-repeat loop is Phase 10 · 15's own framing; what sets the speedup is the question.
Check: The Problem0/2
1. What is parallel MTP, as in Gloeckle et al.?Define
A term card reading Parallel MTP, from the Problem section (Gloeckle et al., Meta, 2024), with a context note: Gloeckle's design is the baseline that the Problem section contrasts with DeepSeek-V3's redesign. A question asks: What is parallel MTP, as in Gloeckle et al.?
The term as the lesson names it; its mechanism is the question.
2. Why is next-token prediction described as a weak training signal for structure, coherence and factuality?Explain
Two boxes: next-token loss, one target per position, and a plain label listing structure, coherence, and factuality. A question asks why next-token prediction is described as a weak signal for these.
Both the loss's shape and the three named properties are the stem's own wording; why the signal is weak is the question.

The Concept

The sequential MTP recipe

DeepSeek-V3 adds D MTP modules on top of the main model. Prediction depth k (for k = 1..D) predicts t_{i+k} given a prefix through position i. Depth 1 reads the backbone state h_i^(0). Module k builds the next state h_i^(k), which is what depth k+1 reads.

A note on numbering. In the formulas below, depth k reads h_i^(k-1), so depth 1 is the backbone's own next-token head and module k feeds depth k+1. The paper counts modules instead: its D = 1 is one extra module predicting t_{i+2}, which is depth 2 here. So the paper's D modules give D+1 depths in this numbering. In the speculative-decoding and parameter sections, "D=1 module" means the paper's first module (the one that predicts t_{i+2}), and "acceptance at depth 1" is a loose label for that same module's draft, not for the depth-1 head above. The toy in main.py builds D modules but reads only depths 1 to D, so its last module's output goes unused.

Module k consists of:

  • A transformer block T_k with its own attention and MLP.
  • A projection matrix M_k that combines the previous-depth hidden state with the embedding of the next-depth ground-truth token.
  • The shared embedding E (same as the main model).
  • The shared output head Out (same as the main model).

At training, for a prefix through position i, the per-depth hidden state is:

h_i^(0) = main model backbone at position i
h_i^(k) = T_k( M_k * concat(RMSNorm(h_i^(k-1)), RMSNorm(E(t_{i+k}))) )   for k >= 1

The per-depth prediction is:

logits_{i+k} = Out(h_i^(k-1))   for k = 1..D

The per-depth loss is cross-entropy against the ground-truth t_{i+k}:

L_k = CE(logits_{i+k}, t_{i+k})

The joint loss across depths:

L_MTP = (lambda / D) * sum_{k=1..D} L_k

lambda is a small weighting factor. DeepSeek-V3 uses 0.3 for the first 10% of training and 0.1 afterward. The total training loss is L_main + L_MTP.

Why sequential, not parallel

Gloeckle's original parallel MTP had D output heads, each directly applied to h_i^(0). Each head predicts t_{i+k} from the same backbone hidden state. That trains fine, but the predictions are not conditioned on each other. head_1's output cannot help head_2 because the heads fire in parallel.

DeepSeek-V3's sequential design builds h_i^(k) from h_i^(k-1) plus the actual next-token embedding E(t_{i+k}). That preserves the causal chain: to predict t_{i+k+1}, the module at depth k+1 sees what was at t_{i+k}. This is the same shape as an autoregressive decoder consuming its own output, which is why the MTP modules can be used directly as speculative-decoding drafters.

At inference: feed h_i^(k-1) and the drafted t_{i+k} into module k to build h_i^(k), then read Out(h_i^(k)) as the draft for t_{i+k+1}. Repeat. That is exactly an EAGLE-style draft, using the trained MTP module as the draft network. DeepSeek-V3 reports 80%+ acceptance on the first MTP module and ~1.8× speedup.

Parameter accounting

For a model with hidden h and vocabulary V:

  • Main model: billions of parameters, plus one output head of size V * h.
  • Shared output head: reuse the main model's head. No extra params.
  • Shared embedding: reuse the main model's embedding. No extra params.
  • Per-MTP module:
    • Projection M_k: (2h) * h = 2h^2.
    • Transformer block T_k: attention (4h^2 for MHA) plus MLP (typically 8h^2 for SwiGLU with ratio 8/3). About 12h^2 per block.

Total extra per module: ~14h^2. For DeepSeek-V3's h = 7168, D = 1 module: ~14 * 7168^2 = ~720M parameters on paper. DeepSeek-V3 reports 14B. The gap comes mostly from the MTP module's transformer block being MoE as well, which the dense formula does not count.

The speculative-decoding payoff

During pre-training, the MTP modules slow training by about 10% (more forward compute, extra loss). The payoff comes in two parts:

  1. Denser training signal. Each hidden state sees D+1 supervision targets. DeepSeek-V3's ablations on MMLU, GSM8K, MATH, and HumanEval show improvements of a few percentage points.

  2. A speculative-decoding draft at inference. The MTP module is already trained to predict the next few tokens. Repurposed as a draft network, it reaches 80%+ acceptance, and DeepSeek-V3 reports 1.8× throughput from it. The roughly 10% training-time cost is paid once, and the draft keeps paying back at every inference run.

Relation to EAGLE

EAGLE trains a small draft model separately after pre-training. MTP bakes the draft into pre-training. The two reach similar acceptance rates through different pipelines:

DimensionEAGLE-3MTP (DeepSeek-V3)
When trainedPost-pre-trainingDuring pre-training
Backward-compatible with existing weightsYesNo (need to re-train)
Draft params1-2 transformer layers1 transformer block + projection
Acceptance rate0.88-0.920.80+ at depth 1
Benefit beyond speedupSpeculative decoding onlyDenser training signal + speedup
Check: The Concept0/21
1. What is an MTP module in DeepSeek-V3?Define
A term card reading MTP module, from the Concept section (the sequential MTP recipe), with a context note: DeepSeek-V3 adds D of these on top of the main model, one per prediction depth. A question asks: What is an MTP module in DeepSeek-V3?
The term as the lesson names it; its mechanism is the question.
2. In MTP, what does the prediction depth k identify?Define
A term card reading Prediction depth k, from the Concept section (a note on numbering), with a context note: The paper's own D=1 module is depth 2 in this lesson's numbering, since depth 1 is the backbone's own next-token head. A question asks: In MTP, what does the prediction depth k identify?
The term as the lesson names it; its mechanism is the question.
3. What is sequential MTP?Define
A term card reading Sequential MTP, from the Concept section (Why sequential, not parallel), with a context note: DeepSeek-V3 (December 2024) re-designed MTP to keep something intact at each prediction depth. A question asks: What is sequential MTP?
The term as the lesson names it; its mechanism is the question.
4. What does it mean that MTP modules use a shared output head?Define
A term card reading Shared output head, from the Concept section (Parameter accounting), with a context note: Every depth needs logits over the vocabulary before its cross-entropy loss can be computed. A question asks: What does it mean that MTP modules use a shared output head?
The term as the lesson names it; its mechanism is the question.
5. What is the shared embedding in an MTP setup?Define
A term card reading Shared embedding, from the Concept section (Parameter accounting), with a context note: Every module needs the embedding of the ground-truth token E(t_{i+k}) at its own depth. A question asks: What is the shared embedding in an MTP setup?
The term as the lesson names it; its mechanism is the question.
6. What job does the projection matrix M_k do inside module k?Define
A term card reading Projection matrix M_k, from the Concept section (the sequential MTP recipe), with a context note: M_k is one of the four named pieces inside module k, alongside the transformer block T_k, the shared embedding E, and the shared output head. A question asks: What job does the projection matrix M_k do inside module k?
The term as the lesson names it; its mechanism is the question.
7. What is the joint MTP loss across D depths?Define
A panel listing the per-depth cross-entropy losses L_1 through L_D, a given lambda weighting factor, and L_MTP left as a question mark. A question asks which expression below is the joint MTP loss.
The per-depth losses and lambda are the lesson's own named quantities; how they combine is the question.
8. What lambda schedule does DeepSeek-V3 use to weight the MTP loss?Define
A panel showing a training-progress bar from 0% to 10% to 100%, with lambda during the first 10% and lambda for the rest of training both left as question marks.
The 10% breakpoint is the lesson's own named milestone; the two lambda values are the question.
9. What does the acceptance rate at depth 1 measure?Define
A term card reading Acceptance rate at depth 1, from the speculative-decoding payoff section, with a context note: DeepSeek-V3 reports this rate at 80%+ for the module that predicts t_{i+2}. A question asks: What does the acceptance rate at depth 1 measure?
The term as the lesson names it; its mechanism is the question.
10. Which limitation of Gloeckle et al.'s parallel MTP heads motivates the sequential design?Explain
Two boxes naming Gloeckle et al., Meta 2024, parallel MTP heads, and DeepSeek-V3, December 2024, sequential MTP modules, with no internal structure drawn. A question asks which limitation of Gloeckle's design motivates the sequential swap.
Only the names and dates are given; the limitation and the swap's motivation are the question.
11. The dense formula gives about 720M parameters for one DeepSeek-V3 MTP module, yet 14B is reported. What explains most of the gap?Explain
Two boxes: the dense formula's estimate at h=7168, about 720M, and DeepSeek-V3's reported total, 14B. A question asks what explains most of the gap between these two figures.
Both 720M and 14B are the stem's own figures; the explanation for the gap is the question.
12. How is the depth-k hidden state h_i^(k) built for k >= 1?Explain
Four labelled chips in a neutral row: T_k, h_i^(k-1), M_k, and E(t_{i+k}). A question asks which expression below assembles these four ingredients into h_i^(k).
The four names are the lesson's own notation; how they combine is the question.
13. Why does module k take the embedding E(t_{i+k}) as input instead of only the previous hidden state?Explain
Two input boxes, h_i^(k-1) and E(t_{i+k}), feeding a module k box, which feeds module k+1 and then a question mark. A question asks why module k takes E(t_{i+k}) instead of only the previous hidden state.
Both named inputs are given directly in the stem; why the second one is needed is the question.
14. MTP modules are added for a training benefit. Why can the same modules also speed up inference?Explain
A box describing the module as trained during pre-training for a denser signal per hidden state, next to an at-inference box left as a question mark. A question asks why the same modules can also speed up inference.
The training purpose is the stem's own framing; what happens at inference is the question.
15. With D = 2, lambda = 0.3, L_1 = 2.0, L_2 = 1.0 and L_main = 2.5, what is the total training loss?Apply
A formula panel giving D=2, lambda=0.3, L_1=2.0, L_2=1.0, L_main=2.5, with the total training loss left as a question mark.
All five figures are the stem's own numbers.
16. Using the dense formula, about how many parameters does one MTP module add at hidden size h = 1000?Apply
A formula panel giving the dense formula, about 14h squared per module, with h = 1000 and the extra parameters per module left as a question mark.
The ~14h^2 formula is the Concept section's own stated approximation; h=1000 is the stem's own figure.
17. A model uses D = 3 MTP modules. Counting the ordinary next-token target, how many supervision targets does each hidden state see?Apply
Two boxes: the main next-token target, one per hidden state, and D=3 MTP depths, one target each. A question asks how many supervision targets each hidden state sees in total, counting the ordinary target.
D=3 and the one main target are the stem's own figures; the total is the question.
18. A pre-training run is budgeted at 30 days. With the roughly 10% training slowdown from adding MTP modules, about how long does it take?Apply
A panel giving a budgeted run of 30 days and a roughly 10% training-time addition from MTP, with the new duration left as a question mark.
30 days and the roughly 10% slowdown are the stem's own figures.
19. A team codes the MTP loss as lambda * sum(L_k), leaving out the 1/D, then raises D from 1 to 3 with lambda fixed. Compared with the specified joint loss, what happens?Analyze
A panel contrasting the specified joint loss, lambda over D times the sum of L_k, with a coded version missing the divide by D, as D is raised from 1 to 3 with lambda unchanged. A question asks what happens to the buggy term compared with the specified one.
The specified formula, the missing-1/D bug, and the D=1 to D=3 change are all given directly in the stem.
20. A model was pre-trained with a D=1 MTP module, but serving with plain decoding shows no speedup. Which ingredient is missing?Analyze
Two boxes: pre-trained, with a D=1 MTP module added, and serving, using plain decoding with no speedup. A question asks which ingredient is missing.
Both the pre-training state and the serving outcome are given directly in the stem.
21. You have a released dense checkpoint and want a speculative-decoding draft next quarter. Which route fits the EAGLE-3 vs. MTP comparison?Design
A four-row table transcribed from the lesson's own Relation to EAGLE comparison, covering when trained, backward-compatibility, draft parameters, and acceptance rate for EAGLE-3 versus MTP. A question asks, given a released dense checkpoint and a draft wanted next quarter, which route fits.
The table is transcribed verbatim from the lesson's Relation to EAGLE section; which route fits the released-checkpoint scenario is the question.

Build It

code/main.py builds a single MTP module end to end: shared embedding, projection, transformer block, shared output head. It then computes the per-depth cross-entropy loss on a short synthetic sequence and prints the parameter count by component. A toy vocabulary of 32 tokens keeps the numbers readable.

Step 1: shared embedding table

One vocab_size x hidden table serves the main model and each MTP module at each depth. There is no second copy, only the same tensor. In main.py the output head is tied to it too: shared_head_logits computes E_v . hidden against the same table.

Step 2: the per-depth combination

python
def combine(prev_hidden, next_token_embed, M_k):
    # concat along feature dim, then project down to hidden
    concat = rms_norm(prev_hidden) + rms_norm(next_token_embed)  # vector addition stand-in
    projected = matvec(M_k, concat)
    return projected

Real DeepSeek-V3 concatenates the two RMSNormed vectors to [2h] and projects with an h x 2h matrix. The toy uses vector addition for stdlib brevity.

Step 3: the transformer block at depth k

Attention plus MLP. The toy keeps the q/k/v/out projections and a SwiGLU MLP, both with residual connections, so the structure is visible without numpy. The attention is a single-token stand-in: it computes the score but applies a fixed weight of 1.0, so it reduces to Wo(Wv x). A full implementation attends over a KV cache and drops in at the same spot.

Step 4: the shared output head

Reuse the main model's output projection to get logits over the vocabulary.

Step 5: per-depth loss

Cross-entropy of softmax(logits) against the ground-truth token at offset k. Aggregate across depths with the lambda / D scaling factor.

Step 6: parameter accounting

Print the parameter counts for the main model and the MTP modules, and the ratio of MTP extra to main-model size, for the toy and for a few real model shapes.

Check: Build It0/6
1. Suppose each MTP module had its own embedding table and its own output head instead of sharing the main model's. How would the overhead change?Explain
Two boxes: today's setup with shared tables, reused with zero extra copies, and a hypothetical where each module gets its own embedding and output head, each sized V times h. A question asks how the overhead would change in the hypothetical.
The V times h per-table size is the Parameter accounting section's own formula; the resulting overhead is the question.
2. In the toy combine() function, what stands in for DeepSeek-V3's concatenation of the two vectors?Apply
An excerpt of the lesson's own combine() snippet from Build It Step 2: it RMSNorms both inputs, then folds them with an operation left as a question mark, with a comment noting that this step stands in for DeepSeek-V3's concatenation, then projects with M_k. A question asks what literally goes in place of the masked operation.
Transcribed from the lesson's own Build It Step 2 snippet.
3. In the toy combine() with hidden size 8, what are the length of the vector passed to matvec and the shape of M_k?Apply
A panel stating the toy hidden size is 8, and that combine() folds two RMSNormed length-h vectors into one before M_k projects it back to length h. A question asks what length is passed to matvec and what shape M_k has.
The toy hidden size, 8, and the fold-then-project shape are the lesson's own description; the exact length and M_k shape are the question.
4. In the toy transformer block, attention computes the score but applies a fixed weight of 1.0 on a single token. For input x, what is the attention output?Apply
An excerpt of the real attention_single function: it computes q, k, v, a score that is then unused, sets a fixed weight of 1.0, builds attended from v, and returns matvec(Wo, ???) with the argument left as a question mark. A question asks what the attention output is for input x with the weight fixed at 1.0.
Code excerpted from the lesson's main.py attention_single() function.
5. main.py prints parameter accounting for several real shapes with one MTP module. How does the MTP overhead change from the mini GPT to the 70B dense model?Apply
A three-row table transcribed from a real run of main.py's parameter accounting, showing shape name and main-model parameter count for mini GPT, 7B dense, and 70B dense, with MTP overhead blanked as a question mark in every row. A question asks how the overhead changes from mini GPT up to 70B dense.
Shape names and main-model parameter counts are captured from a real run of main.py's count_parameters; the overhead percentages are masked in every row so the picture does not single one out.
6. A reader runs main.py, sees L_1 and L_2 fall as the noise on the backbone states is lowered, and concludes the MTP modules learned to predict. What is wrong with that?Analyze
A four-row table captured from a real run of main.py's Step 3, showing noise amplitude against L_1 and L_2 as the noise is lowered by hand, both losses falling. A question asks what is wrong with concluding from this that the MTP modules learned to predict.
Captured from a real run of the lesson's own mtp_loss at each noise amplitude in Step 3; why the fall is misleading is the question.

Use It

MTP is integrated into DeepSeek-V3 (December 2024) and the DeepSeek-R1 series. At inference:

  • DeepSeek's own serving stack consumes MTP modules as speculative decoders out of the box.
  • vLLM and SGLang have integration paths for DeepSeek-V3 MTP as of April 2026.
  • AMD's ROCm SGLang tutorial shows a specific MTP speculative-decoding config with measured 1.8× speedup on the V3 checkpoint.

When to use MTP in a new pre-training run:

  • You control the full pre-training pipeline and want a denser training signal.
  • You plan to serve the model at scale and want a speculative-decoding draft without a separate training stage.
  • Your hidden size is at least 4096. At 1B scale the overhead likely costs more than the gain returns.

When not to:

  • Fine-tuning an existing pre-trained dense model. The MTP module is not trained.
  • Research models where you want a clean baseline to compare against. MTP changes the architecture.
Check: Use It0/2
1. A team plans a 1B-parameter model with hidden size 2048 and wants MTP for the denser training signal. What does the guidance on when to use MTP suggest?Design
A planned-model box, hidden 2048 and about 1B parameters, next to a Use It guidance box with its hidden-size threshold left as a question mark. A question asks what the guidance suggests for a team wanting MTP's denser training signal at this size.
Hidden 2048 and ~1B parameters are the stem's own figures; the guidance's threshold is the question.
2. You control a full pre-training run for a hidden-7168 model that will be served at scale. Which plan fits?Design
Two boxes: full control of the pre-training pipeline, and a model with hidden size 7168 that will be served at scale. A question asks which plan fits this situation.
Both the full pre-training control and the hidden-7168, served-at-scale model are given directly in the stem.

Ship It

This lesson produces outputs/skill-mtp-planner.md. Given a pre-training run specification (model size, data, compute), it returns a plan for integrating MTP: number of depths D, lambda schedule, memory overhead, and the inference-time speculative-decoding wiring.

Author's Note

I'd run main.py first and read the parameter table before the loss numbers. It prints the MTP overhead for the toy and for a few real shapes (mini GPT, 7B, 70B, DeepSeek-V3-shaped), and those percentages are what decide whether MTP is worth adding to a run.

Be careful with what the loss numbers mean. Nothing in the toy is trained. The third printed section lowers the noise on the backbone hidden states by hand and re-evaluates, so L_1 and L_2 falling there shows that the loss responds to a better backbone, not that MTP learns anything. Exercise 1 is where you add a real signal.

The toy also simplifies the module more than the prose does. It adds the two RMSNormed vectors instead of concatenating them, so M_k is h x h rather than h x 2h, and the attention has a fixed weight of 1.0. Read mtp_forward for the order of operations, and keep the equations above for the real shapes. The loss loop in the toy runs D depths, so the state built by the last module is never read. In the full design it is the one that predicts t_{i+D+1}. My bet is that the sequential chain, where the depth-k module takes the ground-truth embedding of t_{i+k}, is the part worth rereading until it feels obvious.

Exercises

  1. Run code/main.py. Show the per-depth loss decreases monotonically as the synthetic signal strengthens. Modify the synthetic to use a fixed pattern and verify both depth-1 and depth-2 losses converge.

  2. Compute the parameter overhead for a dense 70B model (hidden 8192, 80 layers) with D=1 MTP module. Compare to the DeepSeek-V3 reported 14B overhead. Explain why DeepSeek's number is higher: the MTP transformer block inherits the same MoE structure, inflating the per-module parameter count.

  3. Implement D=2 in the toy: add a second MTP module that takes h^(1) and E(t_{i+2}), builds h^(2), and predicts t_{i+3} from it. Verify the joint loss and the parameter accounting match the DeepSeek paper's equations 19-21.

  4. Switch the toy to parallel MTP (Gloeckle-style): add D output heads on top of the main hidden state, each predicting a different offset. Measure how the losses per depth compare to the sequential version on the same synthetic signal. The sequential version should produce lower depth-k loss for k > 1 because it conditions on the intermediate predictions.

  5. Use the trained MTP module as an EAGLE-style draft: run module k on h^(k-1) and the drafted t_{i+k} to propose t_{i+k+1} at inference. Measure the acceptance rate of these draft tokens against the main model's predictions on a held-out sequence. If you hit 50%+ on the toy, you have reproduced the empirical MTP-as-draft property.

Key Terms

TermWhat people sayWhat it actually means
MTP module"Extra loss block"A small transformer block plus projection that extends the hidden state by one depth, so a token one position further ahead can be predicted from it
Prediction depth"Which offset"The integer k such that depth k predicts t_{i+k} from h_i^(k-1), the state built by module k-1 (the backbone for k = 1), given a prefix through position i
Parallel MTP"Gloeckle-style"D independent heads on the same backbone hidden state, no conditional chain
Sequential MTP"DeepSeek-V3 style"Each module conditions on the previous depth's hidden state plus the next token's embedding; preserves causal chain
Shared output head"Reuse the main head"The MTP modules call the main model's LM head, not a separate output projection
Shared embedding"Reuse the main table"Same vocabulary embedding table is used everywhere; no duplicate parameters
Projection matrix M_k"Combine hidden + next-token"An h x 2h linear layer that folds the previous hidden state and the target-token embedding into the next depth's input
Joint loss L_MTP"Averaged extra losses"Arithmetic mean of per-depth cross-entropy losses, scaled by lambda
Acceptance rate at depth 1"How often MTP draft is right"The rate at which the D=1 MTP module's top-1 prediction equals the main model's top-1 prediction; 80%+ on DeepSeek-V3
Lambda weighting"Extra-loss importance"Per-depth scaling factor; 0.3 at start of training, 0.1 later on DeepSeek-V3

Further Reading

Code

Ships With