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
Statistics & Math
Machine Learning Engineer
Together AI
November 29, 2026
Machine Learning Engineer
Onsite
Statistics & Math
Medium

0

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
speculative decoding
geometric distribution
expected value
inference optimization
draft models
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. 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 Questions
Sample Answer
Clarify

Each of the kk drafted tokens is accepted with probability α\alpha, independently, and verification stops at the first rejection. The target forward pass always yields one extra token (the corrected...

Approach

Let AA be the number of accepted drafts. P(A≥j)=αjP(A \ge j) = \alpha^j for j≤kj \le k. Tokens per step are A+1A + 1. Then speedup over plain decoding is expected tokens per step divided by cost per step, $k ...


Submit Your Answer
Markdown supported

Related Questions