You're serving a 7B parameter model. Users complain about latency. You've tried quantization, batching, and KV cache optimization. Throughput is decent, but time-to-first-token still stings. The bottleneck isn't compute—it's memory bandwidth. Every token generated requires a full model forward pass, moving gigabytes of weights from VRAM to compute units. What if you could skip most of those passes?
The Core Idea: Guess and Verify
Speculative decoding separates generation into two stages: a fast draft model predicts multiple tokens, then the target model verifies them in a single forward pass. If the draft matches the target's distribution, you accept multiple tokens for the price of one large model call. If not, you reject and fall back. The math is brutal: a 10x smaller draft model runs 10x faster. Even with a 50% acceptance rate, you cut latency nearly in half.
"Speculative decoding is the only technique that reduces latency without degrading model quality—it changes how you sample, not what you sample.
— Charlie Chen, LLM Systems Researcher
Architecture: Draft Model Selection
The draft model must be fast and reasonably aligned with the target. Three proven approaches exist: a distilled version of the target model (best quality, highest training cost), a smaller open model like TinyLlama or Mamba (zero training, moderate alignment), or a n-gram language model (instant, weak alignment). For production, distilled drafts hit 60-80% acceptance rates. TinyLlama-1.1B drafting for Llama-3-70B achieves ~45%. Choose based on your training budget and latency SLA.
KV Cache Mechanics
The draft model needs its own KV cache. During verification, the target model processes the full sequence (prompt + draft tokens) in one forward pass. This means the target's KV cache grows by the number of accepted tokens only. Rejected tokens never enter the target cache. Implementation detail: allocate draft cache separately, then slice target cache to accepted length after verification. This avoids cache pollution and keeps memory footprint predictable.
| Metric | Standard Decoding | Speculative (γ=4) | Speedup |
|---|---|---|---|
| Time per token (ms) | 45 | 18 | 2.5x |
| VRAM read/token (GB) | 14 | 5.6 | 2.5x |
| Acceptance rate | N/A | 62% | |
| Quality (MT-Bench) | 8.41 | 8.41 | Identical |
Rejection Sampling Without Quality Loss
The verification step uses a modified rejection sampling algorithm that guarantees the output distribution exactly matches the target model. For each draft token, compute acceptance probability: min(1, p_target / (c * p_draft)) where c is a constant ensuring p_target <= c * p_draft everywhere. If rejected, resample from the corrected distribution: (p_target - c * p_draft) / (1 - c * p_draft). This proves speculative decoding is a zero-quality-loss optimization—it's mathematically identical to sampling from the target directly.
Production Checklist
Deploying speculative decoding requires infrastructure changes. First, colocate draft and target models on the same GPU to avoid PCIe transfers—use CUDA graphs for both. Second, pad draft sequences to fixed length for continuous batching compatibility. Third, monitor acceptance rate per request; drops below 30% indicate draft model drift or distribution shift. Fourth, set a hard latency timeout: if verification exceeds standard decoding time, fall back immediately.
✦
Next Steps
Start with a distilled draft model if you have training compute—it pays off in acceptance rate. Otherwise, plug in TinyLlama or a Mamba variant today. Measure baseline latency, enable speculative decoding with gamma=4, and track acceptance rate. If you hit >50%, you've just cut user-facing latency in half without touching model weights. That's the highest ROI optimization in LLM serving right now.










