Explain speculative decoding. Why is the output provably faithful to the target model, and when does it actually help?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Decode is memory-bound: each token costs a full weight-sweep, while compute idles. Speculative decoding spends that idle compute to cut the number of sequential sweeps. A cheap draft model autoregressively proposes k tokens (fast - it's small). The target model then scores all k proposals in one parallel forward pass (cheap per-token, like prefill). Accepted tokens are emitted; at the first rejection, a corrected token is sampled from the target and drafting resumes. Best case you emit k+1 tokens for one target sweep.
Full worked answer with diagram
Decode is memory-bound: each token costs a full weight-sweep, while compute idles. Speculative decoding spends that idle compute to cut the number of sequential sweeps. A cheap draft model autoregressively proposes k tokens (fast - it's small). The target model then scores all k proposals in one parallel forward pass (cheap per-token, like prefill). Accepted tokens are emitted; at the first rejection, a corrected token is sampled from the target and drafting resumes. Best case you emit k+1 tokens for one target sweep.
Faithfulness comes from the acceptance rule (Leviathan et al. 2022; Chen et al. 2023): accept draft token x with probability min(1, p_target(x)/p_draft(x)); on rejection, resample from the residual distribution normalize(max(0, p_target − p_draft)). This is a rejection-sampling construction whose marginal distribution is exactly p_target - provable, not approximate. So speculative decoding is purely a latency optimisation: same output distribution, including with temperature sampling. Any implementation that changes outputs (beyond floating-point noise) is buggy or is deliberately doing lossy "relaxed" acceptance.
When it helps: expected tokens per target pass rise with the acceptance rate α (how well the drafter matches the target). Predictable text - code, structured output, formulaic prose - drafts well; high-entropy creative text doesn't. It shines at low batch sizes with compute headroom, typically ~2-3× ITL improvement. When it hurts: at high batch, the GPU is already compute-saturated, so verification passes steal throughput; a poorly matched or too-slow drafter can net negative; and the draft model consumes memory. Drafter options: a small same-tokenizer model, feature-level drafters such as EAGLE-3, a model's own built-in multi-token-prediction (MTP) module, parallel block drafters that propose a whole block in one pass (DFlash, DSpark), or n-gram/prompt-lookup drafting - copying candidate continuations from the prompt itself, essentially free and very effective for extraction/editing workloads.
Worth sketching. The draft-verify-accept loop with the rejection branch on it is exactly the diagram that proves you understand why output is unchanged.
flowchart TD
D["Draft model proposes k tokens"] --> V["Target scores all k<br/>in one parallel forward pass"]
V --> A["Accept token x with probability<br/>min(1, p_target / p_draft)"]
A -->|"all k accepted"| E["Emit k+1 tokens for one target sweep"]
A -->|"first rejection"| R["Resample from<br/>normalize(max(0, p_target - p_draft))"]
E --> D
R --> D
What a good answer covers
- Decode is memory-bound: each token costs a full weight-sweep, while compute idles
- Speculative decoding spends that idle compute to cut the number of sequential sweeps
- A cheap draft model autoregressively proposes k tokens (fast - it's small)
- The target model then scores all k proposals in one parallel forward pass (cheap per-token, like prefill)
- Accepted tokens are emitted; at the first rejection, a corrected token is sampled from the target and…
Key terms: draft model · target model · acceptance rule · acceptance rate · n-gram/prompt-lookup
In the glossary: Speculative decoding · Faithfulness · Temperature · Structured output · TPOT / ITL · Multi-token prediction (MTP)
Interviewer follow-ups to expect
Derive why the acceptance rule preserves the target distribution. How does batch size change the economics?
Faithfulness comes from the acceptance rule (Leviathan et al. 2022; Chen et al. 2023): accept draft token x with probability
min(1, p_target(x)/p_draft(x)); on rejection, resample from the residual distributionnormalize(max(0, p_target − p_draft)). This is a rejection-sampling construction whose marginal distribution is exactlyp_target- provable, not approximate. So speculative decoding is purely a latency optimisation: same output distribution, including with temperature sampling. Any implementation that changes outputs (beyond floating-point noise) is buggy or is deliberately doing lossy "relaxed" acceptance.When would n-gram lookup beat a trained draft model?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep