DFly2: Turbocharging Long-Context Speculative Decoding by Sharing the Target's Sparsity
Organizations: Tencent Inc.
Abstract
To avoid the quadratic cost of dense attention over long contexts, models such as DeepSeek-V4 and Hy4 have turned natively sparse, and speculative decoding, which matters most where decoding is slowest, increasingly runs on them. Their drafters, however, still keep a context cache of their own, over the whole prompt or a sliding window. Beyond memory, such a cache costs prefill time, prefix-cache hits and decode concurrency. Drafters that read the target's cache avoid one of their own, but settle only which cache, not which positions, and still read everything or a recent window. Neither rule is made for the query at hand, and computing a selection per query in the drafter would cost more as the context grows. Yet a natively sparse target already picks positions for each query, over a cache it keeps anyway. Both of the drafter's choices are therefore already made, and paid for, by the target: its cache and its selection. We measure how far one selection carries: made a step early, it still covers close to nine tenths of what each later token selects on DS-V4.1-Flash. We present DFly2, a block-parallel drafter that shares the target's sparsity. Each draft layer reads the KV its paired target layer cached (KV sharing), at the positions that layer's indexer selected, a fixed number anywhere in the context (Index sharing). DFly2 thus runs no scoring pass and keeps no cache of its own. On DS-V4.1-Flash, GLM-5.3-Flash and Hy4~flash, whose sparse attention and architecture differ, it accepts more tokens per step than DFlash and DSpark trained on the same recipe, over general, long-context and agentic benchmarks. Its margin over the stronger baseline widens from 3.9%-10.5% on general workloads to 10.0%-31.5% on long-context and agentic ones. At high concurrency on DS-V4.1-Flash, at matched per-user decode speed, its throughput is 62% and 81% higher on two 64K sets.
Figures & tables
| Route | Context enters as | Drafter’s own context KV |
| Input conditioning (MTP, EAGLE) | target hidden states at the input | every position |
| KV injection (DFlash, DSpark) | in every layer’s K/V | every position |
| Reading the target’s cache (GliDe) | the target’s stored K/V, read in place | none |
| Target | Target KV | Drafter’s own cache | Increase |
| DS-V4.1-Flash | 4.4 KiB | 3.4 KiB | 1.76 |
| GLM-5.3-Flash | 11.7 KiB | 3.0 KiB | 1.26 |
| Hy4 flash | 17.2 KiB | 3.4 KiB | 1.20 |
| Drafter’s own cache | |||
| Full | Window | KV sharing | |
| Drafter needed at prefill | yes, for all positions | yes, for the last | no |
| Target’s prefix-cache hits | fewer and shorter | can be cut short † | unaffected |
| Decode concurrency at 32K | 1.00 | 1.71–1.73 | 1.73 |
| Reach at 32K | whole context | last (0.4–1.6%) | whole context |
| Target | Paired layers | Top- | Near window | Positions per step |
| DS-V4.1-Flash | 512 | 128 | 646 | |
| GLM-5.3-Flash | 512 pools of four | – | 2,054 | |
| Hy4 flash | 2,048 | – | 2,054 |
| Data type | Mix | Samples | Tokens | Median len. | Think |
| Math (advanced) | 19.2% | 190,000 | 2.90B | 13,982 | 98.6% |
| Code (competitive) | 11.1% | 110,000 | 1.96B | 18,175 | 94.7% |
| Code (engineering) | 9.6% | 95,479 | 0.56B | 4,064 | 46.9% |
| Knowledge & STEM | 15.2% | 150,000 | 0.48B | 2,075 | 51.3% |
| Instruction following | 7.1% | 70,000 | 0.47B | 5,751 | 85.7% |
| Code (function-level) | 11.1% | 110,000 | 0.41B | 686 | 37.9% |
| Math | Code | Chat | Overall | ||||||
| Target | Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
| DS-V4.1-Flash | DFlash | 3.95/3.64 | 3.93/3.42 | 3.54/2.97 | 3.82/3.63 | 4.25/3.99 | 3.34/2.80 | 2.70/2.51 | 3.65/3.28 |
| DFlash † | 3.94/3.59 | 3.91/3.40 | 3.51/2.94 | 3.81/3.58 | 4.08/3.82 | 3.26/2.77 | 2.68/2.53 | 3.60/3.23 | |
| DSpark | 4.24 / 4.00 | 4.18 / 3.74 | 3.69 / 3.24 | 4.00 / 3.83 | 4.27 / 4.07 | 3.44 / 3.04 | 2.82 / 2.67 | 3.81 / 3.51 | |
| [3pt][3pt] | DFly2 | 4.62 / 4.45 | 4.43 / 4.10 | 4.01 / 3.60 | 4.28 / 4.17 | 4.70 / 4.56 | 3.76 / 3.38 | 3.03 / 2.91 | 4.12 / 3.88 |
| GLM-5.3-Flash | DFlash | 3.93/3.65 | 3.73/3.29 | 3.25/2.77 | 3.76/3.38 | 3.84/3.44 | 2.91/2.64 | 2.58/2.34 | 3.43/3.07 |
| Long context | Agentic | Group average | ||||||||
| Target | Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long | Agen. |
| DS-V4.1-Flash | DFlash | 2.98 / 2.55 | 3.81 / 3.13 | 3.42 /2.96 | 4.38 / 4.13 | 2.84/2.60 | 3.40 / 3.11 | 3.58 / 3.14 | 3.40 / 2.88 | 3.55 / 3.25 |
| DFlash † | 2.74/2.40 | 3.43/2.86 | 3.15/2.77 | 3.78/3.62 | 2.80/2.52 | 3.21/2.98 | 3.19/2.80 | 3.11/2.68 | 3.24/2.98 | |
| DSpark | 2.82/2.48 | 3.58/2.92 | 3.29/ 2.98 | 3.87/3.59 | 2.85 / 2.65 | 3.33/3.09 | 3.35/2.99 | 3.23/2.79 | 3.35/3.08 | |
| [3pt][3pt] | DFly2 | 3.12 / 2.81 | 4.14 / 3.59 | 3.97 / 3.55 | 5.10 / 4.72 | 3.36 / 3.13 | 3.77 / 3.55 | 4.02 / 3.60 | 3.74 / 3.32 | 4.06 / 3.75 |
| GLM-5.3-Flash | DFlash | 2.55/2.17 | 3.12/2.48 | 2.92/2.64 | 3.12/1.92 | 2.79 /2.50 | 2.99/2.75 | 2.91/2.60 | 2.86/2.43 | 2.95/2.44 |
| Math | Code | Chat | Overall | ||||||
| Target | Drafter | GSM8K | MATH | AIME25 | MBPP | HumanEval | LCB | MT-Bench | Avg. |
| DS-V4.1-Flash | DFlash | 3.23/2.87 | 3.26 / 3.14 | 2.86 /2.73 | 3.11 / 3.04 | 3.41 / 3.29 | 2.67 / 2.54 | 2.21 / 2.16 | 2.96 / 2.82 |
| DFlash † | 3.21/2.83 | 3.19/3.06 | 2.75/2.71 | 3.09/3.02 | 3.28/3.17 | 2.62/2.49 | 2.19/2.14 | 2.91/2.77 | |
| DSpark | 3.30 / 2.91 | 3.24/3.11 | 2.80/ 2.76 | 3.09/3.02 | 3.31/3.18 | 2.63/2.52 | 2.15/2.11 | 2.93/2.80 | |
| [3pt][3pt] | DFly2 | 3.56 / 3.09 | 3.42 / 3.27 | 3.03 / 2.98 | 3.28 / 3.20 | 3.57 / 3.36 | 2.87 / 2.74 | 2.27 / 2.15 | 3.14 / 2.97 |
| GLM-5.3-Flash | DFlash | 2.69/2.31 | 2.54/2.42 | 2.20/2.17 | 2.57/2.44 | 2.59/2.50 | 1.98/1.89 | 1.79/1.77 | 2.34/2.21 |
| Long context | Agentic | Group average | ||||||||
| Target | Drafter | LongSpec 32K | CodeSpan 64K | LSWE 128K | ALB | MemAgent | BFCL-v3 | SWE 64K | Long | Agen. |
| DS-V4.1-Flash | DFlash | 2.46 /1.75 | 3.05 /1.67 | 2.59 /1.16 | 3.46 /0.69 | 2.22/0.63 | 2.67 /0.78 | 2.79 /1.49 | 2.70 /1.52 | 2.78 /0.90 |
| DFlash † | 2.32/1.70 | 2.70/1.55 | 2.52/1.13 | 3.09/0.83 | 2.25/0.69 | 2.63/0.84 | 2.55/1.47 | 2.51/1.46 | 2.63/0.96 | |
| DSpark | 2.28/ 1.99 | 2.63/ 2.06 | 2.49/ 1.68 | 2.95/ 1.21 | 2.37 / 1.27 | 2.58/ 1.37 | 2.54/ 1.89 | 2.47/ 1.91 | 2.61/ 1.44 | |
| [3pt][3pt] | DFly2 | 2.44 / 2.10 | 3.23 / 2.37 | 2.94 / 1.86 | 3.82 / 1.25 | 2.60 / 1.24 | 2.97 / 1.36 | 3.00 / 2.13 | 2.87 / 2.11 | 3.10 / 1.50 |
| GLM-5.3-Flash | DFlash | 1.70/1.47 | 2.03/1.46 | 1.89/1.28 | 2.15/ 1.09 | 1.83/ 1.01 | 2.02/ 1.16 | 1.88/1.36 | 1.87/1.40 | 1.97/1.15 |
| DS-V4.1-Flash | GLM-5.3-Flash | Hy4 flash | |||||||
| What the drafter reads | Gen. | Long | Agen. | Gen. | Long | Agen. | Gen. | Long | Agen. |
| [3pt][3pt] Full (DFly2) | 3.57 | 3.62 | 3.75 | 3.56 | 3.67 | 3.91 | 3.36 | 3.46 | 3.76 |
| w/o near window | 3.45 | 3.50 | 3.63 | 3.57 | 3.68 | 3.86 | 3.36 | 3.45 | 3.77 |
| w/o the target’s top- | 3.14 | 2.76 | 2.95 | 3.42 | 3.10 | 3.34 | 3.31 | 3.12 | 3.13 |
| w/o sharing (own cache) | 3.46 | 3.34 | 3.37 | 3.46 | 3.18 | 3.43 | 3.32 | 3.14 | 3.17 |
Speculative Decoding
Speculative decoding accelerates generation by drafting multiple tokens and verifying them in parallel with a larger target model.
See all 377 papers