Prove Speculative Decoding Samples Exactly From the Target Model

Last updated: November 29, 2026

Quick Overview

Explain speculative decoding with a small draft model and a large target model, prove the accept-and-resample rule leaves the output distribution unchanged, and estimate the speedup from the acceptance rate.

Google
Machine Learning
Machine Learning Engineer
Google
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Hard

0

0

0 solved


Explain speculative decoding with a small draft model and a large target model, prove the accept-and-resample rule leaves the output distribution unchanged, and estimate the speedup from the acceptance rate.

Speculative decoding came out of Google research and is used to cut latency when serving large models in products like Search, so serving and modeling interviews probe both the proof and the systems economics. The interviewer checks that you can show losslessness, not just describe the idea.

What the Interviewer Expects
  • Describes drafting k tokens cheaply and verifying them in one target forward pass
  • States the acceptance probability min(1, p/q) and the residual resampling distribution
  • Proves the resulting token is distributed exactly as p
  • Shows the acceptance rate equals the sum of min(p, q)
  • Estimates expected tokens per target pass and the latency speedup
  • Discusses when it does not help, such as large batches
Key Topics to Cover
Speculative decoding
Rejection sampling
LLM inference latency
Draft models
Memory-bound decoding
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How do you choose the draft length k?
  • Why does the speedup shrink at large serving batch sizes?
  • How do self-speculative methods avoid a separate draft model?
  • How does greedy decoding simplify the acceptance rule?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Target model distribution p(⋅)p(\cdot) at the next position, draft model distribution q(⋅)q(\cdot). The draft proposes kk tokens autoregressively; the target scores all kk positions in one parallel forw...

Approach

For each drafted token x∼qx \sim q: accept with probability min⁡(1,p(x)/q(x))\min(1, p(x)/q(x)). On rejection, sample from the residual r(x)=max⁡(0,p(x)−q(x))∑ymax⁡(0,p(y)−q(y))r(x) = \frac{\max(0, p(x) - q(x))}{\sum_y \max(0, p(y) - q(y))} and discard th...


Submit Your Answer
Markdown supported