Logic.py: Bridging the Gap between LLMs and Constraint Solvers
Pascal Kesseli, Peter W. O'Hearn, Ricardo Silveira Cabral
Abstract
We present a novel approach to formalise and solve search-based problems using large language models, which significantly improves upon previous state-of-theart results. We demonstrate the efficacy of this approach on benchmarks like the logic puzzles tasks in ZebraLogicBench. Instead of letting the LLM attempt to directly solve the puzzles, our method prompts the model to formalise the problem in a logic-focused, human-readable, domain-specific language (DSL) called Logic.py. This formalised representation is then solved using a constraint solver, leveraging the strengths of both the language model and the solver. Our approach achieves a remarkable 65% absolute improvement over the baseline performance of Llama 3.1 70B on ZebraLogicBench, increasing its accuracy to over 90%. This significant advancement demonstrates the potential of combining language models with domain-specific languages and auxiliary tools on traditionally challenging tasks for LLMs.
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 325133e3-a591-499f-8bf3-d1d6159ca73fCited by top-tier papers2
- LLM-Guided Quantified SMT Solving over Uninterpreted FunctionsKunhang Lv, Yuhang Dong, Rui Han, Fuqi Jia et al.AAAI 2026 · 1 citation
- Open-World LLM Logical ReasoningYe Mo, Chuan Zhou, Fengxiang Cheng, Jialin Yu et al.ICML 2026
Builds on2
Related papers
- ZebraLogic: On the Scaling Limits of LLMs for Logical ReasoningBill Yuchen Lin, Ronan Le Bras, Kyle Richardson, Ashish Sabharwal et al.ICML 2025
- DiLA: Enhancing LLM Tool Learning with Differential Logic LayerYu Zhang, Hui-Ling Zhen, Zehua Pei, Yingzhao Lian et al.KDD 2026 · 6 citations
- SATBench: Benchmarking LLMs' Logical Reasoning via Automated Puzzle Generation from SAT FormulasAnjiang Wei, Yuheng Wu, Yingjia Wan, Tarun Suresh et al.EMNLP 2025 · 1 citation
- A Balanced Neuro-Symbolic Approach for Commonsense Abductive LogicJoseph Cotnareanu, Didier Chételat, Yingxue Zhang, Mark CoatesICLR 2026 · 3 citations
- Lexical Recall or Logical Reasoning: Probing the Limits of Reasoning Abilities in Large Language ModelsHenrike Beyer, Chris ReedACL 2025
