Future-Validity Function in Speculative Decoding
- Future-Validity Function is a prefix-dependent statistic that estimates the probability a token sequence can be completed to form a fully grammatical sentence.
- It reweights locally valid tokens using a Doob transform, thereby correcting standard masking pipelines to match the intended grammar-conditional law.
- Approximate methods such as OneStep and MC rollout mitigate the #P-hardness of exact computation, ensuring practical decoding with explicit total-variation bounds.
The future-validity function is the prefix-dependent statistic that corrects grammar-constrained generation from “currently valid” tokens to the intended distribution conditioned on eventual grammatical completion. In the formulation of grammar-faithful speculative decoding, it is defined for a base autoregressive LLM , a prefix-checkable grammar , and a candidate next token after prefix as
The central claim is that standard serving pipelines combining local vocabulary masking with speculative decoding omit exactly this statistic, and therefore sample from the locally projected law rather than the intended grammar-conditional law . With exact , the target distribution becomes a Doob transform of the base model; with approximate , one obtains explicit total-variation guarantees; and for general context-free grammars, exact computation is -hard, so practical use depends on estimator hierarchies and tractable grammar families (Nie et al., 8 May 2026).
1. Formal definition and probabilistic setting
The setup assumes an autoregressive base LLM 0 over a finite vocabulary 1, with per-step conditional
2
together with a prefix-checkable constraint or grammar 3, and valid-next-token sets
4
Within this setup, the future-validity function is
5
The shorthand 6 suppresses the conditioning on the committed prefix, but the paper emphasizes that the quantity is really prefix-dependent. A “valid completion” means completion into a full terminal string in 7, including EOS as needed (Nie et al., 8 May 2026).
This definition makes 8 a survival probability under the base model 9: after appending 0, one samples the suffix from 1, and 2 is the probability that the resulting full sequence remains in the grammar language. In principle this depends on the full committed history through 3; if the language-model state is not Markov-compressible into grammar state, then grammar state alone is not sufficient. Operationally, for finite languages and regularized settings, the paper computes the grammar side from token tries or automaton states, while the model side still depends on prefix-conditioned probabilities (Nie et al., 8 May 2026).
2. From local masking to the grammar-conditional law
The paper distinguishes sharply between the deployed one-step masking law and the intended full-sequence conditional law. Local masking retains only 4 and renormalizes: 5 The intended target, however, is the base-model sequence law restricted to the language and renormalized: 6 These are different objects: 7 is the product of masked-and-renormalized one-step conditionals, whereas 8 is the original sequence distribution conditioned on eventual grammaticality (Nie et al., 8 May 2026).
The future-validity function is the missing correction statistic because the exact per-step grammar-conditional kernel is
9
Relative to local masking, each locally valid token is reweighted by its probability of surviving to a full valid completion. Local masking is recovered by the degenerate approximation 0, i.e. by pretending that every locally valid token has identical future validity. The paper gives the exact condition under which this omission is harmless: 1 This identifies non-uniformity of 2 over 3 as the sole source of distortion (Nie et al., 8 May 2026).
The same point appears in the KL identity. If
4
then
5
Thus the divergence caused by ignoring future validity is controlled exactly by how non-uniform 6 is across the locally valid token set (Nie et al., 8 May 2026).
3. Doob transform, Bellman recursion, and survival semantics
The paper characterizes 7 as a Doob 8-transform of the base model with 9. This gives a precise probabilistic interpretation: future validity is not an auxiliary heuristic, but the harmonic function that converts the unconstrained next-token kernel into the sequence law conditioned on eventual membership in 0 (Nie et al., 8 May 2026).
The appendix gives the recursive identity
1
which is a Bellman or backward recursion. Future validity at the current decision equals the model-weighted sum of future validity at the next decision over valid next tokens. This makes the quantity directly analogous to inside or backward completion probabilities in constrained language modeling and parsing, a connection stated explicitly in the paper (Nie et al., 8 May 2026).
The same appendix shows why shallow lookahead is biased. For the “true one-step estimator,”
2
and therefore
3
One-step lookahead therefore overestimates true future validity by the expected future invalidity after the next step. This clarifies why local admissibility is insufficient: a token can be locally legal yet lead almost surely to future dead ends (Nie et al., 8 May 2026).
4. Speculative decoding, LMS impossibility, and oracle correction
A central negative result is that speculative decoding does not repair the mismatch between 4 and 5. The paper defines the LMS class by three axioms: B1 Local Mask, B2 Leviathan Rejection, and B3 Rollback Soundness. Under these assumptions, every decoder in LMS has per-step sampling kernel 6, hence marginal law 7. The corollary is an impossibility statement: whenever 8, no LMS method samples 9 (Nie et al., 8 May 2026).
The appendix makes this explicit using masked verifier and draft distributions
0
together with the standard Leviathan accept/reject kernel: draw 1, accept with probability
2
and on rejection resample from 3. Because Leviathan rejection samples exactly from 4, and 5, speculative decoding faithfully preserves the wrong law when only local masks are visible (Nie et al., 8 May 2026).
The positive result is the oracle decoder FVO-Spec. Its modification is conceptually minimal: keep the speculative-decoding machinery, but replace the masked verifier target by the 6-reweighted target 7. With exact 8, the resulting speculative decoder samples exactly from 9 at every step. In pseudocode terms: compute 0, compute corrected weights 1 for 2, normalize to obtain 3, and run the usual speculative accept/reject step against this corrected target rather than 4 (Nie et al., 8 May 2026).
5. Approximation, hardness, tractable regimes, and empirical behavior
Exact computation of 5 is generally difficult. The paper proves that computing 6 exactly is 7-hard for general context-free grammars, even under a unigram base LLM. This motivates an estimator hierarchy. Uniform uses 8, exactly recovering 9. OneStep uses
0
reusing 1 as a proxy for 2, with no extra neural forwards and 3 trie operations. MC rollout estimates
4
with Hoeffding and union-bound guarantees but cost 5 target forwards. Exact methods use dynamic programming or enumeration on tractable subclasses: bounded Dyck grammars, finite languages via token tries, and regular languages via automaton-state backward recursion (Nie et al., 8 May 2026).
Approximate 6 leads to an explicit perturbed target
7
If
8
then
9
The appendix also gives a telescoping sequence-level bound and a multiplicative certificate
0
when 1 uniformly on positive-mass candidates. The paper emphasizes that additive guarantees become hard when 2 is small, precisely the recursive-grammar regime where future validity matters most (Nie et al., 8 May 2026).
Empirically, the distortion is often dominant rather than marginal. For Qwen3-8B on Dyck 3, the paper reports
4
and in a bounded-Dyck analytic confirmation on the same 988-string support,
5
In the Dyck estimator hierarchy, Uniform, OneStep-Cheap, and Exact achieve TV 6 to 7; thus OneStep reduces Dyck TV by 8 with under 9 throughput overhead, and exact dynamic programming reduces it by 0. The speed model reports AR baseline 1 tok/s, SD with no 2 3 tok/s, SD + OneStep-Cheap 4 tok/s, and SD + exact DP 5 tok/s. On Dyck, local projection also overproduces deeper and longer strings, with mean nesting depth 6 versus 7 under 8, and mean length 9 versus 00 (Nie et al., 8 May 2026).
For finite canonical JSON under Qwen3-8B, exact-token-trie experiments report
01
across schemas with 3 to 2000 valid strings, while exact 02-correction reduces the residual to numerical zero,
03
In one 3-string status schema, 04 gives 05 mass to "error", local projection emits it 06 of the time, and exact 07 brings it to 08 in the verifier-path pilot. The online finite-trie FVO-Spec loop samples within TV 09 of 10 on the 24-string schema and mean TV 11 across five finite schemas, with mean acceptance 12. In a production-like DFlash finite-trie pilot, exact 13 reduces mean terminal TV on schemas A–D from 14 to 15, a 16 pooled reduction, while throughput changes from 17 tok/s to 18 tok/s (Nie et al., 8 May 2026).
The paper is explicit about scope. Its strongest fidelity claims are limited to enumerable grammars and token tries, where 19 and 20 can be computed exactly. Exact 21 is tractable for finite languages, regular languages, and bounded-depth or bounded-length grammars small enough for dynamic programming, but not for arbitrary open grammars such as general CFG-style JSON with arbitrary nesting or free-text fields (Nie et al., 8 May 2026).
6. Relation to other “future validity” notions
The phrase “future validity” appears elsewhere in arXiv literature, but it refers to different objects. In conformal prediction for future insurance claims, the closest analogue is the conformal plausibility function
22
which calibrates whether a candidate future claim value is retained in a prediction set, with finite-sample guarantee
23
under exchangeability (Hong, 5 Mar 2025). In consonant conformal prediction and related inferential-model work, the central object is a plausibility contour 24 satisfying
25
or, more generally, an IM validity property of the form
26
for assertions 27 (Cella et al., 2020, Cella et al., 2021, Martin, 2021).
By contrast, the future-validity function in grammar-faithful speculative decoding is not a coverage-calibration device for future observations. It is a base-model completion probability: 28 used to transform one-step local admissibility into the correct law conditioned on eventual grammaticality. The paper explicitly relates this 29 to expected futures in Grammar-Aligned Decoding, to a Doob harmonic function, and to inside or backward completion probabilities in constrained language modeling and parsing (Nie et al., 8 May 2026). This suggests that the shared vocabulary of “future validity” spans two quite different traditions: one centered on calibration of uncertainty about future observations, the other on model-based survival mass over future constrained completions.