The interview problem

Practice prompt

A small draft model proposes tokens for a larger target model to verify. Design a serving policy that enables speculation only when it improves latency without changing the intended sampling distribution.

Original practice, not a reported company interview. All worked numbers are illustrative. Interview date: not applicable. Written October 3, 2026.

1. Scope and assumptions

Assume a supported draft/target implementation and matched tokenization. Greedy verification and stochastic sampling require different correctness treatment. Do not implement stochastic acceptance as simply keeping tokens that look plausible.

2. Architecture and decisions

Request class → draft proposal → target verification → corrected acceptance → committed tokens → next block

Use the algorithm’s acceptance and correction procedure, including its residual distribution, rather than an ad hoc threshold. Keep unverified tokens out of the client stream. Record draft time, verification time, accepted tokens and committed output tokens per iteration. Choose proposal length by workload and load, since longer drafts can waste work when acceptance is poor.

Benchmark against ordinary decoding with the same model, sampling settings and output workload. Disable speculation when draft overhead or target contention outweighs saved target steps. Separate queueing delay from execution time: a policy that helps an isolated request may reduce total service capacity at peak load.

3. Work through the example

An illustrative iteration costs 3 ms of drafting plus 12 ms of verification and commits an average of 3 tokens. That is 5 ms per committed token. If baseline decoding costs 9 ms per token, the execution-only speedup is 1.8×. At 1.2 committed tokens per iteration, cost rises to 12.5 ms per token and speculation loses.

4. Failure cases and trade-offs

Acceptance rate alone is misleading because extra committed tokens and verification cost matter. Streaming a rejected draft requires impossible retraction from some clients. Matching the target distribution does not require identical samples under the same seed. A larger draft model may raise acceptance while consuming too much memory or compute.

5. Validation and acceptance

Use deterministic test cases for boundary correctness and distributional tests for stochastic sampling. Benchmark short answers, domain-shifted prompts and high concurrency. Monitor target-equivalent quality and latency percentiles, not only average acceptance.

6. Follow-ups and self-review

How would adaptive proposal length avoid oscillating under load? Reward correct acceptance semantics, committed-token accounting and workload-specific fallback.

Sources and related practice

Chen et al., Accelerating Large Language Model Decoding with Speculative Sampling (2023), establishes the sampling method; costs here are hypothetical.

Read the primary technical reference

Reference retrieved October 3, 2026. Retrieval date is not an interview or source publication date. The reference supports the named concept; scenario, architecture, examples and rubric are original.

Continue with Design a streaming LLM inference service; Route models under quality, cost and latency constraints.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.