Learning To Draft: Adaptive Speculative Decoding with Reinforcement Learning

Jiebin Zhang, Zhenghan Yu, Liang Wang, Nan Yang, Eugene J. Yu, Zheng Li, Yifan Song, Dawei Zhu, Xingxing Zhang, Furu Wei, Sujian Li

Overview

Learning to Draft (LTD) is a reinforcement learning-based framework that dynamically optimizes the "draft-and-verify" cycle in speculative decoding. By training co-adaptive policies to directly maximize wall-clock throughput rather than just prediction accuracy, LTD achieves inference speedups of up to 4.32x, significantly outperforming current state-of-the-art static and dynamic methods.

The Challenge of Speculative Decoding

Speculative decoding has become a standard technique for accelerating Large Language Model (LLM) inference. It works by using a small, fast "draft" model to guess a sequence of tokens, which a larger "target" model then verifies in a single parallel pass.

The core challenge is the time-accuracy trade-off. If the draft model generates too many tokens, the time spent drafting and verifying them might exceed the time saved. Conversely, drafting too few tokens leaves potential speedup on the table. Most existing methods rely on static configurations (like a fixed tree size) or optimize for "acceptance length"—the average number of correct guesses. However, acceptance length is a proxy metric; it ignores the actual wall-clock time cost of the drafting and verification phases. Furthermore, these two phases are often optimized in isolation, failing to account for how they depend on one another.

Learning to Draft (LTD) Methodology

To address these inefficiencies, the authors introduce Learning to Draft (LTD), which treats the interaction between the draft and target models as a reinforcement learning (RL) environment.

The LTD framework uses RL to coordinate two policies: a Depth Policy to control drafting and a Size Policy to manage verification.

The framework relies on two co-adaptive policies:

  • Depth Policy ($\pi_D$): A binary classifier that decides after each draft step whether to continue drafting or stop.
  • Size Policy ($\pi_V$): Determines the optimal number of candidate tokens to send to the target model for verification.

Unlike prior work, the reward signal for the RL agent is the actual throughput: $Reward = \frac{\text{Accepted Tokens}}{\text{Draft Time} + \text{Verify Time}}$. The policies are trained using Proximal Policy Optimization (PPO). To ensure they work in harmony, the authors use an alternating optimization schedule—freezing one policy while training the other to encourage co-adaptation. Both policies are implemented as small Multi-Layer Perceptrons (MLPs) to ensure that the decision-making overhead remains negligible (less than 1.5% of total inference time).

Evaluation and Benchmarks

The policies were trained on the HumanEval dataset, chosen for its diverse and complex code snippets which provide a challenging environment for the draft model. The authors then tested LTD across four major benchmarks: MT-bench (multi-turn conversation), GSM8K (mathematical reasoning), Alpaca (instruction following), and Natural Questions (QA). To test cross-domain robustness, they also evaluated the model on MMLU, covering 57 subtasks across various fields like law, math, and history.

Key Insights

  • Throughput > Acceptance Length: The "aha moment" of LTD is that a longer draft isn't always better. If a draft model is uncertain, it is more efficient to stop early and verify a few high-confidence tokens than to waste time generating a long, likely-incorrect sequence.
  • The "Shallow but Wide" Strategy: In difficult scenarios with low confidence, LTD often learns to adopt a "shallow but wide" approach—drafting fewer steps but including more branching candidates at those steps to maximize the chance of a hit without ballooning the time cost.
  • Interdependence is Crucial: By training the policies iteratively, the draft model "learns" the capacity of the verification stage, and the verification stage "learns" to trust or distrust the draft model's confidence scores.
  • Robustness to Temperature: Most dynamic speculative decoding methods struggle at higher sampling temperatures where randomness increases. LTD remains robust because its RL-based policies learn to handle the increased variance in token distributions.

Performance and Results

LTD consistently outperforms the previous state-of-the-art, Eagle3, across various model families including Llama-3, Vicuna, and Qwen3.

Analysis of time allocation shows that LTD reduces the normalized time spent in both drafting and verification compared to the Eagle3 baseline.

Overall, LTD achieved speedups ranging from 2.24x to 4.32x relative to vanilla autoregressive decoding. On the Qwen3-32B model specifically, LTD outperformed Eagle3 by 36.4%. As shown in the time analysis, LTD significantly reduces both draft and verification overhead compared to static baselines.

Limitations and Future Directions

While the inference overhead is low, the method requires a specific RL training phase for each draft-target model pair. Additionally, while the depth and size are dynamic, the underlying beam-search-like tree expansion logic remains somewhat constrained. Future work could explore more flexible, non-uniform tree structures. Finally, because throughput is hardware-dependent, a policy trained on one GPU architecture might need retraining or calibration to remain optimal on another with different compute and memory bandwidth ratios.

Summary updated

BibTeX
@inproceedings{zhang2026learning,
  author = {Jiebin Zhang and Zhenghan Yu and Liang Wang and Nan Yang and Eugene J. Yu and Zheng Li and Yifan Song and Dawei Zhu and Xingxing Zhang and Furu Wei and Sujian Li},
  title = {{Learning To Draft: Adaptive Speculative Decoding with Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=IK9cbzzXLt},
}
Figure