Skip to content
,

Tencent DFly2: Open-Source Drafter Makes Long-Context LLMs Up to 4.2x Faster (vLLM and SGLang Setup)

9–13 minutes
Woman in a server room holding a tablet with a DFLY2 card, hook 4.2x faster long context

Tencent has open-sourced DFly2, the speculative-decoding drafter built into its Hy4 flash model. Tencent says it speeds up decoding by up to 4.2x on long-context and agent tasks, and it needs no extra KV cache memory.

The weights, training code (in the AngelSpec framework) and a technical report (arXiv 2611.34776) were released around 25-26 November 2026. The paper also tests DFly2 on DeepSeek-V4.1-Flash and GLM-5.3-Flash.

This guide explains how DFly2 works in plain English, every published number (and which ones to trust), the exact vLLM and SGLang commands, the hardware you need and how it compares with DSpark, DFlash, EAGLE-3 and MTP.

TL;DR

  • What: a small draft model (0.85B in Hy4 flash) that guesses several tokens at once, which the big model then checks in one pass.
  • Trick: it reuses the target model’s own sparse KV cache and its top-k token selection, so drafting cost stays flat as context grows.
  • Speed (Tencent-reported): up to 4.2x pure decode speed on a 64K agent benchmark; agent average 3.41x decode and 1.67x end to end.
  • Throughput: 62% and 81% more throughput than the stronger baseline on DeepSeek-V4.1-Flash at high concurrency (paper abstract).
  • Run it: vLLM with "method":"dfly" or SGLang with --speculative-algorithm DFLY, on 8 GPUs (TP8) in Tencent’s examples.
  • Catch: it only works on natively sparse-attention models with a top-k indexer; it is not a drop-in for Llama or Qwen dense models.

What DFly2 Is and Why It Matters

Large language models write one token at a time, and each token needs a full pass through the model. Speculative decoding speeds this up: a tiny “drafter” guesses the next few tokens, and the big model accepts or rejects them in a single pass.

The problem is long context. Most drafters keep their own cache over the whole conversation, so at 64K or 128K tokens they eat memory and slow down. That hurts exactly where agents and coding tools spend their time.

DFly2 attacks that problem head on. If you want the basics first, our speculative decoding in llama.cpp guide explains draft models step by step.

Release timeline

Date (2026) What happened
16 Nov Tencent releases Hy4 flash weights with a built-in DFly2 drafter
18 Nov AngelSpec v0.2.0 adds DFly2 training support
25 Nov Technical report arXiv 2611.34776 submitted
26 Nov Tencent Hy announces DFly2 open-sourcing; coverage follows on 26-27 Nov

How DFly2 Works (Plain English)

Hy4 flash uses sparse attention. For each new token, a small “indexer” picks the most useful past positions (up to about 2,048) instead of reading the whole context.

DFly2 piggybacks on that work. In Tencent’s words, “each draft layer shares the KV cache (KV Share) and the compressed indexer’s selection of up to 2,048 positions (Index Share).”

  • KV Share: the drafter reads the big model’s existing cache, so it adds zero extra KV memory.
  • Index Share: it reuses the big model’s top-k selection, so each draft token attends to at most ~2K keys at any context length.
  • Block-parallel drafting: it proposes a whole block of tokens at once (5 draft tokens in Tencent’s vLLM example).
  • Warm start: each draft layer starts from the weights of a paired target layer, and the paper says DFly2 “runs no scoring pass and keeps no cache of its own.”
  • Serving bonus: in prefill/decode split setups, “the prefill-to-decode transfer adds only one last-layer hidden state.”
Quick answer: DFly2 is fast at long context because it does not build its own memory of the conversation. It borrows the big model’s memory and its choice of what to look at.

Specs at a Glance

Item Detail Source
Drafter size (built into Hy4 flash) 0.85B parameters, 5 layers Hy4 flash model card
Drafter in the paper 3-layer variant arXiv 2611.34776
Target models tested Hy4 flash, DeepSeek-V4.1-Flash, GLM-5.3-Flash Paper abstract
Keys read per draft token About 2,048 at most Model card
Extra KV memory None Model card
Hy4 flash host model 220B total (incl. 64B Engram), 12B active, 1M context Model card
Training framework AngelSpec (github.com/Tencent/AngelSpec) AngelSpec README
Licence Tencent Hy License (model); paper CC BY 4.0 Model card, arXiv

Note: the model card says 5 layers and the paper describes a 3-layer drafter. They appear to be two configurations; the 5-layer, 0.85B version is the one that ships inside Hy4 flash.

Benchmarks: Every Published Number

All numbers below are vendor-reported by Tencent. No independent benchmark existed when this was written.

From the paper abstract

  • General workloads: 3.9% to 10.5% better than the stronger same-recipe baseline.
  • Long-context and agent workloads (up to 128K): 10.0% to 31.5% better.
  • DeepSeek-V4.1-Flash, high concurrency: 62% and 81% more throughput on two 64K test sets, at matched per-user speed.

From Tencent’s launch materials (Hy4 flash)

Benchmark Context Pure decode speedup
AgentLongBench 64K 4.20x (accepted length 5.43)
SWE-bench 64K 3.47x
LongSWE 128K 3.25x
CodeSpan 64K 3.19x
BFCL-v3 – 3.09x
MemoryAgentBench – 2.29x
12 short-text tasks – 2.88x aggregate

Settings reported: greedy decoding, thinking disabled, 5 draft candidates. These are reported as the launch chart figures, as summarised by APIYI.

Pure decode vs end to end

“Pure decode” ignores the time spent reading your prompt. End-to-end speed includes it, and that is what you actually feel.

Hy4 flash, agent tasks (greedy, concurrency 1) Decode speedup End-to-end speedup
DFly2 3.41x 1.67x
DSpark (same recipe) 2.63x 1.55x

Warning: the 4.2x is a peak value. On a 64K agent task the reported end-to-end gain can be as low as 1.35x, because prompt processing dominates. Based on Tencent’s own end-to-end figures, a realistic expectation is roughly 1.4-2.5x in agent use, not 4x.

Memory savings

The paper compares DFly2’s shared cache with a drafter that keeps its own cache. A private-cache drafter would add 1.20x to 1.76x KV memory per token depending on the model; DFly2 adds none.

At 32K context on DeepSeek-V4.1-Flash, KV sharing allowed about 1.73x more concurrent decodes than a full private cache. Reading a fixed budget of keys costs 4-6% of a decode step at any length, versus 14-23% for a full cache at 128K.

How to Run Hy4 flash With DFly2

DFly2 ships inside Hy4 flash, so you enable it with a speculative-decoding flag. Tencent’s examples use the FP8 weights on 8 GPUs with tensor parallelism. For model sizes and memory, see our Hy4 flash open weights guide.

Option 1: vLLM (Docker)

  1. Get the image. Tencent’s card uses vllm/vllm-openai:hy4-flash.
  2. Start the server with DFly2 enabled:
    docker run --gpus all -p 8000:8000 --ipc=host \
      -v ~/.cache/huggingface:/root/.cache/huggingface \
      vllm/vllm-openai:hy4-flash \
      tencent/Hy4-flash-FP8 \
      --tensor-parallel-size 8 \
      --speculative-config '{"num_speculative_tokens":5,"method":"dfly"}' \
      --attention-backend FLASHMLA_SPARSE \
      --tool-call-parser hy_v4 --reasoning-parser hy_v4 \
      --enable-auto-tool-choice --port 8000 \
      --served-model-name hy4-flash
  3. Test it with any OpenAI-compatible client pointed at http://localhost:8000/v1 and model hy4-flash.

Tip: new to vLLM? Our vLLM install guide covers drivers, Docker and the OpenAI SDK.

Option 2: SGLang

Tencent also publishes an SGLang image, lmsysorg/sglang:hy4-flash, for both x86 and Arm. The command from the model card is:

sglang serve --trust-remote-code \
  --model-path tencent/Hy4-flash-FP8 --tp 8 \
  --cuda-graph-backend-prefill disabled \
  --speculative-algorithm DFLY \
  --speculative-dfly-block-size 6 \
  --host 127.0.0.1 --port 8000

The block size of 6 likely means one anchor token plus 5 draft tokens, matching the vLLM setting.

What hardware you need

  • Official examples: 8 GPUs, tensor parallel 8, FP8 weights. No VRAM figure is given on the card.
  • Home PCs: Hy4 flash is a 220B model, so a single consumer GPU cannot run it in vLLM or SGLang.
  • GGUF: community GGUF builds of Hy4 flash exist, but I found no confirmation that llama.cpp supports DFly2 drafting yet.

For a comparison of the three main engines, see vLLM vs llama.cpp vs Ollama.

Training Your Own DFly2 Drafter

AngelSpec is Tencent’s “unified, torch-native training framework for MTP and block-parallel speculative decoding”. It supports seven drafter types: DFly2, DFly, DFlash, DFlare, Eagle3, DSpark and MTP.

  1. Clone and install. Clone github.com/Tencent/AngelSpec, then run pip install -e ".[vllm]" and pip install mooncake-transfer-engine.
  2. Or use conda. Run ./tools/build_conda.sh 1 vllm (or sglang), then micromamba activate angelspec.
  3. Try the example. ./examples/qwen3-8b-dfly/run.sh trains on one node with 8 GPUs (4 for inference, 4 for training).
  4. Hy4 flash recipe. The multi-node from-scratch example lives in examples/hy-v4-flash-dfly2.

Note: the qwen3-8b example trains a DFly-family drafter, but full DFly2 benefits need a sparse-attention target with a top-k indexer. On CUDA 12.x hosts, install wheels that match your CUDA version.

DFly2 vs DSpark, DFlash, EAGLE-3 and MTP

Drafter Own cache? Long-context cost Works on dense models? Notes
DFly2 No (shares target KV + index) Flat (~2K keys per token) No, needs sparse top-k target Up to 31.5% better than same-recipe baseline at long context (paper)
DSpark Yes Grows with context Yes Paper baseline; 2.63x vs DFly2 3.41x decode on Hy4 agent tasks
DFlash Windowed Bounded, but loses quality Yes A 128-512 token window loses 3-12% accepted length on long context (paper)
EAGLE-3 Yes Grows with context Yes Popular general option; no head-to-head in the paper
MTP Yes Grows with context Built into some models No head-to-head in the paper

Tencent’s earlier DSpine drafter targets dense models instead. Our DSpine for Qwen3.8-27B guide is the better pick if you run a dense model on a single 24 GB card.

Troubleshooting

  • vLLM rejects the dfly method: your vLLM build is older than Hy4 flash support. Use the vllm/vllm-openai:hy4-flash image or the vLLM recipe for Hy4 flash.
  • Transformers cannot load the model: the card says Transformers support needs an unmerged pull request (PR 50903) installed from GitHub.
  • No speedup on short prompts: expected. Short-text gains are smaller, and the biggest wins appear at 64K+ context.
  • Lower speedup with thinking on or sampling: most published numbers use greedy decoding with thinking disabled, so random sampling accepts fewer draft tokens.
  • Out of memory at TP8: use the FP8 weights as in the examples, lower max-model-len, or reduce concurrency.

Limits, Licence and Open Questions

  • Sparse models only: dense targets “require architectural and training changes”, so most popular open models cannot use DFly2 today.
  • Vendor numbers: every speedup is Tencent-reported; no independent tests yet.
  • Peak vs typical: 4.2x is the best single result, and end-to-end gains are much smaller.
  • Standalone drafters: some reports say separate DFly2 drafters for DeepSeek-V4.1-Flash and GLM-5.3-Flash were released; I could not confirm this on the AngelSpec model list.
  • Licence: Hy4 flash and its built-in drafter use the Tencent Hy License, which reports say limits very large service providers. Read it before commercial use.

My Take

DFly2 is a clever idea that only makes sense now that sparse-attention models are common. Instead of fighting the long-context memory problem, it simply reuses work the big model already did.

For home users the impact is indirect today, because Hy4 flash needs a multi-GPU server. The bigger story is the direction: if llama.cpp and Ollama adopt shared-KV drafting for sparse models, long agent sessions on local hardware could get much faster.

If you serve Hy4 flash or DeepSeek-V4.1-Flash for agents or coding tools, it is worth switching on. Just measure end-to-end speed on your own workload instead of trusting the 4.2x headline.

FAQ

What is DFly2?

DFly2 is Tencent’s open-source speculative-decoding drafter. It guesses several tokens at once by reusing the target model’s sparse KV cache and top-k selection.

How much faster is it?

Tencent reports up to 4.2x pure decode speed on a 64K agent benchmark and 3.41x on average for agent tasks. End-to-end gains are about 1.35x to 2.5x.

Which models support DFly2?

It is built into Hy4 flash, and the paper tests it on DeepSeek-V4.1-Flash and GLM-5.3-Flash. It needs natively sparse-attention models.

Does DFly2 use more VRAM?

The drafter weights are small (0.85B), and it adds no extra KV cache, because it shares the big model’s cache.

Can I use DFly2 with Ollama or llama.cpp?

Not yet as far as I can find. Today it runs in vLLM and SGLang using Tencent’s Hy4 flash images.

Is DFly2 free for commercial use?

The Hy4 flash model and drafter use the Tencent Hy License, which has conditions for large providers. Check the licence file before shipping a product.

Can I train DFly2 for my own model?

Yes, with Tencent’s AngelSpec framework, but the target must be a sparse-attention model with a top-k indexer for the full benefit.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman in a server room holding a tablet with a DFLY2 card, hook 4.2x faster long context