UNSAT Solver Synthesis via Monte Carlo Forest Search

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

TL;DR

This paper introduces Monte Carlo Forest Search (MCFS), a novel reinforcement learning approach for synthesizing decision-making policies in complex search problems like proving unsatisfiability in SAT solvers. By cleverly approximating the cost of exploring vast search trees and focusing learning on critical early decisions, Knuth Synthesis, an MCFS instantiation, significantly reduces search space and outperforms strong baselines on challenging benchmarks.

What Problem Does This Paper Address?

Many computationally hard problems, such as proving that a Boolean Satisfiability (SAT) formula has no solution, can be modeled as searching through an exponentially large tree of possibilities. Traditional methods for these problems, like the DPLL algorithm for SAT, rely on "branching policies" – strategies for deciding which variable to assign next. The efficiency of these policies dramatically impacts the size of the search tree and thus the time to find a solution or proof. However, learning optimal branching policies is incredibly difficult because evaluating the true cost of a policy requires exploring the entire, potentially massive, search tree. Existing reinforcement learning (RL) approaches struggle with this "prohibitive cost of policy evaluations" in such large search spaces, limiting their application to much simpler problems. This paper aims to bridge this gap by developing an RL framework that can learn effective branching policies for these complex, tree-structured problems.

Methods

The core contribution is Monte Carlo Forest Search (MCFS), a class of RL algorithms designed for "tree MDPs" (Markov Decision Processes where actions lead to multiple new states). Unlike standard Monte Carlo Tree Search (MCTS) which finds a good path, MCFS aims to find a small tree within a forest of candidate trees.

The paper instantiates MCFS with an algorithm called Knuth Synthesis for learning DPLL branching policies for UNSAT problems. Two key innovations address the prohibitive cost of policy evaluation:

  1. Knuth Sampling: Instead of exhaustively exploring the entire proof tree, Knuth Synthesis uses an unbiased approximation technique based on Knuth's work (1975). It estimates the tree size by randomly sampling paths from the root to a leaf and measuring their lengths. This provides a much cheaper, albeit noisy, estimate of the tree's size.
  2. Bounded Policy Evaluation: The learned policy is not applied to the entire search tree. Instead, it's queried only at nodes above a certain depth threshold (l). Below this depth, a pre-existing, strong "subsolver" is used. This focuses the RL's learning effort on the most critical early decisions that have the largest impact on reducing the overall tree size.

The implementation uses a permutation-equivariant neural network architecture to handle SAT instances of varying sizes and clause/variable permutations.

Datasets

The authors evaluated Knuth Synthesis on three benchmark distributions:

  • R3SAT: A canonical random 3-SAT distribution at the solubility phase transition, a well-studied benchmark.
  • sgen: A notoriously difficult crafted distribution known for its challenging nature relative to its size.
  • satfc: Real-world instances from the 2016 FCC spectrum auction, representing radio-spectrum repacking feasibility problems.

They trained on instances of specific sizes and evaluated generalization on larger instances from the same distributions.

Key Insights and Ideas

  • Reframing the Problem: The core insight is recognizing that for problems like UNSAT, the goal isn't to find a single "best path" (like in Go), but rather to find a "small tree" within a vast forest of possibilities. This reframing necessitates a different approach than standard MCTS.
  • The Power of Early Decisions: The paper highlights that early branching decisions in a search tree have a disproportionately large impact on the overall tree size. Focusing RL efforts on these critical early stages is far more efficient than trying to learn policies for the entire, exponentially growing tree.
  • Approximation is Key: Exact policy evaluation is infeasible for large search spaces. Knuth sampling provides a computationally tractable way to approximate tree size, enabling RL to learn effectively.
  • Hybrid Approach: Combining a learned policy with a strong, existing subsolver below a certain depth is a practical and effective strategy. This leverages the strengths of both learned intelligence and specialized solvers.

Key Results

  • Knuth Synthesis matched or exceeded the performance of a strong baseline (kcnfs) on all three benchmark distributions.
  • The method successfully tackled problems that were two orders of magnitude more challenging than those addressed by previous RL studies, requiring up to 100,000 decisions during training.
  • On the challenging sgen distribution, Knuth Synthesis improved running time by 8% over the kcnfs baseline.
  • For satfc instances, Knuth Synthesis improved running time by 28% over kcnfs.
  • The paper demonstrated significant reductions in search tree size (number of nodes) across various datasets, leading to improved performance. For example, on satfc-hard instances, tree size was reduced by 3.72x compared to kcnfs.

Limitations and Future Work

  • CDCL Solvers: A major limitation is that Knuth Synthesis, as presented, is designed for DPLL solvers and doesn't directly apply to more advanced CDCL (Conflict-Driven Clause Learning) solvers. CDCL solvers break the "tree MDP" assumption by sharing information across subproblems, making Knuth sampling non-trivial. The authors express a desire to generalize MCFS to CDCL solvers.
  • Scalability: While the method tackles more challenging problems, scaling to industrial-size problems with millions of variables is still a challenge due to GPU memory constraints and the need to efficiently search much larger action spaces.
  • Satisfiable Instances: The current framework is primarily for UNSAT problems. Exploring MCFS for satisfiable instances is a future direction.
  • Action Space Reduction: Learning more compact action representations or collapsing similar actions could further improve efficiency.
  • Exploration: The authors mention exploring hybrid ideas that simultaneously search for SAT solutions while shrinking the search space.

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 S. 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