Extracting Problem Structure with LLMs for Optimized SAT Local Search

André Schilder, Stefan SzeiderarXiv 2025 · DOI

Abstract

Modern Boolean Satisfiability (SAT) solvers are the workhorses of industrial verification and combinatorial optimization. However, these solvers often suffer from "structural blindness": once a high-level problem is flattened into the "soup" of Conjunctive Normal Form (CNF) clauses, the original logic—such as graph connections or path constraints—becomes obscured. This paper explores a novel framework that uses Large Language Models (LLMs) to analyze original Python encoding code and automatically synthesize specialized local search algorithms that "understand" the problem's hidden architecture.

Introduction

Most state-of-the-art SAT solvers utilize Conflict-Driven Clause Learning (CDCL). To accelerate the search for a solution, these solvers often employ "local search" as a preprocessing step to find a high-quality initial assignment of variables. However, current local search tools are largely generic, treating every problem instance with the same heuristic approach.

Real-world problems, such as scheduling or circuit design, possess rich internal structures. While this structure is preserved in the SAT translation, it is often too opaque for standard tools to exploit. Manually engineering custom local search algorithms for every new problem domain is prohibitively time-consuming. This research investigates whether LLMs can automate the creation of these "structure-aware" algorithms by treating the encoding script itself as a roadmap.

Methodology

The researchers, André Schidler and Stefan Szeider from TU Wien, developed a two-phase pipeline that utilizes the LLM as an expert programmer:

1. The Gathering Phase

The system provides an LLM (such as GPT-4o or Claude 3.5 Sonnet) with the PySAT encoding code—the Python script used to generate the SAT formula. The LLM is tasked with writing a local search function. To ensure code quality, the system includes an automated repair cycle: if the generated code contains bugs or crashes during execution, the error message is fed back to the model for iterative correction until the code runs successfully.

2. The Refinement Phase

The best-performing functions from the gathering phase are iteratively improved. The LLM receives feedback on the algorithm's performance against specific "training instances" and is prompted to optimize the logic further. The resulting algorithms are then used to set the "initial phase" (the starting True/False guesses) for the CaDiCaL SAT solver.

Experimental Setup

The framework was evaluated across three combinatorial problems of increasing complexity:

  • Graph Coloring: A classic NP-complete problem using 257 graphs from TreewidthLib and DIMACS.
  • Directed Feedback Vertex Set (DFVS): A complex problem involving reachability in directed graphs, using 513 graphs from the PACE 2022 challenge.
  • Bounded Depth Decision Trees (BDDT): A highly complex encoding used to find optimal machine learning decision trees, tested on 69 datasets from the PMLB benchmark.

Key Insights

Code as a Semantic Map

A primary finding of the study is that the encoding code is a far more potent source of information for an LLM than the resulting SAT formula. The code contains variable names, loops, and logic structures that signal the problem's intent (e.g., identifying graph edges), allowing the LLM to design heuristics that a solver looking only at CNF would miss.

Heuristic Diversity and Model Specialization

The LLMs demonstrated significant versatility, implementing over 50 different meta-heuristics, including Ant Colony Optimization, Simulated Annealing, and Tabu Search. The researchers also noted distinct "personalities" among models: GPT o1-mini emerged as the most efficient debugger, while Claude 3.5 Sonnet excelled at synthesizing and combining complex heuristics.

Results

The LLM-generated strategies provided substantial performance gains over baseline solvers:

  • Solving the Unsolvable: In the DFVS problem, the LLM-augmented solver successfully found solutions for 12 additional hard instances that the baseline solver could not solve within the allocated time limit.
  • Tackling Complexity: For the BDDT problem, the LLM-generated search enabled the solver to tackle the "objectivity" instance, which had previously been reported as unsolvable within a six-hour window.
  • Automated Discovery: In Graph Coloring, the LLM autonomously "discovered" and implemented classic graph theory heuristics, such as prioritizing nodes with higher degrees, simply by analyzing the encoding script.

Limitations and Future Work

While promising, the approach faces several challenges. The generated algorithms are currently written in Python, which introduces a performance bottleneck compared to the C++ environments used in production solvers. Additionally, the researchers observed "semantic hallucinations," where an LLM's comments described a complex strategy (like Simulated Annealing) while the actual code performed a simple greedy search.

Future research will focus on porting these prototypes to faster languages and using model embeddings to better measure the diversity of generated strategies, potentially deepening the solver's understanding of complex, high-level encodings.

Summary updated

BibTeX
@misc{schilder2025extracting,
  author = {André Schilder and Stefan Szeider},
  title = {{Extracting Problem Structure with LLMs for Optimized SAT Local Search}},
  year = {2025},
  eprint = {2501.14630},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.14630},
}
Figure