AI Card Bao AICARDBAO.COM
Home / 开源 / AngelSpec
AI TOOL / #12925

AngelSpec

统一的 torch-native 训练框架,支持 MTP 与块并行投机解码。

Introduction

A unified training framework for MTP and block-parallel speculative decoding

AngelSpec is developed by the Tencent Hunyuan AI Infra team, which is a torch-native framework for training speculative-decoding draft models, covering both autoregressive MTP drafting and the block-parallel DFlash family. It is the training framework behind the AngelSpec and DFly2 technical reports: all drafters in them — the TTT-trained MTP drafter and the DFly family, DFly2 included — are trained and released with it.

Latest News

  • [2026/11/26] We open-source DFly2 in full: the weights, the training code and the technical report. Beyond Hy4 and Hy4 flash, DFly2 now also trains on DeepSeek-V4.1-Flash and GLM-5.3-Flash, with new MoE drafters released for Hy4 flash, DeepSeek-V4.1-Flash and GLM-5.3-Flash. 🔥🔥🔥
  • [2026/11/20] We add training for DFly2 on Hy4. 🔥🔥🔥
  • [2026/11/18] We release AngelSpec v0.2.0, adding training for DFly2, the speculative-decoding drafter that ships with Hy4 flash. DFly2 reuses the target's sparse KV cache and top-k indices, keeping drafting cost constant at any context length. Training for more open-source models, on-policy distillation, and the training and inference images are coming soon. 🔥🔥🔥
  • [2026/07/29] We release AngelSpec v0.1.0, supporting MTP and block-parallel speculative decoding training. Check out our technical report and released models.

Key Features

  • 7 draft architectures — DFly2, DFly, DFlash, DFlare, Eagle3, DSpark, MTP — behind one training pipeline; switching is a config change
  • MTP training with TTT — on-policy multi-depth rollout with memory close to a single causal pass; long-context training up to 256k via Ulysses sequence parallelism
  • Acceptance-aligned objectives — CE, top-k KL, LK losses, D-PACE weighting, and end-to-end TV, composable through configuration
  • MLA / DSA drafters — drafters that read the target's MLA latents and DSA candidates
  • Document-aware sequence packing — Megatron-style fixed-length packing with strict cross-document isolation, on both the DFlash and MTP paths
  • Online evaluation — genuine speculative decoding against the latest checkpoint during training, reporting mean accepted length and per-position acceptance as measured by the serving engine

Architecture

Inference and training run as separate GPU worker groups connected by a Mooncake tensor store, so hidden-state generation and optimization scale independently. This disaggregated foundation comes from TorchSpec; AngelSpec extends it with the architectures, objectives, and training features above.

Draft Architectures

ArchitectureMethodKey Idea
DFly2Block-parallelTarget's own sparse-attention picks and KV latents as draft context + MTP fusion (Hy4, Hy4 flash, DeepSeek-V4.1, GLM-5.3)
DFlyBlock-parallelHybrid target conditioning + hidden-correction AR head
DFlashBlock-parallelAnchor sampling + parallel block generation
DFlareBlock-parallelDFlash + learnable per-layer target fusion
Eagle3Autoregressive TTTTest-time training with input fusion
DSparkHybridDFlash backbone + EAGLE-style autoregressive head
MTPSingle-head TTTFull MoE decoder layer as draft (Hy3-native)

See the draft-model family docs for details and trade-offs.

DFly2

DFly2 is the speculative-decoding drafter Hy4 and Hy4 flash ship with, and AngelSpec trains it for sparse-attention targets: Hy4, Hy4 flash, DeepSeek-V4.1-Flash and GLM-5.3-Flash. It is built directly on the target model's Top-k Sparse KV: each draft layer shares the KV cache (KV Share) and the indexer's top-k selection (Index Share) with its corresponding sparse attention layer. This yields three advantages:

  • Constant cost: each draft token attends to at most ~2K keys, regardless of context length.
  • Zero extra KV memory: no separate KV cache is maintained for the drafter.
  • PD-disaggregation ready: not involved in prefill; the prefill-to-decode transfer adds only one last-layer hidden state.

Besides the dense drafter built into Hy4 flash, we also release MoE drafters on Hugging Face.

Its lead over DFlash and DSpark grows on long-context and agentic workloads; see the results.

Quick Start

# Install AngelSpec + the vLLM backend
pip install -e ".[vllm]"
pip install mooncake-transfer-engine

# Single-node quickstart (8 GPUs: 4 inference + 4 training)
./examples/qwen3-8b-dfly/run.sh

# Override config values from CLI
./examples/qwen3-8b-dfly/run.sh training.learning_rate=5e-5 training.num_train_steps=500

Or set up a conda environment (installs mooncake too):

./tools/build_conda.sh 1 vllm     # or: sglang
micromamba activate angelspec
CUDA 12.x hosts: PyPI's default torch / vllm wheels target CUDA 13 and won't load on a CUDA-12 driver. Install CUDA-matched wheels first — see Installation.

Examples

Multi-node (Hy4 and Hy4 flash targets)

ExampleArchitectureModeReleased Model
hy-v4-dfly2DFly2From scratchtencent/Hy4
hy-v4-flash-dfly2DFly2From scratchtencent/Hy4-flash

Multi-node (Hy3 target)

ExampleArchitectureModeReleased Model
hy3-dflyDFlyFrom scratchAngelSlim/Hy3-DFly-Block8
hy3-mtpMTPFrom scratchAngelSlim/Hy3-MTP-TTT3

Single-node (Qwen3-8B target)

ExampleArchitectureModeReleased Model
qwen3-8b-dsparkDSparkFrom scratch—
qwen3-8b-dflyDFlyFrom scratchAngelSlim/Qwen3-8B-DFly-Block8
qwen3-8b-mtpMTPFrom scratchAngelSlim/Qwen3-8B-MTP-TTT3
qwen3-8b-dfly-cptDFlyCPT (from ckpt)Continue from AngelSlim/Qwen3-8B-DFly-Block8

Single-node (Qwen3.5 targets)

ExampleArchitectureModeReleased Model
qwen35-9b-dflashDFlashFrom scratch—
qwen35-35b-a3b-mtpMTPFrom scratch—

Available training configs

ConfigArchitectureFeatures
configs/vllm_qwen3_8b_dfly.yamlDFlyBlock-parallel + hidden correction
configs/vllm_qwen3_8b_dflare.yamlDFlarePer-layer target fusion
configs/sglang_qwen3_8b_dflash.yamlDFlashSGLang backend
configs/sglang_qwen3_8b_dspark.yamlDSparkMarkov head + confidence
configs/vllm_qwen3_8b_mtp_pack_usp_40k.yamlMTPPacking + USP 40k seq
configs/vllm_dsv41_flash_dfly2.yamlDFly2DeepSeek-V4.1-Flash, 32k
configs/vllm_dsv41_flash_dspark.yamlDSparkDeepSeek-V4.1-Flash
configs/vllm_glm53_flash_dfly2.yamlDFly2GLM-5.3-Flash, 32k

Released Models

Draft models trained with AngelSpec:

ModelArchitectureTargetMode
AngelSlim/Hy4-flash-DFly2-B6DFly2Hy4 flash-
AngelSlim/DS-V4.1-Flash-DFly2-B6DFly2DeepSeek-V4.1-Flash-
AngelSlim/GLM-5.3-Flash-DFly2-B6DFly2GLM-5.3-Flash-
AngelSlim/Hy3-DFly-Block8DFlyHy3No-think
AngelSlim/Hy3-DFly-Block8-Think-HighDFlyHy3High-think
AngelSlim/Hy3-MTP-TTT3MTPHy3No-think
AngelSlim/Qwen3-8B-DFly-Block8DFlyQwen3-8BNo-think
AngelSlim/Qwen3-8B-MTP-TTT3MTPQwen3-8BNo-think

Benchmark

Long-context and agentic (DFly2)

Mean accepted length τ on DeepSeek-V4.1-Flash, GLM-5.3-Flash and Hy4 flash, each cell at temperature 0 / 1 (0.9 on Hy4 flash):

TargetDrafterLongSpec 32KCodeSpan 64KLSWE 128KALBMemAgentBFCL-v3SWE 64KLongAgentic
DeepSeek-V4.1-FlashDFlash2.98 / 2.553.81 / 3.133.42 / 2.964.38 / 4.132.84 / 2.603.40 / 3.113.58 / 3.143.40 / 2.883.55 / 3.25
DFlash†2.74 / 2.403.43 / 2.863.15 / 2.773.78 / 3.622.80 / 2.523.21 / 2.983.19 / 2.803.11 / 2.683.24 / 2.98
DSpark2.82 / 2.483.58 / 2.923.29 / 2.983.87 / 3.592.85 / 2.653.33 / 3.093.35 / 2.993.23 / 2.793.35 / 3.08
DFly23.12 / 2.814.14 / 3.593.97 / 3.555.10 / 4.723.36 / 3.133.77 / 3.554.02 / 3.603.74 / 3.324.06 / 3.75
GLM-5.3-FlashDFlash2.55 / 2.173.12 / 2.482.92 / 2.643.12 / 1.922.79 / 2.502.99 / 2.752.91 / 2.602.86 / 2.432.95 / 2.44
DFlash†2.69 / 2.233.22 / 2.602.97 / 2.653.50 / 3.452.68 / 2.483.00 / 2.732.86 / 2.612.96 / 2.503.01 / 2.82
DSpark2.75 / 2.373.32 / 2.773.08 / 2.793.53 / 3.732.74 / 2.583.15 / 2.912.98 / 2.743.05 / 2.643.10 / 2.99
DFly23.31 / 2.924.40 / 3.633.82 / 3.525.49 / 4.773.30 / 3.123.61 / 3.353.73 / 3.483.85 / 3.364.03 / 3.68
Hy4 flashDFlash2.59 / 2.411.17 / 1.101.12 / 1.091.50 / 1.361.08 / 1.063.18 / 3.202.26 / 1.881.63 / 1.532.00 / 1.88
DFlash†2.68 / 2.503.47 / 3.283.23 / 3.063.32 / 3.062.63 / 2.472.90 / 2.923.40 / 2.943.13 / 2.953.06 / 2.85
DSpark2.74 / 2.563.54 / 3.353.31 / 3.113.32 / 3.102.77 / 2.563.08 / 2.983.45 / 3.143.20 / 3.013.16 / 2.95
DFly22.94 / 2.754.12 / 4.033.83 / 3.605.41 / 5.223.23 / 2.953.69 / 3.674.12 / 3.703.63 / 3.464.11 / 3.88

Speedup over autoregressive decoding, greedy at a concurrency of one, as decoding / end-to-end:

TargetDrafterLongSpec 32KCodeSpan 64KLSWE 128KALBMemAgentBFCL-v3SWE 64KLongAgentic
DeepSeek-V4.1-FlashDFlash2.46× / 1.75×3.05× / 1.67×2.59× / 1.16×3.46× / 0.69×2.22× / 0.63×2.67× / 0.78×2.79× / 1.49×2.70× / 1.52×2.78× / 0.90×
DFlash†2.32× / 1.70×2.70× / 1.55×2.52× / 1.13×3.09× / 0.83×2.25× / 0.69×2.63× / 0.84×2.55× / 1.47×2.51× / 1.46×2.63× / 0.96×
DSpark2.28× / 1.99×2.63× / 2.06×2.49× / 1.68×2.95× / 1.21×2.37× / 1.27×2.58× / 1.37×2.54× / 1.89×2.47× / 1.91×2.61× / 1.44×
DFly22.44× / 2.10×3.23× / 2.37×2.94× / 1.86×3.82× / 1.25×2.60× / 1.24×2.97× / 1.36×3.00× / 2.13×2.87× / 2.11×3.10× / 1.50×
GLM-5.3-FlashDFlash1.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×
DSpark1.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×
DFly22.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×
Hy4 flashDFlash2.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×
DSpark2.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×
DFly22.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×

Long and Agentic average the three long-context and four agentic sets; the best result per target is in bold. DFlash† reads only a window of the context at decode but still builds a full cache at prefill.

<
Visits:1 Updated:2026-12-02 AI tools

Related