key: cord-0046700-gh6r60c5 authors: Agrawal, Durgesh; Bhavishya; Meel, Kuldeep S. title: On the Sparsity of XORs in Approximate Model Counting date: 2020-06-26 journal: Theory and Applications of Satisfiability Testing - SAT 2020 DOI: 10.1007/978-3-030-51825-7_18 sha: 5a09fda591e2442993ba9663cf16e1471671d978 doc_id: 46700 cord_uid: gh6r60c5 Given a Boolean formula [Formula: see text], the problem of model counting, also referred to as #SAT, is to compute the number of solutions of [Formula: see text]. The hashing-based techniques for approximate counting have emerged as a dominant approach, promising achievement of both scalability and rigorous theoretical guarantees. The standard construction of strongly 2-universal hash functions employs dense XORs (i.e., involving half of the variables in expectation), which is widely known to cause degradation in the runtime performance of state of the art [Formula: see text] solvers. Consequently, the past few years have witnessed an intense activity in the design of sparse XORs as hash functions. Such constructions have been proposed with beliefs to provide runtime performance improvement along with theoretical guarantees similar to that of dense XORs. The primary contribution of this paper is a rigorous theoretical and empirical analysis to understand the effect of the sparsity of XORs. In contradiction to prior beliefs of applicability of analysis for sparse hash functions to all the hashing-based techniques, we prove a contradictory result. We show that the best-known bounds obtained for sparse XORs are still too weak to yield theoretical guarantees for a large class of hashing-based techniques, including the state of the art approach [Formula: see text]. We then turn to a rigorous empirical analysis of the performance benefits of sparse hash functions. To this end, we first design, to the best of our knowledge, the most efficient algorithm called [Formula: see text] using sparse hash functions, which achieves at least up to two orders of magnitude performance improvement over its predecessor. Contradicting the current beliefs, we observe that [Formula: see text] still falls short of [Formula: see text] in runtime performance despite the usage of dense XORs in [Formula: see text]. In conclusion, our work showcases that the question of whether it is possible to use short XORs to achieve scalability while providing strong theoretical guarantees is still wide open. Given a Boolean formula ϕ, the problem of model counting, also referred to as #SAT, is to compute the number of solutions of ϕ. Model counting is a fundamental problem in computer science with a wide range of applications ranging from quantified information flow, reliability of networks, probabilistic programming, Bayesian networks, and others [4, 5, 10, 16, [21] [22] [23] . Given the computational intractability of #SAT, attention has been focused on the approximation of #SAT [28, 30] . In a breakthrough result, Stockmeyer provided a hashing-based randomized approximation scheme for counting that makes polynomially many invocations of an NP oracle [27] . The procedure, however, was computationally prohibitive in practice at that time, and no practical tools existed based on Stockmeyer's proposed algorithmic framework until the early 2000s [16] . Motivated by the success of SAT solvers, there has been a surge of interest in the design of hashing-based techniques for approximate model counting in the past decade [8, 9, 13, 15, 24, 25] . The core idea of the hashing-based framework is to employ pairwise independent hash functions 1 to partition the solution space into roughly equal-sized small cells, wherein a cell is called small if it has solutions less than or equal to a pre-computed threshold, denoted by thresh. A SAT solver is employed to check if a cell is small by enumerating solutions one-by-one until either there are no more solutions or we have already enumerated thresh + 1 solutions. The current state of the art techniques can be broadly classified into two categories: -The first category of techniques, henceforth called Cat1, consists of techniques that compute a constant factor approximation by setting thresh to a constant and use Stockmeyer's technique of constructing multiple copies of the input formula. [1, 2, 12, 29 ,31] -The second class of techniques, henceforth called Cat2, consists of techniques that directly compute an (ε, δ)-estimate by setting thresh to O( 1 ε 2 ), and hence invoking the underlying NP oracle O( 1 ε 2 ) times [7] [8] [9] 20, 21, 24, 25] . The current state of the art technique, measured by runtime performance, is ApproxMC3, which falls into the class of Cat2 techniques [25] . The proofs of correctness for all the hashing-based techniques involve the use of concentration bounds due to pairwise independent hash functions. The standard construction of pairwise independent hash functions employed in these techniques can be expressed as a conjunction of XOR constraints such that every variable is chosen with probability f = 1/2 for each XORs. As such, each XOR contains, on an average, n/2 variables. A SAT solver is invoked to enumerate solutions of the formula ϕ in conjunction with these XOR constraints. The performance of SAT solvers, however, degrades with an increase in the size of XORs [15] . Therefore recent efforts have focused on the design of hash functions 1 Pairwise independent hash functions were initially referred to as strongly 2-universal hash functions in [6] . The prior work on approximate counting often uses the term 2-universal hashing to refer to strongly 2-universal hash functions. where each variable is chosen with probability f < 1/2 [1, 2, 11, 14, 17] . We refer to the XOR constructed with f = 1/2 as dense XORs while those constructed with f < 1/2 as sparse XORs. In particular, given a hash function, h and cell α, the random variable of interest, denoted by Cnt ϕ,h,α is the number of solutions of ϕ that h maps to cell α. The pairwise independence of dense XORs is known to bound the variance of Cnt ϕ,h,α by the expectation of Cnt ϕ,h,α , which is sufficient for their usage for both Cat1 and Cat2 techniques. In a significant result, Asteris and Dimakis [3] , and Zhao et al. [31] showed that f = O(log n/n) asymptotically suffices for Cat1 techniques. It is worth pointing that f = O(log n/n) provides weaker guarantees on the variance of Cnt ϕ,h,α as compared to the case when f = 1/2. However, Zhao et The reader may observe that Zhao et al.'s paper does not compare their proposed algorithm for (ε, δ)-guarantees, called SparseCount, with state of the art algorithms at that time such as ApproxMC2, which is now in its third version, ApproxMC3 [25] . Therefore the question of whether the proposed sparse XORs are efficient in runtime was not settled. It is perhaps worth remarking that another line of work based on the construction of sparse XORs using low-density parity codes is known to introduce significant slowdown [1, 2] (See Section 9 of [1] ). The primary contribution of this paper is a rigorous theoretical and empirical analysis to understand the effect of sparse XORs for approximate model counters. In particular, we make the following key contributions: 1. We prove that the bounds obtained by Zhao et al., which are the strongest known bounds at this point, for the variance of Cnt ϕ,h,α , are still too weak for the analysis of ApproxMC3. To the best of our knowledge, this is the first time the need for stronger bounds in the context of Cat2 techniques has been identified. 2. Since the weakness of bounds prevents usage of sparse hash functions in ApproxMC3, we design the most efficient algorithm, to the best of our knowledge, using sparse hash functions. To this end, we propose an improvement of SparseCount, called SparseCount2, that reduces the number of SAT calls from linear to logarithmic and significantly improves the runtime performance of SparseCount. The improvement from linear to logarithmic uses the idea of prefix-slicing introduced by Chakraborty, Meel, and Vardi [9] for ApproxMC2. 3. We next present a rigorous empirical study involving a benchmark suite totaling over 1800 instances of runtime performance of SparseCount2 vis-a-vis the state of the art approximate counting technique, ApproxMC3. Surprisingly and contrary to current beliefs, we discover that ApproxMC3, which uses dense XORs significantly outperforms SparseCount2 for every benchmark. It is worth remarking that both ApproxMC3 and SparseCount2 use identical SAT solver for underlying SAT calls and similar to other hashing-based techniques, over 99% for each of the algorithms is indeed consumed by the underlying SAT solver. Given the surprising nature of our results, few words are in order. First of all, our work identifies the tradeoffs involved in the usage of sparse hash functions and demonstrates that the variance bounds offered by sparse hash functions are too weak to be employed in the state of the art techniques. Secondly, our work demonstrates that the weakness of variance bounds leads to such a large overhead that the algorithms using sparse hash functions scale much worse compared to the algorithms without sparse XORs. Thirdly and finally, we believe the negative results showcase that the question of the usage of sparse XORs to achieve scalability while providing strong theoretical guarantees is still wide open. In an upcoming work, Meel r Akshay 2 [20] define a new family of hash functions, called concentrated hashing, and provide a new construction of sparse hash functions belonging to concentrated hashing, and design a new algorithmic framework on top of ApproxMC, which is shown to achieve runtime improvements. The rest of the paper is organized as follows. We discuss notations and preliminaries in Sect. 2. We then discuss the weakness of guarantees offered by sparse XORs in Sect. 3. In Sect. 4, we seek to design an efficient algorithm that utilizes all the advancements, to the best of our knowledge, in approximate model counting community. We present a rigorous empirical study comparing performance of SparseCount, SparseCount2, and ApproxMC3 in Sect. 5 and conclude in Sect. 6. Let ϕ be a Boolean formula in conjunctive normal form (CNF), and let Vars(ϕ) be the set of variables appearing in ϕ. The set Vars(ϕ) is also called the support of ϕ. Unless otherwise stated, we will use n to denote the number of variables in ϕ i.e., |Vars(ϕ)|. An assignment of truth values to the variables in Vars(ϕ) is called a satisfying assignment or witness of ϕ if it makes ϕ evaluate to true. We denote the set of all witnesses of ϕ by R ϕ . We write Pr [Z] to denote the probability of outcome Z. The expected value of Z is denoted E [Z] and its variance is denoted The propositional model counting problem is to compute |R ϕ | for a given CNF formula ϕ. A probably approximately correct (PAC) counter is a probabilistic algorithm ApproxCount(·, ·, ·) that takes as inputs a formula F , a tolerance ε > 0, and a confidence parameter δ ∈ (0, 1], and returns a count c with (ε, δ)- In this work, we employ a family of universal hash functions. Let H(n, m) We use h R ← − H to denote the probability space obtained by choosing a function h uniformly at random from H. In this work, we will use the concept of prefix-slicing introduced by Chakraborty et al. [9] . For h ∈ H(n, m), formally, for every j ∈ {1, . . . , m}, The randomness in the choices of h and α induce randomness in the choices of h (m) and α (m) . However, the (h (j) , α (j) ) pairs chosen for different values of j are no longer independent. Specifically, For the sake of notational clarity, whenever h (i) and α (i) are clear from the context, we will use Cnt i as a shorthand for Cnt F,h (i) ,α (i) . (also known as strongly 2-universal) Since we can represent hash functions in H {fi} (n, m) using a set of XORs; we will use dense XORs to refer to hash functions with f i = 1 2 for all i while we use sparse XORs to refer to hash functions with f i < 1 2 for some i. Note that H {fi= 1 2 } (n, m) is the standard pairwise independent hash family, also denoted as H xor (n, m) in earlier works [21] . Gomes et al. [14] first identified the improvements in solving time due to the usage of sparse XORs in approximate model counting algorithms. The question of whether sparse XORs can provide the required theoretical guarantees was left open. A significant progress in this direction was achieved by Ermon et al. [11] , who provided the first rigorous analysis of the usage of sparse XOR constraints. Building on Ermon et al., Zhao et al. [31] and Asteris and Dimakis [3] independently provided further improved analysis of Ermon et al. and showed that probability f = O( log n n ) suffices to provide constant factor approximation, which can be amplified to (1 + ε) approximation. While the above mentioned efforts focused on each entry of A to be i.i.d., Achlioptas and Theodorpoulos [2] , Achlioptas, Hammoudeh, and Theodorpoulos [1] investigated the design of hash functions where A is a structured matrix by drawing on connections to the error correcting codes. While their techniques provide a construction of sparse constraints, the constants involved in asymptotics lead to impractical algorithms for (ε, δ) guarantees (See Sect. 9 of [1] ). The work of Achlioptas et al. demonstrates the promise and limitations of structured random matrices in the design of hashing-based algorithms; however, there is no such study in the case when all the entries are i.i.d. In this paper, we theoretically improve the construction proposed by Asteris and Dimakis [3] , and Zhao et al. [31] and perform a rigorous empirical study to understand the tradeoffs of sparsity. In this section, we present the first contribution of this paper: demonstration of the weakness of theoretical guarantees obtained in prior work [3, 11, 31] for sparse XORs. To this end, we investigate whether the bounds offered by Zhao et al. on the variance of Cnt i , which are the strongest bounds known on sparse XORs, can be employed in the analysis of Cat2 techniques. For clarity of exposition, we focus on the usage of sparse XOR bounds in ApproxMC3, but our conclusions extend to other Cat2 techniques, as pointed out below. The analysis of ApproxMC3 employs the bounds on the variance of Cnt i using the following standard concentration bounds. For every β > 0,0 < ε ≤ 1, 0 ≤ i ≤ n, we have: Recall, that the core idea of the hashing-based framework is to employ 2universal hash functions to partition the solution space into roughly equal sized small cells, wherein a cell is called small if it has solutions less than or equal to a pre-computed threshold, denoted by thresh, which is chosen as O(1/ε 2 ). To this end, the analysis lower bounds E[Cnt i ] by thresh 2 , which allows the denominator to be lower bounded by a constant. Given that thresh can be set to O( 1 ε 2 ) 1/c for some c > 0, we can relax the requirement on the chosen hash family to ensuring We now investigate the guarantees provided by sparse XORs. To this end, we first recall the following result, which follows from combining Theorem 1 and Theorem 3 of [11] . Pr Cnt i − E[Cnt i ] ≥ ε 1 + ε E[Cnt i ] ≤ (1 + ε) 2 σ 2 [Cnt i ] ε 2 E[Cnt i ] 2 Zhao et al. [31] , building on Ermon et al. [11] , obtain the following bound (see, Lemma 8 and Lemma 10 of [31] ). The bound on σ 2 [Cnt i ] from Zhao et al. can be stated as: Proof. Substituting k = 2 m η(1 − 1 |RF | ), we have: Recall, the analysis of ApproxMC3 requires us to upper bound σ 2 [Cnt i ] by E[Cnt i ] 2−c for c > 0. Since the best-known bounds on σ 2 [Cnt i ] lower bound σ 2 [Cnt i ] by E[Cnt i ] 2 , these bounds are not sufficient to be used by ApproxMC3. At this point, one may wonder as to what is the key algorithmic difference between Cat1 and Cat2 that necessitates the use of stronger bounds: Cat1 techniques compute a constant factor approximation and then make use of Stockmeyer's argument to lift a constant factor approximation to (1 + ε)-approximation, whereas, Cat2 techniques directly compute a (1 + ε)approximation, which necessitates the usage of stronger concentration bounds. The inability of sparse XORs to provide good enough bounds on variance for usage in Cat2 techniques, in particular ApproxMC3, leads us to ask: how do we design the most efficient algorithm for approximate model counting making use of the existing gadgets in the model counting literature. We recall that Zhao et al. [31] provided matching necessary and sufficient conditions on the required asymptotic density of matrix A. Furthermore, they proposed a hashing-based algorithm, SparseCount, that utilizes sparser constraints. As mentioned earlier, Chakraborty et al. [9] proposed the technique of using prefix-slicing of hash functions in the context of hashing-based techniques and their empirical evaluation demonstrated significant theoretical and empirical improvements owing to the usage of prefix hashing. In this work, we first show a dramatic reduction in the complexity of SparseCount by utilizing the concept of prefix-slicing and thereby improving the number of SAT calls from O(n log n) to O((log n) 2 ) for fixed ε and δ The modified algorithm, called SparseCount2, significantly outperforms SparseCount, as demonstrated in Sect. 5. Algorithm 1 shows the pseudo-code for SparseCount2. SparseCount2 assumes access to SAT oracle that takes in a formula ϕ and returns YES if ϕ is satisfiable, otherwise it returns NO. Furthermore, SparseCount2 assumes access to the subroutine MakeCopies that creates multiple copies of a given formula, a standard technique first proposed by Stockmeyer [27] to lift a constant factor approximation to that of (1 + ε)-factor approximation for arbitrary ε. Similar to Algorithm Note that CoreSearch is invoked T times, where T = log(n/δ) Δ (n, δ, Δ as defined in the algorithm) and the returned value is added to the list C. We then return the median of C. It is worth noting that SparseCount2 and ApproxMC3 differ only in the usage of thresh, which is set to 1 for SparseCount2 and a function of ε for ApproxMC3, as observed in the discussion following Lemma 1. The usage of thresh dependent on ε requires stronger bounds on variance, which can not be provided by sparse XORs as discussed in the previous section. We now present the theoretical analysis of SparseCount2. It is worth asserting that the proof structure and technique for SparseCount2 and ApproxMC3 are significantly different, as is evident from the inability of ApproxMC3 to use sparse XORs. Therefore, while the algorithmic change might look minor, the proof of correctness requires a different analysis. Proof. Similar to [31] , we assume that |R ϕ | is a power of 2; a relaxation of the assumption simply introduces a constant factor in the approximation. Let |R ψ | = 2 i * and for we define the variable Cnt t i to denote the value of Cnt i when iter = t. Now notice that |R ψ | = |R ϕ | 1 log 4 (1+ε) ; Therefore, We focus on empirical study for comparison of runtime performance of SparseCount, SparseCount2, and ApproxMC3. All the three algorithms, SparseCount, SparseCount2, and ApproxMC3, are implemented in C++ and use the same underlying SAT solver, CryptoMiniSat [26] augmented with the BIRD framework introduced in [24, 25] . CryptoMiniSat augmented with BIRD is state of the art SAT solver equipped to handle XOR constraints natively. It is worth noting that for hashing-based techniques, over 99% of the runtime is consumed by the underlying SAT solver [25] . Therefore, the difference in the performance of the algorithms is primarily due to the number of SAT calls and the formulas over which the SAT solver is invoked. Furthermore, our empirical conclusions do not change even using the older versions of CryptoMiniSat. We conducted experiments on a wide variety of publicly available benchmarks. Our benchmark suite consists of 1896 formulas arising from probabilistic inference in grid networks, synthetic grid structured random interaction Ising models, plan recognition, DQMR networks, bit-blasted versions of SMTLIB benchmarks, ISCAS89 combinational circuits, and program synthesis examples. Every experiment consisted of running a counting algorithm on a particular instance with a timeout of 4500 s. The experiments were conducted on a highperformance cluster, where each node consists of E5-2690 v3 CPU with 24 cores and 96GB of RAM. We set ε = 0.8 and δ = 0.2 for all the tools. The objective of our empirical study was to seek answers to the following questions: 1. How does SparseCount compare against SparseCount2 in terms of runtime performance? 2. How does SparseCount2 perform against ApproxMC3 in terms of runtime? Overall, we observe that SparseCount2 significantly outperforms SparseCount. On the other hand, ApproxMC3 outperforms SparseCount2 with a mean speedup of 568.53×. Our conclusions are surprising and stand in stark contrast to the widely held belief that the current construction of sparse XORs by Zhao et al. [31] and Ermon et al. [11] lead to runtime improvement [1, 18, 19] . Figure 1 shows the cactus plot for SparseCount, SparseCount2, and ApproxMC3. We present the number of benchmarks on x−axis and the time taken on y−axis. A point (x, y) implies that x benchmarks took less than or equal to y seconds for the corresponding tool to execute. We present a runtime comparison of SparseCount2 vis-a-vis SparseCount and ApproxMC3 in Table 1 . Column 1 of this table gives the benchmark name while column 2 and 3 list the number of variables and clauses, respectively. Column 4, 5, and 6 list the runtime (in seconds) of SparseCount, SparseCount2 and ApproxMC3, respectively. Note that "TO" stands for timeout. For lack of space, we present results only on a subset of benchmarks. The detailed logs along with list of benchmarks and the binaries employed to run the experiments are available at http://doi.org/10. 5281/zenodo. 3792748 We present relative comparisons separately for ease of exposition and clarity. As shown in Fig. 1 , with a timeout of 4500 s, SparseCount could only finish execution on 90 benchmarks while SparseCount2 completed on 379 benchmarks. Note that SparseCount2 retains the same theoretical guarantees of SparseCount. For a clear picture of performance gain achieved by SparseCount2 over SparseCount, we turn to Table 1 . Table 1 clearly demonstrates that SparseCount2 outperforms SparseCount significantly. In particular, for all the benchmarks where both SparseCount and SparseCount2 did not timeout, the mean speedup is 10.94×. Explanation. The stark difference in the performance of SparseCount and SparseCount2 is primarily due to a significant reduction in the number of SAT calls in SparseCount2. Recall, SparseCount invokes the underlying SAT solver O(n log n) times while SparseCount invokes the underlying SAT solver only O(log 2 n) times. As discussed above, such a difference was achieved due to the usage of prefix-slices. With a timeout of 4500 s, SparseCount2 could only finish execution on 379 benchmarks while ApproxMC3 finishes execution on 1169 benchmarks. Furthermore, Table 1 clearly demonstrates that ApproxMC3 significantly outperforms SparseCount2. In particular, for all the formulas where both SparseCount2 and ApproxMC3 did not timeout, the mean speedup is 568.53×. In light of recent improvements in CryptoMiniSat, one may wonder if the observations reported in this paper are mere artifacts of how the SAT solvers have changed in the past few years and perhaps such a study on an earlier version of CryptoMiniSat may have led to a different conclusion. To account for this threat of validity, we conducted preliminary experiments using the old versions of CryptoMiniSat and again observed that similar observations hold. In particular, the latest improvements in CryptoMiniSat such as BIRD framework [24, 25] favor SparseCount and SparseCount2 relatively in comparison to ApproxMC3. Explanation. The primary contributing factor for the difference in the runtime performance of SparseCount2 and ApproxMC3 is the fact that weaker guarantees for the variance of Cnt i necessitates the usage of Stockmeyer's trick of usage of the amplification technique wherein the underlying routines are invoked over ψ instead of ϕ. Furthermore, the weak theoretical guarantees also lead to a larger value of T as compared to its analogous parameter in ApproxMC3. It is worth noticing that prior work on the design of sparse hash function has claimed that the usage of sparse hash functions leads to runtime performance improvement of the underlying techniques. Such inference may perhaps be drawn based only on observing the time taken by a SAT solver on CNF formula with a fixed number of XORs and only varying the density of XORs. While such an observation does indeed highlight that sparse XORs are easy for SAT solvers, but it fails, as has been the case in prior work, to take into account the tradeoffs due to the weakness of theoretical guarantees of sparse hash functions. To emphasize this further, the best known theoretical guarantees offered by sparse XORs are so weak that one can not merely replace the dense XORs with sparse XORs. The state of the art counters such as ApproxMC3 require stronger guarantees than those known today. Hashing-based techniques have emerged as a promising paradigm to attain scalability and rigorous guarantees in the context of approximate model counting. Since the performance of SAT solvers was observed to degrade with an increase in the size of XORs, efforts have focused on the design of sparse XORs. In this paper, we performed the first rigorous analysis to understand the theoretical and empirical effect of sparse XORs. Our conclusions are surprising and stand in stark contrast to the widely held belief that the current construction of sparse XORs by Zhao et al. [31] and Ermon et al. [11] lead to runtime improvement. We demonstrate that the theoretical guarantees offered by the construction as mentioned earlier are still too weak to be employed in the state of the art approximate counters such as ApproxMC3. Furthermore, the most efficient algorithm using sparse XORs, to the best of our knowledge, still falls significantly short of ApproxMC3 in runtime performance. While our analysis leads to negative results for the current state of the art sparse construction of hash functions, we hope our work would motivate other researchers in the community to investigate the construction of efficient hash functions rigorously. In this spirit, concurrent work of Meel r Akshay [20] proposes a new family of hash functions called concentrated hash functions, and design a new family of sparse hash functions of the form Ay + b wherein every entry of A[i] is chosen with probability p i ∈ O( log n n ). Meel r Akshay propose an adaption of ApproxMC3 that can make use of the newly designed sparse hash functions, and in turn, obtain promising speedups on a subset of benchmarks. Fast and flexible probabilistic model counting Probabilistic model counting with short XORs LDPC codes for discrete integration Quantitative verification of neural networks and its security applications Scalable approximation of quantitative information flow in programs Universal classes of hash functions Approximate probabilistic inference via word-level counting A scalable approximate model counter Algorithmic improvements in approximate counting for probabilistic inference: from linear to logarithmic SAT calls Counting-based reliability estimation for power-transmission grids Low-density parity constraints for hashing-based discrete integration Optimization with parity constraints: from binary codes to discrete integration Taming the curse of dimensionality: discrete integration by hashing and optimization Short XORs for model counting: from theory to practice Model counting: a new strategy for obtaining good bounds Model counting On computing minimal independent support and its applications to sampling and counting Adaptive hashing for model counting Approximate inference via weighted Rademacher complexity Sparse hashing for scalable approximate model counting: theory and practice Constrained sampling and counting: universal hashing meets sat solving On the hardness of approximate reasoning Performing Bayesian inference by weighted model counting Accelerating approximate techniques for counting and sampling models through refined CNF-XOR solving Bird: engineering an efficient CNF-XOR Sat solver and its applications to approximate model counting Extending SAT solvers to cryptographic problems The complexity of approximate counting On the computational power of PP and (+)P The complexity of enumeration and reliability problems Closing the gap between short and long XORs for model counting Acknowledgments. The authors would like to sincerely thank the anonymous reviewers of AAAI-20 and SAT-20 (and in particular, Meta-Reviewer of AAAI-20) for providing detailed, constructive criticism that has significantly improved the quality of the paper. We are grateful to Mate Soos for many insightful discussions.This work was supported in part by National Research Foundation Singapore under its NRF Fellowship Programme [NRF-NRFFAI1-2019-0004] and AI Singapore Programme [AISG-RP-2018-005], and NUS ODPRT Grant [R-252-000-685-13]. The computational work for this article was performed on resources of the National Supercomputing Centre, Singapore https://www.nscc.sg.