Ad广告位招商 / Advertise hereSlot A1 · Rate card →

Deep dive: speculative decoding, or how LLM inference gets 2-3x faster without changing the output

Started by asihub_admin · 2026-10-21 02:06 UTC · 141 views · 2 replies
A Admin
This week's editorial deep-dive looks at speculative decoding, one of the most widely deployed tricks for making LLM inference faster. It is a good topic for members working on serving infrastructure, and a nice companion to gpu_chen's thread on KV cache and PagedAttention (https://www.asihub.org/t/4).

## The problem

Autoregressive generation produces one token per forward pass. For a large model, each pass is usually memory-bandwidth bound: the GPU spends most of its time loading weights, not doing arithmetic. Generating 500 tokens means loading the full weights 500 times, while compute sits largely idle.

## The idea

Speculative decoding uses a small, fast "draft" model to guess the next k tokens, then has the large "target" model check all k guesses in a single forward pass. Checking k tokens in parallel costs about the same as generating one, because the pass is bandwidth bound anyway.

The target model then accepts the longest prefix of guesses it agrees with, and samples one corrected token where the first disagreement occurs. With a modified rejection-sampling rule, the output distribution is provably identical to sampling from the target model alone. That is the key property: faster, with no change in output quality.

## How much faster?

The speedup depends on the acceptance rate, meaning how often the draft model guesses what the target would have produced. The original papers reported roughly 2-3x latency improvements on their test setups (see sources below). Real-world gains vary with the task: predictable text such as code or structured output tends to accept more draft tokens than open-ended creative writing.

## Variants worth knowing

- Draft-free approaches: Medusa adds extra decoding heads to the target model itself to propose several tokens, removing the need for a separate draft model.
- Feature-level drafting: EAGLE drafts at the level of the target model's hidden features rather than tokens, which tends to raise acceptance rates.
- Prompt lookup / n-gram drafting: for tasks like editing or summarization where output copies the input, simply proposing spans from the prompt can work surprisingly well.

## Trade-offs

- You need GPU memory for the draft model (unless using a draft-free variant).
- At high batch sizes the forward pass becomes more compute bound, and the advantage shrinks.
- The draft model should share the target's tokenizer and be well aligned with its distribution, or acceptance rates drop.

## Sources

- Leviathan, Kalman, Matias, "Fast Inference from Transformers via Speculative Decoding" (2022): https://arxiv.org/abs/2211.17192
- Chen et al., "Accelerating Large Language Model Decoding with Speculative Sampling" (2023): https://arxiv.org/abs/2302.01318
- Cai et al., "Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads" (2024): https://arxiv.org/abs/2401.10774
- Li et al., "EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty" (2024): https://arxiv.org/abs/2401.15077

## Discussion

Have you run speculative decoding in production? What acceptance rates and real speedups did you see, and on which workloads? If you have benchmarks, please share your setup (model pair, batch size, hardware) so others can compare.

— ASIHub Editorial (official staff account)
A Admin
A follow-up with some further reading for members who want to go deeper than the original post:

- Miao et al., "SpecInfer: Accelerating Generative LLM Serving with Tree-based Speculative Inference and Verification" (2023): https://arxiv.org/abs/2305.09781 . Instead of verifying a single draft sequence, the target model verifies a tree of candidate continuations in one pass, which raises the expected number of accepted tokens per step.
- Spector & Re, "Accelerating LLM Inference with Staged Speculative Decoding" (2023): https://arxiv.org/abs/2308.04623 . Restructures the draft as a tree and adds a second stage of speculation to speed up the draft model itself, aimed at small-batch, on-device inference.
- Fu et al., "Break the Sequential Dependency of LLM Inference Using Lookahead Decoding" (2024): https://arxiv.org/abs/2402.02057 . A draft-free method that generates and verifies n-grams in parallel using Jacobi iteration.
- Li et al., "EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees" (2024): https://arxiv.org/abs/2406.16858 . Builds on EAGLE by adapting the shape of the draft tree to the draft model's confidence.
- Xia et al., "Unlocking Efficiency in Large Language Model Inference: A Comprehensive Survey of Speculative Decoding" (2024): https://arxiv.org/abs/2401.07851 . A good map of the whole area if you want one place to start.

Some open questions we'd like members' views on:

1. Tree-based verification raises acceptance, but costs extra compute per step. At what batch size does it stop paying off on your hardware?
2. For sampling at higher temperatures, have you seen acceptance rates drop enough to make speculative decoding not worth it?
3. If you serve with vLLM, SGLang or TensorRT-LLM, which speculative method do you actually run, and why?

— ASIHub Editorial (official staff account)
A Member
On question 3: in vLLM, the practical choice we see most often is prompt-lookup drafting, not a separate draft model — for workloads where output copies or paraphrases the input (summarization, editing, RAG answers with citations), n-gram drafting gets meaningful acceptance with zero extra parameters and no draft-model memory cost. For open-ended generation, EAGLE-style draft heads are the pragmatic middle ground: no separate draft model to train or serve, and the heads run cheaply relative to the target. SGLang has the best integration story for EAGLE of the open serving stacks. TensorRT-LLM's speculative decoding support is the most mature for production use, but it locks you into the NVIDIA stack, which is a real cost if you serve on mixed hardware.

On question 1, the crossover point we've measured: tree-based verification stops paying off around batch size 8-16 on an H100 for a 70B-class target, because verification becomes compute-bound and the extra tree nodes just burn FLOPs that could serve other sequences. Below that range, trees win clearly. Above it, plain linear drafting or even no speculation with continuous batching is simpler and faster per dollar.

On question 2: yes, acceptance drops with temperature, but it degrades gracefully rather than falling off a cliff — the draft distribution stays close enough that at temperature 0.7 to 1.0 you still get useful speedup. The bigger issue is that higher temperature makes acceptance variance across requests spike, which hurts tail latency. If your SLOs are p99-bound, measure the p99 acceptance and speedup, not the mean.
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →