Provably Tractable NFA-Constrained Language Generation via HMMs
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- 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.
Create a lesson
Metadata
- Categories
- cs.CL, cs.FL
Related papers
NORMCRAFT: Cultural Norm Generation for Context-Aware Language Model Alignment
Shared title terminologycs.CLTangyuan Zhang, Zhuang Li, Fatemeh Shiri et al.
Evaluating Large Language Models on conversational African American English: Feature classification and next-turn generation
Shared title terminologycs.CLRomeo De Timmerman, Thomas Demeester, Els Lefever
Investigating the Role of Reasoning-Language Alignment in Monolingual Retrieval-Augmented Generation
Shared title terminologycs.CLOliver Hauck, Mario Sanz-Guerrero, Katharina von der Wense
HARPO: Hallucination-Aware Reinforcement Learning for Faithful and Creative Language Generation
Shared title terminologycs.CLTiezheng Yu, Yuxin Jiang, Jinpeng Li et al.
Temporally-Resolved Token Attribution Reveals the Generation Dynamics of Diffusion Language Models
Shared title terminologycs.CLDarpan Aswal, Céline Hudelot
Disciplined Anthropomorphism: How to Extend Cognitive Language to Artificial Intelligence
Shared title terminologycs.CLMatthieu Queloz