Fast sampling and counting k-SAT solutions in the local lemma regime

Weiming Feng, Heng Guo, Yitong Yin, Chihao Zhang

TL;DR

This paper introduces a breakthrough Markov Chain Monte Carlo (MCMC) approach for sampling and counting satisfying assignments of $k$-SAT formulas in the Lovász Local Lemma (LLL) regime. By running a Markov chain on the marginal distribution of a subset of variables, the authors bypass the traditional "connectivity barrier," achieving near-linear time for sampling and near-quadratic time for counting—a massive speedup over previous state-of-the-art methods.

What Problem Does This Paper Address?

The $k$-SAT problem—finding a satisfying assignment for a Boolean formula—is a cornerstone of computer science. While finding one solution is NP-hard in general, the Lovász Local Lemma (LLL) regime identifies conditions (where clauses don't overlap too much) under which solutions are guaranteed to exist.

However, two related problems remain notoriously difficult even in the LLL regime:

  1. Sampling: Generating a satisfying assignment uniformly at random.
  2. Counting (#SAT): Estimating the total number of satisfying assignments.

The standard tool for these tasks is the Markov Chain Monte Carlo (MCMC) method, specifically Glauber dynamics, which moves between solutions by flipping one variable at a time. The "connectivity barrier" arises because the space of satisfying assignments for SAT is often "shattered" into many disconnected components. If the Markov chain cannot move between these components, it cannot converge to the correct distribution. Previous solutions (like Moitra, 2019) avoided Markov chains but suffered from super-polynomial running times as the variable degree $d$ or clause size $k$ increased.

Methods

The authors propose a novel way to use MCMC that sidesteps the connectivity issue entirely.

  • Variable Marking: They use the Moser-Tardos algorithm to partition variables into "marked" and "unmarked" sets. They ensure every clause contains enough of both.
  • Marginal Glauber Dynamics: Instead of running a Markov chain on all variables, they run it only on the marked variables. By focusing on the marginal distribution, they show that the state space for these variables becomes connected (ergodic) because the unmarked variables act as a "buffer" that absorbs constraints.
  • Approximate Implementation: Calculating exact marginal probabilities is #P-hard. To make the algorithm efficient, the authors use a Sample subroutine. When marked variables are fixed, the remaining formula on unmarked variables "shatters" into small, independent components. They use simple rejection sampling on these components to estimate the transition probabilities of the Markov chain.
  • Simulated Annealing: For the counting problem, they adapt their sampling algorithm into a non-adaptive simulated annealing framework, which gradually introduces constraints to estimate the partition function.

Datasets

As a theoretical computer science paper, no empirical datasets (like those found in computer vision or NLP) were used. The results are proven for the class of $k$-uniform CNF formulas where each variable appears in at most $d$ clauses, satisfying specific constraints on $k$ and $d$.

Key Insights and Ideas

  • Projection as a Solution: The core "aha moment" is that while the full solution space is disconnected, its projection onto a carefully chosen subset of variables is not. This allows the use of well-developed MCMC tools on problems previously thought unreachable by them.
  • Local Uniformity: The authors leverage the fact that in the LLL regime, variables are "almost" independent. This "local uniformity" ensures that the marginal distribution on marked variables is well-behaved and easy to approximate.
  • Path Coupling with Induced Paths: To prove the Markov chain mixes quickly (in $O(n \log n)$ time), the authors developed a new analytical technique based on counting induced paths in a graph of dependencies. This is a more powerful tool than the tree-based analysis used in prior work.

Key Results

  • Fixed-Parameter Tractability: Unlike previous algorithms where the exponent of the running time grew with $d$ and $k$, this algorithm's exponent is fixed.
  • Sampling Speed: For formulas satisfying $k \ge 20 \log k + 20 \log d + 60$, the sampling algorithm runs in close to linear time ($n^{1+\zeta}$ for a small $\zeta$).
  • Counting Speed: The counting algorithm runs in close to quadratic time ($n^{2+\zeta}$).
  • Comparison: Compared to Moitra’s breakthrough (2019) which had a complexity of $n^{O(d^2 k^2)}$, this work provides a significant polynomial speedup, especially when $d$ or $k$ are large (e.g., $\omega(1)$).

Limitations and Future Work

  • The LLL Gap: The condition required for this algorithm ($k \approx 20 \log d$) is still stronger than the theoretical limit of the Lovász Local Lemma ($2^k > ed$). There is still a gap between where we know solutions exist and where we can sample them efficiently.
  • Randomized vs. Deterministic: This approach is inherently randomized. Moitra’s 2019 algorithm remains the only efficient deterministic counter for this regime, albeit much slower.
  • Dynamic Marking: The authors suggest that "pre-Gibbs sampling"—where the set of marked variables changes dynamically—could be a promising direction to further relax the requirements on $k$ and $d$.

Summary updated

BibTeX
@inproceedings{feng2020fast,
  author = {Weiming Feng and Heng Guo and Yitong Yin and Chihao Zhang},
  title = {{Fast sampling and counting k-SAT solutions in the local lemma regime}},
  booktitle = {STOC},
  year = {2020},
  doi = {10.1145/3357713.3384255},
}
Figure