arXiv Science⌕ Search

arXiv subjects

Arnav Dandu

Publications and source records attributed to Arnav Dandu.

1 recordsLinked to original sources

Machine-Checked Grammar-Constrained Decoding

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.

cs.FL↗