DMTP
Overview
DMTP combines native multi-token prediction (MTP) with parallel drafting from the DFlash family. The parallel draft can use DFlash, DFlash2, or another DFlash-family variant. Native MTP proposes the first candidate, T1; the parallel draft uses that candidate and its MTP representation to propose the rest of the block. The target verifies the combined proposals.
The motivation is the accepted-prefix rule: if the first proposal is rejected, the rest of the block cannot be committed in that round. A target model's pretrained MTP module can provide a useful first proposal, while a small parallel draft provides a longer continuation at low additional drafting cost. DMTP combines these roles and passes the MTP predictor representation to the parallel draft. Its benefit depends on the target's MTP quality and the cost of the extra MTP step.
Start with speculative decoding for the common verification procedure. DFlash2 describes one of the parallel draft architectures that can be used inside DMTP.
Method blog · Training implementation · Inference implementation · SGLang PR #50270
How it works?
Source: the official DMTP blog, Figure 2. The diagram illustrates dual-anchor residual conditioning; the conditioning adapter and proposal layout are checkpoint-specific.
Let A be the last emitted token and T1 the next candidate. One round proceeds as follows:
- Run native MTP once. Given the aligned target state and token input, MTP predicts T1. Retain the hidden representation that produced T1.
- Condition the parallel draft. Provide T1 and its predictor state along with the normal target-context features. In the released residual adapters, the conditioning update is added only to T1's token embedding.
- Draft the remaining positions. A DFlash-family model predicts the continuation in parallel. In the 27B release,
[A, T1, MASK × 6]yields seven proposals: T1 from MTP and six from DFlash2. A is already emitted and is not a new proposal. - Verify the combined block. The target applies the runtime's speculative verification rules. Commit the accepted prefix and correction or bonus token, update caches, and repeat from the new verified context.
Why pass both a token and a hidden state?
T1 identifies the concrete first candidate. The MTP predictor state also contains information useful for continuing after it. The residual interface can be written schematically as
The function f is checkpoint-specific. It can project the MTP state through a low-rank network or combine separately normalized token and MTP features. The original token embedding remains available through the residual path. The released variants below use these different adapters.
Correct alignment matters: the predictor state for T1 is the state that generated T1, not the state obtained after consuming T1. The target context must also stop at the boundary expected by the checkpoint. These interfaces affect what the draft can read, so they belong to the training and serving contract rather than being interchangeable tensor shapes.
Training
The target and native MTP remain frozen while the parallel draft and its conditioning adapter are trained. In the released checkpoints, T1 is taken from the training sequence; at inference it is proposed by native MTP. The unknown continuation positions receive draft prediction supervision. The MTP predictor state is detached, so the draft loss does not fine-tune the target's MTP module.
Capture contract
The optional mtp_hidden server artifact is stored under the canonical mtp_hidden_states feature key with shape [1, sequence_length, hidden_size]. Its shifted alignment is:
mtp_hidden_states[a] = MTP(input_ids[a], target_last_hidden[a - 1], causal MTP history)
T1 = input_ids[a + 1]- Captured tensors are taken after the native MTP final RMSNorm, before
lm_head. - Row
0is zero padding and is masked out of DMTP anchor selection (min_anchor = 1). - Target context visible to a block always ends strictly before anchor
a(input_offset + context_end_offset = 0, i.e.context_end_offset = 0for dual-anchor and-1for dropped-anchor). - Native MTP uses SGLang's shifted-prefill positions (
0 .. L - 2for rows1 .. L - 1) and retains causal history across the entire single-document request. - Multimodal capture and packed multi-document requests are not supported.
SGLang natively computes the shifted post-norm MTP states when launched with --enable-return-mtp-hidden-states --disable-radix-cache (via sglang.srt.state_capturer.mtp_hidden.MTPHiddenCapturer), reusing the target model's shared embeddings, lm_head, KV pool allocator, TP sharding, MoE, and quantization support without enabling speculative decoding. The specforge-sglang-capture plugin reads logits_output.mtp_hidden_states directly inside CaptureObserver with zero dependency on the main specforge package.
Capture server setup
Install only the standalone capture plugin (--no-deps) in the SGLang capture environment so the server's Torch/SGLang pins remain intact:
pip install --no-deps plugins/sglang-spec-captureLaunch the target server with SPECFORGE_SPEC_CAPTURE=1 and SGLang's --enable-return-mtp-hidden-states --disable-radix-cache flags (in managed_local mode, the SpecForge launcher passes these flags automatically):
export SGLANG_PLUGINS=specforge_spec_capture
export SPECFORGE_SPEC_CAPTURE=1
export MOONCAKE_MASTER_SERVER_ADDR=127.0.0.1:35551
export MOONCAKE_METADATA_SERVER=http://127.0.0.1:35880/metadata
export MOONCAKE_LOCAL_HOSTNAME=127.0.0.1
export MOONCAKE_PROTOCOL=tcp
python -m sglang.launch_server \
--model-path /path/to/Qwen3.6-27B \
--speculative-algorithm DFLASH \
--enable-return-aux-hidden-states \
--return-aux-hidden-state-layer-ids 1 16 31 46 61 \
--enable-return-mtp-hidden-states \
--return-hidden-states-mode full \
--disable-radix-cache \
--chunked-prefill-size -1 \
--mem-fraction-static 0.8 \
--port 30000When enabled, /server_info advertises spec_capture_mtp_hidden: true.
Draft block layout & conditioning settings
DMTP is not a separate draft architecture. Native-MTP conditioning is an optional spec_config.mtp node on the block-parallel drafts (DFlashDraftModel, DFlash2DraftModel, DSparkDraftModel, DominoDraftModel); the draft keeps its own heads, losses and metrics, and spec_config.block keeps its usual layout. Omitting mtp (or mtp: null) trains the plain draft.
spec_config.mtp.drop_anchorselects the block layout; the block protocol derives the T1 slot, known prefix tokens, label offset and anchor eligibility:drop_anchor: false(block_size: 8): dual-anchor[A, T1, MASK × 6](T1 in slot 1, aligned with released DMTP 27B/120B checkpoints).drop_anchor: true(block_size: 7): dropped-anchor[T1, MASK × 6](T1 in slot 0).- Either way anchors start at row 1 and need
[A, T1, T2]supervised.
spec_config.mtp.conditioningselects the T1 adapter:residual_lowrank(withresidual_rank: 256,residual_eps: 1.0e-06): weightless RMSNorm onh_MTPfollowed byup(silu(down(·)))with zero-initializedup, added as a residual toe_T1(27B style).residual_fusion(residual_rank: null,residual_eps: null): normalized[e_T1, h_MTP]projection with zero-initializedfc, added as a residual toe_T1(120B style).replace(residual_rank: null,residual_eps: null): normalized[e_T1, h_MTP]projection replacinge_T1.
spec_config.mtp.hidden_sizemust equal the target hidden size.- Accepted-length metrics keep the draft's own prefix and add a
t1_conditioned_tag (for exampledflash/hard_label/t1_conditioned_walk_accepted_length).
architectures: [DFlash2DraftModel]
spec_config:
block: {block_size: 8}
mtp:
hidden_size: 5120
conditioning: residual_lowrank
residual_rank: 256
residual_eps: 1.0e-06
drop_anchor: falseNOTE
SGLang serving export (specforge export --format sglang) rejects drafts with spec_config.mtp until upstream DMTP serving support (SGLang PR #50270) is merged and pinned.
Online disaggregated training
Run canonical specforge train against the capture server using the bundled dual-anchor DFlash2 DMTP preset (specforge/config/draft/presets/qwen3.6-27b-dmtp.yaml) and example configuration (examples/configs/online/disaggregated/external/qwen3.6-27b-dmtp.yaml):
specforge train -c examples/configs/online/disaggregated/external/qwen3.6-27b-dmtp.yamlOffline preparation and training
DMTP uses the standard scripts/prepare_hidden_states.py entrypoint with a DMTP draft preset. Each saved .ckpt record contains input_ids, loss_mask, hidden_states, and mtp_hidden_states:
python scripts/prepare_hidden_states.py \
--target-model-path /path/to/Qwen3.6-27B \
--draft specforge/config/draft/presets/qwen3.6-27b-dmtp.yaml \
--data-path ./cache/dataset/nemotron_v2_train.jsonl \
--output-path ./cache/hidden_states/qwen3.6-27b-dmtp \
--chat-template qwen3.5 \
--max-length 4096 \
--server-urls http://127.0.0.1:30000Then train offline with specforge train pointing data.hidden_states_path at ./cache/hidden_states/qwen3.6-27b-dmtp and draft at specforge/config/draft/presets/qwen3.6-27b-dmtp.yaml.
Inference
DMTP adds an MTP step before parallel drafting. The runtime must coordinate the two proposal sources, use the corresponding proposal distributions for exact sampling, and commit or roll back their cache state after verification. An ordinary DFlash worker does not acquire this behavior merely by loading DMTP draft weights.
Performance should be measured over the entire cycle, including MTP, parallel drafting, selection, target verification, and cache management. Improving T1's acceptance can help later candidates become usable, but does not by itself guarantee higher throughput. Sampling settings, concurrency, and the model's native MTP implementation all affect the result.
Using DMTP in SpecForge
Follow the training workflow above for online or offline DMTP training, and use a checkpoint-compatible serving implementation for inference. The following release details identify the two published drafts and their runtime requirements.
Checkpoints
The two checkpoints released here use DFlash2 as their parallel drafting component.
| Target | Draft checkpoint | Draft parameters | T1 conditioning |
|---|---|---|---|
| Qwen3.6-27B | Piggy12/Qwen3.6-27B-DMTP | 1.167B | Rank-256 residual network over the MTP representation |
| Qwen3.8-Flash-Next (120B) | Piggy12/Qwen3.8-next-120b-dmtp | 616.2M | Projection of separately normalized T1 embedding and MTP representation, concatenated |
Both repositories contain BF16 draft weights. Supply the matching target, its native MTP module, and shared embedding and language-model head separately. The conditioning residual is added to the T1 embedding. The two checkpoints use different adapters and are not interchangeable.
The 120B draft was continued from incoai/Qwen3.8-Flash-Next-DFlash2. Its released step-7000 export has passed artifact checks; GPU generation validation remains pending according to its model card.
Qwen3.6-27B acceptance results
The 27B model card compares DMTP with a DFlash2 baseline under the same training configuration. Both use token-level rejection sampling, seven proposals per verification round, TP4, concurrency up to 32, and temperature 1. Each task uses 64 fixed inputs. See the card for the full evaluation settings.
| Task | DFlash2 | DMTP |
|---|---|---|
| Code | 3.9621 | 4.6022 |
| Math | 4.2909 | 4.8871 |
| MT-Bench | 4.0044 | 4.1826 |
| Agent | 3.8197 | 4.6871 |
| SWE | 2.9273 | 3.9427 |
| Long-horizon | 3.1929 | 4.3310 |
The metric is tokens advanced per verification round: 1 + total accepted draft tokens / total verification rounds. These are acceptance results, not task accuracy or throughput measurements. They are reported separately from the SpecBundle throughput dashboard.
Serving
Use a DMTP-aware runtime with the adapter matching the checkpoint. For 27B, follow the reference launch command in the model card or its serve_dmtp.sh. That reference uses the implementation branch and enables SGLANG_DMTP_T1_RESIDUAL=1.
For 120B, follow its model card and the implementation branch. It additionally requires the architecture-specific HC/QSA adapter. Its configuration defines its own query-slot and proposal layout; do not reuse the 27B launch settings.
These release-specific serving paths do not establish support in an unmodified SGLang release or in SpecForge's canonical SGLang exporter. See training and export for the current exporter support. Inference performance is still being optimized; consult the model cards for runtime requirements and validation status.