Model NewsTopic: AI Models →

DFly2: Speculative decoding for sparse LLMs

Tencent's DFly2 reuses target model KV cache in speculative decoding, eliminating drafter memory overhead and achieving up to 81% higher throughput on long-context tasks.

Headline card: DFly2: Speculative decoding for sparse LLMs
On this page
  1. What changed
  2. Why it matters
  3. What to test
  4. Common questions
  5. The conclusion
  6. Related reading

What changed

Tencent has open-sourced DFly2, a speculative decoding drafter designed specifically for natively sparse language models. The system appears in a research paper submitted to arXiv and ships as part of Tencent’s Hy4-flash model, a 220-billion-parameter mixture-of-experts system with approximately 12 billion active parameters and one million token context window.

DFly2’s core design eliminates the separate key-value cache that conventional drafters maintain. Instead, the drafter reads the KV cache already computed by the target model’s sparse attention layers. This shared index approach means the drafter attends only to positions the target’s indexer has already selected. Tencent’s research found that an attention selection made one step early covers close to 90 percent of what subsequent tokens select on DeepSeek-V4.1-Flash, making this approximation practical.

The drafter is a block-parallel design with 0.85 billion parameters and five layers. Each draft layer pairs with one sparse attention layer in the target model. This architecture allows the drafter to skip prefill computation entirely, transferring only the target’s last-layer hidden state from the prefill phase to the decode phase.

DFly2 targets models including DeepSeek-V4.1-Flash, GLM-5.3-Flash, and Hy4-flash. Tencent’s tests ran on NVIDIA H20 GPUs using vLLM with tensor parallelism of 8 per instance. Deployment support exists through vLLM via the official container and through SGLang. Teams training custom DFly2 drafters for other sparse models can use the AngelSpec framework, which requires one node with eight GPUs (four for inference, four for training).

Why it matters

Speculative decoding accelerates language model inference by using a small drafter to propose tokens that a target model verifies. However, traditional drafters maintain their own KV cache, which consumes GPU memory that could otherwise serve more concurrent users. For long-context and agentic workloads where individual requests already occupy significant memory, this memory overhead directly reduces concurrency.

By eliminating the drafter’s separate cache, DFly2 recovers GPU memory for concurrent requests. At 32K token context length, removing the drafter cache allows the same memory pool to hold 1.73 times as many concurrent requests compared to conventional approaches.

The throughput improvements demonstrate the practical value of this change. On DeepSeek-V4.1-Flash at 64K context, DFly2 delivered 81 percent higher throughput than DSpark on code retrieval tasks when both maintained matched per-user decode speed. On the same model, CodeSpan benchmarks showed 62 percent higher throughput. These gains matter because production serving systems measure cost per output token and latency per user.

Acceptance rate differences determine how many tokens the drafter can propose before the target verifies them. Higher token acceptance means fewer verification passes and fewer model runs. On long-context and agentic workloads up to 128K tokens, DFly2 achieved 10.0 to 31.5 percent higher average accepted token length than DSpark on the same training configuration. On general workloads, the improvement ranged from 3.9 to 10.5 percent.

For teams already running sparse models, deployment requires minimal friction. If you deploy DeepSeek-V4.1-Flash, GLM-5.3-Flash, or Hy4-flash, DFly2 is available immediately through existing serving frameworks without custom integration beyond selecting the speculative method in vLLM or SGLang.

What to test

Before deploying DFly2 in production, validate these specific claims:

  • Run latency and throughput benchmarks on your target hardware. The reported numbers use Tencent’s specific serving configuration (H20 GPUs, vLLM, tensor parallelism 8). Your setup may produce different results.
  • Test on representative workloads. DFly2 performs best on long-context and agentic tasks, where acceptance improvements reach 10 to 31 percent. General workloads show smaller gains, with the smallest reported improvement at 3.9 percent on Hy4-flash general tasks at temperature 0.
  • Measure end-to-end latency per user, not only aggregate throughput. While throughput increases significantly, individual user experience depends on actual decode latency per request.
  • Measure memory usage directly. The claim that removing the drafter cache enables 1.73x more concurrent requests at 32K context depends on your model’s actual sparse attention implementation and KV size.
  • Verify prefill behavior. DFly2 skips prefill entirely and transfers only the last-layer hidden state from prefill to decode. Test whether this assumption holds for your models and task distribution.
  • Benchmark on your specific sparse attention mechanism. DFly2 was tested on three models with different sparse attention implementations, but your model may have unique characteristics.

Common questions

How does DFly2 reuse the target’s attention selections?

DFly2 reuses the target model’s sparse attention indices because they were already computed during the target’s forward pass. Rather than computing its own sparse selection per query, the drafter reads the positions the target’s indexer already selected. The paper found that one selection made a step early still covers close to 90 percent of what later tokens select on DeepSeek-V4.1-Flash, making this approximation practical for most tasks.

How much memory does sharing the KV cache actually save?

According to the paper, a conventional three-layer drafter cache adds memory per token at 32K context length. By removing the drafter’s cache, the same memory pool can hold 1.73 times as many concurrent requests. The exact savings depend on your drafter size and context length in your deployment.

Does DFly2 work with any sparse model, or only specific ones?

DFly2 was tested on DeepSeek-V4.1-Flash, GLM-5.3-Flash, and Hy4-flash, which have different sparse attention mechanisms and architectures. Teams can train DFly2 for other sparse models using the AngelSpec framework, which requires one node with eight GPUs.

The conclusion

DFly2 addresses a real production constraint: the memory overhead that drafters impose on serving. By sharing the target’s KV cache and sparse attention indices, it recovers memory that matters most when concurrency is tight. The throughput gains on long-context and agentic tasks justify evaluation, particularly for systems serving tasks where context length is high and concurrency limits are constrained.

The smallest improvement reported is 3.9 percent on general tasks with Hy4-flash at temperature 0, indicating that general chat workloads may see modest benefit. Long-context and agentic workloads are where DFly2’s advantage widens to 10 to 31 percent. Test on your own traffic pattern before committing to production deployment.

Deployment friction remains low. If you already run vLLM or SGLang with one of the three tested models, DFly2 is available as a serving option. For custom sparse models, the training path is straightforward but requires GPU resources for the AngelSpec framework.

Watch for two developments: first, how other sparse model teams integrate DFly2 or develop competing approaches. Second, whether the prefill-to-decode transfer of only the last-layer hidden state generalizes across all sparse attention implementations or encounters limitations with certain architectures.

AI Tool Herald may earn a commission from some links on this site. It never changes what we report or recommend. Affiliate disclosure