Transformer-based Machine Learning for Fast SAT Solvers and Logic Synthesis

Feng Shi, Chonghan Lee, Mohammad Khairul Bashar, Nikhil Shukla, Song-Chun Zhu, Vijaykrishnan NarayananarXiv 2021

Abstract

Boolean Satisfiability (SAT) and its optimization variant, Maximum Satisfiability (MaxSAT), are fundamental to modern electronic design automation (EDA), particularly in logic synthesis and hardware verification. While traditional Conflict-Driven Clause Learning (CDCL) solvers are highly optimized, their sequential nature limits scalability for massive industrial circuits. This paper introduces TRSAT, a hybrid architecture combining Transformers and Graph Neural Networks (GNNs). TRSAT utilizes 2-hop meta-paths to enable direct communication between related variables and leverages parallelized attention mechanisms for rapid inference. Experimental results demonstrate that TRSAT achieves up to a 184x speedup over traditional heuristic solvers and maintains high completion rates across diverse benchmarks, including real-world logic synthesis tasks.

Introduction

The complexity of modern integrated circuits necessitates efficient algorithms for Boolean Satisfiability. SAT solvers are the engine behind logic optimization, equivalence checking, and formal verification. However, as circuit sizes grow into the millions of gates, traditional solvers like MiniSat or Glucose face bottlenecks due to their sequential search processes.

Recent research has explored machine learning (ML) to accelerate SAT solving. Early models like NeuroSAT treated SAT as a graph learning problem using standard GNNs or Recurrent Neural Networks (RNNs). While promising, these models often suffer from slow convergence and an inability to capture long-range dependencies between variables that are logically related but distant in the graph topology. TRSAT addresses these limitations by adopting a Transformer-based approach designed for high parallelism and global context awareness.

TRSAT Architecture and Methodology

The core of TRSAT lies in its ability to represent and process logical constraints efficiently. The model is built upon three primary pillars: bipartite graph representation, meta-path-based attention, and a differentiable objective function.

Bipartite Graph Representation

A SAT problem in Conjunctive Normal Form (CNF) is naturally represented as a bipartite graph. In this graph, nodes are categorized as either variables ($v_i$) or clauses ($u_j$). An edge exists between a variable node and a clause node if the variable (or its negation) appears within that clause.

Bipartite graph representation of CNF formulas, distinguishing between positive (solid) and negative (dashed) literal polarities.

As shown in the figure above, the model distinguishes between positive and negative literal polarities using different edge types (solid vs. dashed). This structural information is crucial for the model to learn the logical implications of variable assignments.

Meta-Paths and Heterogeneous Attention

Traditional GNNs pass messages only between direct neighbors. In a bipartite SAT graph, this means variables only "talk" to clauses. TRSAT introduces 2-hop meta-paths (Variable $\to$ Clause $\to$ Variable) to allow variables sharing a constraint to communicate directly. This "homogeneous attention" enables the model to capture the influence variables exert on one another more effectively than multi-hop message passing in standard GNNs.

The architecture follows an Encoder-Decoder structure:

  1. Encoder: Performs self-attention among variables using meta-paths.
  2. Decoder: Employs cross-attention to exchange information between the heterogeneous variable and clause nodes.

Differentiable Training

To train the model using gradient descent, the discrete SAT objective is approximated using a "smoothmax" function. This differentiable loss allows the model to learn assignments that maximize the number of satisfied clauses, making it particularly effective for MaxSAT problems.

Application in Logic Synthesis

A key motivation for TRSAT is its application in the logic synthesis pipeline. Logic synthesis involves transforming a high-level Register-Transfer Level (RTL) description into an optimized gate-level netlist. SAT solvers are used in various stages of this flow, such as irredundant Sum-of-Products (SOP) generation and functional factoring.

Integration of SAT solvers within the logic synthesis flow for circuit optimization.

TRSAT acts as a high-speed "one-shot" solver within this flow. By providing high-quality partial or complete assignments rapidly, it can significantly reduce the time spent in the optimization loops shown in the figure above.

Experimental Evaluation

TRSAT was evaluated against both traditional heuristic solvers (WalkSAT, Glucose) and recent RL-based neural solvers (RLSAT).

Benchmarks

The evaluation spanned several categories:

  • Combinatorial Problems: Random 3-SAT, graph $k$-coloring, vertex cover, and clique detection.
  • Industrial Circuits: CNF instances derived from Data Encryption Standard (DES) circuits and arithmetic units like adder-trees and Braun multipliers.
  • Scale: The model handled instances with up to 14,000 variables and 42,000 clauses.

Key Results

  • Inference Speed: TRSAT achieved a massive 184x speedup over WalkSAT on random 3-SAT benchmarks. Its Transformer-based design allows for full parallelization on GPUs, unlike sequential heuristic solvers.
  • Completion Rate: The model reached a 97% completion rate on general SAT problems, outperforming RLSAT, which struggled to scale to larger problem instances.
  • Logic Synthesis Accuracy: On circuit-specific datasets, TRSAT maintained an average completion rate of 88-89% in a single shot, demonstrating its utility as a "warm start" mechanism for exact solvers.

Conclusion and Future Work

TRSAT represents a significant step forward in neural SAT solving. By combining the structural priors of bipartite graphs with the global modeling power of Transformers, it offers a fast, parallelizable alternative to traditional solvers for MaxSAT problems. While it does not yet replace exact solvers for 100% guaranteed solutions, its ability to provide high-quality assignments in a fraction of the time makes it an invaluable tool for accelerating logic synthesis and hardware verification workflows. Future work will focus on tighter integration with backtracking heuristics to create a hybrid solver that combines neural speed with symbolic exactness.

Summary updated

BibTeX
@misc{shi2021transformer,
  author = {Feng Shi and Chonghan Lee and Mohammad Khairul Bashar and Nikhil Shukla and Song-Chun Zhu and Vijaykrishnan Narayanan},
  title = {{Transformer-based Machine Learning for Fast SAT Solvers and Logic Synthesis}},
  year = {2021},
  eprint = {2107.07116},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.07116},
}
Figure