Toward Reliable Neural Specifications

Chuqin Geng, Nham Le, Xiaojie Xu, Zhaoyue Wang, Arie Gurfinkel, Xujie Si

Abstract: Having reliable specifications is an unavoidable challenge in achieving verifiable correctness, robustness, and interpretability of AI systems. Existing specifications for neural networks are in the paradigm of data as specification. That is, the local neighborhood centering around a reference input is considered to be correct (or robust). While existing specifications contribute to verifying adversarial robustness, a significant problem in many research domains, our empirical study shows that those verified regions are somewhat tight, and thus fail to allow verification of test set inputs, making them impractical for some real-world applications. To this end, we propose a new family of specifications called neural representation as specification, which uses the intrinsic information of neural networks - neural activation patterns (NAPs), rather than input data to specify the correctness and/or robustness of neural network predictions. We present a simple statistical approach to mining neural activation patterns. To show the effectiveness of discovered NAPs, we formally verify several important properties, such as various types of misclassifications will never happen for a given NAP, and there is no ambiguity between different NAPs. We show that by using NAP, we can verify a significant region of the input space, while still recalling 84% of the data on MNIST. Moreover, we can push the verifiable bound to 10 times larger on the CIFAR10 benchmark. Thus, we argue that NAPs can potentially be used as a more reliable and extensible specification for neural network verification.

Introduction: The Limits of Data-as-Specification

In the field of formal verification, the goal is to prove that a neural network will always behave correctly within a defined range. Currently, the industry standard follows the data-as-specification paradigm, primarily focused on adversarial robustness. This approach defines a small mathematical box (an $L_\infty$ ball) around a specific reference image and attempts to prove the network's output remains constant for any input within that box.

However, these boxes are often extremely small and overfitted to training data. Most existing verification methods fail to certify even a single image from standard test sets because test images are often mathematically "far" from training points, even if they are visually identical to humans. This gap makes current verification methods impractical for many safety-critical real-world applications.

Figure 1: Comparison of testing images, training images, and adversarial examples. Note that the adversarial example (c) is much closer to the training image (b) in $L_\infty$ distance than the actual test image (a), illustrating why distance-based specifications are often too tight.

Neural Representation as Specification

To address this, we propose a shift to Neural Representation as Specification. Instead of focusing on input pixels, this method utilizes Neural Activation Patterns (NAPs)—the internal "fingerprints" of how a network processes a class. By identifying which neurons consistently fire (or remain silent) for a given label, we can define correctness based on the network's internal logic.

Methodology

  1. NAP Mining: We use a statistical algorithm to identify neurons that are consistently active or inactive for a given class across a dataset.
  2. $\delta$-Relaxation: A tuning parameter, $\delta$, balances generality and precision. A $\delta=1.0$ NAP includes only neurons that fire for every image in a class, while lower values allow for more flexible specifications.
  3. Formal Verification: NAPs are encoded as linear constraints and integrated into the Marabou SMT-based verifier. This allows us to mathematically prove properties like non-ambiguity—ensuring no input can satisfy the NAPs of two different classes simultaneously.
  4. NAP-Augmented Robustness: By combining NAPs with traditional distance-based metrics, we can verify robustness over much larger regions of the input space, provided the internal representation remains consistent.
Figure 3: Geometric visualization of NAPs. The green and red regions represent NAPs for different classes. The "Safe $L_\infty$ box" around a sample point is contained within the NAP region, while the "Unsafe" box extends into the ambiguous white region.

Key Insights and Results

Our evaluation on MNIST and CIFAR-10 benchmarks reveals several critical advantages of the NAP approach:

  • Unprecedented Test Set Coverage: On MNIST, NAP-based specifications allowed us to formally verify 84% of the test set. In contrast, traditional $L_\infty$ methods typically verify 0% of unseen test data.
  • Massive Scaling of Verified Regions: On CIFAR-10, NAPs allowed us to push the verifiable perturbation bound to be 10 times larger than previous methods. This represents an astronomical increase in the volume of the verified input space.
  • Internal Logic vs. Input Pixels: The network's internal state is a more reliable source of truth. Two images might look different to a distance metric but trigger the same "concept" inside the network. Additionally, NAPs can help identify "noisy" data where human labels might be debatable.
  • Efficiency: Because NAPs provide strong constraints on the search space, verifiers like Marabou can often solve queries significantly faster than when using pixel-distance constraints alone.

Conclusion and Future Work

Neural Activation Patterns provide a more reliable and extensible framework for neural network verification. While current mining methods are statistical, future work will explore more precise formal algorithms for pattern discovery. Additionally, extending this framework to non-ReLU architectures and more granular neuron abstractions (beyond binary states) remains a promising direction for achieving truly verifiable AI systems.

Summary updated

BibTeX
@inproceedings{geng2023toward,
  author = {Chuqin Geng and Nham Le and Xiaojie Xu and Zhaoyue Wang and Arie Gurfinkel and Xujie Si},
  title = {{Toward Reliable Neural Specifications}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=gZXFNUcnHd},
}
Figure