Integrating logical reasoning within deep learning architectures has been amajor goal of modern AI systems. In this paper, we propose a new directiontoward this goal by introducing a differentiable (smoothed) maximumsatisfiability (MAXSAT) solver that can be integrated into the loop of largerdeep learning systems. Our (approximate) solver is based upon a fast coordinatedescent approach to solving the semidefinite program (SDP) associated with theMAXSAT problem. We show how to analytically differentiate through the solutionto this SDP and efficiently solve the associated backward pass. We demonstratethat by integrating this solver into end-to-end learning systems, we can learnthe logical structure of challenging problems in a minimally supervisedfashion. In particular, we show that we can learn the parity function usingsingle-bit supervision (a traditionally hard task for deep networks) and learnhow to play 9x9 Sudoku solely from examples. We also solve a "visual Sudok"problem that maps images of Sudoku puzzles to their associated logicalsolutions by combining our MAXSAT solver with a traditional convolutionalarchitecture. Our approach thus shows promise in integrating logical structureswithin deep learning.
Quick Read (beta)
SATNet: Bridging deep learning and logical reasoning using a differentiable satisfiability solver
SATNet: Bridging deep learning and logical reasoning using a differentiable satisfiability solver
Integrating logical reasoning within deep learning architectures has been a major goal of modern AI systems. In this paper, we propose a new direction toward this goal by introducing a differentiable (smoothed) maximum satisfiability (MAXSAT) solver that can be integrated into the loop of larger deep learning systems. Our (approximate) solver is based upon a fast coordinate descent approach to solving the semidefinite program (SDP) associated with the MAXSAT problem. We show how to analytically differentiate through the solution to this SDP and efficiently solve the associated backward pass. We demonstrate that by integrating this solver into end-to-end learning systems, we can learn the logical structure of challenging problems in a minimally supervised fashion. In particular, we show that we can learn the parity function using single-bit supervision (a traditionally hard task for deep networks) and learn how to play Sudoku solely from examples. We also solve a “visual Sudoku” problem that maps images of Sudoku puzzles to their associated logical solutions by combining our MAXSAT solver with a traditional convolutional architecture. Our approach thus shows promise in integrating logical structures within deep learning.
Although modern deep learning has produced groundbreaking improvements in a variety of domains, state-of-the-art methods still struggle to capture “hard” and “global” constraints arising from discrete logical relationships. Motivated by this deficiency, there has been a great deal of recent interest in integrating logical or symbolic reasoning into neural network architectures (Palm et al., 2017; Yang et al., 2017; Cingillioglu & Russo, 2018; Evans & Grefenstette, 2018). However, with few exceptions, previous work primarily focuses on integrating preexisting relationships into a larger differentiable system via tunable continuous parameters, not on discovering the discrete relationships that produce a set of observations in a truly end-to-end fashion. As an illustrative example, consider the popular logic-based puzzle game Sudoku, in which a player must fill in a partially-filled grid of numbers to satisfy specific constraints. If the rules of Sudoku (i.e. the relationships between problem variables) are not given, then it may be desirable to jointly learn the rules of the game and learn how to solve Sudoku puzzles in an end-to-end manner.
We consider the problem of learning logical structure specifically as expressed by satisfiability problems – concretely, problems that are well-modeled as instances of SAT or MAXSAT (the optimization analogue of SAT). This is a rich class of domains encompassing much of symbolic AI, which has traditionally been difficult to incorporate into neural network architectures since neural networks rely on continuous and differentiable parameterizations. Our key contribution is to develop and derive a differentiable smoothed MAXSAT solver that can be embedded within more complex deep architectures, and show that this solver enables effective end-to-end learning of logical relationships from examples (without hard-coding of these relationships). More specifically, we build upon recent work in fast block coordinate descent methods for solving SDPs (Wang et al., 2017) to build a differentiable solver for the smoothed SDP relaxation of MAXSAT. We provide an efficient mechanism to differentiate through the optimal solution of this SDP by using a similar block coordinate descent solver as used in the forward pass. Our module is amenable to GPU acceleration, greatly improving training scalability.
Using this framework, we are able to solve several problems that, despite their simplicity, prove essentially impossible for traditional deep learning methods and existing logical learning methods to reliably learn without any prior knowledge. In particular, we show that we can learn the parity function, known to be challenging for deep classifiers (Shalev-Shwartz et al., 2017), with only single bit supervision. We also show that we can learn to play Sudoku, a problem that is challenging for modern neural network architectures (Palm et al., 2017). We demonstrate that our module quickly recovers the constraints that describe a feasible Sudoku solution, learning to correctly solve 98.3% of puzzles at test time without any hand-coded knowledge of the problem structure. Finally, we show that we can embed this differentiable solver into larger architectures, solving a “visual Sudoku” problem where the input is an image of a Sudoku puzzle rather than a binary representation. We show that, in a fully end-to-end setting, our method is able to integrate classical convolutional networks (for digit recognition) with the differentiable MAXSAT solver (to learn the logical portion). Taken together, this presents a substantial advance toward a major goal of modern AI: integrating logical reasoning into deep learning architectures.
2 Related work
Recently, the deep learning community has given increasing attention to the concept of embedding complex, “non-traditional” layers within deep networks in order to train systems end-to-end. Major examples have included logical reasoning modules and optimization layers. Our work combines research in these two areas by exploiting optimization-based relaxations of logical reasoning structures, namely an SDP relaxation of MAXSAT. We explore each of these relevant areas of research in more detail below.
Logical reasoning in deep networks.
Our work is closely related to recent interest in integrating logical reasoning into deep learning architectures (Garcez et al., 2015). Most previous systems have focused on creating differentiable modules from an existing set of known relationships, so that a deep network can learn the parameters of these relationships (Dai et al., 2018; Manhaeve et al., 2018; Sourek et al., 2018; Xu et al., 2018; Hu et al., 2016; Yang et al., 2017; Selsam et al., 2018). For example, Palm et al. (2017) introduce a network that carries out relational reasoning using hand-coded information about which variables are allowed to interact, and test this network on Sudoku. Similarly, Evans & Grefenstette (2018) integrate inductive logic programming into neural networks by constructing differentiable SAT-based representations for specific “rule templates.” While these networks are seeded with prior information about the relationships between variables, our approach learns these relationships and their associated parameters end-to-end. While other recent work has also tried to jointly learn rules and parameters, the problem classes captured by these architectures have been limited. For instance, Cingillioglu & Russo (2018) train a neural network to apply a specific class of logic programs, namely the binary classification problem of whether a given set of propositions entails a specific conclusion. While this approach does not rely on prior hand-coded structure, our method applies to a broader class of domains, encompassing any problem reducible to MAXSAT.
Differentiable optimization layers.
Our work also fits within a line of research leveraging optimization as a layer in neural networks. For instance, previous work has introduced differentiable modules for quadratic programs (Amos & Kolter, 2017; Donti et al., 2017), submodular optimization problems (Djolonga & Krause, 2017; Tschiatschek et al., 2018; Wilder et al., 2018), and equilibrium computation in zero-sum games (Ling et al., 2018). To our knowledge, ours is the first work to use differentiable SDP relaxations to capture relationships between discrete variables.
MAXSAT SDP relaxations.
We build on a long line of research exploring SDP relaxations as a tool for solving MAXSAT and related problems. Classical work shows that such relaxations produce strong approximation guarantees for MAXCUT and MAX-2SAT (Goemans & Williamson, 1995), and are empirically tighter than standard linear programming relaxations (Gomes et al., 2006). More recent work, e.g. Wang et al. (2017); Wang & Kolter (2019), has developed low-rank SDP solvers for general MAXSAT problems. We extend the work of Wang et al. (2017) to create a differentiable optimization-based MAXSAT solver that can be employed in the loop of deep learning.
3 A differentiable satisfiability solver
The MAXSAT problem is the optimization analogue of the well-known satisfiability (SAT) problem, in which the goal is to maximize the number of clauses satisfied. We present a differentiable, smoothed approximate MAXSAT solver that can be integrated into modern deep network architectures. This solver uses a fast coordinate descent approach to solving an SDP relaxation of MAXSAT. We describe our MAXSAT SDP relaxation as well as the forward pass of our MAXSAT deep network layer (which employs this relaxation). We then show how to analytically differentiate through the MAXSAT SDP and efficiently solve the associated backward pass.
3.1 Solving an SDP formulation of satisfiability
Consider a MAXSAT instance with variables and clauses. Let denote binary assignments of the problem variables, where is the truth value of variable , and define for , where denotes the sign of in clause . We then write the MAXSAT problem as
As derived in Goemans & Williamson (1995); Wang & Kolter (2019), to form a semidefinite relaxation of (1), we first relax the discrete variables into associated continuous variables with respect to some “truth direction” . Specifically, we relate the continuous to the discrete probabilistically via based on randomized rounding (Goemans & Williamson (1995); see Section 3.2.4). We additionally define a coefficient vector associated with . Our SDP relaxation of MAXSAT is then
where , and . We note that this problem is a low-rank (but non-convex) formulation of MIN-UNSAT, which is equivalent to MAXSAT. This formulation can be rewritten as an SDP, and has been shown to recover the optimal SDP solution given (Barvinok, 1995; Pataki, 1998).
Despite its non-convexity, problem (2) can then be solved optimally via coordinate descent for all . In particular, the objective terms that depend on are given by , where is the th column vector of . Minimizing this quantity over subject to the constraint that yields the coordinate descent update
3.2 SATNet: Satisfiability solving as a layer
Using our MAXSAT SDP relaxation and associated coordinate descent updates, we create a deep network layer for satisfiability solving (SATNet). Define to be the indices of MAXSAT variables with known assignments, and let correspond to the indices of variables with unknown assignments. Our layer admits probabilistic or binary inputs , and then outputs the assignments of unknown variables which are similarly probabilistic or (optionally, at test time) binary. We let and refer to all input and output assignments, respectively.
The outputs are generated from inputs via the SDP (2), and the weights of our layer correspond to the SDP’s low-rank coefficient matrix . This forward pass procedure is pictured in Figure 1. We describe the steps of layer initialization and the forward pass in Algorithm 1, and in more detail below.
3.2.1 Layer initialization
When initializing SATNet, the user must specify a maximum number of clauses that this layer can represent. It is often desirable to set to be low; in particular, low-rank structure can prevent overfitting and thus improve generalization.
Given this low-rank structure, a user may wish to somewhat increase the layer’s representational ability via auxiliary variables. The high-level intuition here follows from the conjunctive normal form (CNF) representation of boolean satisfaction problems; adding additional variables to a problem can dramatically reduce the number of CNF clauses needed to describe that problem, as these variables play a role akin to register memory that is useful for inference.
3.2.2 Step 1: Relaxing layer inputs
Our layer first relaxes its inputs into continuous vectors for use in the SDP formulation (2). That is, we relax each layer input to an associated random unit vector so that
where is a random unit vector. For simplicity, we use the notation (i.e. the -indexed column subset of ) to collectively refer to all relaxed layer inputs derived via Equation (5).
3.2.3 Step 2: Generating continuous relaxations of outputs via SDP
Given the continuous input relaxations , our layer employs the coordinate descent updates (3) to compute values for continuous output relaxations (which we collectively refer to as ). Notably, coordinate descent updates are only computed for output variables, i.e. are not computed for variables whose assignments are given as input to the layer.
Our coordinate descent algorithm for the forward pass is detailed in Algorithm 2. This algorithm maintains the term needed to compute , and then modifies it via a rank-one update during each inner iteration. Accordingly, the per-iteration runtime is (and in practice, only a small number of iterations is required for convergence).
3.2.4 Step 3: Generating discrete or probabilistic outputs
Given the relaxed outputs from coordinate descent, our layer converts these outputs to discrete or probabilistic variable assignments via either thresholding or randomized rounding (which we describe here).
The main idea of randomized rounding is that for every , we can take a random hyperplane from the unit sphere and assign
where is the boolean output for . Intuitively, this scheme sets to “true” if and only if and the truth vector are on the same side of the random hyperplane . Given the correct weights , this randomized rounding procedure assures an optimal expected approximation ratio for certain NP-hard problems (Goemans & Williamson, 1995).
During training, we do not explicitly perform randomized rounding. We instead note that the probability that and are on the same side of any given is
and thus set to equal this probability.
During testing, we can either output probabilistic outputs in the same fashion, or output discrete assignments via thresholding or randomized rounding. If using randomized rounding, we round multiple times, and then set to be the boolean solution maximizing the MAXSAT objective in Equation (1). Prior work has observed that such repeated rounding improves approximation ratios in practice, especially for MAXSAT problems (Wang & Kolter, 2019).
3.3 Computing the backward pass
We now derive backpropagation updates through our SATNet layer to enable its integration into a neural network. That is, given the gradients of the network loss with respect to the layer outputs, we must compute the gradients with respect to layer inputs and with respect to layer weights. As it would be inefficient in terms of time and memory to explicitly unroll the forward-pass computations and store intermediate Jacobians, we instead derive analytical expressions to compute the desired gradients directly, employing an efficient coordinate descent algorithm. The procedure for computing these gradients is summarized in Algorithm 1 and derived below.
3.3.1 From probabilistic outputs to their continuous relaxations
Given (with respect to the layer outputs), we first derive an expression for (with respect to the output relaxations) by pushing gradients through the probability assignment mechanism described in Section 3.2.4. That is, for each ,
where we obtain by differentiating through Equation (7) (or, more readily, by implicitly differentiating through its rearrangement ).
3.3.2 Backpropagation through the SDP
Given the analytical form for (with respect to the output relaxations), we next seek to derive (with respect to the input relaxations) and (with respect to the layer weights) by pushing gradients through our SDP solution procedure (Section 3.2.3). We describe the analytical form for the resultant gradients in Theorem 1.
Define for each . Then, define , where the columns and the columns are given by
where , where , and where . Then, the gradient of the network loss with respect to the relaxed layer inputs is
where is the -indexed column subset of , and the gradient with respect to the layer weights is
We defer the derivation of Theorem 1 to Appendix B. Although this derivation is somewhat involved, the concept at a high level is quite simple: we differentiate the solution of the SDP problem (Section 3.1) with respect to the problem’s parameters and input, which requires computing the (relatively large) matrix-vector solve given in Equation (9).
To solve Equation (9), we use a coordinate descent approach that closely mirrors the coordinate descent procedure employed in the forward pass, and which has similar fast convergence properties. This procedure, described in Algorithm 3, enables us to compute the desired gradients without needing to maintain intermediate Jacobians explicitly. Mirroring the forward pass, we use rank-one updates to maintain and modify the term needed to compute , which again enables our algorithm to run in time. We defer the derivation of Algorithm 3 to Appendix D.
3.3.3 From relaxed to original inputs
As a final step, we must use the gradient (with respect to the input relaxations) to derive the gradient (with respect to the actual inputs) by pushing gradients through the input relaxation procedure described in Section 3.2.2. For each , we see that
3.4 An efficient GPU implementation
The coordinate descent updates in Algorithms 2 and 3 dominate the computational costs of the forward and backward passes, respectively. We thus present an efficient, parallel GPU implementation of these algorithms to speed up training and inference. During the inner loop of coordinate descent, our implementation parallelizes the computation of all () terms by parallelizing the computation of (), as well as of all rank-one updates of (). This underscores the benefit of using a low-rank SDP formulation in our MAXSAT layer, as traditional full-rank coordinate descent cannot be efficiently parallelized. We find in our preliminary benchmarks that our GPU CUDA-C implementation is up to x faster than the corresponding OpenMP implementation run on Xeon CPUs. Source code for our implementation is available at https://github.com/locuslab/SATNet.
We test our MAXSAT layer approach in three domains that are traditionally difficult for neural networks: learning the parity function with single-bit supervision, learning Sudoku solely from examples, and solving a “visual Sudoku” problem that generates the logical Sudoku solution given an input image of a Sudoku puzzle. We find that in all cases, we are able to perform substantially better on these tasks than previous deep learning-based approaches.
4.1 Learning parity (chained XOR)
This experiment tests SATNet’s ability to differentiate through many successive SAT problems by learning to compute the parity function. The parity of a bit string is defined as one if there is an odd number of ones in the sequence and zero otherwise. The task is to map input sequences to their parity, given a dataset of example sequence/parity pairs. Learning parity functions from such single-bit supervision is known to pose difficulties for conventional deep learning approaches (Shalev-Shwartz et al., 2017). However, parity is simply a logic function – namely, a sequence of XOR operations applied successively to the input sequence.
Hence, for a sequence of length , we construct our model to contain a sequence of SATNet layers with tied weights (similar to a recurrent network). The first layer receives the first two binary values as input, and layer receives value along with the rounded output of layer . If each layer learns to compute the XOR function, the combined system will correctly compute parity. However, this requires the model to coordinate a long series of SAT problems without any intermediate supervision.
Figure 2 shows that our model accomplishes this task for input sequences of length and . For each sequence length, we generate a dataset of 10K random examples (9K training and 1K testing). We train our model using cross-entropy loss and the Adam optimizer (Kingma & Ba, 2015) with a learning rate of . We compare to an LSTM sequence classifier, which uses 100 hidden units and a learning rate of (we tried varying the architecture and learning rate but did not observe any improvement). In each case, our model quickly learns the target function, with error on the held-out set converging to zero within 20 epochs. In contrast, the LSTM is unable to learn an appropriate representation, with only minor improvement over the course of 100 training epochs; across both input lengths, it achieves a testing error rate of at best 0.476 (where a random guess achieves value 0.5).
4.2 Sudoku (original and permuted)
In this experiment, we test SATNet’s ability to infer and recover constraints simply from bit supervision (i.e. without any hard-coded specification of how bits are related). We demonstrate this property via Sudoku. In Sudoku, given a (typically) partially-filled grid of numbers, a player must fill in the remaining empty grid cells such that each row, each column, and each of nine subgrids contains exactly one of each number from 1 through 9. While this constraint satisfaction problem is computationally easy to solve once the rules of the game are specified, actually learning the rules of the game, i.e. the hard constraints of the puzzle, has proved challenging for traditional neural network architectures. In particular, Sudoku problems are often solved computationally via tree search, and while tree search cannot be easily performed by neural networks, it is easily expressible using SAT and MAXSAT problems.
We construct a SATNet model for this task that takes as input a logical (bit) representation of the initial Sudoku board along with a mask representing which bits must be learned (i.e. all bits in empty Sudoku cells). This input is vectorized, which means that our SATNet model cannot exploit the locality structure of the input Sudoku grid when learning to solve puzzles. Given this input, the SATNet layer then outputs a bit representation of the Sudoku board with guesses for the unknown bits. Our model architecture consists of a single SATNet layer with 300 auxiliary variables and low rank structure , and we train it to minimize a digit-wise negative log likelihood objective (optimized via Adam with a learning rate).
We compare our model to a convolutional neural network baseline modeled on that of Park (2016), which interprets the bit inputs as 9 input image channels (one for each square in the board) and uses a sequence of 10 convolutional layers (each with 512 33 filters) to output the solution. The ConvNet makes explicit use of locality in the input representation since it treats the nine cells within each square as a single image. We also compare to a version of the ConvNet which receives a binary mask indicating which bits need to be learned (ConvNetMask). The mask is input as a set of additional image channels in the same format as the board. We trained both architectures using mean squared error (MSE) loss (which gave better results than negative log likelihood for this architecture). The loss was optimized using Adam (learning rate ). We additionally tried to train an OptNet (Amos & Kolter, 2017) model for comparison, but this model made little progress even after a few days of training. (We compare our method to OptNet on a simpler version of the Sudoku problem in Appendix E.)
Our results for the traditional Sudoku problem (over 9K training examples and 1K test examples) are shown in Table 1. (Convergence plots for this experiment are shown in Appendix F.) Our model is able to learn the constraints of the Sudoku problem, achieving high accuracy early in the training process (95.0% test accuracy in 22 epochs/37 minutes on a GTX 1080 Ti GPU), and demonstrating 98.3% board-wise test accuracy after 100 training epochs (172 minutes). On the other hand, the ConvNet baseline does poorly. It learns to correctly solve 72.6% of puzzles in the training set but fails altogether to generalize: accuracy on the held-out set reaches at most 0.04%. The ConvNetMask baseline, which receives a binary mask denoting which entries must be completed, performs only somewhat better, correctly solving 15.1% of puzzles in the held-out set. We note that our test accuracy is qualitatively similar to the results obtained in Palm et al. (2017), but that our network is able to learn the structure of Sudoku without explicitly encoding the relationships between variables.
To underscore that our architecture truly learns the rules of the game, as opposed to overfitting to locality or other structure in the inputs, we test our SATNet architecture on permuted Sudoku boards, i.e. boards for which we apply a fixed permutation of the underlying bit representation (and adjust the corresponding input masks and labels accordingly). This removes any locality structure, and the resulting Sudoku boards do not have clear visual analogues that can be solved by humans. However, the relationships between bits are unchanged (modulo the permutation) and should therefore be discoverable by architectures that can truly learn the underlying logical structure. Table 1 shows results for this problem in comparison to the convolutional neural network baselines. Our architecture is again able to learn the rules of the (permuted) game, demonstrating the same 98.3% board-wise test accuracy as in the original game. In contrast, the convolutional neural network baselines perform even more poorly than in the original game (achieving 0% test accuracy even with the binary mask as input), as there is little locality structure to exploit. Overall, these results demonstrate that SATNet can truly learn the logical relationships between discrete variables.
4.3 Visual Sudoku
In this experiment, we demonstrate that SATNet can be integrated into larger deep network architectures for end-to-end training. Specifically, we solve the visual Sudoku problem: that is, given an image representation of a Sudoku board (as opposed to a one-hot encoding or other logical representation) constructed with MNIST digits, our network must output a logical solution to the associated Sudoku problem. An example input is shown in Figure 3. This problem cannot traditionally be represented well by neural network architectures, as it requires the ability to combine multiple neural network layers without hard-coding the logical structure of the problem into intermediate logical layers.
Our architecture for this problem uses a convolutional neural network connected to a SATNet layer. Specifically, we apply a convolutional layer for digit classification (which uses the LeNet architecture (LeCun et al., 1998)) to each cell of the Sudoku input. Each cell-wise probabilistic output of this convolutional layer is then fed as logical input to the SATNet layer, along with an input mask (as in Section 4.2). This SATNet layer employs the same architecture and training parameters as described in the previous section. The whole model is trained end-to-end to minimize cross-entropy loss, and is optimized via Adam with learning rates for the SATNet layer and for the convolutional layer.
We compare our approach against a convolutional neural network which combines two sets of convolutional layers. First, the visual inputs are passed through the same convolutional layer as in our SATNet model, which outputs a probabilistic bit representation. Next, this representation is passed through the convolutional architecture that we compared to for the original Sudoku problem, which outputs a solution. We use the same training approach as above.
Table 1 summarizes our experimental results (over 9K training examples and 1K test examples); additional plots are shown in Appendix F. We contextualize these results against the theoretical “best” testing accuracy of 74.7%, which accounts for the Sudoku digit classification accuracy of our specific convolutional architecture; that is, assuming boards with 36.2 out of 81 filled cells on average (as in our test set) and an MNIST model with 99.2% test accuracy (LeCun et al., 1998), we would expect a perfect Sudoku solver to output the correct solution 74.7% () of the time. In 100 epochs, our model learns to correctly solve 63.2% of boards at test time, reaching 85% of this theoretical “best.” Hence, our approach demonstrates strong performance in solving visual Sudoku boards end-to-end. On the other hand, the baseline convolutional networks make only minuscule improvements to the training loss over the course of 100 epochs, and fail altogether to improve out-of-sample performance. Accordingly, our SATNet architecture enables end-to-end learning of the “rules of the game” directly from pictorial inputs in a way that was not possible with previous architectures.
In this paper, we have presented a low-rank differentiable MAXSAT layer that can be integrated into neural network architectures. This layer employs block coordinate descent methods to efficiently compute the forward and backward passes, and is amenable to GPU acceleration. We show that our SATNet architecture can be successfully used to learn logical structures, namely the parity function and the rules of Sudoku. We also show, via a visual Sudoku task, that our layer can be integrated into larger deep network architectures for end-to-end training. Our layer thus shows promise in allowing deep networks to learn logical structure without hard-coding of the relationships between variables.
More broadly, we believe that this work fills a notable gap in the regime spanning deep learning and logical reasoning. While many “differentiable logical reasoning” systems have been proposed, most of them still require fairly hand-specified logical rules and groundings, and thus are somewhat limited in their ability to operate in a truly end-to-end fashion. Our hope is that by wrapping a powerful yet generic primitive such as MAXSAT solving within a differentiable framework, our solver can enable “implicit” logical reasoning to occur where needed within larger frameworks, even if the precise structure of the domain is unknown and must be learned from data. In other words, we believe that SATNet provides a step towards integrating symbolic reasoning and deep learning, a long-standing goal in artificial intelligence.
Po-Wei Wang is supported by a grant from the Bosch Center for AI; Priya Donti is supported by the Department of Energy’s Computational Science Graduate Fellowship under grant number DE-FG02-97ER25308; and Bryan Wilder is supported by the National Science Foundation Graduate Research Fellowship.
- Amos & Kolter (2017) Amos, B. and Kolter, J. Z. Optnet: Differentiable optimization as a layer in neural networks. arXiv preprint arXiv:1703.00443, 2017.
- Barvinok (1995) Barvinok, A. I. Problems of distance geometry and convex properties of quadratic maps. Discrete & Computational Geometry, 13(2):189–202, 1995.
- Cingillioglu & Russo (2018) Cingillioglu, N. and Russo, A. Deeplogic: End-to-end logical reasoning. arXiv preprint arXiv:1805.07433, 2018.
- Dai et al. (2018) Dai, W.-Z., Xu, Q.-L., Yu, Y., and Zhou, Z.-H. Tunneling neural perception and logic reasoning through abductive learning. arXiv preprint arXiv:1802.01173, 2018.
- Djolonga & Krause (2017) Djolonga, J. and Krause, A. Differentiable learning of submodular models. In Advances in Neural Information Processing Systems, pp. 1013–1023, 2017.
- Donti et al. (2017) Donti, P. L., Amos, B., and Kolter, J. Z. Task-based end-to-end model learning in stochastic optimization. arXiv preprint arXiv:1703.04529, 2017.
- Evans & Grefenstette (2018) Evans, R. and Grefenstette, E. Learning explanatory rules from noisy data. Journal of Artificial Intelligence Research, 61:1–64, 2018.
- Garcez et al. (2015) Garcez, A., Besold, T. R., De Raedt, L., Földiak, P., Hitzler, P., Icard, T., Kühnberger, K.-U., Lamb, L. C., Miikkulainen, R., and Silver, D. L. Neural-symbolic learning and reasoning: contributions and challenges. In Proceedings of the AAAI Spring Symposium on Knowledge Representation and Reasoning: Integrating Symbolic and Neural Approaches, Stanford, 2015.
- Goemans & Williamson (1995) Goemans, M. X. and Williamson, D. P. Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming. Journal of the ACM (JACM), 42(6):1115–1145, 1995.
- Gomes et al. (2006) Gomes, C. P., van Hoeve, W.-J., and Leahu, L. The power of semidefinite programming relaxations for max-sat. In International Conference on Integration of Artificial Intelligence (AI) and Operations Research (OR) Techniques in Constraint Programming, pp. 104–118. Springer, 2006.
- Hu et al. (2016) Hu, Z., Ma, X., Liu, Z., Hovy, E., and Xing, E. Harnessing deep neural networks with logic rules. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 2410–2420, 2016.
- Kingma & Ba (2015) Kingma, D. P. and Ba, J. L. Adam: Amethod for stochastic optimization. In International Conference on Learning Representations, 2015.
- LeCun et al. (1998) LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
- Ling et al. (2018) Ling, C. K., Fang, F., and Kolter, J. Z. What game are we playing? end-to-end learning in normal and extensive form games. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, pp. 396–402, 2018. doi: 10.24963/ijcai.2018/55.
- Manhaeve et al. (2018) Manhaeve, R., Dumancic, S., Kimmig, A., Demeester, T., and De Raedt, L. Deepproblog: Neural probabilistic logic programming. In Advances in Neural Information Processing Systems, pp. 3749–3759, 2018.
- Palm et al. (2017) Palm, R. B., Paquet, U., and Winther, O. Recurrent relational networks. arXiv preprint arXiv:1711.08028, 2017.
- Park (2016) Park, K. Can neural networks crack sudoku?, 2016. URL https://github.com/Kyubyong/sudoku.
- Pataki (1998) Pataki, G. On the rank of extreme matrices in semidefinite programs and the multiplicity of optimal eigenvalues. Mathematics of operations research, 23(2):339–358, 1998.
- Selsam et al. (2018) Selsam, D., Lamm, M., Bunz, B., Liang, P., de Moura, L., and Dill, D. L. Learning a sat solver from single-bit supervision. arXiv preprint arXiv:1802.03685, 2018.
- Shalev-Shwartz et al. (2017) Shalev-Shwartz, S., Shamir, O., and Shammah, S. Failures of gradient-based deep learning. In Proceedings of the 34th International Conference on Machine Learning, pp. 3067–3075, 2017.
- Sourek et al. (2018) Sourek, G., Aschenbrenner, V., Zelezny, F., Schockaert, S., and Kuzelka, O. Lifted relational neural networks: Efficient learning of latent relational structures. Journal of Artificial Intelligence Research, 62:69–100, 2018.
- Tschiatschek et al. (2018) Tschiatschek, S., Sahin, A., and Krause, A. Differentiable submodular maximization. arXiv preprint arXiv:1803.01785, 2018.
- Wang & Kolter (2019) Wang, P.-W. and Kolter, J. Z. Low-rank semidefinite programming for the max2sat problem. In AAAI Conference on Artificial Intelligence, 2019.
- Wang et al. (2017) Wang, P.-W., Chang, W.-C., and Kolter, J. Z. The mixing method: coordinate descent for low-rank semidefinite programming. arXiv preprint arXiv:1706.00476, 2017.
- Wilder et al. (2018) Wilder, B., Dilkina, B., and Tambe, M. Melding the data-decisions pipeline: Decision-focused learning for combinatorial optimization. In AAAI Conference on Artificial Intelligence, 2018.
- Xu et al. (2018) Xu, J., Zhang, Z., Friedman, T., Liang, Y., and den Broeck, G. V. A semantic loss function for deep learning with symbolic knowledge. In Proceedings of the 35th International Conference on Machine Learning, pp. 5498–5507, 2018. URL http://proceedings.mlr.press/v80/xu18h.html.
- Yang et al. (2017) Yang, F., Yang, Z., and Cohen, W. W. Differentiable learning of logical rules for knowledge base reasoning. In Advances in Neural Information Processing Systems, pp. 2319–2328, 2017.
Appendix A Derivation of the forward pass coordinate descent update
Our MAXSAT SDP relaxation (described in Section 3.1) is given by
where and is the th column vector of .
We rewrite the objective of (A.1) as by noting that is symmetric and by cycling matrices within the trace. We then observe that the objective terms that depend on any given are given by
where is the th column vector of . Observe in the last term cancels to , and the remaining coefficient
is constant with respect to . Thus, (A.2) can be simply rewritten as
Minimizing this expression over with respect to the constraint yields the block coordinate descent update
Appendix B Details on backpropagation through the MAXSAT SDP
Given the result , we next seek to compute and by pushing gradients through the SDP solution procedure described in Section 3.1. We do this by taking the total differential through our coordinate descent updates (3) for each output at the optimal fixed-point solution to which these updates converge.
Computing the total differential.
Computing the total differential of the updates (3) and rearranging, we see that for every ,
and where and .
Rewriting as a linear system.
Rewriting Equation B.1 over all as a linear system, we obtain
where , , and the second step follows from the lemma presented in Appendix C.
We then see that by the chain rule, the gradients and are given by the left matrix-vector product
where the second equality comes from plugging in the result of (B.3).
Now, define , where the columns and the columns are given by
Then, we see that (B.4) can be written as
which is the implicit linear form for our gradients.
Computing desired gradients from implicit linear form.
Once we have obtained (via coordinate descent), we can explicitly compute the desired gradients and from the implicit form (B.6). For instance, to compute the gradient for some , we would set and all other gradients to zero in Equation (B.6) (where these gradients are captured within the terms ).
Explicitly, we compute each by setting and all other gradients to zero, i.e.
Similarly, we compute each by setting and all other gradients to zero, i.e.
In matrix form, these gradients are
where is the th column of , and where denotes the -indexed column subset of .
Appendix C Proof of pseudoinverse computations
We prove the following lemma, used to derive the implicit total differential for .
is the solution of the linear system
where , , , and is as defined in Equation (B.2).
Examining the equation with respect to gives
which implies that for all , for some . Substituting into the equality gives
Note that the last equation comes form due to the block diagonal structure of the projection . Thus, by the properties of projectors and the pseudoinverse,
Note that the first equation comes from the idempotence property of (that is, ). Substituting back gives the solution of . ∎
Appendix D Derivation of the backward pass coordinate descent algorithm
Consider solving for as mentioned in Equation (B.5):
where . The linear system can be computed using block coordinate descent. Specifically, observe this linear system with respect to only the variable. Since we start from , we can assume that . This yields
Let . Then we have
Define to be the terms contained in parentheses in the right-hand side of the above equation. Note that does not depend on the variable . Thus, we have the closed-form feasible solution
After updating , we can maintain the term by replacing the old with the new . This yields the rank 1 update
The above procedure is summarized in Algorithm 3. Further, we can verify that the assumption still holds after each update by the projection .
Appendix E Results for the Sudoku problem
We compare the performance of our SATNet architecture on a reduced version of the Sudoku puzzle against OptNet (Amos & Kolter, 2017) and a convolutional neural network architecture. These results (over 9K training and 1K testing examples) are shown in Figure E.1. We note that our architecture converges quickly – in just two epochs – to 100% board-wise test accuracy.
OptNet takes slightly longer to converge to similar performance, in terms of both time and epochs. In particular, we see that OptNet takes 3-4 epochs to converge (as opposed to 1 epoch for SATNet). Further, in our preliminary benchmarks, OptNet required 12 minutes to run 20 epochs on a GTX 1080 Ti GPU, whereas SATNet took only 2 minutes to run the same number of epochs. In other words, we see that SATNet requires fewer epochs to converge and takes less time per epoch than OptNet.
Both our SATNet architecture and OptNet outperform the traditional convolutional neural network in this setting, as the ConvNet somewhat overfits to the training set and therefore does not generalize as well to the test set (achieving 93% accuracy). The ConvNetMask, which additionally receives a binary input mask, performs much better (99% test accuracy) but does not achieve perfect performance as in the case of OptNet and SATNet.
Appendix F Convergence plots for Sudoku experiments
Convergence plots for our Sudoku experiments (original and permuted) are shown in Figure F.1. SATNet performs nearly identically in both the original and permuted settings, generalizing well to the test set at every epoch without overfitting to the training set. The ConvNet and ConvNetMask, on the other hand, do not generalize well. In the original setting, both architectures overfit to the training set, showing little-to-no improvement in generalization performance over the course of training. In the permuted setting, both ConvNet and ConvNetMask make little progress even on the training set, as they are not able to rely on spatial locality of inputs.
Convergence plots for the visual Sudoku experiments are shown in Figure F.2. Here, we see that SATNet generalizes well in terms of loss throughout the training process, and generalizes somewhat well in terms of whole-board accuracy. The difference in generalization performance between the logical and visual Sudoku settings can be attributed to the generalization performance of the MNIST classifier trained end-to-end with our SATNet layer. The ConvNetMask architecture overfits to the training set, and the ConvNet architecture makes little-to-no progress even on the training set.