REAL Loss: Directly Optimizing Expected Acceptance Length in Speculative Decoding

REAL Loss uses path weights and Rao-Blackwellization to exactly optimize the expected acceptance length of speculative decoding, outperforming existing block-level training objectives.
The article points out that the speedup of speculative decoding is fundamentally determined by the expected acceptance length (EAL), while standard training objectives such as cross-entropy, KL divergence, and total variation distance, as well as recent block-level objectives, are only surrogate metrics for EAL. Some block-level methods average acceptance probabilities over contiguous segments of the target distribution rather than computing them over the verification branch selected by already-accepted tokens, producing a covariance gap that may even reverse the gradient direction. To address this, the authors derive the REAL (Real EAL) loss: using path weights for unbiased estimation and Rao-Blackwellization to reduce variance, thereby exactly optimizing EAL. In loss-level comparisons with the Qwen3.6-35B-A3B target model and the Domino draft model, REAL outperforms WTV, VSD, DBLast, and the static LK baseline on the probabilistic serving acceptance length metric across 9 task subsets and 5 evaluation seeds, without modifying the draft model architecture or inference pipeline, and the implementation has been open-sourced.
Speculative decoding significantly accelerates large language model inference by having a lightweight draft model propose multiple tokens at once, which the target model then verifies in parallel. The speedup of this process hinges on the Expected Acceptance Length (EAL). However, standard training objectives such as cross-entropy, KL divergence, and total variation distance focus only on distribution matching or single-step overlap, and do not directly optimize EAL. Recent work has begun proposing block-level training objectives that attempt to directly optimize EAL, but these objectives remain surrogate metrics rather than exact forms of EAL. For example, some methods average subsequent acceptance probabilities over contiguous segments of the target distribution, rather than computing them over the verification branch selected by already-accepted tokens, thereby introducing a covariance gap that may even reverse the gradient direction.

To address this issue, the researchers analyze the aforementioned gap and derive the REAL (Real EAL) training loss. This method uses path weights for unbiased estimation and employs Rao-Blackwellization to reduce variance, thereby exactly optimizing EAL. In controlled loss-level comparison experiments, with Qwen3.6-35B-A3B as the target model and Domino as the draft model, REAL outperforms WTV, VSD, DBLast, and the static LK baseline on the probabilistic serving acceptance length metric across 9 task subsets and 5 evaluation seeds. These gains require only changing the training loss, with no modifications to the draft model architecture or inference process, demonstrating the practicality of true EAL training. A reference implementation of the REAL loss has been open-sourced on GitHub (link in the original article).
Why Is EAL So Critical?
The speedup of speculative decoding is directly determined by EAL: the longer the EAL, the more tokens can be accepted per verification, and the more pronounced the reduction in inference latency. Traditional training objectives (such as cross-entropy) optimize the degree of distribution matching between the draft model and the target model's outputs, but this is not fully equivalent to EAL. Good distribution matching does not guarantee longer acceptance sequences during verification, because verification proceeds token by token, and acceptance depends on the specific path.
Recent block-level training objectives attempt to directly optimize EAL, but most use surrogate formulations. For example, some methods average subsequent acceptance probabilities over contiguous segments generated by the target distribution, whereas the actual verification process operates on the verification branch determined by already-accepted tokens. This mismatch leads to estimation bias, referred to in the paper as the covariance gap. This gap may cause the gradient direction to oppose the true optimization direction of EAL, thereby harming training effectiveness.
The basic process of speculative decoding can be summarized in three steps: "draft—verify—accept." The draft model first autoregressively and rapidly generates γ candidate tokens; the target model then performs a single parallel forward pass over these γ positions to obtain the full distribution at each position; then, according to some acceptance rule (such as rejection sampling), it decides from left to right whether to accept each token, stopping at the first rejection, and samples a token from the corrected distribution as the conclusion of that round. Therefore, the number of tokens actually produced in one round is a random variable, and its expectation is the EAL. A higher EAL means that each target model forward pass is "amortized" over more tokens, and the wall-clock speedup is typically approximated as EAL divided by (1 + the overhead ratio of drafting to verification). This also explains why directly modeling EAL is closer to deployment-time benefits than merely minimizing distribution distance.
Core Design of REAL Loss
The core idea of the REAL loss is to express EAL exactly and achieve unbiased estimation. Specifically, it introduces path weights to correct the aforementioned covariance gap. Path weights reflect the probability of each possible path being selected during verification, thereby transforming the computation of EAL from a surrogate average into a weighted sum over true verification branches.
Furthermore, to reduce estimation variance, REAL employs the Rao-Blackwellization technique. This technique reduces the variance of stochastic estimates by leveraging conditional expectations, making the training process more stable and faster to converge. Together, these two designs ensure that the REAL loss is both an unbiased estimate of EAL and has the low variance required for practical training.
Rao-Blackwellization is a classic variance reduction technique in statistics: if an estimator depends on a random variable Z, replacing f(X) with the conditional expectation E[f(X)|Z] preserves the expectation (unbiasedness) while its variance does not increase and typically decreases significantly. In the REAL setting, EAL requires taking an expectation over all possible acceptance paths, and naive Monte Carlo sampling of paths would introduce large variance; by analytically computing the step "expectation over subsequent branches given the accepted prefix," this is equivalent to Rao-Blackwellizing the path variable, so each update only needs to sample prefixes, resulting in lower variance and more stable gradients, allowing training with larger effective learning rates without divergence.
Experimental Validation and Results
The researchers evaluated the effectiveness of REAL in controlled loss-level comparisons. The experimental setup used Qwen3.6-35B-A3B as the target model and Domino as the draft model, comparing the probabilistic serving acceptance length corresponding to different training losses across 9 task subsets and 5 evaluation seeds. The baselines included WTV, VSD, DBLast, and the static LK baseline.
The results show that REAL outperforms these baselines on all task subsets and evaluation seeds. More importantly, these performance gains are achieved solely by changing the training loss, with the draft model's architecture and inference process completely unchanged. This means that existing speculative decoding systems can integrate the REAL loss at low cost, without redesigning the model or adjusting the deployment pipeline.
Probabilistic serving acceptance length refers to the average number of accepted tokens counted when verification results are randomly sampled according to acceptance probabilities in serving inference. It better reflects throughput performance under real online load than deterministic greedy acceptance length, and is also closer to the definition of EAL. Different evaluation seeds correspond to different sampling randomness, so reporting results across 5 seeds can test whether the gains are stable rather than incidental. WTV, VSD, DBLast, and static LK are several representative draft model training objectives: they are based on total variation distance, block-level acceptance probability approximations, or, in the case of static LK, a fixed acceptance length proxy. Comparing these baselines under the same target model and draft model combination cleanly isolates the variable of "changing only the loss function."
Practical Significance and Open Source
The proposal of the REAL loss bridges the gap between speculative decoding training objectives and the true acceleration metric. Previously, developers often improved acceptance length by adjusting the draft model structure or inference parameters, whereas REAL shows that optimizing only the training loss can yield consistent gains. This provides a new direction for the further adoption of speculative decoding.
A reference implementation of the REAL loss has been open-sourced on GitHub (repository path: the real-loss branch of King-ty/speculators), facilitating reproduction and integration by researchers and engineers. As speculative decoding becomes increasingly widespread in low-latency inference scenarios, training methods like REAL that directly align with the final metric are expected to become standard practice.
One-line Summary
REAL Loss uses path weights and Rao-Blackwellization to exactly optimize the expected acceptance length of speculative decoding, outperforming existing block-level training objectives.
Paragraph Summary
The article points out that the speedup of speculative decoding is fundamentally determined by the expected acceptance length (EAL), while standard training objectives such as cross-entropy, KL divergence, and total variation distance, as well as recent block-level objectives, are only surrogate metrics for EAL. Some block-level methods average acceptance probabilities over contiguous segments of the target distribution rather than computing them over the verification branch selected by already-accepted tokens, thereby producing a covariance gap that may even reverse the gradient direction. To address this, the authors derive the REAL (Real EAL) loss: using path weights for unbiased estimation and Rao-Blackwellization to reduce variance, thereby exactly optimizing EAL. In loss-level comparisons with the Qwen3.6-35B-A3B target model and the Domino draft model, REAL outperforms WTV, VSD, DBLast, and the static LK baseline on the probabilistic serving acceptance length metric across 9 task subsets and 5 evaluation seeds, without modifying the draft model architecture or inference pipeline, and the implementation has been open-sourced.
Related articles

ChatGPT Plus Subscription Pitfall Guide: Go/Plus/Pro Tier Comparison and Quick Activation
A complete ChatGPT Plus subscription guide based on a Bilibili tutorial: from registering an account, comparing Go/Plus/Pro tiers, to the practical steps for quickly completing your subscription.

GPT-6.2 Sol/Astra Released! A Step-by-Step ChatGPT Plus Subscription Guide and Tier Comparison
GPT-6.2 Sol/Astra is out—here's a ChatGPT Plus subscription guide: register an account, compare Go/Plus/Pro tiers, and subscribe in a minute.

Comparing Three Channels for Subscribing to GPT Plus in China: Is Website Top-Up the Easiest?
How to subscribe to GPT Plus in China? This article compares website top-up, credit card, and mobile top-up channels—process, cost, and risk—with steps and tips to help you choose wisely.