Verifying Neural Networks with Mixed Integer Programming

Vincent Tjeng, Russ TedrakearXiv 2017 · OpenReview

Abstract

Neural networks have demonstrated considerable success on a wide variety of real-world problems. However, networks trained only to optimize for training accuracy can often be fooled by adversarial examples - slightly perturbed inputs that are misclassified with high confidence. Verification of networks enables us to gauge their vulnerability to such adversarial examples. We formulate verification of piecewise-linear neural networks as a mixed integer program. On a representative task of finding minimum adversarial distortions, our verifier is two to three orders of magnitude quicker than the state-of-the-art. We achieve this computational speedup via tight formulations for non-linearities, as well as a novel presolve algorithm that makes full use of all information available. The computational speedup allows us to verify properties on convolutional networks with an order of magnitude more ReLUs than networks previously verified by any complete verifier. In particular, we determine for the first time the exact adversarial accuracy of an MNIST classifier to perturbations with bounded $l_\infty$ norm $\epsilon=0.1$: for this classifier, we find an adversarial example for 4.38% of samples, and a certificate of robustness (to perturbations with bounded norm) for the remainder. Across all robust training procedures and network architectures considered, we are able to certify more samples than the state-of-the-art and find more adversarial examples than a strong first-order attack.

Introduction

Neural networks are notoriously vulnerable to adversarial examples—small, often imperceptible perturbations to inputs that cause the model to make high-confidence errors. While many defense mechanisms have been proposed, they are typically evaluated using heuristic attacks like Projected Gradient Descent (PGD). However, heuristic attacks only provide an upper bound on robustness; if an attack fails, we cannot guarantee that an adversarial example doesn't exist, only that the attack couldn't find it.

To get a mathematical guarantee of robustness, researchers use complete verifiers, which check the exact "adversarial polytope" (the set of all possible network outputs for a bounded input perturbation). Unfortunately, complete verification is an NP-hard problem. Historically, complete verifiers scaled poorly and were limited to tiny networks. This work introduces a highly efficient Mixed Integer Linear Programming (MILP) approach to scale complete verification to modern architectures like Convolutional Neural Networks (CNNs) and ResNets.

Methodology

The verification of piecewise-linear networks (using ReLUs, max pooling, and linear layers) is formulated as a MILP problem. The efficiency of this approach stems from three key optimizations:

  1. Tight Formulations for Non-linearities: ReLUs are modeled using asymmetric bounds. If a ReLU's input is proven to be strictly positive or negative, it collapses into a simple linear constraint, avoiding expensive binary variables.
  2. Progressive Bounds Tightening (Presolve): A presolve step finds the tightest possible bounds for every node's activation. It starts with fast methods like Interval Arithmetic and moves to Linear Programming only when necessary to avoid adding binary variables.
  3. Exploiting Restricted Input Domains: By restricting the domain to a local neighborhood around a specific test input, the verifier can prove that a massive fraction of ReLUs are "stably active" or "stably inactive," drastically reducing the search space.

Experimental Results

The verifier was evaluated on MNIST and CIFAR-10 datasets using various network architectures, including MLPs, CNNs, and ResNets.

Computational Efficiency

The proposed MILP verifier achieves a 2 to 3 orders of magnitude speedup over Reluplex, the previous state-of-the-art SMT-based complete verifier. This leap in efficiency allows for the verification of much larger networks, such as a ResNet on CIFAR-10 with over 100,000 ReLUs.

Comparison of solve times across different norms ($l_\infty, l_2, l_1$) and methods. The proposed MILP approach ("Exact: Ours") demonstrates significant speedups over Reluplex and approaches the speed of lower-bound methods.

Robustness Verification

For the first time, the exact adversarial accuracy for an MNIST classifier against $l_\infty$ perturbations ($\epsilon=0.1$) was determined. The verifier found an exact adversarial example for 4.38% of samples and provided a mathematical certificate of robustness for the remaining 95.62%.

Minimum adversarial distortion for $l_\infty$ norm. The exact method ("Exact: Ours") identifies the true minimum distortion, revealing a significant gap compared to lower-bound heuristic methods.

Key Insights

  • ReLU Stability: Verification time depends more on the number of unstable ReLUs than total network size.
  • Robust Training Benefits: Networks trained for robustness naturally have more stable ReLUs, making them faster to verify.
  • Heuristic Limitations: Strong first-order attacks like PGD often fail to find adversarial examples that are mathematically proven to exist, especially at larger perturbation bounds.

Conclusion

This work bridges the gap between formal verification and practical deep learning models. By optimizing MILP formulations and employing progressive bounds tightening, it is now possible to provide exact robustness guarantees for large-scale networks. Future work may focus on verifying against non-$l_p$ perturbations and developing training procedures that explicitly encourage verifiability through ReLU stability and weight sparsity.

Summary updated

BibTeX
@misc{tjeng2017verifying,
  author = {Vincent Tjeng and Russ Tedrake},
  title = {{Verifying Neural Networks with Mixed Integer Programming}},
  year = {2017},
  eprint = {1711.07356},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.07356},
}
Figure