Full text not available for this paper
Summary of DFly2: Turbocharging Long-Context Speculative Decoding by Sharing the Target's Sparsity
Summary (Overview)
- Core contribution: DFly2 is a block-parallel speculative decoding drafter that shares both the KV cache and the sparse attention selection of its natively sparse target model, eliminating the need for a drafter-owned context cache and scoring pass.
- Key insight: A natively sparse target (e.g., DeepSeek-V4, GLM-5, Hy4) already computes a query-aware position selection for every token via its trained indexers; this selection, made one step early, covers ~90% of what later tokens in a draft block would select, far exceeding a sliding window of the same size.
- Mechanism: Each DFly2 draft layer reads the KV cache of a paired target layer (KV sharing) at the positions that layer's indexer selected (Index sharing), and initializes its weights from that same paired layer.
- Results: DFly2 consistently outperforms DFlash and DSpark baselines (trained on the same recipe) in accepted length and end-to-end speedup across three targets with different sparse attention architectures, with margins growing from 3.9%–10.5% on general workloads to 10.0%–31.5% on long-context and agentic workloads (up to 128K tokens).
- Serving efficiency: On DS-V4.1-Flash at high concurrency with matched per-user decode speed, DFly2 delivers 62% and 81% more throughput on long-context and agentic sets at 64K, plus 28% more on short text.
Introduction and Theoretical Foundation
Background and Motivation
The paper addresses the growing cost of decoding long contexts in large language models. Recent long-context models (DeepSeek-V4, GLM-5, Hy4) have adopted natively sparse attention (e.g., DeepSeek Sparse Attention, DSA), where each layer attends only to a fixed budget of positions selected by a trained indexer. This reduces both compute and KV cache memory. However, speculative decoding drafters—which propose tokens for the target to verify—were designed for dense targets and still maintain their own context caches, creating several inefficiencies.
Key Theoretical Foundations
Speculative decoding latency model: The latency per generated token is
where is the mean accepted length (1 ≤ τ ≤ γ+1), and drafting time splits into
with being the number of context positions the drafter reads.
Sparse attention formulation: In a DSA layer, each query token attends only to a set of positions selected by an indexer:
The Three Costs of a Drafter's Own Cache
- Prefill: The drafter must run on prefill instances, projecting and transferring its cache, delaying first token.
- Prefix caching: The drafter's cache (projected from target hidden states, which prefix caching doesn't keep) must be stored or rebuilt, reducing cache hits.
- Decode concurrency: A full drafter cache adds significantly to per-token KV memory. For a memory pool of bytes, concurrency is where is per-token KV, is context length, and is fixed per-request state.
Methodology
DFly2 Architecture
DFly2 consists of three draft layers, each paired with a target DSA layer. The design has four key components:
1. KV Sharing: Each draft layer reads the target's cached latents directly:
where is the latent cached by target layer at position , and is the set of positions read. The block's own hidden states are compressed and appended:
2. Index Sharing: The read positions come from the target's own selection:
where is the top- selected by layer 's indexer at row (the anchor's preceding token), and is the target's near window before the anchor (if not already covered by top-).
3. Weight Initialization: Each draft layer starts from its paired target layer's weights:
The feed-forward side draws a random subset of the target layer's routed experts:
4. Intra-Block Correction: A sequential correction per slot combines an inherited SwiGLU update with attention reads of the context and the block:
where , and is a per-head gate starting at zero.
Training objective: Single-stage distillation loss with D-PACE weights:
Target-Specific Configurations
| Target | Paired Layers | Top-k | Near Window | Positions/step |
|---|---|---|---|---|
| DS-V4.1-Flash | [28, 32, 36] | 512 | 128 | 646 |
| GLM-5.3-Flash | [35, 39, 43] | 512 pools of four | – | 2,054 |
| Hy4 flash | [33, 37, 41] | 2,048 | – | 2,054 |
Empirical Validation / Results
Key Measurement: Coverage of Shared Selection
The paper measures top-k mass coverage on DS-V4.1-Flash:
- The shared selection (made one step early) achieves 0.873–0.880 coverage vs. only 0.147–0.175 for a window of the same size.
- Coverage declines gradually along the block: the deepest layer's last slot still retains ~0.80 coverage.
- The advantage over a window widens with context length (0.873 → 0.880 as context grows from 16-32K to 64-128K).
Accepted Length Results (τ)
General-purpose benchmarks (Table 6): DFly2 accepts more tokens than both baselines in all cells.
| Target | DSpark Avg. | DFly2 Avg. | Gain |
|---|---|---|---|
| DS-V4.1-Flash | 3.81/3.51 | 4.12/3.88 | +8.1%/+10.5% |
| GLM-5.3-Flash | 3.68/3.35 | 3.96/3.69 | +7.6%/+10.1% |
| Hy4 flash | 3.81/3.73 | 3.96/3.95 | +3.9%/+5.9% |
Long-context & agentic benchmarks (Table 7): The margin widens substantially.
| Target | DSpark Avg. (Long/Agen.) | DFly2 Avg. (Long/Agen.) | Gain |
|---|---|---|---|
| DS-V4.1-Flash | 3.23/3.35 | 3.74/4.06 | +15.8%/+21.2% |
| GLM-5.3-Flash | 3.05/3.10 | 3.85/4.03 | +26.2%/+30.0% |
| Hy4 flash | 3.20/3.16 | 3.63/4.11 | +13.4%/+30.1% |
Speedup Results
- Decoding speedup (Tables 8-9): DFly2 achieves the highest average speedup on every target and family. Over the stronger baseline: +2-6% on general, +6-18% on long-context, +12-30% on agentic.
- Critical failure modes of baselines: On Hy4 flash, DFlash collapses at >32K contexts (τ falls to 1.08), and DFlash variants on DS-V4.1-Flash end agentic sets slower than no speculation due to prefill overhead.
- High concurrency (Figure 7): At matched per-user decode speed, DFly2 delivers +28% throughput on short text, +62% on CodeSpan 64K, +81% on SWE 64K vs. DSpark.
Ablation Findings
- Removing the target's top-k (leaving only near window) is the largest loss, 2-6× more costly on long contexts than general.
- Near window alone adds ~3% on DS-V4.1-Flash, ~0% on others.
- Pairing matters: Adjacent layers 37-39 (which reuse layer 36's latents) cost 4.6% vs. layers 28/32/36 (each with own indexer).
- Weight initialization: Attention copy and FFN expert draw each contribute ~1-1.6% independently.
- Intra-block correction adds 2.8%; last-layer hidden injection adds 1.6%.
Theoretical and Practical Implications
Theoretical Implications
-
Selection reuse is viable: The paper provides quantitative evidence that a sparse target's attention selection, made one step early, covers ~90% of what subsequent tokens would select—validating that drafting can follow the target's own choices without additional scoring.
-
Cost structure of drafters: The analysis formalizes the three costs of a drafter's own cache (prefill, prefix caching, decode concurrency) and shows that sharing the target's KV eliminates all three by design.
-
Length generalization: Because the target's selection is a fixed-size top-k that can reach anywhere in the context, DFly2 inherits the target's length generalization—its accepted length stays within 4% of its general average on agentic workloads, while DSpark's falls 11-21%.
Practical Implications
-
Deployment simplification: DFly2 needs no place on prefill instances, inherits every prefix-cache hit of the target, and costs no decode concurrency—making it substantially easier to deploy in disaggregated serving.
-
Memory savings: Removing the drafter's own cache increases max concurrency 1.73× on DS-V4.1-Flash at 32K tokens (vs. a full own cache).
-
Universal design: The same DFly2 design works across three targets with different sparse attention variants (shared latent cache, interleaved linear attention, two-stage index compression) with nothing to tune in what it reads.
Conclusion
DFly2 demonstrates that a natively sparse target's own choices—its KV cache layout and its per-query attention selection—can serve as the complete context specification for a block-parallel drafter. The drafter keeps no cache of its own, runs no scoring pass, and reads a fixed number of positions at any prompt length. This yields consistently higher accepted lengths and end-to-end speedups across three architecturally different targets, with gains that grow with context length—precisely where speculative decoding is most needed. The work opens a design space (e.g., using YOCO-style shared caches to explore cross-layer unions, history rows, and larger per-row budgets) for further improving drafter context selection at minimal cost.
Related papers
- Learning from Recurrence: Internalizing Depth-Induced Preferences in Looped Language Models
Preference write-back, a self-distillation method where looped language models learn from their own deeper recurrent outputs, improves reasoning accuracy by up to 46% without external supervision.
- Evolve to Learn: Gradient-aligned experience evolution for model self-improvement
Gradient alignment between experience-induced and reference gradients predicts post-distillation gains, while inference-time accuracy shows no correlation, enabling autonomous self-improvement via the E2L framework.
- FlyingStart: Learned Cross-Token Warm Starts for Fixed-Point Decoding in Recurrent-Depth Language Models
FlyingStart learns a linear warm-start map for recurrent-depth language models, cutting decoding layers by 14–19% while matching accuracy and preserving the exit rule's safety certificate.