TL;DR
Multi-candidate speculative decoding accelerates Large Language Model (LLM) inference by validating multiple tokens in parallel, but it suffers from "Residual Drift"—a phenomenon where early candidate rejections cause subsequent candidates in the same batch to become statistically useless. ResiSpec solves this by introducing a proxy distribution that actively shapes the target's residual distribution, keeping it anchored within the draft model's high-confidence zones. This mathematically exact adjustment prevents candidate waste, delivering up to a 1.92× speedup over state-of-the-art multi-candidate methods without altering the final output quality.
What Problem Does This Paper Address?
Standard autoregressive decoding generates tokens one-by-one, creating a severe memory I/O bottleneck that leaves powerful GPUs heavily underutilized. Speculative Decoding (SD) mitigates this by using a lightweight "draft" model to guess a sequence of future tokens, which a larger "target" model then verifies in a single parallel pass.
To maximize efficiency, recent advanced frameworks use multi-candidate or tree-based schemes, proposing multiple branching token paths at once. Theoretically, more candidates should mean a higher chance of acceptance. In practice, however, these methods hit a scaling wall: the acceptance probability of subsequent candidates plummets sharply after the first token is rejected.
The authors identify the culprit as Residual Drift. When a target model rejects a draft token, it must mathematically adjust its remaining distribution (the residual distribution) to maintain exactness. Crucially, this residual distribution shifts directly into the draft model's "blind spots"—areas where the draft model has low confidence or poor accuracy. Because all candidates in the batch were pre-sampled from the original draft distribution, they become completely incompatible with this shifted residual, triggering a "cascade of obsolescence" and forcing expensive resampling.
Methods
ResiSpec introduces a novel Residual Distribution Shaping framework. Instead of verifying candidates against the standard draft distribution, it swaps in an auxiliary proxy distribution $k(x)$.
The proxy is formulated as: $$k(x) = p(x) - r(x) + s(x)$$ where $p(x)$ is the target distribution, $r(x)$ is the unnormalized residual mass, and $s(x)$ is a "slack function" that acts as a compensatory mass to keep the distribution normalized.
By strategically constructing this proxy distribution, ResiSpec ensures that if a candidate token is rejected, the updated residual target distribution is actively steered back toward the high-density, high-confidence regions of the draft model.
The practical implementation relies on a minimal-budget approximation strategy (Algorithm 1). Since a perfect alignment is theoretically impossible due to the "long-tail" nature of language models, ResiSpec calculates the minimal residual mass budget ($Z$) required to bridge the gap between the draft's prediction and the target's reality. It then uses a "water-filling" approach to redistribute any mass deficits to tokens where the target model has available capacity, ensuring the entire process remains mathematically exact and unbiased.
Datasets
The authors evaluated ResiSpec across three widely recognized text corpora to ensure broad domain coverage:
- CNN/DM: A document summarization dataset.
- OpenWebText: An open-source replication of the WebText dataset used to train GPT-2.
- C4 (Colossal Clean Crawled Corpus): A massive, cleaned version of Common Crawl web scraping.
No new benchmarks were introduced, allowing for a direct, apples-to-apples comparison against existing speculative decoding baselines.
Key Insights and Ideas
- The Path to Exactness is Flexible: Traditional speculative decoding treats the verification criteria as fixed, resulting in severe residual drift as an unavoidable penalty. ResiSpec's core insight is that the mathematical path to exact sampling is not unique; you can alter the verification criteria using a proxy distribution to reshape the residual state space however you like, provided they match at the local sampled point.
- Compute Waste in Tree Width: Expanding tree width or batch size in standard multi-candidate verification incurs a linear compute cost but yields sub-linear acceptance gains. Mitigating Residual Drift is the missing key to unlocking the true scaling potential of tree-based speculative decoding.
- The Monotonicity Principle: The authors mathematically prove that allocating any more residual budget than the absolute minimum necessary will cause the residual distribution to drift further away from the draft model's manifold. Thus, a minimal-budget heuristic is uniquely optimal for keeping subsequent candidates viable.
Key Results
- Substantial Speedups: Compared to the baseline SpecInfer framework, ResiSpec achieved up to a 1.92× speedup in end-to-end throughput and up to a 1.86× increase in accepted token length per step.
- Plug-and-Play Compatibility: ResiSpec is baseline-agnostic. When integrated as an add-on to other state-of-the-art multi-candidate methods, it boosted Sequoia (yielding a 1.31× speedup) and EAGLE (yielding a 1.15× speedup).
- Guaranteed Distributional Exactness: The authors empirically measured the Kullback-Leibler (KL) divergence between ResiSpec's output and the true target model. The divergence consistently hovered around $10^{-10}$—a negligible value attributable to standard floating-point noise—confirming zero quality degradation.
- Negligible Computational Overhead: Because ResiSpec operates entirely on token distributions after verification, it requires no additional model forward passes. The runtime overhead is minimal and primarily driven by memory-bound GPU operations.
Limitations and Future Work
While ResiSpec successfully avoids expensive target model forward passes, its proxy distribution calculations involve element-wise operations over the entire vocabulary size on the GPU. These operations are currently memory-bound. The authors note that developing highly optimized, fused CUDA kernels could significantly reduce this minor latency overhead. Additionally, while ResiSpec maximizes the utility of a pre-sampled batch, its performance ceiling remains fundamentally tied to the baseline quality and alignment of the chosen draft model.
Summary updated