Abstract
Large Language Model (LLM) inference is primarily constrained by memory bandwidth rather than computational capacity. We present Speculative Sampling (SpS), a lossless acceleration algorithm that achieves 2–2.5× speedups in decoding latency. SpS utilizes a small, efficient draft model to generate candidate token sequences, which are then verified in parallel by a larger target model. This approach effectively bypasses the sequential memory-bandwidth bottleneck of standard auto-regressive decoding without altering the target model's output distribution.
Introduction
The generation of text from massive models like Chinchilla (70B) or PaLM (540B) is notoriously slow. In standard auto-regressive decoding, the model must load billions of parameters from memory to produce a single token. Because each token depends on the previous one, this process is strictly sequential, leaving the massive computational power of modern GPUs and TPUs largely idle while waiting for data movement. Speculative Sampling aims to break this sequential dependency to better utilize hardware resources.
Methodology: Speculative Sampling
Speculative Sampling (SpS) introduces a three-step process to accelerate inference:
- Drafting: A significantly smaller "draft model" (e.g., 4B parameters) generates a short sequence of $K$ candidate tokens. Due to its size, the draft model can perform this task rapidly.
- Scoring: The large "target model" (e.g., Chinchilla 70B) evaluates all $K$ draft tokens in a single parallel pass. In memory-bound regimes, scoring $K$ tokens in parallel takes approximately the same time as sampling a single token.
- Modified Rejection Sampling: A novel mathematical scheme determines the acceptance of draft tokens. If the target model's distribution aligns with the draft, multiple tokens are accepted. If they diverge, the draft is rejected at the point of divergence, a "correct" token is sampled from the target model, and the cycle repeats.
This "Modified Rejection Sampling" ensures the final output follows the exact probability distribution of the target model, making the acceleration mathematically lossless.
Experimental Setup
The method was evaluated using Chinchilla 70B as the target model on two benchmarks:
- XSum: A natural language summarization task.
- HumanEval: A code generation benchmark.
A 4B parameter draft model was trained on the same dataset as Chinchilla to ensure alignment in vocabulary and stylistic output.
Results and Discussion
Speculative Sampling achieved a 2× to 2.5× speedup in decoding latency for Chinchilla 70B. On the HumanEval benchmark, mean token time was reduced from 14.1ms to 5.73ms.
Key Insights
- Parallelism Efficiency: In memory-bound scenarios, the primary cost is loading weights. Once loaded, processing multiple tokens (scoring) adds negligible latency compared to the bandwidth cost.
- Predictability Advantage: Common phrases and code syntax are highly predictable. A small model can often guess these correctly, allowing the target model to "skip" several sequential steps.
- Seamless Integration: SpS requires no changes to the target model's weights or architecture, acting as a transparent wrapper.
Limitations
The speedup is sensitive to the draft model's quality; a poor draft model can increase latency due to frequent rejections. Additionally, the lookahead parameter $K$ must be carefully tuned to balance speed gains against latency variance. Implementing SpS in distributed environments also requires sophisticated engineering to manage communication overhead.
Conclusion
Speculative Sampling provides a robust, lossless method for accelerating LLM inference by exploiting the gap between memory bandwidth and computational throughput. By shifting the bottleneck from sequential memory access to parallel verification, it sets a new standard for efficient large-scale model deployment.
Summary updated