Grammar-constrained generation is often combined with local vocabulary masking and speculative decoding, but the resulting sampling law is not the grammar-conditional distribution users usually intend. We show that any speculative decoder with local mask access, Leviathan rejection, and rollback soundness samples from the locally projected distribution $μ^{\mathrm{proj}}$ rather than the grammar-conditional distribution $μ^\star$. This extends the GAD impossibility result to speculative decoding; on Dyck grammars with Qwen3-8B, the total-variation gap can reach 0.996. We identify the future-validity function $Φ_t(y)=\Pr_p[\mathrm{valid\ completion}\mid y]$ as the missing correction statistic. The target distribution is a Doob transform of the base model with $h=Φ$, while local masking corresponds to setting $h$ to one. With exact $Φ$, our oracle decoder FVO-Spec samples exactly from $μ^\star$; with approximate $Φ$, we bound the resulting total-variation error. Because exact future validity is hard for general context-free grammars, we evaluate estimator hierarchies on tractable Dyck and finite JSON languages. OneStep reduces Dyck TV by 14% with under 1% throughput overhead, exact dynamic programming reduces it by 97%, and finite-language correction closes JSON gaps to numerical precision. All fidelity claims are scoped to enumerable grammars and token tries.
翻译:语法约束生成通常结合局部词汇掩码与推测解码,但由此产生的采样分布并非用户通常期望的语法条件分布。我们证明,任何使用局部掩码访问、莱维坦拒绝和回滚健全性的推测解码器,实际采样的是局部投影分布$\mu^{\mathrm{proj}}$而非语法条件分布$\mu^\star$。这一结论将GAD不可能性结果扩展至推测解码领域;在Dyck文法配合Qwen3-8B模型时,总变差距离可达0.996。我们识别出未来有效性函数$\Phi_t(y)=\Pr_p[\mathrm{有效补全}\mid y]$为缺失的校正统计量。目标分布是基座模型以$h=\Phi$进行的Doob变换,而局部掩码对应于将$h$设为1。在精确$\Phi$条件下,我们的预言解码器FVO-Spec能精确采样$\mu^\star$;在近似$\Phi$条件下,我们给出了总变差误差的上界。由于对通用上下文无关文法计算精确未来有效性具有难度,我们在可处理的Dyck文法和有限JSON语言上评估了估计器层次结构。OneStep方法在吞吐量开销低于1%的情况下将Dyck文法的总变差降低了14%,精确动态规划方法降低了97%,有限语言校正器将JSON语言的总变差降低至数值精度。所有保真性结论均适用于可枚举的文法和令牌前缀树。