atlas

Research map / Large language models / Agents, code and math

Logic.py: Bridging the Gap between LLMs and Constraint Solvers

NeurIPS 2025 · Large language models › Agents, code and math · approach: LLMs for optimization and heuristics · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Introduces Logic.py, a Python-based DSL that Llama 3.1 70B uses to formalise Zebra logic puzzles, which are then solved by the CBMC constraint solver, reaching 91.4% on ZebraLogicBench.

Problem

LLMs struggle to directly solve search-based logic puzzles such as Zebra/logic grid puzzles, requiring reasoning over many interacting constraints.

Approach

Instead of having the LLM solve puzzles directly, prompt it to formalise the problem in a logic-focused Python-syntax DSL (Logic.py) with type decorators and nondeterministic variables, transpile it via libCST to C, and solve it with CBMC's SAT/SMT backend.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add Logic.py formalisation and constraint-solver solving to direct Llama 3.1 70B Instruct puzzle solvingLlama 3.1 70B Instruct · ZebraLogicBench allpuzzle accuracy: 24.9 -> 91.4Helped
Add Logic.py formalisation and constraint-solver solving to direct Llama 3.1 70B Instruct puzzle solvingLlama 3.1 70B Instruct · ZebraLogicBench Easypuzzle accuracy: 73.57 -> 97.86Helped
Add Logic.py formalisation and constraint-solver solving to direct Llama 3.1 70B Instruct puzzle solvingLlama 3.1 70B Instruct · ZebraLogicBench Hardpuzzle accuracy: 5.97 -> 88.89Helped
Add Logic.py formalisation and constraint-solver solving to direct Llama 3.1 70B Instruct puzzle solvingLlama 3.1 70B Instruct · ZebraLogicBenchcell accuracy: 27.98 -> 92.98Helped

Surprising findings

Limitations

Experimental setup

Datasets: ZebraLogicBench

Benchmarks: ZebraLogicBench

Metrics: puzzle accuracy cell accuracy

Baselines: o1-preview o1-mini claude-3-5-sonnet gpt-4o Llama-3.1-405B-Instruct gemini-1.5-pro Mistral-Large-2 claude-3-opus Qwen2.5-72B-Instruct Meta-Llama-3.1-70B-Instruct

Builds on: Logic-LM SatLM CBMC libCST

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy