Skip to main content
QUICK REVIEW

[Paper Review] Accelerating Large Language Model Decoding with Speculative Sampling

Charlie Chen, Sebastian Borgeaud|arXiv (Cornell University)|Feb 2, 2023
Natural Language Processing TechniquesComputer Science26 citations
TL;DR

Speculative sampling speeds up transformer decoding by drafting multiple tokens with a fast draft model and then using a modified rejection sampling scheme to preserve the target model’s distribution, yielding 2–2.5x speedups on Chinchilla 70B without modifying the target model.

ABSTRACT

We present speculative sampling, an algorithm for accelerating transformer decoding by enabling the generation of multiple tokens from each transformer call. Our algorithm relies on the observation that the latency of parallel scoring of short continuations, generated by a faster but less powerful draft model, is comparable to that of sampling a single token from the larger target model. This is combined with a novel modified rejection sampling scheme which preserves the distribution of the target model within hardware numerics. We benchmark speculative sampling with Chinchilla, a 70 billion parameter language model, achieving a 2-2.5x decoding speedup in a distributed setup, without compromising the sample quality or making modifications to the model itself.

Motivation & Objective

  • Motivate reducing latency in autoregressive decoding for very large transformers.
  • Propose speculative sampling (SpS) to generate multiple draft tokens per target model call.
  • Show that SpS preserves the target distribution within hardware numerics and can be deployed without modifying the target model.
  • Demonstrate substantial speedups on Chinchilla-sized models across natural language tasks while maintaining sample quality.

Proposed method

  • Generate a short draft of length K using a faster draft model (auto-regressive or parallel).
  • Score the draft continuations with the larger target model to obtain logit distributions.
  • Apply a modified rejection sampling scheme to accept draft tokens and recover the target distribution.
  • Prove that the scheme preserves the target distribution (Theorem 1).
  • Experiment with a 4B draft model and a 70B target model (Chinchilla) to measure latency and quality.
  • Show compatibility with common decoding methods (nucleus, top-k, temperature) and potential to combine with other efficiency techniques.
Figure 1: Left: The average time to generate 128 tokens, with standard deviation. Note that as $K$ increases, the overall speedup plateaus or even regresses, with XSum being optimal at $K=3$ . The variance consistently increases with $K$ . Middle: The average number of tokens accepted divided by $K+
Figure 1: Left: The average time to generate 128 tokens, with standard deviation. Note that as $K$ increases, the overall speedup plateaus or even regresses, with XSum being optimal at $K=3$ . The variance consistently increases with $K$ . Middle: The average number of tokens accepted divided by $K+

Experimental results

Research questions

  • RQ1Can speculative sampling achieve latency reductions without modifying the target model?
  • RQ2What is the trade-off between draft length K and overall speedup across tasks and decoding strategies?
  • RQ3How does the acceptance rate of draft tokens depend on domain and decoding setup, and does sample quality remain intact?

Key findings

  • Achieves 2–2.5× decoding speedup when sampling from Chinchilla 70B in distributed settings.
  • Speculative sampling maintains the target distribution within numerics, with empirical results matching the baseline in XSum and HumanEval tasks.
  • A 4B draft model can reach 1.8 ms/token versus 14.1 ms/token for the target model on the same hardware, enabling substantial practical speedups.
  • Speedups can exceed hardware memory-bandwidth limits for autoregressive sampling in some cases (e.g., HumanEval with greedy XSum).
  • The acceptance rate and efficiency depend on K and the domain, with optimal K varying by task (e.g., K=3 for XSum).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.