Paper · published 2025-02-19 · added 2026-08-23 · github.com

Grammar-Constrained Decoding Formalization

What it is

A Lean 4 formal verification of a grammar-constrained decoding algorithm. It proves the correctness of a system that combines a detokenizing lexer FST with a pushdown parser to ensure LLM outputs adhere to formal grammars like JSON or SQL.

The problem it solves

Ensuring that complex grammar constraints (like nested JSON or SQL) are correctly and safely enforced during LLM inference without excluding valid outputs or allowing invalid ones.

What you could use it for

formal verificationLean 4LLMgrammar-constrained decoautomata theory

Read the source ↗Back to the library →

Summary written by an AI model from the source; check the source before you rely on it.