Fully Automatic Neural Network Reduction for Formal Verification

Tobias Ladner, Matthias Althoff

Abstract

Formal verification of neural networks is essential before their deployment in safety-critical applications. However, existing methods for formally verifying neural networks are not yet scalable enough to handle practical problems under strict time constraints. We address this challenge by introducing a fully automatic and sound reduction of neural networks using reachability analysis. The soundness ensures that the verification of the reduced network entails the verification of the original network. Our sound reduction approach is applicable to neural networks with any type of element-wise activation function, such as ReLU, sigmoid, and tanh. The network reduction is computed on the fly while simultaneously verifying the original network and its specification. All parameters are automatically tuned to minimize the network size without compromising verifiability. We further show the applicability of our approach to convolutional neural networks by explicitly exploiting similar neighboring pixels. Our evaluation shows that our approach reduces large neural networks to a fraction of the original number of neurons and thus shortens the verification time to a similar degree.

Introduction: The Scalability Challenge

Formal verification is the "gold standard" for ensuring neural networks behave safely in critical applications like autonomous driving or medical imaging. However, verifying a network is computationally expensive—verifying even simple ReLU networks is NP-hard. While researchers often use "incomplete" algorithms to speed things up, these tools still struggle to scale to the large, over-parameterized networks used in the real world. Standard compression techniques like pruning or quantization often lack the formal error bounds required for verification. This work bridges the gap by creating a reduction method that is both automatic and sound, meaning if the reduced network is proven safe, the original large network is guaranteed to be safe too.

Methods: On-the-Fly Neuron Merging

The core of the approach is Neuron Merging. The authors observe that for a specific set of inputs, many neurons in a layer behave similarly (e.g., many sigmoid neurons might be fully saturated near 0 or 1).

  1. Merge Buckets: Neurons with similar output bounds are grouped into "buckets." All neurons in a bucket are replaced by a single representative neuron with a constant output.
  2. Soundness via Error Bounds: To ensure the reduction is sound, the weights of the surrounding layers are adjusted and an explicit "approximation error" term is added. This ensures the reduced network's output set always encloses (envelops) the original network's output set.
  3. On-the-Fly Reduction: Instead of a separate preprocessing step, the algorithm performs reduction during the verification process. It uses a "one-step look-ahead" with simple interval arithmetic to identify mergeable neurons without heavy computational costs.
  4. Sound Image Compression: For CNNs, the authors exploit spatial redundancy. By grouping similar neighboring pixels into superpixels with formal bounds, they drastically reduce input dimensionality for the verification pipeline.
Illustration of the sound reduction process where similar neurons are merged into a constant with an error term.

Key Insights: Redundancy as an Opportunity

Neural networks are often massively over-parameterized. This method turns that "waste" into a speed advantage by collapsing redundant neurons into a single representative. Empirical data shows that many neurons across different layers exhibit high levels of saturation, making them ideal candidates for merging.

Histogram of neuron outputs showing high levels of saturation at 0 and 1, justifying the merging of similar neurons.
  • Activation Agnostic: Unlike many tools limited to ReLU, this reduction method works for Sigmoid, Tanh, and others because it treats reduction as a general outer-approximation problem.
  • Orthogonality: The method is "orthogonal" to other verification techniques like branch-and-bound. One can reduce the network first and then use state-of-the-art verifiers like $\alpha,\beta$-CROWN on the smaller model.

Key Results

  • Massive Speedups: On an ERAN sigmoid network, the verification time was reduced by 96% (from 4.5s to 200ms) by verifying only 10% of the original neurons.
  • Significant Compression: Large CNNs from the Marabou benchmark were reduced to just 10–15% of their original neuron count while remaining verifiable.
  • Efficiency: Even accounting for reduction overhead, the "fully automatic" approach was 30% faster than the state-of-the-art $\alpha,\beta$-CROWN verifier on large CNNs.
  • Closed-Loop Success: In quadrotor control benchmarks, the reduced network could be reused across multiple time steps, demonstrating utility for real-time control.

Limitations and Future Work

The reduction is specific to a given input set. While the reduced network can be reused for subsets of that input, a completely different input might require a new reduction. Future work includes exploring more sophisticated clustering algorithms and deeper integration into existing high-performance verifiers to further minimize computational overhead.

Summary updated

BibTeX
@article{ladner2025fully,
  author = {Tobias Ladner and Matthias Althoff},
  title = {{Fully Automatic Neural Network Reduction for Formal Verification}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=gmflcWlVMl},
}
Figure