research24 min studyLesson 731 in Engineering

Verify candidate continuations under the target’s actual histories

Separate autoregressive probability factorization from parallel scoring so drafted tokens accelerate a target decoder without becoming unverified output.

On this page

What you’ll understand

  • Define draft and target conditionals on a shared committed prefix.
  • Explain why candidate scoring can be parallel while sampling remains causally conditioned.
  • Identify what becomes invalid after the first rejected candidate.

A small draft model proposes four tokens before a larger target model is called. This does not authorize publishing all four. The target scores the proposed histories in parallel, and a verifier commits only the continuation justified by the intended decoding rule. The speed opportunity comes from amortizing expensive target work over several potentially usable tokens. Correctness still depends on the target's conditional distribution at the history that was actually committed, with exact verification and correction rules rather than confidence-based acceptance alone.

Factor both models over the same token histories

For a fixed committed prefix h, define normalized next-token distributions p for the target and q for the draft over the same finite token vocabulary. A proposed block is generated autoregressively from q: each later proposal conditions on the earlier proposed tokens. The target can teacher-force that whole block through a causal model to compute the next-token distributions for those candidate histories in one verification pass. This is parallel evaluation of known inputs, not simultaneous unconditional sampling of several independent future tokens. Preserve the tokenizer, positions, attention mask, and processed probability convention that define each conditional.

Temperature, top-k or nucleus truncation, repetition penalties, and grammar constraints can change the distribution being sampled. The exactness claim must identify the target decoder after the declared transformations, not silently compare an adjusted proposal with an unrelated raw target softmax. The actual proposal probabilities must match the proposal mechanism used to generate candidates. A draft need not be a perfect model of the target; poor agreement can reduce efficiency while a correct verifier still preserves the target law. Special proposal mechanisms or different tokenizers require their own supported mapping and correctness argument.

p(y1:m∣h)=∏i=1mp(yi∣h,y<i)p(y_{1:m}\mid h)=\prod_{i=1}^{m}p(y_i\mid h,y_{<i})
This finite-length autoregressive factorization uses normalized conditional distributions over a shared token vocabulary. It describes a specified target decoding law, including its declared transformations and stopping convention, rather than independent token probabilities.↔ Scroll wide equations horizontally.

Score speculative histories, then keep only a valid prefix

Suppose the target scores p 1 at h, p 2 at h plus the first proposed token, and so on. Verification proceeds from the beginning. If the first two proposals pass and the third fails, only the first two proposed histories remain the committed path. Scores and key/value states computed after the rejected third proposal describe a history that will not occur. Do not use a favorable fourth-position score to skip over that rejection. The correction token is chosen from the distribution required at the first failing history; the next round starts from the resulting actual prefix.

If all proposed tokens pass, the scored target distribution after the full proposed block can supply one additional token. The usual no-stop round can therefore emit accepted proposals plus one correction or bonus token. EOS and output-length limits can shorten that count and must be applied consistently with the baseline. A target verification pass may be cheaper than several sequential target calls, especially when a short block improves reuse of weights, but its arithmetic and temporary storage still grow with candidate work. One pass is an execution boundary, not evidence that every block length costs the same time.

pi(⋅)=p(⋅∣h,y1:i−1),i=1,…,γ+1p_i(\cdot)=p(\cdot\mid h,y_{1:i-1}),\qquad i=1,\ldots,\gamma+1
γ is a positive integer draft length and y are the proposed tokens. Later conditionals are usable only along their matching verified history. After a rejection, downstream speculative conditionals cannot be treated as conditionals of the corrected history.↔ Scroll wide equations horizontally.

State which exactness claim the implementation supports

Greedy verification can preserve a deterministic target sequence under matched model numerics and tie rules. Stochastic verification instead aims to preserve a probability distribution using a valid acceptance-and-residual scheme. These are different tests: equal seeded strings are not required for two exact stochastic implementations that consume randomness differently. Original speculative-sampling papers give the algorithmic argument under their model; pinned Transformers 4.56.2 exposes assisted generation with explicit mode limitations. Confirm the exact backend and configuration rather than infer support from the existence of a generic speculative option.

The probability lab illustrates a two-token distribution at one fixed history only. Reset, set both p=0.7 and n=1, predict the two bars, then inspect. They represent target masses 0.7 and 0.3 for a deliberately finite example, not a four-token draft or verification pass. The instrument has no conditional histories, target model, or correction sampler. It is useful for keeping a normalized one-step distribution distinct from the product of several conditional probabilities, which must be computed from the actual histories in a real decoder.

Track the history used by a two-token probability

For one fictional prompt and binary vocabulary, target probability of first token A is 0.6. After A, probability of second token B is 0.5; after the other first token, that B probability is 0.1. These conditionals belong to one normalized finite model.

  1. The probability of the sequence A, B is 0.6×0.5=0.3. Its second factor uses the history containing A.

  2. If A were replaced by the other first token, the sequence ending in B would instead have probability 0.4×0.1=0.04.

  3. A speculative score 0.5 computed after A cannot be reused after replacing A. Recompute or use the correctly scored branch for the actual committed history.

The result

The two joint probabilities are 0.3 and 0.04 for different histories. Causal conditioning, not the visible token B alone, determines the relevant verification distribution.

Explore the model

Interactive lab

Interactive lab · probability

Inspect one normalized next-token distribution

Reset, set both p=0.7 and n=1, predict, then inspect. The Bernoulli bars carry masses 0.7 and 0.3. This exact one-step display has no draft model, conditional tree, verification pass, or text generation.

Inspect one normalized next-token distributionThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA normalized next-token law is attached to one history. Multi-token probabilities require the correct sequence of conditional histories.

Check your understanding

The third proposed token is rejected after two earlier proposals pass. May a precomputed fourth-token distribution be used after the correction token without checking its history?

Try it yourself

A binary target gives first-token A probability 0.8, then B probability 0.25 after A. After the other first token, B probability is 0.75. Compute the two corresponding length-two sequence probabilities.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Multiply each first-token mass by its own conditional second-token mass.

Compare with the solution

P(A, B)=0.8×0.25=0.2. The other-first-token, B sequence has probability 0.2×0.75=0.15. Both can coexist in one normalized model; their second-token distributions apply to different prefixes.

Take it with you

  • Draft proposals are hypotheses about future token histories.
  • Parallel target scoring preserves causal conditioning rather than removing it.
  • Commit only a verified path and apply stopping and mode semantics consistently.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.