Choose the Draft Length for Speculative Decoding
Last updated: November 29, 2026
Quick Overview
A draft model proposes k tokens that the target model verifies in one forward pass, each accepted independently with probability alpha until the first rejection. Derive the expected tokens per verification step and choose k to maximize speedup given the draft's relative cost.
Together AI
November 29, 20260
0
0 solved
A draft model proposes k tokens that the target model verifies in one forward pass, each accepted independently with probability alpha until the first rejection. Derive the expected tokens per verification step and choose k to maximize speedup given the draft's relative cost.
Speculative decoding is a major lever in Together AI's inference speedups, including speculators adapted to a customer's traffic. This onsite math question checks whether a candidate can model acceptance as a stochastic process, derive a closed form, and turn it into an engineering decision about draft length.
What the Interviewer Expects
- Models accepted tokens as a truncated geometric variable
- Counts the bonus token the target produces on rejection or full acceptance
- Derives the closed form for expected tokens per step
- Builds a speedup ratio that charges draft cost per proposed token
- Explains why the optimum k rises with acceptance rate and falls with draft cost
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- Acceptance is not independent in practice; how would you estimate the real curve from logs?
- Why does the speedup shrink at large batch sizes?
- How would you make k adaptive per request?
- Does speculative sampling change the output distribution? Why not?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
Each of the drafted tokens is accepted with probability , independently, and verification stops at the first rejection. The target forward pass always yields one extra token (the corrected...
Approach
Let be the number of accepted drafts. for . Tokens per step are . Then speedup over plain decoding is expected tokens per step divided by cost per step, $k ...