A unified training framework for MTP and block-parallel speculative decoding.
✒️ Technical Report | 📄 DFly2 Paper | 📖 Documentation | 🤗 Hugging Face | 💻 GitHub
Hy4-flash DFly2 Drafter (Block Size 6)
Model Summary
This repository contains a DFly2 speculative-decoding drafter for Hy4-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 Hy4-flash target model.
- Target model: Hy4-flash
- Drafter type: DFly2
- Block size: 6 (one anchor token + 5 draft tokens)
- Training framework: AngelSpec
- Serving backend: vLLM speculative decoding (support in progress)
Highlights
- No KV cache of its own. A three-layer drafter that kept a full cache of its own would add 3.4 KiB per token on top of the target's 17.2 KiB, raising the per-token KV to 1.20×. DFly2 adds none, so the same KV pool holds 1.19× as many requests at 32K tokens. It needs no place on the prefill instances under prefill-decode disaggregation, and every prefix-cache hit of the target is also a drafter hit.
- Fixed-size, query-aware reads. Each draft step reads the positions the target's own sparse indexer selected for the token before the block. They can lie anywhere in the context, their number does not grow with it, and the drafter runs no indexer of its own.
- Higher acceptance on every benchmark. Against DFlash and DSpark trained on the same recipe and data, DFly2 accepts more tokens per step on every benchmark below, at both temperatures.
- Generalizes past its 32K training length. On the agentic sets, whose prompts mostly run longer, its average accepted length stays close to its general-purpose average (4.11 / 3.88 vs. 3.96 / 3.95 at T = 0 / 0.9), while DSpark's drops from 3.81 / 3.73 to 3.16 / 2.95. DFlash with a full cache of its own falls to as few as 1.08 tokens per step once prompts pass 32K.
Model Details
Hy4-flash compresses the index of its sparse layers in two stages. DFly2 takes the selection in the form the target gives it.
| Item | Value |
|---|---|
| Draft layers | 3 MoE layers, 128 routed experts each |
| Paired target layers (KV + index sharing) | 33, 37, 41 |
| Context read per draft step | Target's top-2048 selection at the row before the anchor |
| Initialization | Attention copied from the paired target layer |
| 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 |
Training Data
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 composition
Each 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% |
Training Recipe
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.
Evaluation: Accepted Length
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 = 0.9, 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 512-token sliding window, and DFlash† is DFlash held to that same window. All methods draft a block of 5 tokens on vLLM.
General-purpose benchmarks
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.86 / 3.77 | 4.11 / 3.95 | 3.80 / 3.69 | 3.81 / 3.68 | 3.02 / 3.04 | 3.59 / 3.51 | 2.90 / 2.71 | 3.58 / 3.48 |
| DFlash† | 3.87 / 3.78 | 4.13 / 3.98 | 3.80 / 3.67 | 3.83 / 3.69 | 3.00 / 3.01 | 3.61 / 3.52 | 2.91 / 2.74 | 3.59 / 3.48 |
| DSpark | 4.16 / 4.09 | 4.42 / 4.29 | 4.05 / 3.98 | 4.02 / 3.92 | 3.17 / 3.22 | 3.79 / 3.72 | 3.07 / 2.92 | 3.81 / 3.73 |
| DFly2 | 4.40 / 4.43 | 4.55 / 4.52 | 4.22 / 4.20 | 4.16 / 4.11 | 3.34 / 3.42 | 3.92 / 3.91 | 3.16 / 3.03 | 3.96 / 3.95 |
Long-context and agentic benchmarks
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.59 / 2.41 | 1.17 / 1.10 | 1.12 / 1.09 | 1.50 / 1.36 | 1.08 / 1.06 | 3.18 / 3.20 | 2.26 / 1.88 | 1.63 / 1.53 | 2.00 / 1.88 |
| DFlash† | 2.68 / 2.50 | 3.47 / 3.28 | 3.23 / 3.06 | 3.32 / 3.06 | 2.63 / 2.47 | 2.90 / 2.92 | 3.40 / 2.94 | 3.13 / 2.95 | 3.06 / 2.85 |
| DSpark | 2.74 / 2.56 | 3.54 / 3.35 | 3.31 / 3.11 | 3.32 / 3.10 | 2.77 / 2.56 | 3.08 / 2.98 | 3.45 / 3.14 | 3.20 / 3.01 | 3.16 / 2.95 |
| DFly2 | 2.94 / 2.75 | 4.12 / 4.03 | 3.83 / 3.60 | 5.41 / 5.22 | 3.23 / 2.95 | 3.69 / 3.67 | 4.12 / 3.70 | 3.63 / 3.46 | 4.11 / 3.88 |
Evaluation: Speedup
Speedup over the target alone on NVIDIA H20 GPUs, greedy, at a concurrency of one, on one TP8 instance. 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.
General-purpose benchmarks
| Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
|---|---|---|---|---|---|---|---|---|
| DFlash | 3.23× / 2.98× | 3.47× / 3.35× | 3.21× / 3.16× | 3.21× / 3.09× | 2.55× / 2.50× | 3.03× / 2.84× | 2.44× / 2.39× | 3.02× / 2.90× |
| DFlash† | 3.25× / 3.00× | 3.49× / 3.38× | 3.22× / 3.18× | 3.24× / 3.13× | 2.53× / 2.48× | 3.04× / 2.87× | 2.44× / 2.38× | 3.03× / 2.92× |
| DSpark | 3.47× / 3.16× | 3.71× / 3.57× | 3.42× / 3.37× | 3.38× / 3.26× | 2.67× / 2.60× | 3.17× / 2.97× | 2.58× / 2.51× | 3.20× / 3.06× |
| DFly2 | 3.70× / 3.34× | 3.85× / 3.69× | 3.56× / 3.51× | 3.51× / 3.38× | 2.81× / 2.75× | 3.30× / 3.07× | 2.66× / 2.59× | 3.34× / 3.19× |
Long-context and agentic benchmarks
| Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long Avg. | Agen. Avg. |
|---|---|---|---|---|---|---|---|---|---|
| DFlash | 2.15× / 1.93× | 0.96× / 0.96× | 0.90× / 1.00× | 1.23× / 1.06× | 0.87× / 0.97× | 2.64× / 1.87× | 1.87× / 1.46× | 1.34× / 1.30× | 1.65× / 1.34× |
| DFlash† | 2.28× / 2.03× | 2.96× / 2.26× | 2.75× / 1.60× | 2.81× / 1.26× | 2.18× / 1.29× | 2.46× / 1.82× | 2.90× / 1.80× | 2.66× / 1.96× | 2.59× / 1.54× |
| DSpark | 2.32× / 2.06× | 3.00× / 2.28× | 2.79× / 1.60× | 2.80× / 1.26× | 2.23× / 1.27× | 2.59× / 1.85× | 2.92× / 1.81× | 2.70× / 1.98× | 2.63× / 1.55× |
| DFly2 | 2.47× / 2.17× | 3.48× / 2.51× | 3.22× / 1.68× | 4.55× / 1.35× | 2.54× / 1.31× | 3.08× / 2.04× | 3.46× / 1.96× | 3.06× / 2.12× | 3.41× / 1.67× |
Deployment
vLLM: support in progress. Serving instructions will be added here once DFly2 support is available in vLLM. The drafter is deployed together with the Hy4-flash target model and drafts 5 tokens per step (block size 6).
License
This drafter is released under the Apache-2.0 License. The Hy4-flash target model is subject to its own license.
Technical Report
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
- Downloads last month
- -
Model tree for AngelSlim/Hy4-flash-DFly2-B6
Base model
tencent/Hy4-flash