Navigation
⚡ Inference Systems· 14 min read

Draft Strategies

Separate draft model, Medusa heads, EAGLE feature prediction, n-gram matching, prompt lookup — how to generate good candidates cheaply.

speculative-decodingdraftmedusaeaglengramself-drafttree-attention

The draft strategy determines speculative decoding’s effectiveness. A good draft is fast (cheap to generate), accurate (high acceptance rate), and compatible (same tokenizer, same context). This chapter covers the full spectrum from separate models to self-draft approaches.


1. What Makes a Good Draft

PropertyWhy it mattersTradeoff
SpeedDraft time adds to every roundFaster draft = more net speedup
AccuracyHigher acceptance rate = more tokens per roundBetter draft often means larger/slower model
CompatibilityMust share tokenizer and produce valid continuationsLimits which models can pair

The acceptance rate aa is the probability each candidate is accepted. With acceptance rate aa and γ\gamma candidates:

E[tokens per round]=1−aγ+11−a\mathbb{E}[\text{tokens per round}] = \frac{1 - a^{\gamma+1}}{1 - a}

At a=0.8a = 0.8, γ=5\gamma = 5: expected 3.7 tokens per round. At a=0.5a = 0.5: only 2.0 tokens.


2. Separate Draft Model

The simplest approach: use a smaller model from the same family.

# vLLM with separate draft model
vllm serve meta-llama/Llama-3.1-70B \
    --speculative-model meta-llama/Llama-3.1-8B \
    --num-speculative-tokens 5 \
    --speculative-draft-tensor-parallel-size 1
ConsiderationDetails
Speed~5-10× faster than target (smaller model)
Accuracy60-85% acceptance rate (same family helps)
CompatibilityMust share tokenizer; same family strongly preferred
ResourcesSeparate GPU memory for draft model weights + KV cache

Not any small model works: A 1B model drafting for 70B may have poor acceptance rate because the distribution mismatch is too large. Typically, draft should be 5-10× smaller (8B for 70B, 1B for 8B).


3. N-gram and Prompt Lookup

No draft model at all — find candidates from the existing context:

N-gram Matching

Search the already-generated text for n-grams that match the current suffix:

Generated so far: "The attention mechanism allows the model to focus on"
Current suffix (last 3 tokens): "to focus on"

Search history for "to focus on" → found at position 42:
  "to focus on relevant parts of the input"

Candidate: "relevant parts of the input" (next 5 tokens after match)

Pros: Zero compute cost, zero extra memory. Cons: Only works when the model repeats itself (code, repetitive text). Acceptance rate varies wildly — 90%+ for repetitive code, <10% for creative text.

# vLLM with n-gram speculation
vllm serve meta-llama/Llama-3.1-70B \
    --speculative-model [ngram] \
    --num-speculative-tokens 5 \
    --ngram-prompt-lookup-max 4

Prompt Lookup

Similar but searches the input prompt rather than generated text. Useful when the output contains phrases from the input (summarization, extraction).


4. Medusa: Multi-Head Self-Draft

Medusa adds extra prediction heads to the target model itself — no separate model needed:

Standard LM:     hidden_state → LM_head → logits → 1 next token

Medusa:          hidden_state → LM_head    → logits → token t+1 (standard)
                              → Medusa_head_1 → logits → token t+2 (speculative)
                              → Medusa_head_2 → logits → token t+3 (speculative)
                              → Medusa_head_3 → logits → token t+4 (speculative)

Each Medusa head predicts a future token position from the current hidden state, without autoregressive dependency between heads.

Tree Attention

Since each head independently predicts multiple candidates, the candidates form a tree rather than a single chain:

Position t+1: [A, B]          (2 candidates from head 1)
Position t+2: [C, D, E]       (3 candidates from head 2)
Position t+3: [F, G]          (2 candidates from head 3)

Tree structure (12 paths):
  A → C → F
  A → C → G
  A → D → F
  ...
  B → E → G

Verify all 12 paths in one forward pass using tree attention mask

Tree attention lets the target verify all paths simultaneously — the attention mask ensures each path only sees its ancestors, not siblings.

Trade-offs

AspectMedusa
Extra parametersSmall (one linear layer per head, ~0.5% of model)
Training requiredYes — heads must be trained on target model’s representations
AccuracyModerate (50-70%) — heads predict independently, miss inter-token dependencies
No separate model✅ No extra memory for draft model

5. EAGLE: Feature-Level Prediction

EAGLE improves on Medusa by predicting in feature space rather than token space:

Medusa:  hidden_state_t → predict token_{t+1}, token_{t+2}, ... independently

EAGLE:   hidden_state_t + token_t → small autoregressive network →
         predict hidden_state_{t+1} → predict hidden_state_{t+2} → ...
         Then: each predicted hidden_state → LM_head → candidate token

Key difference: EAGLE’s draft network is autoregressive in feature space — each predicted hidden state depends on the previous one. This captures inter-token dependencies that Medusa’s independent heads miss.

EAGLE Versions

VersionInnovationImprovement
EAGLEAutoregressive feature predictionHigher acceptance than Medusa
EAGLE-2Confidence-based tree budget allocationSpend more verification on likely paths
EAGLE-3Improved training + richer input featuresFurther accuracy gains

Important: EAGLE checkpoints are model-specific. An EAGLE head trained for Llama-3.1-70B won’t work with Llama-3.1-8B or a different 70B model. Always verify checkpoint compatibility.


6. Choosing a Draft Strategy

Draft Strategies

StrategySpeedAccuracyExtra memoryTraining neededBest for
Separate modelFast (small model)Good (same family)Draft model weightsNoGeneral purpose
N-gramFreeVariable (0-90%)NoneNoRepetitive text, code
Prompt lookupFreeVariableNoneNoSummarization, extraction
MedusaVery fast (heads only)Moderate~0.5% extra paramsYesLow-latency, no extra memory
EAGLEFastHighSmall networkYesBest quality, single-user latency

For how to measure acceptance rate and determine if speculative decoding helps your workload, see Acceptance Rate & Speedup Bounds.


Self-Check

  • Calculate expected tokens per round for a given acceptance rate and speculation length
  • Explain why draft model should be from the same family as target
  • Describe n-gram matching and when it works well vs poorly
  • Compare Medusa’s independent heads vs EAGLE’s autoregressive feature prediction
  • Explain tree attention and why siblings can’t see each other
  • Choose a draft strategy for: (a) general chat, (b) code completion, (c) latency-critical API

References