计算机科学 > 形式语言与自动机理论
[提交于 2026年11月28日]
标题:Machine-Checked Grammar-Constrained Decoding
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:Grammar-constrained decoding (GCD) restricts a language model's next-token choices so that its output remains extendable to a string accepted by a user-provided grammar. GreatGramma is a compositional GCD algorithm built from automata-theoretic components. We formalize its executable checker in Lean 4 and prove it sound and complete under explicit assumptions on the vocabulary, lexer, parser, and whitespace. To our knowledge, this is the first machine-checked end-to-end correctness proof for a grammar-constrained decoding algorithm for LLMs. The formalization finds an end-of-stream bug in the published lexer construction and makes explicit a universal-assumption needed for the algorithm. The development also includes reusable verified components for finite-state automata and transducers, pushdown automata, parser overapproximations, and graph search.
提交历史
来自:Manu Bhat[v1] 2026年11月28日 星期六 04:37:15 UTC (93 KB)