Abstract: Linear relaxation based perturbation analysis (LiRPA) for neural networks, which computes provable linear bounds of output neurons given a certain amount of input perturbation, has become a core component in robustness verification and certified defense. The majority of LiRPA-based methods focus on simple feed-forward networks and need particular manual derivations and implementations when extended to other architectures. In this paper, we develop an automatic framework to enable perturbation analysis on any neural network structures, by generalizing existing LiRPA algorithms such as CROWN to operate on general computational graphs. The flexibility, differentiability and ease of use of our framework allow us to obtain state-of-the-art results on LiRPA based certified defense on fairly complicated networks like DenseNet, ResNeXt and Transformer that are not supported by prior works. Our framework also enables loss fusion, a technique that significantly reduces the computational complexity of LiRPA for certified defense. For the first time, we demonstrate LiRPA based certified defense on Tiny ImageNet and Downscaled ImageNet where previous approaches cannot scale to due to the relatively large number of classes. Our work also yields an open-source library for the community to apply LiRPA to areas beyond certified defense without much LiRPA expertise, e.g., we create a neural network with a probably flat optimization landscape by applying LiRPA to network parameters. Our opensource library is available at https://github.com/KaidiXu/auto_LiRPA.
Introduction
Neural networks are notoriously vulnerable to adversarial attacks. To build trustworthy AI, researchers use "certified robustness"—mathematical guarantees that a network's output won't change drastically if the input is perturbed within a certain limit. A leading method for this is Linear Relaxation based Perturbation Analysis (LiRPA), which computes provable upper and lower bounds for network outputs.
However, applying LiRPA has historically been challenging. It existed in a "pre-automatic differentiation" state: researchers had to manually derive and implement complex bounding math for every new network architecture. Furthermore, existing LiRPA methods scaled poorly. The computational cost grew linearly with the number of output classes, making it practically impossible to apply to datasets with hundreds or thousands of classes (like ImageNet).
Methodology
The authors build a generalized, automatic framework that computes LiRPA bounds for any PyTorch model represented as a Directed Acyclic Graph (DAG).
Automatic Bound Propagation
Just as backpropagation automatically computes gradients by chaining derivatives, this framework automatically computes bounds by chaining linear relaxations of network operations in both forward and backward modes. This automation removes the need for manual derivation for each new architecture.
Loss Fusion
Previously, researchers computed bounds for the network's output logits (scaling with $K$ classes) and then fed those bounds into the loss function. This paper proposes treating the loss function itself as the final node in the computational graph. By computing the LiRPA bound directly on the loss function, the output dimension drops from $K$ to 1. This reduces the time complexity to match standard forward propagation and often results in tighter mathematical bounds during training.
Experimental Evaluation
The framework was tested across diverse datasets and architectures:
- Computer Vision: CIFAR-10, Tiny-ImageNet (200 classes), Downscaled ImageNet (1000 classes), MNIST, and FashionMNIST.
- Natural Language Processing: SST-2 (Sentiment analysis) using Transformers.
Key Results
- Unprecedented Scale: This is the first time LiRPA-based certified defense has been successfully applied to Tiny-ImageNet and Downscaled ImageNet. Previous methods simply ran out of memory or took too long.
- Massive Speedups: Thanks to loss fusion, robust training is only 3 to 5 times slower than standard natural training. Previous LiRPA methods were up to $K$ times slower (e.g., 1000x slower on ImageNet).
- State-of-the-Art Accuracy: The framework achieved a SOTA verified error rate of 66.62% on CIFAR-10 ($\epsilon=8/255$), outperforming previous certified defense benchmarks.
Discussion and Future Work
By automating LiRPA, the authors have removed a massive barrier to entry for certified robustness. The framework's ability to perturb any independent node allows it to be applied to network parameters (weights), linking robustness tools to deep learning generalization theory by training networks with provably "flat" optimization landscapes.
While vastly more efficient than prior work, a 3-5x computational overhead remains non-trivial for industry-scale models. Future directions include applying the "forward mode" of perturbation analysis to generative models and exploring applications beyond adversarial robustness, such as verifiable plant control in engineering.
Summary updated