✒️ Technical Report | 📄 DFly2 Paper | 📖 Documentation | 🤗 Hugging Face | 💻 GitHub
This repository contains a DFly2 speculative-decoding drafter for GLM-5.3-Flash, trained with AngelSpec. DFly2 is a block-parallel drafter for natively sparse targets: each of its three draft layers is paired with one of the target's DeepSeek Sparse Attention (DSA) layers and reads the KV that layer has already cached (KV sharing), at the positions that layer's indexer has already selected (index sharing). The drafter keeps no KV cache of its own, runs no indexer, and reads a fixed number of positions from anywhere in the context.
It should be deployed together with the GLM-5.3-Flash target model.
GLM-5.3-Flash interleaves 11 DSA layers with 34 linear-attention layers. DFly2 pairs with three of its DSA layers.
| Item | Value |
|---|---|
| Draft layers | 3 MoE layers, 128 routed experts each |
| Paired target layers (KV + index sharing) | 35, 39, 43 |
| Context read per draft step | Target's top-2048 selection at the row before the anchor, made over groups of adjacent positions |
| Initialization | Attention copied from the paired target layer; 128 of that layer's routed experts drawn at random, with their router rows and biases |
| Last-layer hidden injection | Target's last-layer hidden state, fused with the anchor embedding and gated into the anchor slot |
| Intra-block correction | Hidden correction plus a context attention and a gated prefix attention, slot by slot |
| Embedding / LM head | Shared with the target (not stored in this repository) |
| Precision | BF16 |
The drafter is trained on DFly-SFT, a general-purpose instruction-tuning corpus of 989,861 conversations and 7.42B tokens, all from public datasets. The conversations fall into ten capability domains, labeled by their source where it gives a label and by an LLM annotator otherwise. Samples are capped at 32,768 tokens and each domain is filled with its longest samples first, which makes the mixture long-form and reasoning-heavy: 61.6% of samples carry an explicit reasoning trace and 34.9% run past 8K tokens. The corpus is deduplicated globally and decontaminated against the twelve DeepSpec evaluation sets with an n-gram overlap test.
| Data type | Mix | Samples | Tokens | Median len. | Think |
|---|---|---|---|---|---|
| Math (advanced) | 19.2% | 190,000 | 2.90B | 13,982 | 98.6% |
| Code (competitive) | 11.1% | 110,000 | 1.96B | 18,175 | 94.7% |
| Code (engineering) | 9.6% | 95,479 | 0.56B | 4,064 | 46.9% |
| Knowledge & STEM | 15.2% | 150,000 | 0.48B | 2,075 | 51.3% |
| Instruction following | 7.1% | 70,000 | 0.47B | 5,751 | 85.7% |
| Code (function-level) | 11.1% | 110,000 | 0.41B | 686 | 37.9% |
| Writing | 10.1% | 100,000 | 0.24B | 1,425 | 40.1% |
| Text transformation | 6.1% | 60,000 | 0.19B | 1,972 | 37.4% |
| Logical reasoning | 2.5% | 24,382 | 0.11B | 1,461 | 65.0% |
| Math (word problems) | 8.1% | 80,000 | 0.09B | 477 | 20.2% |
| Total | 100.0% | 989,861 | 7.42B | 3,621 | 61.6% |
Mix is the share of samples. Token counts and lengths use the GLM-5.3-Flash tokenizer, and Think is the fraction of samples whose assistant turns carry an explicit reasoning trace.
Per-source compositionEach domain's share is given on its first row, and Mix is each source's share of the full 989,861-sample corpus.
| Data type | Dataset | Mix |
|---|---|---|
| Math (advanced), 19.2% | OpenMathReasoning | 9.68% |
| Dolci-Think-SFT-32B | 3.29% | |
| Step-3.5-Flash-SFT | 2.02% | |
| Nemotron-Math-v4 | 2.02% | |
| Nemotron-Math-v2 | 1.01% | |
| SYNTHETIC-2 (math) | 0.81% | |
| WildChat-4.8M | 0.20% | |
| Nemotron-Chat-v3 | 0.10% | |
| Arena-Human-Pref-140k | 0.06% | |
| Code (competitive), 11.1% | Nemotron-CompProg (Python) | 4.80% |
| Dolci-Think-SFT-32B | 1.91% | |
| CodeForces-CoTs | 1.62% | |
| Step-3.5-Flash-SFT | 1.41% | |
| SYNTHETIC-2 (code) | 0.71% | |
| Nemotron-CompProg (C++) | 0.51% | |
| WildChat-4.8M | 0.16% | |
| Code (engineering), 9.6% | WildChat-4.8M | 4.74% |
| Step-3.5-Flash-SFT | 3.96% | |
| Nemotron-Chat-v3 | 0.59% | |
| Arena-Human-Pref-140k | 0.36% | |
| Knowledge & STEM, 15.2% | Step-3.5-Flash-SFT | 5.05% |
| WildChat-4.8M | 4.83% | |
| Arena-Human-Pref-140k | 2.53% | |
| Nemotron-Chat-v3 | 2.02% | |
| Dolci-Think-SFT-32B | 0.72% | |
| Instruction following, 7.1% | Dolci-Think-SFT-32B | 3.54% |
| Nemotron-IF-v3 | 1.21% | |
| Step-3.5-Flash-SFT | 0.81% | |
| SYNTHETIC-2 (format) | 0.51% | |
| WildChat-4.8M | 0.51% | |
| AutoIF-61k | 0.51% | |
| Code (function-level), 11.1% | OpenCodeInstruct | 6.30% |
| Dolci-Think-SFT-32B | 3.20% | |
| Step-3.5-Flash-SFT | 0.90% | |
| WildChat-4.8M | 0.56% | |
| Nemotron-Chat-v3 | 0.13% | |
| Arena-Human-Pref-140k | 0.03% | |
| Writing, 10.1% | WildChat-4.8M | 5.59% |
| Step-3.5-Flash-SFT | 3.00% | |
| Nemotron-Chat-v3 | 1.08% | |
| Arena-Human-Pref-140k | 0.25% | |
| Charcard-Roleplay | 0.18% | |
| Text transformation, 6.1% | WildChat-4.8M | 3.59% |
| Step-3.5-Flash-SFT | 1.82% | |
| Nemotron-Chat-v3 | 0.45% | |
| Arena-Human-Pref-140k | 0.20% | |
| Logical reasoning, 2.5% | UltraInteract-SFT | 0.62% |
| SYNTHETIC-2 (output-pred.) | 0.54% | |
| R1-Brain-Teasers | 0.38% | |
| Step-3.5-Flash-SFT | 0.29% | |
| SYNTHETIC-2 (reasoning-gym) | 0.24% | |
| Nemotron-Chat-v3 | 0.22% | |
| WildChat-4.8M | 0.13% | |
| Arena-Human-Pref-140k | 0.04% | |
| Math (word problems), 8.1% | Orca-Math-200k | 5.78% |
| Step-3.5-Flash-SFT | 1.42% | |
| WildChat-4.8M | 0.61% | |
| Nemotron-Chat-v3 | 0.23% | |
| Arena-Human-Pref-140k | 0.04% |
The same recipe trains DFly2 and every baseline below, on all three targets of the technical report.
| Hyperparameter | Value |
|---|---|
| Epochs | 3 |
| Global batch size | 256 |
| Sequence length | 32K |
| Optimizer | Muon |
| Objective | Per-slot LK distillation loss (KL + TV) against the target, weighted by D-PACE |
| Draft tokens per block (γ) | 5 |
Only the drafter is trained. At serving time the selection comes from the target's verify pass. Training has no verify pass, so it recomputes the selection with a frozen copy of each paired layer's indexer, and a draft layer sees the same latents and positions in training as at serving.
Mean accepted length τ, counting the bonus token, in the 2K chat setting (thinking disabled, at most 2048 generated tokens). Each cell gives T = 0 / T = 1, and bold marks the best per column and temperature. Accepted length is measured on a single TP8 engine on NVIDIA H20 GPUs, as the mean of the last three runs.
All baselines are trained by us with the same recipe, data and number of steps as DFly2, on the same three-layer MoE stack (within 2% of its size). DFlash keeps its own KV cache over the whole context, DSpark bounds its own cache with a 128-token sliding window, and DFlash† is DFlash held to that same window. All methods draft a block of 5 tokens on vLLM.
GSM8K, MATH-500 (MATH), AIME25, MBPP, HumanEval, LiveCodeBench (LCB) and MT-Bench, seven of the twelve evaluation sets that ship with DeepSpec.
| Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
|---|---|---|---|---|---|---|---|---|
| DFlash | 3.93 / 3.65 | 3.73 / 3.29 | 3.25 / 2.77 | 3.76 / 3.38 | 3.84 / 3.44 | 2.91 / 2.64 | 2.58 / 2.34 | 3.43 / 3.07 |
| DFlash† | 4.00 / 3.73 | 3.83 / 3.38 | 3.36 / 2.92 | 3.79 / 3.43 | 3.74 / 3.40 | 2.99 / 2.73 | 2.66 / 2.35 | 3.48 / 3.13 |
| DSpark | 4.23 / 3.97 | 4.06 / 3.61 | 3.58 / 3.17 | 4.02 / 3.66 | 3.91 / 3.62 | 3.16 / 2.92 | 2.80 / 2.50 | 3.68 / 3.35 |
| DFly2 | 4.53 / 4.37 | 4.31 / 4.00 | 3.88 / 3.51 | 4.24 / 4.01 | 4.36 / 4.03 | 3.41 / 3.24 | 2.96 / 2.72 | 3.96 / 3.69 |
Long context: LongSpec 32K, CodeSpan 64K and LongSWE-Bench 128K (LSWE 128K). Agentic: AgentLongBench (ALB), MemoryAgentBench (MemAgent), the long-context multi-turn category of BFCL-v3, and LongSWE-Bench issues at 64K (SWE 64K). Long Avg. and Agen. Avg. average the three long-context and four agentic sets. Every drafter is trained at 32K.
| Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long Avg. | Agen. Avg. |
|---|---|---|---|---|---|---|---|---|---|
| DFlash | 2.55 / 2.17 | 3.12 / 2.48 | 2.92 / 2.64 | 3.12 / 1.92 | 2.79 / 2.50 | 2.99 / 2.75 | 2.91 / 2.60 | 2.86 / 2.43 | 2.95 / 2.44 |
| DFlash† | 2.69 / 2.23 | 3.22 / 2.60 | 2.97 / 2.65 | 3.50 / 3.45 | 2.68 / 2.48 | 3.00 / 2.73 | 2.86 / 2.61 | 2.96 / 2.50 | 3.01 / 2.82 |
| DSpark | 2.75 / 2.37 | 3.32 / 2.77 | 3.08 / 2.79 | 3.53 / 3.73 | 2.74 / 2.58 | 3.15 / 2.91 | 2.98 / 2.74 | 3.05 / 2.64 | 3.10 / 2.99 |
| DFly2 | 3.31 / 2.92 | 4.40 / 3.63 | 3.82 / 3.52 | 5.49 / 4.77 | 3.30 / 3.12 | 3.61 / 3.35 | 3.73 / 3.48 | 3.85 / 3.36 | 4.03 / 3.68 |
Speedup over the target alone on NVIDIA H20 GPUs, greedy, at a concurrency of one, with prefill and decode on separate TP8 instances. Each cell gives decoding / end-to-end speedup, the latter including prefill, and bold marks the best per column and speedup. DFlash† reads a window at decode but still builds a full cache at prefill. DFly2 builds no cache of its own at prefill and leaves prefill speed unaffected.
| Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
|---|---|---|---|---|---|---|---|---|
| DFlash | 2.69× / 2.31× | 2.54× / 2.42× | 2.20× / 2.17× | 2.57× / 2.44× | 2.59× / 2.50× | 1.98× / 1.89× | 1.79× / 1.77× | 2.34× / 2.21× |
| DFlash† | 2.77× / 2.39× | 2.62× / 2.50× | 2.26× / 2.22× | 2.63× / 2.49× | 2.56× / 2.47× | 2.04× / 1.98× | 1.83× / 1.80× | 2.39× / 2.26× |
| DSpark | 2.85× / 2.42× | 2.67× / 2.55× | 2.32× / 2.28× | 2.71× / 2.57× | 2.62× / 2.54× | 2.10× / 2.04× | 1.85× / 1.82× | 2.45× / 2.32× |
| DFly2 | 2.90× / 2.40× | 2.71× / 2.56× | 2.43× / 2.39× | 2.71× / 2.56× | 2.74× / 2.64× | 2.16× / 2.10× | 1.88× / 1.85× | 2.50× / 2.36× |
| Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long Avg. | Agen. Avg. |
|---|---|---|---|---|---|---|---|---|---|
| DFlash | 1.70× / 1.47× | 2.03× / 1.46× | 1.89× / 1.28× | 2.15× / 1.09× | 1.83× / 1.01× | 2.02× / 1.16× | 1.88× / 1.36× | 1.87× / 1.40× | 1.97× / 1.15× |
| DFlash† | 1.86× / 1.56× | 2.12× / 1.48× | 2.04× / 1.28× | 2.45× / 1.07× | 1.92× / 0.97× | 2.08× / 1.09× | 1.99× / 1.50× | 2.00× / 1.44× | 2.11× / 1.16× |
| DSpark | 1.84× / 1.53× | 2.24× / 1.58× | 2.12× / 1.38× | 2.48× / 1.08× | 1.90× / 0.97× | 2.17× / 1.13× | 2.02× / 1.49× | 2.07× / 1.49× | 2.14× / 1.17× |
| DFly2 | 2.14× / 1.75× | 2.82× / 1.79× | 2.40× / 1.39× | 3.57× / 1.10× | 2.20× / 0.98× | 2.34× / 1.17× | 2.35× / 1.62× | 2.45× / 1.64× | 2.61× / 1.22× |
vLLM: support in progress. Serving instructions will be added here once DFly2 support is available in vLLM. The drafter is deployed together with the GLM-5.3-Flash target model and drafts 5 tokens per step (block size 6).
This drafter is released under the Apache-2.0 License. The GLM-5.3-Flash target model is subject to its own license.
DFly2 and the results above are described in the DFly2 technical report:
DFly2: Turbocharging Long-Context Speculative Decoding by Sharing the Target's Sparsity
arXiv: https://arxiv.org/abs/2611.34776
The drafter is trained with AngelSpec. For the training framework, see:
AngelSpec: Towards Real-World High Performance Inference with Speculative Decoding
arXiv: https://arxiv.org/abs/2607.25852
model-00001-of-00004.safetensors 5.4 GBmodel-00003-of-00004.safetensors 5.4 GBmodel-00002-of-00004.safetensors 5.4 GBmodel-00004-of-00004.safetensors 4.6 GB