← Back to all articles
arXiv cs.CLOctober 7, 2026

Provably Tractable NFA-Constrained Language Generation via HMMs

Excerpt

arXiv:2609.40185v2 Announce Type: replace Abstract: Constrained generation aims to sample from language models (LMs) conditioned on hard constraints. Existing constrained-generation techniques for nondeterministic finite automaton (NFA) constraints either distort the distribution or sacrifice efficiency. Theoretically, this task reduces to counting the length-$n$ sequences accepted by an NFA (#NFA), and the exact #NFA problem is #P-complete. Recent work has shown that #NFA admits a fully polynom