Adaptable Logical Control for Large Language Models
Honghua Zhang, Po-Nien Kung, Masahiro Yoshida, Guy Van den Broeck, Nanyun Peng
Abstract
Despite the success of Large Language Models (LLMs) on various tasks following human instructions, controlling model generation at inference time poses a persistent challenge. In this paper, we introduce Ctrl-G, an adaptable framework that facilitates tractable and flexible control of LLM generation to reliably follow logical constraints. Ctrl-G combines any production-ready LLM with a Hidden Markov Model, enabling LLM outputs to adhere to logical constraints represented as deterministic finite automata. We show that Ctrl-G, when applied to a TULU2-7B model, outperforms GPT3.5 and GPT4 on the task of interactive text editing: specifically, for the task of generating text insertions/continuations following logical constraints, Ctrl-G achieves over 30% higher satisfaction rate in human evaluation compared to GPT4. When applied to medium-size language models (e.g., GPT2-large), Ctrl-G also beats its counterparts for constrained generation by large margins on standard benchmarks. Additionally, as a proof-of-concept study, we experiment Ctrl-G on the Grade School Math benchmark to assist LLM reasoning, foreshadowing the application of Ctrl-G, as well as other constrained generation approaches, beyond traditional language generation tasks.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 4fd804db-de9f-45df-aa21-a0309034bc9fCited by top-tier papers17
- Constrained Sampling for Language Models Should Be Easy: An MCMC PerspectiveEmmanuel Anaya Gonzalez, Sairam Vaidya, Kanghee Park, Ruyi Ji et al.NeurIPS 2025 · 15 citations
- Neurosymbolic Diffusion ModelsEmile van Krieken, Pasquale Minervini, Edoardo Maria Ponti, Antonio VergariNeurIPS 2025 · 12 citations
- Fast and Expressive Multi-Byte Prediction with Probabilistic CircuitsAndreas Grivas, Lorenzo Loconte, Emile van Krieken, Piotr Nawrot et al.ICML 2026 · 9 citations
- Decoupling Task-Solving and Output Formatting in LLM GenerationHaikang Deng, Po-Nien Kung, Nanyun PengACL 2026 · 8 citations
- Breaking the Factorization Barrier in Diffusion Language ModelsIan Li, Zilei Shao, Benjie Wang, Rose Yu et al.ICML 2026 · 5 citations
Builds on10
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
- Multitask Prompted Training Enables Zero-Shot Task GeneralizationVictor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach et al.ICLR 2022 · 1,976 citations
- CoAuthor: Designing a Human-AI Collaborative Writing Dataset for Exploring Language Model CapabilitiesMina Lee, Percy Liang, Qian YangCHI 2022 · 340 citations
- COLD Decoding: Energy-based Constrained Text Generation with Langevin DynamicsLianhui Qin, Sean Welleck, Daniel Khashabi, Yejin ChoiNeurIPS 2022 · 217 citations
Related papers
- Controlled Text Generation with Natural Language InstructionsWangchunshu Zhou, Yuchen Eleanor Jiang, Ethan Wilcox, Ryan Cotterell et al.ICML 2023 · 121 citations
- Teaching Models to Improve on TapeLiat Bezalel, Eyal Orgad, Amir GlobersonAAAI 2025
- Control Large Language Models via Divide and ConquerBingxuan Li, Yiwei Wang, Tao Meng, Kai-Wei Chang et al.EMNLP 2024 · 1 citation
- COLLIE: Systematic Construction of Constrained Text Generation TasksShunyu Yao, Howard Chen, Austin W. Hanjie, Runzhe Yang et al.ICLR 2024 · 65 citations
- Tractable Control for Autoregressive Language GenerationHonghua Zhang, Meihua Dang, Nanyun Peng, Guy Van den BroeckICML 2023 · 63 citations
