UNSAT Solver Synthesis via Monte Carlo Forest Search

Chris Cameron, Jason Hartford, Taylor Lundy, Tuan Truong, Alan Milligan, Rex Chen, Kevin Leyton-Brown

TL;DR

The authors introduce Monte Carlo Forest Search (MCFS), a reinforcement learning framework designed for problems where the goal is to find a small proof tree rather than a single solution path. By combining this with Knuth Sampling—a technique to estimate tree size from random paths—they developed "Knuth Synthesis," the first RL approach capable of learning SAT branching policies for problems two orders of magnitude larger than previous state-of-the-art RL methods.

What Problem Does This Paper Address?

In many combinatorial problems, like proving a Boolean formula is unsatisfiable (UNSAT), the goal isn't just to find a "needle in a haystack" (a single satisfying assignment). Instead, you must prove that no such assignment exists by building a proof tree that covers every possibility.

The size of this tree depends heavily on the "branching policy"—the order in which you decide to assign variables. A bad policy leads to an exponentially large tree, while a good one can find a compact proof.

The challenge for Reinforcement Learning (RL) is that evaluating a single policy requires traversing this massive tree, which is computationally prohibitive. Consequently, previous RL attempts were stuck solving "toy" problems requiring only about 1,000 decisions. This paper aims to scale RL to "industrial-strength" problems requiring 100,000+ decisions.

Fig. 1: A proof tree shows that any variable assignment to an unsatisfiable instance leads to a conflict. Its size substantially varies with the choice of branching policy.

Methods

The authors propose Monte Carlo Forest Search (MCFS), an extension of Monte Carlo Tree Search (MCTS). While standard MCTS searches for a high-reward path, MCFS searches for a policy that minimizes the total size of the resulting tree.

To make this tractable, they introduce Knuth Synthesis, which relies on two "aha" ideas:

  1. Knuth Sampling: Instead of building the entire proof tree to measure its size, they use an unbiased estimator from 1975. By sampling a few random paths to their leaves and measuring their lengths, they can statistically estimate the size of the full tree. This turns a "tree evaluation" problem back into a "path evaluation" problem, which MCTS is great at.
  2. Bounded-Depth Search: They recognize that the most impactful decisions happen at the top of the tree. They use a Deep Neural Network (DNN) to make decisions only up to a certain depth $\ell$. Below that depth, they hand the sub-problem over to a fast, existing "subsolver" (like the kcnfs heuristic).
Fig. 2: Two keys ideas of Knuth Synthesis to avoid the prohibitive costs of exact tree-size policy evaluations: (1) bounded-depth search and (2) Knuth samples.

The policy itself is a Permutation-Equivariant Graph Neural Network, which ensures that the model treats the SAT formula consistently regardless of how the variables or clauses are ordered in memory.

Datasets

The authors evaluated their method on three distinct unsatisfiable SAT distributions:

  • R3SAT: Uniform random 3-SAT at the "phase transition" (the point where problems are hardest).
  • sgen: A notoriously difficult "crafted" distribution designed to be hard for its size.
  • satfc: Real-world instances derived from radio-spectrum repacking feasibility problems in FCC auctions.

Crucially, they tested "upward size generalization"—training on smaller problems and testing on larger ones—to see if the learned heuristics actually scale.

Key Insights and Ideas

  • The Power of the Root: In a proof tree, a single mistake at the root can double the size of the entire tree. By focusing the expensive neural network on the first few levels and using cheap heuristics for the "leaves," the authors get the best of both worlds: high-quality decisions where they matter most and speed where they don't.
  • Tree MDPs: The paper leverages the concept of "Tree Markov Decision Processes." In a standard MDP, an action leads to one new state. In a Tree MDP, an action (like branching on a variable) splits the world into two or more independent sub-problems.
  • Overcoming the RL Scaling Wall: By using Knuth Sampling, the authors found a way to provide a "reward signal" to the RL agent without waiting for an exponential-sized process to finish.

Key Results

Knuth Synthesis matched or outperformed kcnfs, a highly specialized, hand-tuned solver that has won SAT competitions.

  • Tree Size Reduction: On the satfc (real-world) distribution, they reduced the proof tree size by 3.72x compared to the baseline. On the difficult sgen distribution, they achieved a 23% reduction.
  • Wall-clock Speedup: Despite the overhead of running a deep neural network, they achieved a 28% improvement in total running time on satfc and an 8% improvement on the largest sgen instances.
  • Scaling: They successfully trained on problems requiring 100,000 decisions, a 100-fold increase over prior RL-for-SAT research.

Limitations and Future Work

  • CDCL Integration: Most modern SAT solvers use "Conflict-Driven Clause Learning" (CDCL), which shares information across different branches of the tree. This breaks the "Tree MDP" assumption (where sub-problems are independent), making it difficult to apply MCFS directly to the most powerful class of solvers.
  • Action Space: For industrial problems with millions of variables, the "action space" (which variable to pick) becomes too large for current GNN architectures to handle efficiently.
  • SAT vs. UNSAT: The current framework is specifically for proving unsatisfiability. Applying this to satisfiable instances (finding a single solution) is a different challenge, as the "tree" property no longer holds once a solution is found in one branch.

Summary updated

Abstract

We introduce Monte Carlo Forest Search (MCFS), a class of reinforcement learning (RL) algorithms for learning policies in {tree MDPs}, for which policy execution involves traversing an exponential-sized tree. Examples of such problems include proving unsatisfiability of a SAT formula; counting the number of solutions of a satisfiable SAT formula; and finding the optimal solution to a mixed-integer program. MCFS algorithms can be seen as extensions of Monte Carlo Tree Search (MCTS) to cases where, rather than finding a good path (solution) within a tree, the problem is to find a small tree within a forest of candidate trees. We instantiate and evaluate our ideas in an algorithm that we dub Knuth Synthesis, an MCFS algorithm that learns DPLL branching policies for solving the Boolean satisfiability (SAT) problem, with the objective of achieving good average-case performance on a given distribution of unsatisfiable problem instances. Knuth Synthesis is the first RL approach to avoid the prohibitive costs of policy evaluations in an exponentially-sized tree, leveraging two key ideas: first, we estimate tree size by randomly sampling paths and measuring their lengths, drawing on an unbiased approximation due to Knuth (1975); second, we query a strong solver at a user-defined depth rather than learning a policy across the whole tree, to focus our policy search on early decisions that offer the greatest potential for reducing tree size. We matched or exceeded the performance of a strong baseline on three well-known SAT distributions, facing problems that were two orders of magnitude more challenging than those addressed in previous RL studies.
BibTeX
@inproceedings{cameron2024unsat,
  author = {Chris Cameron and Jason Hartford and Taylor Lundy and Tuan Truong and Alan Milligan and Rex Chen and Kevin Leyton-Brown},
  title = {{UNSAT Solver Synthesis via Monte Carlo Forest Search}},
  booktitle = {CPAIOR},
  year = {2024},
  doi = {10.1007/978-3-031-60597-0\_12},
}
Figure