Monte Carlo Forest Search: UNSAT Solver Synthesis via Reinforcement learning

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 learning policies in complex search problems that can be modeled as "tree MDPs." Their implementation, Knuth Synthesis, effectively learns branching policies for SAT solvers, significantly reducing the search tree size and improving performance on challenging unsatisfiable instances.

What Problem Does This Paper Address?

Many complex computational problems, like proving unsatisfiability of Boolean formulas (SAT) or finding optimal solutions in mixed-integer programming, involve searching through an exponentially large space of possibilities. Traditional methods often struggle with the sheer scale of these search spaces. Reinforcement learning (RL) has shown promise in learning effective strategies (policies) for navigating these spaces, but evaluating the performance of a learned policy in such vast trees is computationally prohibitive. This paper tackles the challenge of efficiently learning high-performing policies for these "tree-like" search problems, specifically focusing on the UNSAT (unsatisfiable) case of SAT.

Methods

The core contribution is Monte Carlo Forest Search (MCFS), an extension of Monte Carlo Tree Search (MCTS). While MCTS typically searches for a good path in a tree, MCFS is designed to find a small tree within a forest of possibilities. This is crucial for problems like SAT where the goal is to find a small proof tree demonstrating unsatisfiability.

Knuth Synthesis, their specific MCFS implementation for DPLL-based SAT solvers, employs two key innovations to overcome the computational cost of exact policy evaluation:

  • Knuth Sampling: Instead of exhaustively exploring the entire proof tree, Knuth Synthesis uses an unbiased approximation technique based on Knuth's work [39]. This involves sampling random paths through the tree to estimate its size, significantly reducing computation.
  • Bounded Policy Evaluation: The learned policy is not applied across the entire search tree. Instead, it's used for decisions at shallower depths, and below a certain depth, a strong, pre-existing SAT solver (a "subsolver") is called. This focuses the learning effort on the most critical early decisions that have the greatest impact on reducing tree size.

Datasets

The authors evaluated Knuth Synthesis on three benchmark distributions:

  • R3SAT: A canonical random 3-SAT distribution at the solubility phase transition.
  • sgen: A notoriously difficult crafted distribution known for its challenging nature.
  • satfc: Real-world instances from the 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

  • Tree MDPs are a powerful abstraction: The paper frames problems like DPLL-based SAT solving as "tree MDPs," allowing them to leverage RL techniques designed for sequential decision-making in hierarchical structures.
  • Focusing on early decisions is key: The insight that early branching decisions in a SAT search tree have a disproportionately large impact on the overall tree size is central to their approach. By bounding the policy's application depth and using a subsolver, they efficiently target these crucial decisions.
  • Knuth sampling offers a practical trade-off: While not as precise as full exploration, Knuth sampling provides a computationally feasible way to estimate tree size, enabling RL to learn effective policies without prohibitive costs.
  • RL can synthesize effective solvers: The work demonstrates that RL can learn branching policies that outperform hand-tuned heuristics, even on highly optimized SAT solvers.

Key Results

Knuth Synthesis achieved competitive or improved performance compared to strong baselines (like kcnfs) on all three benchmark distributions. Notably:

  • They matched or exceeded baseline performance on R3SAT, sgen, and satfc.
  • Knuth Synthesis tackled problems that were two orders of magnitude more challenging than those addressed in previous RL studies, requiring up to 100,000 decisions during training.
  • On the satfc dataset, Knuth Synthesis reduced tree size by 3.72x and running time by 1.28x compared to kcnfs.
  • The method showed good generalization to larger problem sizes not seen during training.

Limitations and Future Work

  • Scalability to CDCL solvers: The current MCFS framework is based on the tree MDP assumption, which doesn't directly apply to more complex CDCL solvers that incorporate clause learning and history-dependent policies. Generalizing MCFS to CDCL is a significant future direction.
  • Memory constraints: Training on extremely large instances (millions of variables) is currently limited by GPU memory. The authors suggest exploring model parallelism and memory-efficient techniques.
  • Action space reduction: For very large action spaces, learning an action representation and collapsing similar actions could improve efficiency.
  • Satisfiable instances: The current work focuses on unsatisfiable instances. Exploring how MCFS can be applied to finding SAT solutions, potentially by combining proof tree shrinking with solution finding, is another avenue.
  • Exploration of hybrid approaches: The authors are interested in hybrid ideas that simultaneously search for SAT solutions and shrink 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 leverages two key ideas to avoid the prohibitive costs of policy evaluations in an exponentially-sized tree. 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 improved performance over a strong baseline on three well-known SAT distributions (R3SAT, sgen, satfc).
BibTeX
@inproceedings{cameron2024monte,
  author = {Chris Cameron and Jason S. Hartford and Taylor Lundy and Tuan Truong and Alan Milligan and Rex Chen and Kevin Leyton-Brown},
  title = {{Monte Carlo Forest Search: UNSAT Solver Synthesis via Reinforcement learning}},
  booktitle = {CPAIOR},
  year = {2024},
  doi = {10.1007/978-3-031-60597-0\_12},
}
Figure