GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

Accelerating Large Language Model Decoding with Speculative Sampling

DeepMind's independent take on speculative decoding: a shallow 4B draft proposes tokens and Chinchilla 70B checks them in one pass. Samples were unchanged and decoding ran 2-2.5x faster.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2023
AUTHORS
Chen, Borgeaud, Irving, Lespiau, Sifre, Jumper
FROM
DeepMind
PUBLISHED
Feb 2023 · arXiv preprint
CITED BY
1,305Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 22% of this breakdown.

01

The paper in one minute

A large language model generates text one token at a time, and for big models at small batch sizes each step mostly waits on reading weights from memory. Scoring several tokens in one pass costs about as much as generating one. DeepMind's speculative sampling uses that slack: a small draft model writes a short continuation of K tokens, the large target model scores all K positions in a single call, and a rejection-sampling rule decides how many draft tokens to keep. The authors note that this was developed independently of, and at the same time as, Leviathan et al.'s speculative decoding at Google; the core algorithm is the same.

The acceptance rule keeps each draft token with probability min(1, q/p), where q is the target's probability for that token and p the draft's. At the first rejection, a replacement is sampled from the normalized positive part of q − p and the rest of the draft is discarded. If all K survive, the target's last set of logits gives one more token for free. The output then follows the target model's distribution exactly, up to numerical precision, for nucleus sampling, top-k and temperature as well as greedy decoding.

This paper's contribution is making it work for a large model served across many chips. The obvious draft, a smaller model in the same family, is fastest on fewer chips than the target; a 7B model is fastest on 4 TPU v4s and gets slower on 16. So DeepMind trained a wide, shallow draft: 4 billion parameters in only 8 layers, which runs at 1.8 ms per token on the same 16 chips that serve Chinchilla 70B at 14.1 ms per token. With four draft tokens per step, decoding was 1.9 to 2.5 times faster, and the samples scored the same on summarization and code benchmarks.

THE IDEA, VISUALLY
ONE LOOP, K = 4 (ALGORITHM 2) d1 d2 d3 d4 draft: 4 x 1.8 ms target scores 5 positions one call, ~14 ms d1 d2 d3 new kept 2, rejected d3, resampled 1: 3 tokens accept d_t with probability min(1, q(d_t) / p(d_t)) on rejection sample from (q - p)+, normalized q = target, p = draft (reversed from Leviathan et al.) WHY A WIDE, SHALLOW DRAFT (CHOICE OF DRAFT MODELS) Chinchilla 70B is served on 16 TPU v4s: 14.1 ms/token. A 7B model is fastest on 4 chips (5 ms/token) and gets slower spread over 16: communication outweighs bandwidth. A 4B model with only 8 layers runs at 1.8 ms/token on the same 16 chips. samples match the target's distribution within numerics; benchmark scores were unchanged MS PER TOKEN, BATCH 1 (TABLE 1) plain sampling 14.1 ms XSum, nucleus 7.52 ms 1.92x printed, 1.88x by timing XSum, greedy 7.0 ms 2.01x HumanEval, nucleus 5.73 ms 2.46x dashed: 7.3 ms bandwidth floor for plain sampling (our estimate) LATENCY VS K, LOOP MODEL (OURS) ms per token at acceptance 0.75; K = 1..8 1 2 3 4 5 6 7 8 flat from K = 3 to 5; spread of response time keeps rising with K (sd 48 ms at K=2, 106 ms at K=7) arXiv 2302.01318, DeepMind, February 2023
A draft model writes K tokens; the 70B target scores all of them in one call, which costs about as much as generating one token. Each draft token is kept with probability min(1, q/p) and the first rejection is resampled from the leftover distribution, so outputs follow the target model exactly. A wide, shallow draft keeps drafting fast on the target's own 16 chips.
Research notes: the problem, approach and results
2.46x

faster decoding on HumanEval (100-shot) for Chinchilla 70B, 14.1 to 5.73 ms per token (Table 1)

1.8 ms

per token for the 4B, 8-layer draft model on the same 16 TPU v4s (Results)

K = 3

draft length that minimized latency on XSum with nucleus sampling; larger K plateaued and raised variance (Figure 1)

THE PROBLEM

Large models generate one token per forward pass, and each pass is limited by memory bandwidth and, when the model is sharded across chips, by communication. For a 70B model on 16 TPU v4s, that floor was 14.1 ms per token at batch size 1.

THE IDEA

Let a cheap draft model propose K tokens, score them all with the target in one call, and accept them left to right with a modified rejection sampling rule that preserves the target's distribution. Make the draft a wide, shallow 4B model so it samples quickly on the same distributed hardware the target uses.

THE RESULT

With Chinchilla 70B and a 4B, 8-layer draft (1.8 ms per token), K = 4 cut mean token time from 14.1 ms to 7.52 ms on XSum with nucleus sampling, 7.00 ms with greedy decoding, and 5.73 ms on HumanEval (2.46x), with benchmark scores unchanged within noise.

02

Why it matters to an FDE

Speculative sampling is one of the few latency optimizations that cannot change answers, and this paper adds two practical lessons that the original speculative decoding paper does not.

Pick the draft for the serving topology. A small model in the same family can be a poor draft if the target runs across many GPUs: the small model is fastest on fewer devices and wastes the rest. A wider model with fewer layers needs less communication per step. When a customer serves a large model with tensor parallelism, ask whether the draft was chosen for that layout.

More draft tokens is not free. Latency per token plateaued or got worse past three or four draft tokens, and the spread of time per response grew with K. For products with a P90 or P99 latency target, choose K for the tail, not only the mean.

Gains depend on the content. Code (HumanEval) sped up more than summarization, because code has predictable runs a draft can guess. Measure acceptance on the customer's real traffic before promising a speedup.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Why scoring is cheap, the acceptance rule, draft design, choosing K and two misreadings

    Free account
  2. 04How it works

    The algorithm, why parallel scoring is cheap at scale, the acceptance rule and the draft model

    Premium
  3. 05The numbers that matter

    Table 1, the K trade-off and the memory-bandwidth claim

    Premium
  4. 06Try it yourself

    Recheck Table 1, infer acceptance from timings, find the best K, and test the bandwidth claim

    Premium
  5. 07Where it breaks

    Batch size, draft training cost, domain dependence, one target model and slips

    Premium
  6. 08Using it on a deployment

    Choosing the draft and K, measuring acceptance, and protecting tail latency

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →