Provably Tractable NFA-Constrained Language Generation via HMMs
Jialiang Sun, Kuldeep Meel
Key points
From the paper's conclusion- Inspired by this result, we propose NFA-LM, a polynomial-time engine for NFA-constrained generation with theoretical guarantees under mild assumptions.
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 polynomial randomized approximation scheme (FPRAS). Inspired by this result, we propose NFA-LM, a polynomial-time engine for NFA-constrained generation with theoretical guarantees under mild assumptions. Experiments show that NFA-LM efficiently generates high-quality outputs with theoretically bounded approximation error.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- No-Regret Language GenerationarXiv · 2026
- PAC Learning to Sample: On Computational Aspects of Language GenerationarXiv · 2026
- Breaking the Space Barrier and its Application to Language Model InferencearXiv · 2026
- On the Role of Large Language Models in Robustness-Guided Requirement FalsificationProceedings of the ACM on Software Engineering · 2026
- Private Uniform Language GenerationarXiv · 2026
- Lookahead-Then-Verify: Reliable Constrained Decoding for Diffusion LLMs under Context-Free GrammarsProceedings of the ACM on Software Engineering · 2026