Conversation
Depth-1 sequential MTP head (DeepSeek-V3 / Qwen3-Next style): a top-level
`mtp` module predicts token i+2 from the trunk hidden + embed(token i+1),
sharing embed_tokens and the tied lm_head. Param layout matches the released
Qwen3.5 checkpoints (mtp.fc / pre_fc_norm_{embedding,hidden} / layers / norm);
fc concat order is [embedding, hidden].
- Config-gated by text_config.mtp_num_hidden_layers (0 = disabled, fully
backward-compatible; base Qwen3-VL checkpoints unaffected).
- Forward returns total = main_ce + mtp_loss_weight * mtp_ce; build_mtp_targets
masks packed-segment boundaries so no supervision leaks across samples.
- Training wiring: train_mtp / random_init_mtp / lr_mtp / mtp_loss_weight,
init_mtp, MTP optimizer group, FSDP/TP/compile, FLOPs accounting, warning_once
on architecture-vs-config mismatch.
- eval/benchmark_mtp_decode.py: self-speculative greedy decode benchmark
(verified ~1.61x decode speedup, ~0.77 acceptance, lossless on Qwen3.5-2B).
- models/tests/test_mtp.py: masking, forward/backward, checkpoint-load parity,
and a draft-quality regression guard.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation of Multi Token Prediction on Qwen3-VL and Qwen3.5
Needs stronger verification via a proper training run