๐Ÿƒ

Speculative Decoding

Small model drafts predictions, large model verifies

LLM token generation is autoregressive, producing only one token at a time. Even with spare GPU compute, memory bandwidth bottlenecks limit speed. Speculative Decoding solves this. A fast Draft model (small) generates ฮณ tokens at once, and the Target model (large) verifies them all in parallel in a single forward pass. If correct, they're accepted; if wrong, the Target model re-generates. Output quality remains identical (mathematically guaranteed same distribution) while speed improves. Variants include Medusa and EAGLE.

Key Concepts

1

Draft Model (small, fast) autoregressively generates ฮณ candidate tokens

2

Target Model (large, slow) verifies original prompt + Draft tokens in a single forward pass

3

Verify each Draft token sequentially โ€” compare with Target's probability distribution

4

Accept Draft token if it matches Target distribution

5

Target model re-generates from first mismatching token (reject + resample)

6

On average, multiple tokens are confirmed per Target forward pass โ†’ 2-3x speed improvement

Pros

  • Identical output quality (mathematically guaranteed same distribution)
  • 2-3x speed improvement
  • No modification to existing models needed
  • Resolves memory bandwidth bottleneck

Cons

  • Draft Model choice affects performance (high reject rate if too different)
  • Additional memory needed for Draft Model
  • Implementation complexity (verification/resampling logic)
  • Reduced effectiveness in batch processing

Use Cases

Google DeepMind (original paper) Apple MLX Framework vLLM / TGI serving engines Medusa โ€” parallel prediction with multiple heads in a single model EAGLE โ€” drafting from its own hidden states