Towards Practical Automata-Based Steering of Large Language Models for Diverse Structured Generation
Xiaokun Luan, Zeming Wei, Yihao Zhang, Kailong Wang, Meng SunLarge language models are increasingly used to produce structured outputs, including JSON objects, API routes, and configuration fragments. Validity masks can enforce syntactic constraints but do not ensure that a sample set explores the constrained space broadly. We present DiverseGuide + , a configurable framework for diversity steering under regular expression constraints. Building on automata-based steering, DiverseGuide + tracks traversal histories in the guiding automaton and adjusts probabilities among valid tokens, preserving constrained-decoding validity while encouraging less visited structures. The framework adds soft path-frequency aggregation, which scores a token-induced path by its full frequency profile, and completion-proximity steering, which rewards progress toward acceptance under fixed token budgets. For efficiency, DiverseGuide + precomputes indexed token-transition records using a byte trie over the vocabulary. We evaluate DiverseGuide + against the original automata-based method and a standard structured generation baseline across three language models and six regular expression constraints. Automata-based steering consistently improves state, transition, and path coverage over the baseline, including at higher temperatures, and these gains carry over to library testing. Within this family, DiverseGuide + exposes configurable trade-offs among structural coverage, reject rate, and content diversity, while trading construction time and memory for lower logits processor latency.