Speculative Decoding in Production: Reducing LLM Per-User Latency with EAGLE and Draft Models
The Problem: Why LLM Generation Is Slow “One Token at a Time”
Large model online inference typically has two phases: prefill and decode. Prefill processes the input context, which is computationally heavy but highly parallel. Decode generates tokens one by one, an inherently autoregressive process—token t+1 depends on token t, so traditional decoding forces the target model to take only one step forward at a time.
In low-concurrency or medium-low QPS scenarios, the decode phase is often not limited by raw compute, but by a combination of HBM parameter reads, KV Cache access, scheduling overhead, and the number of serial steps. The result: after the first token, users wait for a full target model forward pass for each subsequent token, leading to high TPOT (Time Per Output Token) and a poor streaming experience.
Speculative Decoding doesn’t aim to make the model “smarter.” Instead, it reduces the number of serial steps the target model must perform: a cheaper method first guesses multiple future tokens, then the target model verifies them all at once. If the draft is accurate, a single target model forward pass can accept multiple tokens, reducing the number of serial decode rounds.
The key value of this approach is that, under standard algorithmic conditions, it preserves the target model’s original output distribution. It is not a simple replacement of a large model with a small one, nor is it an approximate generation that sacrifices quality for speed.
Core Principle: Draft Generation + Parallel Verification by the Target Model
1. Two Roles: Drafter and Target Model
Speculative decoding typically involves two roles:
| Role | Responsibility | Common Forms |
|---|---|---|
| Drafter | Quickly proposes candidate tokens | Small model, n-gram rules, extra prediction heads, EAGLE-style feature-level drafter |
| Target Model | Verifies candidate tokens, decides to accept/reject/resample | The large model that guarantees output quality |
A simplified flow:
Given context x → drafter generates candidate tokens: y₁, y₂, y₃, ... yₖ → target model does one forward pass to verify these candidate positions → accepts consecutive candidates from left to right → upon the first rejection, samples from the corrected distribution and discards subsequent drafts → proceeds to the next round.
If the first 4 of the candidates y₁...yₖ are accepted, the target model would have needed 4 decode forward passes but now may only need one verification forward pass. The real savings come from reducing the number of serial decode rounds for the target model.
2. Acceptance Rate Isn’t the Only Metric; Acceptance Length Matters More
Many engineering teams first look at the acceptance rate—the proportion of draft tokens accepted by the target model. However, in production, you should also track accepted tokens per target step, i.e., how many tokens the target model advances on average per verification.
The reason is simple:
- If you only draft 2 tokens per round, even with a high acceptance rate, you can advance at most 2 tokens.
- If you draft 8 tokens per round, but the acceptance rate drops sharply after the 3rd token, the later candidates become wasted.
A reasonable num_speculative_tokens typically requires tuning based on real prompts, sampling parameters, model alignment, and concurrency levels.
3. Why It Can “Preserve the Output Distribution”
Standard speculative sampling does not blindly accept draft tokens. It uses the target model to verify candidates. For sampling scenarios, the classic algorithm compares the drafter distribution q with the target distribution p, using acceptance/rejection sampling to ensure the final output distribution matches that of directly sampling from the target model step-by-step.
Engineering considerations:
- For greedy decoding, verification typically checks if the candidate token matches the target model’s choice.
- For stochastic sampling with temperature/top-p, correct probability-based verification logic is required.
- If you relax verification for speed, you are no longer doing lossless speculative decoding and are entering the realm of approximate decoding.
Comparing Mainstream Approaches: Draft Model, N-gram, Medusa, EAGLE
Draft Model: Most Intuitive, Most Dependent on Model Alignment
A Draft Model uses a smaller, faster language model to predict future tokens. The advantage is a clear mechanism and mature integration paths. The disadvantage is the need to maintain a second model, and the draft and target models must have highly aligned tokenizers, chat templates, domain distributions, and sampling behavior.
Suitable scenarios:
- You have a related small model, e.g., a 7B target with a 1B/3B drafter.
- Business prompts are relatively stable, and acceptance rate can be verified offline.
- The inference service prioritizes per-user latency over extreme high-concurrency throughput.
A common pitfall is that the drafter appears fast, but its candidates are inaccurate, leading to many rejections by the target. The result is running an extra model without significantly reducing target model rounds.
N-gram / Suffix: Lightweight, but Limited Gains
N-gram or suffix methods don’t introduce an extra model; they reuse existing fragments from the context as candidates. The cost is very low, making them suitable for repetitive text like code completion, templated responses, or table/log formatting. However, these methods lack true language modeling capability—for open-ended Q&A, reasoning tasks, or multi-turn dialogues, candidate quality is usually limited, and gains are less stable.
Medusa: Adding Multiple Prediction Heads to the Target Model
Medusa’s idea is not to maintain a separate small model but to add multiple lightweight decoding heads to the target model. Each head predicts a token at a future position, and then a tree-structured candidate set with tree attention verifies multiple paths in one go.
The advantage is reducing the maintenance burden of a second model. The disadvantage is the need to train or adapt extra heads, increasing the complexity of deployment and model asset management. For standard model services, Medusa is not a simple toggle; it typically requires additional training, compatibility validation, and inference framework support.
EAGLE: From Token Prediction to Feature-Level Drafting
EAGLE doesn’t simply use a small model to guess future tokens token-by-token. Instead, it leverages intermediate layer features from the target model for prediction. Early EAGLE emphasized autoregression at the feature level. Subsequent versions like EAGLE-3 and EAGLE-3.1 have continued optimizing around multi-layer feature fusion, dynamic draft trees, and long-context robustness.
Engineering appeal:
- Doesn’t fully depend on a separate small language model.
- Can be more closely aligned with the target model’s internal representations.
- Can yield significant TPOT improvements in low-concurrency, long-output, and code generation scenarios.
- Has been adopted into the practical paths of inference stacks like vLLM and TensorRT-LLM.
However, EAGLE is not a zero-cost solution. It requires a drafter/head matched to the target model, and you must handle chat templates, long contexts, hidden state extraction, and framework version compatibility. Production validation with real workloads is essential; don’t rely solely on papers or single-machine benchmarks.
Approach Comparison Summary
| Approach | Extra Model | Training Required | Typical Gain | Maintenance Cost | Suitable Scenarios |
|---|---|---|---|---|---|
| Draft Model | Needs separate small model | No | Medium-High | Medium | Related small model available, stable prompts |
| N-gram / Suffix | None | No | Low | Very Low | Repetitive text, code completion |
| Medusa | No separate model, needs extra heads | Yes | Medium-High | Higher | Want to avoid a second model |
| EAGLE | Needs feature-level drafter | Needs to match target model | High | Higher | Low concurrency, long outputs, code generation |
Engineering Implementation: From Experiment to Production
Step 1: First, Determine if the Bottleneck is Decode TPOT
Don’t jump to speculative decoding just because it “sounds like it speeds things up.” Break down your service metrics first:
| Metric | Meaning |
|---|---|
| TTFT | Time to first token |
| TPOT / ITL | Average time per output token |
| Output TPS per user | Per-user output throughput |
| Total throughput | Overall throughput |
| GPU utilization | SM, HBM, KV Cache, batch size |
| Queueing latency | Request queueing time |
If the bottleneck is mainly in very long input prefill, retrieval pipelines, tool calls, network latency, or queueing, Speculative Decoding may not be the priority. It primarily addresses serial token generation during the decode phase.
Step 2: Choose Controllable Pilot Traffic
Start with traffic like:
- Code completion, code explanation, structured rewriting
- Templated customer service replies
- Fixed-format report generation
- Long-output summaries or document continuation
- Low-to-medium concurrency interactions where user-perceived latency is critical
Avoid starting with highly open-ended, high-temperature, or cross-domain conversations—these have higher entropy in token distributions and a higher probability of draft rejection.
Step 3: Minimal Configuration Experiment
Using vLLM’s Draft Model as an example:
vllm serve <target-model> \
--speculative-config '{
"method": "draft_model",
"model": "<draft-model>",
"num_speculative_tokens": 5
}'
For EAGLE/EAGLE-3, you’ll need the corresponding drafter checkpoint and follow the framework’s documentation to select method, target model, tensor parallel, attention backend, etc. Don’t mix mismatched chat templates or force models with different tokenizers together.
Step 4: Build a Dedicated Evaluation Set
Before production, prepare at least three types of evaluation data:
- Real business prompts: From online anonymized samples, covering typical input and output lengths.
- High-entropy prompts: Open-ended creative tasks, complex reasoning, cross-domain questions—to observe worst-case gains.
- Regression prompts: Fixed random seeds and sampling parameters to compare output consistency and abnormal rejection patterns.
For each sample, record at least: input token count, output token count, temperature, top-p, accepted token count, rejection position, target forward count, end-to-end latency, TPOT, and peak GPU memory.
Step 5: Gradual Rollout, Not a One-Time Replacement
In production, treat speculative decoding as a separate serving profile:
profiles:
baseline:
speculative: false
spec_decode_eagle:
speculative: true
method: eagle3
num_speculative_tokens: 3
rollout: 5%
During the rollout, monitor at least:
- P50/P95/P99 TTFT and TPOT
- Average accepted tokens per round
- Reduction in target model forward passes
- GPU memory and KV Cache pressure
- Total throughput changes
- Error rate, timeout rate, OOM, cancelled requests
- Gain differences across prompt types
Looking only at average latency can mask tail latency degradation. Especially at high concurrency, the drafter also consumes GPU/CPU/memory resources, potentially increasing overall queueing.
Suitable Scenarios: When Is It Worth It?
Good Fit
- Low to medium concurrency: GPU is not fully saturated by large batches, allowing the parallel verification of multiple tokens to yield benefits.
- Long outputs: More output tokens mean more serial decode rounds, offering greater optimization potential.
- High token predictability: Code, formatted text, templated responses, and repetitive contexts are more likely to yield high acceptance rates.
- Users care about streaming speed: e.g., IDE assistants, customer service bots, document generators.
- Maintainable drafter assets: The team can manage the versioning, compatibility, and evaluation of the draft model/EAGLE head.
Poor Fit
- Main bottleneck is prefill or RAG retrieval.
- GPU is already fully saturated by high-concurrency continuous batching.
- Outputs are very short, with few decode rounds.
- Prompt distribution is highly variable, making acceptance rate unstable.
- The business cannot tolerate the complexity of additional model assets and deployment.
Common Misconceptions
Misconception 1: Speculative Decoding Always Improves Throughput
Its more direct benefit is per-request decode latency. At low concurrency, it can significantly improve per-user output speed. At high concurrency, if the GPU is already highly utilized by continuous batching, the extra drafter may compete for resources. Whether throughput improves depends on the target model, concurrency, batch size, sampling parameters, and implementation details.
Misconception 2: The Smaller the Draft Model, the Better
A very small drafter is fast but inaccurate; a larger drafter is more accurate but costly. The optimum is not the “smallest model” but the best trade-off between draft cost × acceptance length × target verification benefit.
Misconception 3: Only Measure Acceptance Rate
A high acceptance rate doesn’t guarantee end-to-end speed. You also need to look at average accepted tokens per round, extra memory, drafter latency, target verification overhead, and changes in service queueing.
Misconception 4: Treating It as a Quality Degradation Strategy
Standard speculative decoding is not a degradation strategy. Its promise is to preserve the target model’s output distribution. If you skip verification, relax it, or directly accept the small model’s output for speed, you should explicitly label it as an approximate mode and re-evaluate quality.
Misconception 5: Ignoring Chat Templates and Tokenizers
Many failures are not algorithmic but due to engineering mismatches. Inconsistencies in tokenizers, special tokens, system prompts, tool call formats, stop words, or sampling parameters between the draft and target models can cause abnormally low acceptance rates.
Production Rollout Checklist
Model & Configuration
- Target model and drafter/head versions are explicitly bound.
- Tokenizers, chat templates, special tokens, and stop tokens are consistent.
-
num_speculative_tokenshas been swept offline. - Scenarios with temperature/top-p/top-k are covered.
- Both long and short contexts have been evaluated.
Performance Metrics
- Compare TTFT, TPOT, and end-to-end latency against baseline.
- Record accepted tokens per target step.
- Record rejection position distribution.
- Observe P95/P99, not just averages.
- Test at both high and low concurrency.
Resources & Stability
- Monitor peak GPU memory, KV Cache usage, and OOM.
- Check if the drafter introduces additional GPU contention.
- Observe the impact of cancellations, timeouts, and retries on the scheduler.
- Set independent rate limits and a rollback switch for the speculative profile.
Quality & Consistency
- Compare output distribution or regression samples under fixed sampling parameters.
- Validate tool calls, JSON output, and structured output scenarios separately.
- Prohibit unlabeled approximate acceptance strategies from entering the formal pipeline.
- Feed anomalous samples back into the offline evaluation set.
FAQ
Does Speculative Decoding conflict with Continuous Batching?
No, but the relationship is nuanced. Continuous Batching improves GPU utilization by scheduling multiple requests. Speculative Decoding reduces latency by decreasing the number of serial decode steps for a single request. When concurrency is low, speculative decoding benefits are more apparent. When concurrency is high and the GPU is fully loaded, the extra drafter can complicate scheduling, and benefits need to be measured.
Is EAGLE always better than a Draft Model?
Not necessarily. EAGLE’s strength is leveraging the target model’s internal features, reducing the alignment problem of a separate small model, and performing well in some service scenarios. However, Draft Models are more intuitive and general, and n-gram is lighter. The choice depends on the target model, available drafter, deployment framework, real prompt distribution, and maintenance costs.
Why do paper claims of 2x-3x speedup become 1.2x in production?
Common reasons include: higher online concurrency, more diverse prompts, shorter outputs, higher sampling temperatures, poor draft-target alignment, greater KV Cache pressure, suboptimal framework implementation, or the end-to-end bottleneck not being in decode. Speculative decoding should be evaluated with real traffic, not just paper numbers.
Is it helpful for RAG or Agents?
Potentially, but you need to break it down. The end-to-end latency of RAG and Agents often includes retrieval, tool calls, re-ranking, network requests, and multi-step planning. Speculative Decoding only optimizes the model generation phase. If an Agent’s output is very short each time, the benefit is limited. If there is long document generation, long code generation, or long explanatory output, the benefit is more pronounced.
Summary
The core of Speculative Decoding is not “finding another small model to replace the large one.” It’s about using a drafter to propose candidates in advance, then having the target model verify them in parallel, thereby reducing the target model’s serial decode rounds. It is best suited for scenarios sensitive to per-user latency, with long outputs, high token predictability, and GPUs not fully saturated by high concurrency.
In engineering practice, don’t treat it as a magic parameter to enable by default. The correct path is: first confirm decode is the bottleneck, then choose a drafter approach, then evaluate acceptance length, TPOT, tail latency, memory, and rollback capability with real traffic. Only when these metrics are all favorable can Speculative Decoding transition from a paper technique to a stable production optimization.
Key References
- vLLM Documentation: Speculative Decoding
- NVIDIA TensorRT-LLM: Speculative Sampling
- NVIDIA Triton + TensorRT-LLM: Speculative Decoding Tutorial
- NVIDIA Technical Blog: An Introduction to Speculative Decoding for Reducing Latency in AI Inference
- Leviathan et al., Fast Inference from Transformers via Speculative Decoding
- Li et al., EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty
- Cai et al., Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads
- vLLM Blog: EAGLE 3.1
- vLLM Project: Speculators