A Pseudo-Semantic Loss for Autoregressive Models with Logical Constraints
Kareem Ahmed, Kai-Wei Chang, Guy Van den Broeck
Abstract
Neuro-symbolic AI bridges the gap between purely symbolic and neural approaches to learning. This often requires maximizing the likelihood of a symbolic constraint w.r.t the neural network's output distribution. Such output distributions are typically assumed to be fully-factorized. This limits the applicability of neuro-symbolic learning to the more expressive autoregressive distributions, e.g., transformers. Under such distributions, computing the likelihood of even simple constraints is #P-hard. Instead of attempting to enforce the constraint on the entire output distribution, we propose to do so on a random, local approximation thereof. More precisely, we optimize the likelihood of the constraint under a pseudolikelihood-based approximation centered around a model sample. Our approximation is factorized, allowing the reuse of solutions to sub-problems, a main tenet for efficiently computing neuro-symbolic losses. Moreover, it is a local, high-fidelity approximation of the likelihood, exhibiting low entropy and KL-divergence around the model sample. We evaluate our approach on Sudoku and shortest-path prediction cast as autoregressive generation, and observe that we greatly improve upon the base model's ability to predict logically-consistent outputs. We also evaluate on the task of detoxifying large language models. Using a simple constraint disallowing a list of toxic words, we are able to steer the model's outputs away from toxic generations, achieving SoTA detoxification compared to previous approaches.
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 d61049b9-c7ac-4002-8dd7-8bb79bda473eCited by top-tier papers8
- Adaptable Logical Control for Large Language ModelsHonghua Zhang, Po-Nien Kung, Masahiro Yoshida, Guy Van den Broeck et al.NeurIPS 2024 · 42 citations
- On the Independence Assumption in Neurosymbolic LearningEmile van Krieken, Pasquale Minervini, Edoardo M. Ponti, Antonio VergariICML 2024 · 18 citations
- Neurosymbolic Diffusion ModelsEmile van Krieken, Pasquale Minervini, Edoardo Maria Ponti, Antonio VergariNeurIPS 2025 · 12 citations
- Compositional Neural Network Verification via Assume-Guarantee ReasoningHai Duong, David Shriver, ThanhVu Nguyen, Matthew DwyerNeurIPS 2025 · 10 citations
- Logically Consistent Language Models via Neuro-Symbolic IntegrationDiego Calanzone, Stefano Teso, Antonio VergariICLR 2025 · 2 citations
Builds on8
- Differentiation of Blackbox Combinatorial SolversMarin Vlastelica Pogancic, Anselm Paulus, Vít Musil, Georg Martius et al.ICLR 2020 · 341 citations
- Einsum Networks: Fast and Scalable Learning of Tractable Probabilistic CircuitsRobert Peharz, Steven Lang, Antonio Vergari, Karl Stelzner et al.ICML 2020 · 155 citations
- Coherent Hierarchical Multi-Label Classification NetworksEleonora Giunchiglia, Thomas LukasiewiczNeurIPS 2020 · 142 citations
- Semantic Probabilistic Layers for Neuro-Symbolic LearningKareem Ahmed, Stefano Teso, Kai-Wei Chang, Guy Van den Broeck et al.NeurIPS 2022 · 133 citations
- Exploring the Limits of Domain-Adaptive Training for Detoxifying Large-Scale Language ModelsBoxin Wang, Wei Ping, Chaowei Xiao, Peng Xu et al.NeurIPS 2022 · 89 citations
Related papers
- Controllable Generation via Locally Constrained ResamplingKareem Ahmed, Kai-Wei Chang, Guy Van den BroeckICLR 2025
- Constraints-Guided Diffusion Reasoner for Neuro-Symbolic LearningXuan Zhang, Zhijian Zhou, Weidi Xu, Yanting Miao et al.AAAI 2026
- MIL-Decoding: Detoxifying Language Models at Token-Level via Multiple Instance LearningXu Zhang, Xiaojun WanACL 2023 · 3 citations
- Contrastive Perplexity for Controlled Generation: An Application in Detoxifying Large Language ModelsTassilo Klein, Moin NabiACL 2025
- CMD: a framework for Context-aware Model self-DetoxificationZecheng Tang, Keyan Zhou, Juntao Li, Yuyang Ding et al.EMNLP 2024 · 1 citation
