Abstract
Understanding properties of deep neural networks is an important challenge in deep learning. In this paper, we take a step in this direction by proposing a rigorous way of verifying properties of a popular class of neural networks, Binarized Neural Networks, using the well-developed means of Boolean satisfiability. Our main contribution is a construction that creates a representation of a binarized neural network as a Boolean formula. Our encoding is the first exact Boolean representation of a deep neural network. Using this encoding, we leverage the power of modern SAT solvers along with a proposed counterexample-guided search procedure to verify various properties of these networks. A particular focus will be on the critical property of robustness to adversarial perturbations. For this property, our experimental results demonstrate that our approach scales to medium-size deep neural networks used in image classification tasks. To the best of our knowledge, this is the first work on verifying properties of deep neural networks using an exact Boolean encoding of the network.
Introduction
Deep neural networks (DNNs) are often viewed as "black boxes." Despite their impressive performance, they remain susceptible to adversarial perturbations—tiny, human-imperceptible changes to inputs that can cause a model to confidently misclassify them. In safety-critical applications like autonomous driving, empirical defenses are insufficient; we require formal verification to mathematically guarantee that a model's output remains stable within a certain range of input perturbations.
While standard DNNs use continuous real numbers, making them difficult to model with discrete logic, Binarized Neural Networks (BNNs) use binary weights and activations. This discrete nature makes BNNs essentially complex logic functions, allowing them to be translated into a format that Boolean Satisfiability (SAT) solvers can process efficiently. This paper introduces the first exact Boolean encoding for BNNs, enabling formal verification of properties like adversarial robustness and network equivalence.
BNN Architecture and Encoding
The core contribution of this work is a multi-step translation process that converts a BNN into a Conjunctive Normal Form (CNF) formula. Unlike previous approximation-based methods, this encoding is exact. Every neuron operation—including linear transformations (LIN), batch normalization (BN), and binarization (BIN)—is mapped to a Boolean representation.
As shown in the architecture above, the network is partitioned into internal blocks and an output block. The mathematical structure of these blocks is detailed below:
A significant challenge in this encoding is the "summation" step, which counts how many inputs are +1 versus -1. To handle this, the authors utilize sequential counters to encode cardinality constraints into SAT, keeping the resulting formula compact. Furthermore, to scale verification to larger networks, a Counterexample-Guided Search (CEG) procedure is employed. This method uses Craig interpolants to prune the search space by generating learned constraints when potential adversarial examples are found to be invalid for the entire network.
Experimental Evaluation
The approach was evaluated using three variants of the MNIST digit classification dataset: Standard MNIST, MNIST-rot (rotated digits), and MNIST-back-image (digits over random backgrounds). The target models were BNNs with four internal blocks, containing between 100 and 200 neurons per layer.
Key Results
- Performance: The SAT-based approach, particularly the CEG version, outperformed standard Integer Linear Programming (ILP) solvers, successfully solving 30% more instances within the allotted time.
- Scalability: The method proved effective for "medium-sized" networks, managing formulas with millions of clauses.
- Certifiable Robustness: On the challenging MNIST-back-image dataset, the tool provided mathematical guarantees of robustness for small perturbations ($\epsilon=1$). However, robustness dropped sharply as the allowed perturbation range increased.
- Efficiency: For many test cases, the solver could either find an adversarial example or prove its absence in under 30 seconds.
Conclusion and Future Work
This research demonstrates that BNNs are naturally suited for formal logic verification. By treating the network as a sequence of modules rather than a monolithic equation, the authors show that formal verification can scale to practical network sizes.
Future work includes extending this encoding to "fixed-point" networks that use more than one bit for weights and activations, as well as further optimizing layer-wise variable sharing to improve solver speed for even larger state-of-the-art models.
Summary updated