注意力与可达性相遇:语法约束下 LLM 解码的结构等价性与效率

📄 中文摘要

研究了语法约束解码(GCD)作为自回归下一个标记分布与通过上下文无关文法(CFG)编译的下推系统上的可达性预言机之间的耦合。证明了一个预言机不变性定理:语言等价的文法为每个前缀诱导相同的可接受下一个标记集合,因此具有相同的对数掩码,但可以产生明显不同的编译状态空间和在线模糊成本。提供了在冗余非终结符委派下,典型的 $a^n b^n$ 语言的确切控制状态膨胀计数,并引入了一种从左到右的结构模糊成本(SAC),用于衡量每个标记的增量打包解析森林增长。对于所有有限字符串的两个等价文法,SAC 为 $O(1)$。

📄 English Summary

Attention Meets Reachability: Structural Equivalence and Efficiency in Grammar-Constrained LLM Decoding

This study investigates grammar-constrained decoding (GCD) as a coupling between an autoregressive next-token distribution and a reachability oracle over a pushdown system derived from a context-free grammar (CFG). An oracle invariance theorem is proven, stating that language-equivalent grammars induce identical admissible next-token sets for every prefix, resulting in identical logit masks, yet can lead to provably different compiled state spaces and online ambiguity costs. Exact control-state blowup counts are provided for the canonical $a^n b^n$ language under redundant nonterminal delegation. Additionally, a left-to-right structural ambiguity cost (SAC) is introduced to measure the incremental packed-parse-forest growth per token. For two equivalent grammars over all finite strings, SAC is shown to be $O(1)$.

Powered by Cloudflare Workers + Payload CMS + Claude 3.5

数据源: OpenAI, Google AI, DeepMind, AWS ML Blog, HuggingFace 等