BetterSWE DigestWhat is BetterSWE?

Deep Dive · Issue 4

Achieve State-of-the-Art Inference Latencies with Speculative Decoding

GPUs sit idle while an LLM types one token at a time. Speculative decoding fills that slack by guessing ahead and checking in bulk.

A GPU generating tokens one at a time with most compute idle

The bottleneck

Decoding wastes the GPU

A GPU generating tokens one at a time with most compute idle

Autoregressive decoding produces one token per forward pass, and each pass has to stream every one of the model's billions of parameters through the GPU. That makes generation memory-bandwidth bound, not compute bound: the arithmetic units sit mostly idle waiting on weights to arrive from HBM.

So the GPU has spare compute on every step, but the sequential nature of decoding gives it nothing to do with it. Speculative decoding is the trick that fills that slack.

The compute is already paid for. Decoding just refuses to use it.

The core idea

Propose cheap, verify in parallel

A small model proposing tokens and a large model verifying them together

The move is to split generation into two jobs. A cheap mechanism proposes several candidate future tokens in sequence, then the expensive target model verifies all of them in a single forward pass. That verification pass is structurally the same as prompt processing, which GPUs already run efficiently in parallel across many positions.

Draft proposes K tokens (cheap, sequential)Target verifies K+1 (one parallel pass)Accept run + bonus (commit output)

As long as the target accepts more than one token per verification pass on average, you spend fewer sequential target steps per output token, and wall-clock latency drops. The guarantee that makes it usable: the output distribution is provably identical to plain decoding from the target. It is lossless.

Draft and target

Rejection sampling keeps it exact

Draft and target models comparing probabilities per token with a rejection point

In the classic setup from Leviathan et al. and Chen et al. (2023), a small draft model autoregressively proposes K tokens, usually 4 to 8. The target then scores all K+1 positions at once and applies rejection sampling: at each position it compares the target's probability against the draft's, accepting while the target's is at least as high, and on the first rejection it discards that token and everything after it, resampling from an adjusted distribution.

draft:   the  cat  sat  on   mat
target:  ✓    ✓    ✓    ✗
                        └─ reject here, resample
         └────────────┘
          3 accepted  +1 bonus token = 4
Accept the matching prefix, resample at the first miss, plus one free bonus token

If all K are accepted, the target's own forward pass also emits a free bonus token. Even the worst case, zero draft tokens accepted, still yields one token, so speculative decoding is never slower per step, it only adds proposal overhead. One hard requirement: draft and target must share the same tokenizer and vocabulary, which constrains which small model you can pair with a given target.

The payoff

What it buys in practice

Throughput jumping from baseline to over 3x with a small draft model

NVIDIA's TensorRT-LLM numbers on a DGX H200 make the gain concrete. With Llama 3.1 405B as the target on 4×H200, baseline decoding runs at 33.46 tok/s. Add a Llama 3.2 3B draft and it jumps to 120.75 tok/s, a 3.61x speedup.

405B target: 33.46→1B draft111.34    33.46→3B draft120.75    33.46→8B draft101.86    (tok/s)\text{405B target: } 33.46 \xrightarrow{\text{1B draft}} 111.34 \;\; 33.46 \xrightarrow{\text{3B draft}} 120.75 \;\; 33.46 \xrightarrow{\text{8B draft}} 101.86 \;\; (\text{tok/s})
Bigger draft is not better: the 8B draft is slower than the 1B

Notice the shape of it. The tiny 1B draft gives a bigger speedup than the 8B draft, because a larger draft costs more latency per proposal than the extra acceptance rate buys back. For the 70B target on a single H200, the 1B draft is the clear winner at 2.86x (146.05 vs 51.14 tok/s).

Draft model design

Depth is the enemy, not size

A deep narrow model versus a shallow wide model at equal parameter count

The UW-Madison study "Decoding Speculative Decoding" ran over 350 experiments against LLaMa-65B and OPT-66B targets. Its first finding: throughput is bottlenecked by draft-model latency, not by token acceptance rate alone. And draft latency is driven by model depth, the number of layers, more than by parameter count, since layers must run in sequence.

Deep + narrow

higher acceptance, but each proposal is slow

Shallow + wide

same params, far lower proposal latency

The second finding is stranger: a draft model's benchmark accuracy on MMLU or Hellaswag does not correlate well with its acceptance rate. Off-the-shelf small models, tuned to squeeze accuracy per parameter, make poor drafts. Rebuilding them shallow and wide at the same parameter budget gave 60%+ higher throughput in greedy decoding and up to 111% in sampling.

The 796M draft trained on 0.8% of the data

Applying Sheared-LLaMa pruning, the authors built a LLaMa-796M draft that beat Sheared-LLaMa-1.3B by 111% on throughput while training on just 0.42B tokens versus 50.42B, about 0.8% of the data. It generalized across the LLaMa-2 and 3.1 families and fine-tuned models like Vicuna-33B, and shrank the KV cache by 37%, leaving room for larger batches.

No separate model

Growing the draft from the target itself

A lightweight head attached to the target model producing a tree of candidate tokens

A separate draft model means a second set of weights, a second KV cache, and a shared-vocabulary constraint. The alternative is to generate proposals from the target's own internals. EAGLE attaches a lightweight head, a stripped-down decoder layer plus a linear layer, that extrapolates from the target's hidden states just before the output head. EAGLE-3 fuses low, middle, and high-level features into that head.

            root
           /    \
         the    a
         / \     \
       cat sat   dog
       /
     sat
  → verify all branches in one pass
    via tree attention, prune losers
EAGLE-2/3 build a dynamic draft tree, not a single line, checked with tree attention

Instead of one linear guess, EAGLE builds a dynamic draft tree: multiple candidate branches verified together with tree attention, pruning the invalid ones. The head is instance-adaptive, drafting longer on predictable text and stopping a branch once its confidence drops. Reported results land around an 80% acceptance rate and 2.5x speedups.

Medusa takes a simpler route: extra linear heads on the final hidden state, where head k predicts the token k positions ahead, forming a tree verified with a sparse attention mask. DeepSeek's Multi-Token Prediction uses several independently trained heads in the same spirit, keeping the longest matching prefix each step.

Zero-cost proposals

When the draft is just the prompt

Prompt lookup copying repeated phrases from input into output

Sometimes you need no model at all. N-gram / prompt-lookup decoding builds n-grams from the prompt and generation so far, and when the current context matches something seen before, it proposes whatever followed last time. On tasks with heavy input-output overlap, summarization, doc QA, code editing, this is almost free and very effective.

CNN/DailyMail, QPS=1: 2.8× speedup⟶high QPS: 1.8× slowdown\text{CNN/DailyMail, QPS=1: } 2.8\times \text{ speedup} \quad\longrightarrow\quad \text{high QPS: } 1.8\times \text{ slowdown}
vLLM: the same n-gram setup flips from win to loss as load rises

vLLM reports 2.8x on CNN/DailyMail summarization at QPS=1 with prompt lookup. There is also self-speculation, where the target drafts for itself: SWIFT skips intermediate layers of the same model (1.3x, 1.6x), and early-exit methods use a partial run as the draft. The catch is early exit still runs roughly a quarter of the model, capping its ceiling far below a true 100x-smaller draft.

Making it real

The speedup lives or dies in serving

Draft and target contending for a GPU under high request load

The algorithm is only half the work. Verification grows the target's per-step batch by (num draft tokens + 1) to score every continuation at once, so its compute cost rises faster than plain decoding. That is fine while the GPU has idle capacity, but once the system is already compute-bound at high QPS, the overhead stops overlapping with slack and starts costing you.

Draft model (wants the GPU)Target model (wants the GPU)

Co-located naively, they halve each other; the fix is strict sequenced execution

vLLM saw its Llama3-70B draft setup swing from 1.5x faster at QPS=1 to a 1.4x slowdown at high QPS. Getting the win in production means reusing the KV cache across draft and target calls, sequencing the two models so they do not fight over the GPU, and watching draft tensor-parallel layout, since a shrunk allocation on one GPU limits the whole TP group.

The takeaway

A free lunch, if you serve it right

Why it matters

Speculative decoding turns the biggest waste in LLM serving, idle GPU compute during sequential decoding, into a 2x-to-3.6x latency win with no change to model outputs. The lossless guarantee means teams can adopt it without quality regressions, which is why it now ships in vLLM and TensorRT-LLM by default. The sharp edge is load: the same technique that halves latency at low QPS can slow you down under heavy concurrency, so it is a tuning decision, not a switch you flip and forget.

The short version

  • Decoding is memory-bandwidth bound, so the GPU has spare compute; speculative decoding fills it by proposing tokens cheaply and verifying many at once.
  • Rejection sampling plus a bonus token make it **lossless**: identical distribution to the target, never slower per step.
  • Draft latency, driven by **depth** not parameter count, is the real bottleneck; shallow-wide drafts beat off-the-shelf small models.
  • Draft-free variants (EAGLE, Medusa, MTP, n-gram, self-speculation) skip the second model and its vocabulary constraint.
  • Real speedups (up to **3.6x**) need KV-cache reuse and sequenced execution; at high QPS the overhead can flip to a slowdown.

Sources

  1. 1.Decoding Speculative Decoding
  2. 2.Decoding Speculative Decoding
  3. 3.How Speculative Decoding Boosts vLLM Performance by ...
  4. 4.An Introduction to Speculative Decoding for Reducing ...
  5. 5.[Research] JetSpec: Speculative Decoding with Parallel Tree Drafting Enables up to 9.64x Lossless LLM Inference Speedup with more than 1000TPS
  6. 6.TensorRT-LLM Speculative Decoding Boosts Inference Throughput by up to 3.6x | NVIDIA Technical Blog
  7. 7.Speculative Decoding: Achieving 2-3x LLM Inference Speedup
  8. 8.How we built production-ready speculative decoding with TensorRT-LLM
  9. 9.[vLLM vs TensorRT-LLM] #11. Speculative Decoding - The official SqueezeBits Tech blog
  10. 10.TensorRT-LLM/docs/source/legacy/advanced/speculative-decoding.md at main · NVIDIA/TensorRT-LLM · GitHub
  11. 11.Simple LLM Inference Acceleration Framework with Multiple Decoding ...
  12. 12.Fast Inference from Transformers via Speculative Decoding (Leviathan et al., 2023)
  13. 13.Accelerating Large Language Model Decoding with Speculative Sampling (Chen et al., 2023)
  14. 14.Decoding Speculative Decoding (Yan, Agarwal, Venkataraman, 2024)
  15. 15.Low-Latency Inference with Speculative Decoding in TensorRT-LLM (NVIDIA, Dec 2024)
  16. 16.How Speculative Decoding Boosts vLLM Performance (vLLM blog, Oct 2024)
  17. 17.EAGLE-3 and Speculative Decoding in NVIDIA TensorRT-LLM (NVIDIA, Sept 2025)
  18. 18.Baseten: Speculative decoding in production serving
  19. 19.SqueezeBits: Understanding speculative decoding overheads