Speculative Decoding in Practice: Draft Models and Parallel Verification

    This article explains how to put speculative decoding into production. It covers why the technique works (turning expensive serial waiting into cheap proposals plus expensive but parallel confirmation), the four layers where real-world performance breaks down (model, runtime, software, and hardware/parallelism), the core accept/reject mechanism, dynamic draft-path selection, cache commit and rollback semantics, the difference between single-request latency and cluster throughput, a step-by-step rollout plan, and the boundaries of the speedup. Readers will learn how to instrument each layer, keep draft and target probability semantics aligned, and reproduce results instead of relying on a single demo run.

    The engineering value of speculative decoding is not “computing a little less.” It rewrites the most expensive serial waiting in autoregressive decoding into “cheap proposals plus expensive but parallel confirmation.” Every token the large model generates requires a full forward pass of the target model, after which the new token is appended back to the context. The longer the context and the lower the concurrency, the more visible this step-by-step waiting becomes: compute is often not saturated, yet latency scales linearly with the number of tokens. A draft model quickly proposes a candidate span over the same context; the target model then checks, in one or a few forward passes, whether those candidates are consistent with its own distribution. Accepted prefixes can be committed directly, and rejected positions fall back to ordinary sampling. As a result, the number of target-model forward passes per unit time drops and single-request decoding speed rises; under the right concurrency, overall throughput improves too.

    Where the Problem Actually Comes From

    Continuously iterated models chain training, data generation, environment feedback, and online inference into a closed loop. In this setting, “speed measured in the lab” often fails to match real serving. The cause is usually not a single point but four layers stacked together.

    The model layer determines the acceptance rate. If the draft and target disagree on vocabulary, tokenization, chat template, or sampling constraints, even fast candidates get rejected en masse, the speedup ratio approaches 1, and the extra computation can even make things slower. The runtime layer determines whether parallel verification is truly parallel: batch dimensions, key-value cache layout, prefix reuse, and rollback after rejection—any serialization here eats the gains. The software layer determines how requests are split: context length, high or low entropy, forced structured output, and whether long thinking-style output is enabled all change how many draft tokens can be accepted per step. Hardware and parallelism strategy determine the fixed cost of one target-model forward pass: the finer tensor parallelism is sliced, the higher the communication share, and the worse the penalty at low single-request concurrency; once concurrency rises, communication can be amortized across the batch, and the bottleneck shifts to memory bandwidth and cache capacity.

    Therefore, reproducing performance cannot rely on comparing a single “tokens per second” number. You need per-layer instrumentation: draft proposal time, target verification time, accepted-length distribution, rollback count, cache hits, communication wait, and queue wait. Only by pinpointing whether the problem is a low acceptance rate, verification that failed to batch, or cache bloat can optimization have a direction.

    The Basic Mechanism

    Let the target model’s next-token distribution at the current position be P and the draft model’s be Q. The draft samples a candidate sequence of length k continuously from Q. Using the existing cache, the target model computes log-probabilities for these k positions (and the fallback position when needed) in parallel. Comparing position by position: if a candidate falls within the acceptable set, it is kept and we advance one step; once a position is rejected, that position and everything after it are discarded, and a token is resampled from the target distribution at the rejection point. The cache for the accepted prefix can be retained, but the cache corresponding to the rejected suffix must be discarded or marked invalid—otherwise subsequent steps read a ghost context.

    The acceptance rule must match the target model’s sampling semantics. If temperature, top-p, banned tokens, and structured constraints are applied only on the draft side or only on the target side, you get either “verification passes but the output is invalid for the business” or “the output is valid for the business but verification rejects almost everything.” In engineering terms, push sampling parameters and constraints down to the same runtime; the draft only proposes and does not invent a separate decoding strategy.

    k is not better when larger. As k grows, the upper bound of tokens a single verification can absorb rises, but so does the probability that rejection happens early in the sequence, wasting draft computation and invalid cache writes. In practice, a more robust approach is to adaptively shrink or extend k based on the average accepted length over recent steps, rather than hardcoding a global constant.

    The following pseudocode shows the control flow of one decoding step. It only describes data relationships and is not bound to any specific framework interface:

    1. state = load_prefix_cache(request)
    2. loop until stop:
    3. path = choose_draft_path(state) # choose draft path by entropy, length, constraints
    4. draft = draft_model.propose(state, path, max_k)
    5. logits = target_model.verify_parallel(state, draft)
    6. accepted, new_token = accept_prefix(draft, logits, sampler)
    7. state = commit(state, accepted)
    8. if rejected(draft, accepted):
    9. state = rollback_cache(state, len(accepted))
    10. state = commit(state, [new_token])
    11. if should_stop(state):
    12. break

    Dynamic Path Selection

    A single draft path can hardly cover all traffic. Low-entropy, strongly templated long contexts (for example, fixed-format summarization, extraction, or repeated structures in code completion) have high acceptance rates and suit longer drafts and a lighter draft network. High-entropy open generation, multi-turn tool results just spliced into the context, or output that must satisfy a strict grammar tend to get rejected in the first few tokens; here you should shorten k or even temporarily fall back to pure autoregression, so the draft forward pass does not become pure overhead.

    Dynamic path selection should look at at least three kinds of signals. First, local uncertainty: the entropy of the target or draft at recent positions, and the log-probability gap between candidates. Low entropy loosens k; high entropy tightens it. Second, sequence shape: remaining maximum length, whether inside a structured segment, and whether a rejection just occurred. Consecutive rejections should trigger a cooldown to avoid repeatedly proposing on difficult segments. Third, system load: at single concurrency, latency is sensitive and some draft overhead can be tolerated in exchange for accepted length; at high concurrency the target model is already saturated, and overly long verification batches crowd out other requests, so cap per-request k and verification batch size.

    Path selection itself must be cheap and reproducible. Make the selection basis explicit features rather than implicit branches, so the same traffic can be replayed offline to confirm the speedup comes from acceptance rate and not incidental batch scheduling. “One-click reuse” means the same draft weights, the same verification and rollback, and the same path strategy can ship together with the target model version; when context length or concurrency changes, you only tune strategy thresholds without touching business code.

    Consistency and Caching

    What goes wrong most easily in speculative decoding is not the math but the state. The target model’s key-value cache grows by sequence position. During parallel verification, multiple candidate positions are written to the cache temporarily; if a rejection does not roll back precisely to the end of the accepted prefix, the next round reads key-values of uncommitted tokens, the output silently drifts, and this is hard to catch with a metric like “slowing down.”

    It is advisable to split the cache into a committed region and a staging region. Verification writes only to the staging region; once the whole prefix is accepted it is committed at once; on rejection the staging region is discarded. Stop tokens, padding tokens, and special chat markers must also follow the same commit rules, to avoid the draft emitting a stop token that the target did not accept while the server truncates early.

    The numerical paths of draft and target should also be aligned as much as possible: the same vocabulary, the same pre- and post-processing, and the same random-number consumption order. In parallel verification, accepted tokens should not consume a random-number sequence different from autoregression, otherwise token-by-token alignment with the baseline becomes impossible under temperature sampling. If the business only requires distributional consistency and not exact per-item reproduction, the evaluation should still report “distributional consistency” and “byte-level consistency” separately, to avoid applying the wrong standard.

    Concurrency, Parallelism, and Two Kinds of Speed

    Single-request decoding speed and total cluster throughput answer different questions. At low concurrency with long contexts, the startup and communication cost of one target-model forward pass is high, and autoregression pays this fixed cost k times over; speculative decoding merges multiple token decisions into fewer forward passes, so single-request speedup is usually most visible. As concurrency rises, autoregression itself can group multiple forward passes into large batches, device utilization goes up, and the benefit of speculative decoding shifts from “latency” to “average tokens produced per forward pass.” If the acceptance rate is mediocre, the extra draft computation competes with the target model for compute, total throughput gains will be smaller than the single-request speedup, and at extreme high concurrency the benefit thins out.

    Tensor parallelism slices a single forward pass across multiple cards, reducing per-card memory pressure but adding collective communication. At low concurrency with long contexts, watch whether communication is hidden by the verification batch; at high concurrency, watch whether total cache volume caps concurrency. Evaluation should split into at least two groups: one with fixed long context and a single request to measure decoding latency; one that gradually raises concurrency to measure total token throughput, tail latency, and rejection rate. Contexts should distinguish low-entropy templated traffic from high-entropy open traffic, otherwise a single average hides the range where the path strategy fails.

    When comparing against a baseline, lock the same target model, the same parallelism, the same cache implementation, the same sampling parameters, and the same stop condition. Change only the single variable of “whether the draft is enabled.” If the draft model’s compute shares the same devices, its time must be counted in the end-to-end result; you cannot report only the target model’s forward-pass count.

    Rollout Steps

    1. Align interfaces. Confirm the draft and target share vocabulary and template, and that sampling and constraints have only one implementation.
    2. Do correctness first. On short sequences, compare accepted tokens between autoregression and speculative decoding; check resampling at the rejection point and cache rollback; construct three test cases: consecutive rejections, early stopping, and over-long prefixes.
    3. Then add adaptive k. Use a sliding window of accepted length and entropy to adjust the path, and set upper and lower bounds on k plus a rejection cooldown.
    4. Instrument per layer. Record proposal time, verification time, average accepted length, rollback rate, and queue time. When average accepted length approaches 1, first investigate inconsistency and constraints rather than continuing to increase k.
    5. Set per-scenario thresholds. Low-entropy long contexts lean toward longer drafts; high concurrency or high entropy leans toward short drafts or pass-through autoregression. Calibrate thresholds with replayed traffic; do not turn a single demo number into a capacity commitment.
    6. Look at it together with the resource loop. Inference speedup changes the unit cost of data generation and online feedback; scheduling must watch queue, cache, and batch size together, avoiding optimizing a single request while saturating the cluster.

    Boundaries

    If the draft model is too small, proposal quality is poor and the acceptance rate stays low. If the draft is too large, proposal cost approaches the target model and the savings from parallel verification are canceled out. Strong output constraints, multimodal splicing, or frequent tool round-trips all raise local entropy; here dynamically falling back to autoregression is a normal path, not a failure. Also, do not extrapolate the speed at one hardware scale or one parallelism into a multiplier for all contexts and all concurrencies; the speedup ratio is a function of acceptance rate, fixed overhead, and load.

    To make speculative decoding a reusable inference solution, three things are core: the probability semantics of proposal and verification are consistent, the commit and rollback cache semantics are clean, and path selection can vary with entropy and load. With these three in place, both single-request latency and cluster throughput can be explained and reproduced, rather than looking good on only one demo traffic stream.