Paper | Blog | GitHub | SGLang PR
A DMTP draft checkpoint for Qwen/Qwen4-35B-A3B. Native MTP proposes the first token; a parallel DFlash2-style draft conditions on that token and its predictive representation to propose the continuation.
This repository contains draft weights only. The matching Target model, native MTP, tokenizer, shared token embeddings, and language-model head must be supplied separately.
The residual projection shown in the diagram is implemented as a rank-256 linear factorization, W_up W_down, without SiLU.
Native MTP proposes the first candidate token, T1.
The parallel draft receives the last emitted token A, T1, and MASK positions.
The MTP representation that predicted T1 is normalized and projected through a rank-256 linear residual, added only to the T1 embedding:
E(T1) <- E(T1) + W_up W_down RMSNorm(h_MTP)
DFlash2 drafts the continuation in parallel, and the Target verifies the combined proposals.
The A embedding, MASK embeddings, and original Target-context feature path remain unchanged.
This checkpoint was trained on continual pre-training (CPT) data, primarily covering agent, vision-language, and long-context tasks. It can be further fine-tuned with supervised fine-tuning (SFT) on OPC and other coding datasets.
The residual is W_up W_down RMSNorm(h_MTP). The Target context path, the first anchor embedding, and MASK embeddings remain unchanged. The draft uses hyper-connections and MRoPE; these architecture-specific features must be preserved by the inference implementation.
We report per-verify accepted length. The main evaluation uses an input limit of 128K tokens and an output limit of 64K tokens.
The task-level macro average is 3.5528. Long-context results are evaluated separately across input-length ranges from 0-32K to 128-256K.
Per-verify accepted length, including the target correction or bonus token:
| Dataset | DMTP Per-Verify Accepted Length |
|---|---|
| GSM8K | 4.6154 |
| HumanEval | 3.8242 |
| MATH500 | 4.3418 |
| MBPP Sanitized | 3.8757 |
| AIME 2024 | 3.6266 |
| Alpaca | 2.6194 |
Use the full Qwen4 runtime on the repository's main branch. The matching target must include native MTP.
git clone --depth 1 --branch main https://github.com/Sylvan820/sglang-dmtp.git
cd sglang-dmtp
python -m pip install -e ./python
hf download Qwen/Qwen4-35B-A3B --local-dir ./models/Qwen4-35B-A3B
hf download Piggy12/Qwen4-35B-A3B-dmtp --local-dir ./models/Qwen4-35B-A3B-dmtp
TARGET_MODEL="$PWD/models/Qwen4-35B-A3B" \
DRAFT_MODEL="$PWD/models/Qwen4-35B-A3B-dmtp" \
TP_SIZE=4 MAX_RUNNING_REQUESTS=32 PORT=39532 \
bash ./scripts/dmtp/serve_qwen4_35b.sh
The launcher reads the proposal layout from config.json; the runtime selects the matching residual, mask layout, and attention windows. Keep the checkpoint config unchanged. Decode CUDA Graphs and the MTP/draft graph pipeline are enabled; prefill remains eager. Set CONTEXT_LENGTH and MAX_TOTAL_TOKENS according to GPU memory. Use a CUDA environment with kernels and dependencies matching this checkout.
The full Qwen4 HC/QSA path is on main; the SGLang PR contains the common path only. This launcher serves text. End-to-end GPU validation of the newly ported public runtime remains in progress, and inference performance is still being optimized.
See the blog for the method and the repository for inference integration references. These references can also help AI coding tools adapt DMTP to an existing inference framework.
Preserve the matching tokenizer, native MTP, feature-layer selection, residual normalization, attention layout, selector, and position encoding. Inference performance is still being optimized; scheduling, KV-cache handling, and CUDA Graph coverage are runtime-specific.
model.safetensors: BF16 draft weights, including the candidate selector and MTP residual adapter.config.json: draft architecture and conditioning configuration.If you find DMTP useful, please cite the paper, also available on Hugging Face Papers.
@misc{shen2026dmtp,
title = {{DMTP}: A Better First Token for Block Drafting via MTP},
year = {2026},
eprint = {2611.37561},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.37561}
}
The draft weights are released under Apache-2.0. The separately downloaded Target model and other dependencies remain subject to their respective licenses.
Qwen/Qwen4-35B-A3B