Provably Tractable NFA-Constrained Language Generation via HMMs
TL;DR - NFA-LM is a polynomial-time method for generating language-model outputs that approximately preserve the LM distribution while satisfying hard nondeterministic finite automaton constraints. It provides bounded approximation error under mild assumptions, addressing a problem whose exact counting formulation is #P-complete.
- Connects NFA-constrained generation to counting length-(n) sequences accepted by an NFA (#NFA).
- Builds on a fully polynomial randomized approximation scheme for #NFA to obtain tractable generation.
- Aims to avoid the distribution distortion or inefficiency of existing approaches.
- Experiments report efficient generation of high-quality outputs with theoretically bounded approximation error.