TL;DR
Speculative decoding accelerates Large Language Model (LLM) inference using a small draft model, but standard training relies on distribution-matching proxies like KL divergence rather than optimizing the actual metric of success: acceptance length. This paper introduces two decoding-regime-aware losses—Expected Accepted Length (EAL) for greedy decoding and Window Total Variation (WTV) for sampling—alongside a reinforcement learning alignment step (GRPO). By directly optimizing the expected number of accepted tokens in a sequence, these methods significantly boost speculative decoding efficiency across multiple benchmarks.
What Problem Does This Paper Address?
Speculative decoding is a popular technique to speed up LLM inference. It uses a small, fast "draft" model to generate a short sequence of candidate tokens, which a larger, powerful "target" model then verifies in parallel. The overall speedup hinges entirely on the acceptance length—the number of draft tokens accepted before the target model spots a mistake and halts the window.
Currently, draft models are trained using standard knowledge distillation (like Kullback-Leibler divergence or cross-entropy) to make their output distributions match the target model. However, because draft models are intentionally small, they lack the capacity to perfectly mimic the target. Forcing them to minimize distribution discrepancy often leads to suboptimal token choices for speculative decoding.
Crucially, the authors point out a major oversight in existing methods: the acceptance mechanism differs fundamentally depending on whether you use greedy decoding (where a strict top-1 token match is required) or sampling-based decoding (which uses stochastic rejection sampling based on distribution overlap). A single proxy loss cannot optimally serve both regimes.
Methods
The authors propose two differentiable surrogate losses tailored to specific decoding regimes, plus a reinforcement learning fine-tuning stage:
- Expected Accepted Length (EAL) Loss (for Greedy Decoding): This loss directly maximizes the expected number of consecutively accepted tokens by optimizing the joint probability of consecutive top-1 matches with the target model across a speculative window.
- Window Total Variation (WTV) Loss (for Sampling-Based Decoding): This loss optimizes the temperature-scaled distributional overlap (Total Variation distance) across the speculative window. Crucially, it models the sequential nature of verification: if an early token is rejected, subsequent tokens in the window are discarded.
- GRPO Alignment Stage: To optimize acceptance length directly as a non-differentiable reward, the authors adapt Group-Relative Policy Optimization (GRPO). They simulate verification on window-level slices and use the resulting acceptance length (debiased against a frozen reference draft model) as a reward signal on top of the supervised training phase.
Datasets
- Training Data: The models were trained on 60,000 target-generated sequences. Prompts were sampled from ShareGPT, and responses were generated by the target model under greedy decoding, truncated to a maximum length of 2,048 tokens.
- Evaluation Benchmarks: The approach was evaluated across five diverse benchmarks covering different task types: MT-Bench (multi-turn conversation), GSM8K (math reasoning), HumanEval (code generation), LongWriter (long-form generation), and STEM QA (scientific knowledge).
Key Insights and Ideas
- Regime Alignment is Essential: A draft model trained for greedy decoding shouldn't be trained the same way as one meant for stochastic sampling. Matching the loss function to the actual verification mechanism yields substantial efficiency gains.
- The Multiplicative Window Effect: Speculative decoding is a sequential process where an early failure invalidates all subsequent drafts in that window. Both EAL and WTV explicitly capture this multiplicative decay across the speculative window, rather than treating token positions as isolated, independent events.
- Proxy Mismatch: When capacity is constrained (as it always is for draft models), optimizing for perfect distribution matching (KL) forces suboptimal trade-offs compared to directly optimizing for acceptance.
Key Results
The proposed methods consistently outperform standard KL-divergence training across different model families (Qwen3, Gemma4) and both tree-based and chain-based speculative decoding configurations.
- Sampling Breakthroughs: The WTV loss delivers massive improvements under sampling-based decoding. For a Qwen3-8B target and Qwen3-0.6B draft model at temperature $T=1.0$, the average acceptance length increases from 4.998 (standard KL) to 5.750 (WTV), and reaches 5.763 when combined with GRPO.
- Greedy Improvements: Under greedy verification, the EAL loss combined with GRPO achieves the highest average acceptance length (4.514 vs. 4.494 for the KL baseline).
Limitations and Future Work
- Training Data Distribution Shift: The training data generation relies on greedy responses from the target model, which might introduce a subtle distribution shift when evaluating under high-temperature sampling regimes.
- Fixed Window Assumptions: The methods assume a fixed speculative window size ($\gamma$) during training, whereas some advanced real-world implementations utilize dynamic window sizes.
- Compute Overhead during Training: The GRPO reinforcement learning stage requires three forward passes per sequence during training (target, current draft, and reference draft), adding computational overhead during the alignment phase.
Summary updated