Tencent Open-Sources DFly2, Hitting 4.2x Speed on Long-Context AI
Tencent Hunyuan released DFly2, the speculative decoding drafter inside Hy4 Flash that reuses the target's sparse KV cache for up to 4.2x speedup on long-context work.
Takeaways
- Tencent open sourced DFly2, the speculative decoding drafter inside Hy4 Flash, delivering up to 4.2x speedup.
- Shares the target model's sparse KV cache and top-k token indices, so drafting cost stays constant at any context length.
- Zero extra KV memory: no separate cache maintained for the drafter, PD-disaggregation ready.
- On agentic tasks, ~30% faster than same-recipe DSpark and accepts 10.4% more draft tokens vs open-source DSpark.
- Shipped in AngelSpec v0.2.0 training framework, which now supports seven drafter architectures.
- Weights available on Hugging Face; training recipe includes DFly-OPD online distillation without rollouts.
Tencent’s Hunyuan team has open-sourced DFly2, the speculative-decoding drafter used by its Hy4 Flash model. Tencent reports up to a 4.2x generation speedup on long-context and agentic workloads. The design adds no drafter-specific key-value cache, and its attention cost remains fixed as the total context grows.
Why long context erodes the gain
Standard autoregressive decoding generates one token per target-model pass. Speculative decoding asks a smaller draft model to propose several tokens, then verifies those proposals with the target model in parallel. Accepted proposals allow the target to advance by multiple tokens in one pass. The target still verifies every proposal and retains final authority over the output.
Conventional drafters maintain their own key-value cache, commonly called a KV cache, containing attention data from earlier tokens. Their attention work and memory use grow with the sequence. At contexts spanning hundreds of thousands of tokens, those costs can consume much of the speedup from drafting.
DFly2 borrows the target’s cache
Released with AngelSpec v0.2.0, DFly2 reuses Hy4 Flash’s sparse KV cache and selected token positions. Hy4 Flash uses DeepSeek-style sparse attention, or DSA, whose compressed indexer chooses a limited set of relevant positions instead of attending to the entire sequence.
Each DFly2 layer shares data with the corresponding sparse-attention layer in the target model and inherits its selection of up to 2,048 positions. A draft token therefore attends to no more than roughly 2,000 keys, regardless of the full context length. The cost remains constant with respect to context size, though it still depends on the selected-key limit, model architecture and hardware.
- Bounded attention: Each draft token attends to at most 2,048 selected positions.
- No second cache: The drafter reuses the target model’s sparse KV data instead of maintaining a separate KV cache.
- Disaggregated serving support: DFly2 stays out of prefill, the stage that processes the input prompt. When prefill and decoding run on separate workers, the transfer adds only the target’s final-layer hidden state.
The 4.2x claim has boundaries
| Measurement | Tencent’s result | Comparison |
|---|---|---|
| Peak generation speed | Up to 4.2x | Long-context and agentic workloads |
| Speed against DSpark | About 30% higher | Models trained with the same recipe |
| Accepted draft tokens | 10.4% more | Open-source DSpark baseline |
| Earlier AngelSpec throughput | 1.98x to 2.40x on average | Autoregressive decoding on Hunyuan 3 |
These figures are Tencent’s reported results, and the 4.2x number is a peak rather than an expected gain for every request. Reproduction depends on the target model, context length, proposed-token count, acceptance rate, batch size, serving engine and GPU configuration. The earlier AngelSpec results used Hunyuan 3, a 295-billion-parameter mixture-of-experts model, with the original DFly architecture.
Seven drafters share one pipeline
AngelSpec packages seven drafter architectures behind a common training pipeline. Block-parallel designs predict groups of draft tokens together, while autoregressive designs generate draft tokens sequentially.
| Architecture | Drafting approach |
|---|---|
| DFly2 | Block-parallel drafting using the target’s DSA selections, multi-head latent attention data and multi-token-prediction fusion. |
| DFly | Block-parallel drafting with hybrid target conditioning and a hidden-correction autoregressive head. |
| DFlash and DFlare | Block-parallel variants using anchor sampling and target-state fusion at each layer. |
| Eagle3 | Autoregressive test-time training with input fusion. |
| DSpark | A DFlash backbone paired with an EAGLE-style autoregressive head. |
| MTP | A full mixture-of-experts decoder layer used as the drafter, native to Hunyuan 3. |
The quickstart needs eight GPUs
AngelSpec separates inference and training into independently scalable GPU pools. Hidden states move through RDMA networking, which transfers data directly between machines’ memory, and a Mooncake tensor store handles communication without staging data on disk.
The repository’s single-node Qwen3-8B example assigns four GPUs to inference and four to training. Its setup installs AngelSpec with vLLM support, adds the Mooncake transfer engine and launches the supplied script:
pip install -e ".[vllm]"
pip install mooncake-transfer-engine
./examples/qwen3-8b-dfly/run.sh
Compatibility follows the attention design
Tencent has published the Hy4 Flash DFly2 weights, making that model the primary supported deployment target. DFly2 depends on access to the target’s sparse-attention selections, cache layout and intermediate states. Dense-attention models, or sparse models with different indexing schemes, require architectural and training changes before they can use the same approach.
Teams evaluating DFly2 should verify that their serving stack can share target-model cache data with the drafter, perform speculative verification and transfer the required hidden state between prefill and decode workers. Hardware comparisons should also include the drafter’s weights and compute, even though it adds no separate KV cache.
Online distillation trims training work
DFly2 adds a hybrid online-offline training mode and DFly-OPD, Tencent’s lightweight online-distillation method. The project says DFly-OPD removes the need to generate rollout trajectories before training, reducing the work required to adapt a drafter to another DSA-based target. Tencent lists support for additional open-source models and prebuilt training and inference containers on the project roadmap.