Tencent Open-Sources DFly2 for Efficient Speculative Decoding

Tencent has open-sourced DFly2, a speculative decoding drafter tailored for natively sparse large language models (LLMs). This drafter specifically supports models such as DeepSeek-V4.1-Flash, GLM-5.3-Flash, and Tencent’s own Hy4 flash. Notably, DFly2 does not maintain an independent key-value (KV) cache, which is crucial for applications requiring long-context and agentic serving due to competition for memory resources.

Overview of DFly2

DFly2 is a block-parallel speculative decoding drafter developed by Tencent’s Hunyuan AI Infra team. Its approach involves utilizing a small drafter to propose tokens that are subsequently verified by the target model in a single pass, ensuring lossless output. Traditional drafter designs generally retain their own KV cache, but DFly2 optimizes performance by sharing the target model’s sparse KV cache.

Functionality and Mechanism

DFly2 operates by pairing each draft layer with a sparse attention layer in the target model, sharing two key elements:

  • KV Sharing: The draft layer reads from the paired target layer’s latent KV cache.
  • Index Sharing: Draft layers only attend to positions selected by the target’s indexer (top-k sparse KV).

Each draft layer begins from the weights of its paired target layer, and relevant hidden states are integrated into the draft block. This mechanism allows DFly2 to limit memory consumption while maintaining efficiency across various context lengths, enabling it to draft without the need for prefilling, as the transfer adds only one last-layer hidden state.

Performance Benchmarks

DFly2 has demonstrated superior performance metrics compared to other systems. Compared to DSpark and DFlash, it achieved the following:

  • Up to 81% more throughput on DeepSeek-V4.1-Flash with matched per-user speed.
  • A margin of 3.9% to 10.5% improvement on general workloads and 10.0% to 31.5% on more complex, long-context scenarios.
  • An average accepted length (τ) of 4.12 tokens on DeepSeek-V4.1-Flash, outpacing both DFlash and DSpark.

Deployment and Training

DFly2 is packaged within Tencent’s Hy4 flash, operating under NVIDIA H20 GPUs and serving through vLLM. Users can deploy it using the dfly method via specified container images. For those looking to train DFly2 for their sparse models, the AngelSpec repository provides the necessary tools, with a straightforward setup typically requiring a single node equipped with eight GPUs.

Conclusion

By leveraging shared resources, DFly2 effectively eliminates the need for additional draft KV memory, enhancing performance on various benchmarks. It is optimized for high-throughput tasks within sparse model frameworks, making it a valuable addition for developers and researchers in AI.

Source: www.marktechpost.com

Related Articles

OpenAI has initiated a lawsuit against Apple, claiming trade secret theft and engaging in unfair business practices. The legal action...
Introduction Wearable technology has gained traction as a tool to monitor personal health and fitness, yet it raises questions about the...
Nvidia has recently instructed its manufacturing partners to temporarily halt shipments of server chips to several Southeast Asian countries, including...