Summary: This article explains how DFly2 speculative decoding speeds up DeepSeek V4.1 Flash, GLM-5.3 Flash, and Hy4 Flash — and how to read and validate the published speedup numbers.
Bottom line: DFly2 is a family of three-layer MoE draft models. Each round, it proposes five candidate tokens in parallel, and the target model verifies them in a single forward pass. What makes it different is that it doesn’t keep a separate draft KV cache that grows with context. Instead, it reads the KV latent vectors already cached by the target model’s sparse attention layers and reuses the sparse indices the target selects. Under the same baseline — H20, vLLM, concurrency 1, greedy decoding — the three target models see decode-only speedups of roughly 2.45×–3.41× (group mean). End-to-end speedup, however, drops as input length grows: long-context and agent tasks get only 1.22×–2.12×. The main reason for the gap is prefill on long inputs. GLM on MemoryAgentBench is a perfect example: 2.20× decode-only, but just 0.98× end-to-end.
Deployment is a separate story. Three standalone B6 draft checkpoints have been released, but their vLLM support is still marked as in progress. The only option with an official deployment recipe right now is the built-in draft head that comes with the Hy4 Flash main model. The product entry points each vendor has announced only show that the target model is available; they don’t prove that the standalone B6 is live.

Knowledge Map: How the DFly2 Speculative Decoding Components Relate

Figure caption: The top half of the map covers “how acceleration works.” The draft proposes candidates, the target verifies them, and the two sharing links explain why the draft barely adds cache overhead. The bottom half covers “how much faster, and how it’s measured.” Acceptance length, pure decode, and end-to-end are three different measures; prefill determines how much of the end-to-end speedup is retained. The three cards at the bottom are parallel examples showing how the same mechanism is implemented across three targets.
Index: Reading Order for the DFly2 Article
- Section 1: Mechanism: First, it clearly explains drafting, verification, and the two types of sharing. All the numbers later in the article build on the definitions established in this section.
- Section 2: Three Target-Model Adaptations: Explains which layers each target model is paired with and how many past positions it can read. The three subsections are parallel and can be consulted as needed.
- Section 3: Same-Baseline Quantification: Explains the test conditions, then examines the gap between pure decoding and end-to-end results, and uses GLM’s 0.98× to account for prefill.
- Section 4: Deployment and Speed Testing: Lists how deployable each model is today, then provides a code snippet for measuring three types of speed so you can verify it yourself.
To Know: DFly2 Speculative Decoding Terms
| Term | Brief explanation |
|---|---|
| Speculative decoding | A small model guesses several tokens first, the Large Language Model verifies them in one pass, and accepted guesses are taken directly, reducing the number of token-by-token forward passes by the Large Language Model |
| Target model | The Large Language Model actually responsible for output quality; in this article, DeepSeek V4.1 Flash, GLM-5.3 Flash, and Hy4 Flash |
| Draft model (B6) | The independent draft weights released by DFly2: three MoE layers, with 128 routed experts per layer. It must be used together with the corresponding target model |
| Anchor | The starting point of each drafting round — the last position already confirmed by the target model |
| Average accepted length | The average number of tokens advanced per round, including the one extra token generated by the target model |
| Native sparse attention | The target model’s attention layers read only the subset of past positions selected by the indexer, rather than the full history |
| Prefill | The stage that processes the input prompt; the draft model provides essentially no speedup at this stage |
| TP / DP / EP | Tensor parallelism / data parallelism / expert parallelism; describes how a model is split across multiple GPUs |
1 How DFly2 Speculative Decoding Works
1.1 DFly2’s Draft–Verify–Bonus Token Loop
In each round, DFly2 starts from an anchor the target model has already confirmed and proposes five candidate tokens in parallel. The target model performs one forward pass, checks the prefix formed by these five candidates position by position, accepts the parts that satisfy the rules, and then generates one extra token. So even if all five candidates are rejected, the round still advances at least one token, which means it won’t advance content more slowly than decoding without a draft.
There are two acceptance rules. In greedy decoding, the target model decides each position itself; the draft is only “guessing” what the target will choose. In stochastic sampling, the verification rule guarantees the final output matches the distribution the target would produce if it sampled on its own. In other words, the draft model affects speed, not the standard for output quality.
Average acceptance length is the most commonly misunderstood number. In the paper, the average acceptance length for the DeepSeek agent group is 4.06. That means each round advances about 4 tokens on average (including the bonus token), not that it’s a 4.06x speedup. Actual time per token also has to include the drafting overhead and the cost of one target verification forward pass.
1.2 DFly2’s KV Sharing and Index Sharing
All three target models use native sparse attention, which is a prerequisite for DFly2’s design. Each draft layer is paired with a specific sparse layer in the target and directly reads the KV latent vectors already cached at that layer. This is KV sharing. At the same time, the draft reuses the sparse indices the target picked in the previous round for “the position before the anchor.” This is index sharing.
This produces three direct results:
- The cache barely grows: the draft doesn’t need a separate KV cache that grows with context length, and the target’s prefix cache can be used directly by the draft.
- It can see far-away information: the five candidates share the same set of historical positions, so the read range can cover relevant content at long distances, while read volume stays within the target layer’s budget.
- It retains learning ability: the draft doesn’t run its own indexer, but it keeps its trainable projection, so it can still learn how to use this shared information.
1.3 DFly2’s Three Speed Metrics
When reading DFly2’s numbers, you need to distinguish three kinds of speed. Pure decoding speed looks only at the generation phase, which is the part speculative decoding directly affects. End-to-end speed includes prefill and decode, and is the time users actually wait. Time to first token (TTFT) is almost entirely determined by prefill; speculative decoding helps it only in a limited way. Average acceptance length isn’t a speed metric at all. It only reflects how accurately the draft guesses.
2 Adapting DFly2 to the Three Flash Models
2.1 DFly2 for DeepSeek V4.1 Flash
The standalone weights live at AngelSlim/DS-V4.1-Flash-DFly2-B6: the expert portion uses FP4, while the rest of the main body stays BF16. The three draft layers pair with target layers 28, 32, and 36 respectively, each reusing 512 historical positions — and the indexer in each of the three paired layers is different.
DeepSeek’s adaptation adds a separately maintained neighbor window: the most recent 128 positions, plus 6 positions inside the block, for a maximum of 646 positions. Ablation runs show that removing the neighbor window drops acceptance length by roughly 3% in all three groups — general, long-context, and agent. What that tells us is that for DeepSeek, the distant positions picked out by the sparse index still can’t fully cover the immediately adjacent context.
2.2 DFly2 for GLM-5.3 Flash
The standalone weights live at AngelSlim/GLM-5.3-Flash-DFly2-B6, with the main body in BF16. GLM-5.3 Flash’s 45 layers mix linear attention and sparse attention, and only 11 of them are sparse layers. DFly2 can only attach to sparse layers, so the later layers 35, 39, and 43 were chosen.
GLM’s index groups every 4 adjacent positions into one unit, and each layer reuses 512 units — 2,048 historical positions — plus 6 positions inside the block, for 2,054 total. Neighbor positions are already part of the selectable history, so there’s no need for a separately maintained window the way DeepSeek requires.
2.3 DFly2 for Hy4 Flash
The standalone weights live at AngelSlim/Hy4-flash-DFly2-B6, BF16, with the three layers paired to target layers 33, 37, and 41. Hy4 uses a two-level compressed index, capped at 2,048 historical positions per layer (2,054 with the extra 6), and neighbors are likewise selectable.
Hy4 Flash differs from the other two in one key respect: the main model ships with a built-in draft of five layers and roughly 850M parameters. The vLLM and SGLang deployment recipes in the Tencent repo target that built-in head, not the standalone B6.
| Target model | Standalone B6 weight precision | Paired target layers | Historical positions per layer | Neighbor handling | Max total positions |
|---|---|---|---|---|---|
| DeepSeek V4.1 Flash | Experts FP4, rest BF16 | 28 / 32 / 36 | 512 | Separately maintains the most recent 128 | 646 |
| GLM-5.3 Flash | Main body BF16 | 35 / 39 / 43 | 512 units × 4 = 2,048 | Already within selectable history | 2,054 |
| Hy4 Flash | BF16 | 33 / 37 / 41 | Two-level compression, max 2,048 | Already within selectable history | 2,054 |
Table note: all three B6 checkpoints are three-layer MoE with 128 routed experts per layer, released under Apache-2.0; each target model carries its own separate license. The position counts are read ceilings — they don’t mean every position is actually read each time.
3 How to Read DFly2’s Same-Baseline Quantitative Results
3.1 DFly2 Test Conditions and Comparison Denominator
The paper compares DFly2 with DFlash, window-limited DFlash, and DSpark under the same protocol. All draft models are three-layer MoE, with parameter counts within 2% of each other, a 32K training sequence, and each proposes five candidates.
| Item | Setting |
|---|---|
| Hardware and framework | H20, vLLM (experimental branch) |
| Request mode | Single request, concurrency 1, greedy, thinking disabled, output cap 2,048 |
| Parallelism | DeepSeek and GLM use TP8 for both prefill and decode; Hy4 is a single TP8 instance |
| Task groups | 7 general, 3 long-context, 4 agent; group averages |
| 1× denominator | Each target model with no draft enabled, token-by-token generation |
The last row means the numbers below can only be read vertically. Each multiplier’s denominator is that target model’s own baseline speed, so Hy4’s 3.34× being higher than DeepSeek’s 3.14× does not mean Hy4 is absolutely faster.
3.2 DFly2: Pure Decoding vs End-to-End Speedup

Figure note: Within the same target, the gap between pure decoding and end-to-end widens as the input gets longer. Data comes from the same-baseline experiments in the DFly2 paper. If you want to re-measure the target model on your own production prompts, see the speed-test script in Section 4.2 and collect the three types of latency through the OpenAI-compatible interface at APIYI apiyi.com.
| Target model | General: decode / end-to-end | Long context: decode / end-to-end | Agent: decode / end-to-end | Average acceptance length (DFly2) | Average acceptance length (DSpark) |
|---|---|---|---|---|---|
| DeepSeek V4.1 Flash | 3.14× / 2.97× | 2.87× / 2.11× | 3.10× / 1.50× | 4.12 / 3.74 / 4.06 | 3.81 / 3.23 / 3.35 |
| GLM-5.3 Flash | 2.50× / 2.36× | 2.45× / 1.64× | 2.61× / 1.22× | 3.96 / 3.85 / 4.03 | 3.68 / 3.05 / 3.10 |
| Hy4 Flash | 3.34× / 3.19× | 3.06× / 2.12× | 3.41× / 1.67× | 3.96 / 3.63 / 4.11 | 3.81 / 3.20 / 3.16 |
Table note: The three acceptance-length numbers correspond, in order, to the general, long-context, and agent groups. Multipliers use each target with draft disabled as 1×.
Two consistent patterns jump out from this table. First, across all three targets, DFly2’s average acceptance length beats DSpark in every group, and the gap is wider in the long-context and agent groups — which lines up with the long-distance retrieval capability we talked about in Section 1.2. Second, general tasks have short inputs, so end-to-end and pure decoding aren’t far apart; but by the agent group, end-to-end speedup is typically only about half of pure decoding.
3.3 DFly2 on GLM-5.3 Flash: 2.20× and 0.98×
The most revealing data point is GLM’s result on MemoryAgentBench: 2.20× for pure decoding, 0.98× end-to-end. The generation phase really is more than twice as fast, but these tasks have extremely long inputs and relatively short outputs, so almost all the time is spent on prefill. Speculative decoding doesn’t touch prefill, so the time saved on decoding gets washed out — and once you add the small overhead of the draft itself, total latency ends up slightly higher than the baseline.
Hy4 on AgentLongBench shows the same pattern: 4.55× for pure decoding, only 1.35× end-to-end. So before deciding whether DFly2 is worth turning on, look at your workload’s input-to-output ratio. Generation tasks with long outputs and moderate inputs see the biggest gains; for “read a lot, write a little” scenarios like long-document QA and long-memory agents, you should optimize prefill as well — with prefix caching, for example. And because the DFly2 draft can directly reuse the target’s prefix cache, the two techniques stack.
3.4 Acceptance Length for DFly2 Under Random Sampling
After switching to random sampling (temperature 1 for DeepSeek and GLM, 0.9 for Hy4), the three agent suites averaged acceptance lengths of 3.75, 3.68, and 3.88, compared with 3.08, 2.99, and 2.95 for DSpark. Under random sampling the draft is harder to guess right, so acceptance length drops across the board — but DFly2’s lead over DSpark still holds. The paper only reports acceptance length here, not the corresponding speed, so you can’t use these numbers to estimate the speedup under sampling.
3.5 DFly2 Throughput Under High Concurrency
Figure 7 of the paper benchmarks only DeepSeek, against DSpark, with the configuration DP8, TP1, EP8, and greedy decoding. While keeping per-user decode speed the same, end-to-end throughput across three workloads — short text, CodeSpan 64K, and SWE 64K — improves by 28%, 62%, and 81% respectively. At a fixed total throughput, per-user decode speed is 15%, 23%, and 24% faster respectively. The short-text workload is measured at a prefill:decode ratio of 1:1 with 1–128 concurrent requests, while the two 64K workloads use an 8:1 ratio with 1–32 concurrent requests.
Long contexts benefit more, which has to do with cache footprint. When the entire draft cache is stored separately, the per-token cache comes out to roughly: DeepSeek 4.4 KiB plus another 3.4 KiB, GLM 11.7 KiB plus another 3.0 KiB, Hy4 17.2 KiB plus another 3.4 KiB. From this, the paper estimates that in a 32K cache pool, DeepSeek’s shared scheme can accommodate about 1.73× the number of requests of the separate-storage scheme. Keep in mind that this is a theoretical estimate of the cache ceiling — it’s a separate matter from the measured throughput above, and the two can’t be converted directly into each other.
4 DFly2 Deployment Status and Hands-On API Speed Testing
4.1 How Deployable the Three DFly2 Targets Actually Are
| Item | DeepSeek V4.1 Flash | GLM-5.3 Flash | Hy4 Flash |
|---|---|---|---|
| Standalone B6 weights | Released | Released | Released |
| vLLM support for standalone B6 | In progress; benchmarked in the paper with an experimental vLLM build | In progress | In progress |
| Official deployment recipe | Not found | Not found | Yes, for the built-in five-layer draft |
| Recipe example | — | — | Hy4-flash-FP8, TP8; vLLM with dfly and five candidates; SGLang with DFLY and block size 6 |
| Public entry points for target models | WorkBuddy, CodeBuddy, OpenCode, etc. | Announced on the official blog | TokenHub, WorkBuddy, Fireworks, etc. |
Table note: “Public entry points for target models” only means the target models are available — it doesn’t mean those services are using the standalone B6 draft. Tencent’s announcement says Hy4 exceeds 150 tok/s in overall speed when megakernel, 4-bit quantization, and DFly work together, and that’s the combined result of several optimizations.
If you want to self-host a deployment right now, Hy4 Flash’s built-in draft is the only route with a complete official recipe. For specific parameters, go by Tencent’s repository and the vLLM and SGLang recipe pages. DeepSeek’s and GLM’s B6 will have to wait until the inference frameworks officially merge support, or you’ll need to maintain experimental branches yourself.
4.2 Testing All Three Speed Metrics with an OpenAI-Compatible API
Whether or not the inference server has speculative decoding enabled, you can still measure time to first token, generation speed, and total latency from the caller side — which is exactly how you verify the three metrics described in Section 1.3. The script below uses streaming output. Swap in a target model ID that’s actually available in your console’s model list; this article doesn’t assume any platform already serves DFly2 drafts.
import time
import openai
client = openai.OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.apiyi.com/v1"
)
start = time.perf_counter()
first = None
stream = client.chat.completions.create(
model="your-target-model", # Replace with the actual ID from the model list
messages=[{"role": "user", "content": "用 300 字解释投机解码"}],
temperature=0, max_tokens=2048, stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if first is None and chunk.choices and chunk.choices[0].delta.content:
first = time.perf_counter()
if chunk.usage:
out_tokens = chunk.usage.completion_tokens
end = time.perf_counter()
print(f"首字延迟 {first-start:.2f}s, 生成速度 {out_tokens/(end-first):.1f} tok/s, 总耗时 {end-start:.2f}s")
View the full benchmark code (median over multiple runs, short vs. long input)
import time
import statistics
import openai
client = openai.OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.apiyi.com/v1"
)
def measure_once(model: str, prompt: str, max_tokens: int = 2048) -> dict:
"""Run one streaming request; return TTFT, decode speed, and end-to-end latency"""
start = time.perf_counter()
first = None
out_tokens = 0
stream = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
temperature=0, # Greedy sampling, matching the paper's single-request setup
max_tokens=max_tokens, # Matches the paper's output cap
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if first is None and chunk.choices and chunk.choices[0].delta.content:
first = time.perf_counter()
if chunk.usage:
out_tokens = chunk.usage.completion_tokens
end = time.perf_counter()
decode_time = max(end - (first or end), 1e-6)
return {
"ttft": (first or end) - start,
"decode_tps": out_tokens / decode_time,
"e2e": end - start,
"out_tokens": out_tokens,
}
def benchmark(model: str, prompt: str, runs: int = 5) -> dict:
"""Run several rounds sequentially (concurrency 1) and take the median to smooth out network jitter"""
results = [measure_once(model, prompt) for _ in range(runs)]
return {k: statistics.median(r[k] for r in results) for k in results[0]}
if __name__ == "__main__":
model = "your-target-model" # Replace with the actual model ID
short_prompt = "写一个 Python 快速排序并逐行解释。"
long_prompt = ("以下是一份长文档:\n" + "示例段落内容。" * 4000
+ "\n请用三句话总结。")
for name, p in [("短输入", short_prompt), ("长输入", long_prompt)]:
r = benchmark(model, p)
print(f"[{name}] 首字延迟 {r['ttft']:.2f}s | "
f"生成速度 {r['decode_tps']:.1f} tok/s | "
f"总耗时 {r['e2e']:.2f}s | 输出 {r['out_tokens']} tokens")
Tip: Register at APIYI (apiyi.com) and you’ll get free test credits. Run the script above against several models with the same API key, then compare the ratio of time-to-first-token to total latency for short versus long inputs — you’ll get a direct, intuitive look at how prefill affects end-to-end speed.
Generation speed measured on the client side includes network transmission and server-side scheduling. It isn’t measured the same way as the pure decode speed reported in the paper, which was measured directly on H20. This metric is useful for relative comparisons on your own business prompts—for example, different input lengths for the same model, or different models during the same time window. It isn’t suitable for verifying the speedup multiples claimed in the paper.
4.3 How to Validate DFly2 Before Deployment
To determine whether DFly2 can deliver real benefits for you, check the following in order:
- Confirm the target and draft are paired correctly: B6 is a standalone weight set and can only be used with its corresponding target. If you change the target, you must also change the draft.
- Confirm framework support: standalone B6 still relies on vLLM support that is currently in progress; the Hy4 built-in draft has an official recipe.
- Measure the input/output ratio: use the script from Section 4.2 to test real business prompts. If time to first token accounts for most of the total latency, the end-to-end speedup will be notably lower than the pure decode speedup.
- Measure sampling settings: when the business uses random sampling, acceptance length drops, so you need to measure actual speed rather than relying on greedy decoding data.
- Measure concurrent load: benefits in high-concurrency, long-context scenarios come from cache sharing, so you need to measure throughput within your target concurrency range.
Before DFly2 is adopted by more inference services, what callers can do is first measure the three speed metrics for the target model itself. With APIYI’s OpenAI-compatible API at apiyi.com, you can switch models for comparison without changing your code structure. Once speculative decoding is enabled on the server side, you can retest to see the real speedup.
FAQ: Common Questions
Q1: What is DFly2?
DFly2 is a draft model for speculative decoding. Each round, it proposes five candidate tokens in parallel, and the target model verifies them in a single forward pass. It reads the KV latent vectors from the target’s sparse attention layers directly and reuses their sparse indices, so there’s no need to keep a separate draft cache that grows with the context.
Q2: How is DFly2 different from DSpark and DFlash?
They’re all 3-layer MoE models, within 2% of each other in parameter count, and all propose five candidates. DFly2’s difference is that it reuses the target’s KV and indices, and it can see far back into the history. On the same baseline, DFly2’s average acceptance length across all three targets is higher than DSpark’s, and the gap widens on long-context and agentic sets.
Q3: An acceptance length of around 4 means a 4× speedup, right?
No. The acceptance length includes the 1 extra token the target generates, so it only means about 4 tokens advance per round. Real speed also has to account for drafting and verification overhead — which is why DeepSeek’s agentic set shows an acceptance of 4.06 and 3.10× on pure decoding, but only 1.50× end-to-end.
Q4: Why does GLM-5.3 Flash come out at 0.98× end-to-end?
MemoryAgentBench inputs are extremely long, and most of the time goes into prefill. Speculative decoding only speeds up the decode phase, so even at 2.20× for pure decoding, the time saved is too small a share of the total — and once you add draft overhead, the total ends up slightly above baseline. Long-input scenarios should be paired with prefill optimizations such as prefix caching.
Q5: Can I use DFly2 through an API right now?
There’s no public evidence yet that APIYI has listed a DFly2 draft, and the entry points vendors have published only state that the target models are available. You can start by calling an already-listed target model through APIYI apiyi.com using the OpenAI-compatible interface, record your baseline speed with the script in Section 4.2, and then re-test and compare once speculative decoding is enabled server-side.
Q6: What are DFly2’s current limitations?
– vLLM support for three independent B6s is still in progress; only Hy4’s built-in draft has an official recipe.
– The published multipliers were only measured on H20, at concurrency 1, under greedy conditions; for random sampling, only acceptance length data is available.
– High-concurrency data only covers DeepSeek.
If you want to evaluate how a target model performs on your own workload first, you can run a small-scale speed test with free credits on APIYI apiyi.com.
References
-
DFly2 paper: mechanisms, same-baseline experiments, and high-concurrency data
- Link:
arxiv.org/html/2611.34776v1 - Notes: Sections 3.1, 4, 5.1, 5.3, and 5.4 correspond to Sections 1 and 3 of this article
- Link:
-
AngelSpec repository: the list of models released for DFly2
- Link:
github.com/Tencent/AngelSpec - Notes: check the release status of the three B6 weights
- Link:
-
DeepSeek V4.1 Flash B6 weight card: adaptation details and high-concurrency throughput evaluation
- Link:
huggingface.co/AngelSlim/DS-V4.1-Flash-DFly2-B6
- Link:
-
GLM-5.3 Flash B6 weight card and official blog
- Links:
huggingface.co/AngelSlim/GLM-5.3-Flash-DFly2-B6,z.ai/blog/glm-5.3-flash
- Links:
-
Hy4 Flash B6 weight card and deployment recipes
- Links:
huggingface.co/AngelSlim/Hy4-flash-DFly2-B6,github.com/Tencent-Hunyuan/Hy4-flash - Recipes:
recipes.vllm.ai/tencent/Hy4-flash,docs.sglang.io/cookbook/autoregressive/Tencent/Hy4-flash
- Links:
-
Product launch announcements: Tencent Hy4 Flash release, TokenHub billing, DeepSeek news, and the Fireworks announcement
- Links:
tencent.com,cloud.tencent.com/document/product/1823/130055,api-docs.deepseek.com/news/news260910,fireworks.ai/blog/hy4-flash-on-fireworks
- Links:
Author: APIYI Technical Team
Technical discussion: You’re welcome to reach us via the APIYI apiyi.com homepage. For more integration resources, visit the docs.apiyi.com documentation center.