Revisiting Neuron Coverage Metrics and Quality of Deep Neural Networks

Zhou Yang, Jieke Shi, Muhammad Hilmi Asyrofi, David Lo

TL;DR

This paper replicates and extends previous work questioning the effectiveness of neuron coverage metrics for testing deep neural networks (DNNs). The authors find that coverage-driven methods are generally less effective than gradient-based methods at uncovering defects and improving model robustness, even when transformations are restricted to be differentiable.

What Problem Does This Paper Address?

Deep neural networks (DNNs) are increasingly used in critical applications like autonomous driving, making their reliability and robustness paramount. To test conventional software, code coverage metrics are widely used to guide test case generation. Analogously, researchers have proposed "neuron coverage" metrics for DNNs, aiming to generate test cases that activate a diverse set of neurons. However, recent studies have cast doubt on the efficacy of these neuron coverage metrics, suggesting they don't necessarily lead to better model quality or defect detection compared to gradient-based adversarial attack methods. This paper aims to rigorously re-evaluate these claims by replicating previous findings and extending the experiments with larger models, higher-resolution datasets, and more diverse testing techniques.

Methods

The core of this study is a replication and extension of prior work by Yan et al. [11]. The authors employ a variety of neuron coverage metrics, including k-multisection Neuron Coverage (KMNC), Neuron Boundary Coverage (NBC), and Strong Neuron Activation Coverage (SNAC). They compare coverage-driven test case generation methods (specifically variants of DeepHunter) with gradient-based methods like Fast Gradient Sign Method (FGSM) and Projected Gradient Descent (PGD).

A key aspect of their methodology is the investigation of adversarial training. They explore whether retraining DNNs with adversarial examples generated by coverage-driven methods can improve model robustness. They also introduce a refined process for iterative model retraining, mimicking a more realistic DNN development lifecycle. A novel contribution is the creation of two variants of DeepHunter: one restricted to differentiable transformations (DH-D) and another to non-differentiable transformations (DH-N), to isolate the impact of different perturbation types.

Datasets

The study utilizes several standard datasets for DNN research:

  • MNIST: Grayscale images of handwritten digits.
  • CIFAR-10: 32x32 color images across 10 classes.
  • SVHN (Street View House Numbers): 32x32 color images of house numbers.
  • EuroSAT: Higher-resolution satellite images covering 13 spectral bands across 10 classes. This dataset is notable for its larger image resolution, allowing the authors to examine the generalizability of findings to more complex inputs.

Key Insights and Ideas

  • Coverage doesn't guarantee quality: The study reinforces the finding that simply increasing neuron coverage metrics does not consistently lead to improvements in model quality metrics. This suggests a disconnect between what coverage metrics aim to measure and what constitutes a truly robust and reliable DNN.
  • Coverage-improving vs. Coverage-remaining examples: The authors distinguish between test cases that increase neuron coverage ("coverage-improving") and those that don't ("coverage-remaining"). Surprisingly, retraining models with coverage-improving examples did not yield significantly better results than using coverage-remaining examples, further questioning the utility of coverage metrics.
  • Gradient-based methods still lead: The research consistently shows that gradient-based adversarial attack methods are more effective at uncovering DNN failures (i.e., generating misclassified test cases) than coverage-driven methods.
  • Differentiable vs. Non-differentiable transformations: While coverage-driven methods can employ non-differentiable transformations (like rotation and blurring) that gradient-based methods cannot, restricting coverage-driven methods to only differentiable transformations did not significantly impact their ability to uncover defects. This suggests that the limitations of coverage-driven methods might not solely stem from their ability to perform non-differentiable transformations.
  • Adversarial training limitations: Adversarial training using gradient-based methods, while effective against its own generated attacks, does not appear to effectively repair defects uncovered by coverage-driven methods. This implies that different testing strategies uncover different types of vulnerabilities.

Key Results

  • Model quality metrics are not monotonous with coverage: Across various metrics, model quality did not show a consistent upward trend as neuron coverage increased.
  • No significant difference between coverage-improving and remaining examples: Statistical tests (Mann-Whitney U test) showed no significant difference in model quality metrics when models were retrained using coverage-improving versus coverage-remaining examples (p > 0.05 for robustness metrics).
  • Gradient-based methods significantly outperform coverage-driven methods: Misclassification rates on test cases generated by gradient-based methods were significantly higher than those from coverage-driven methods (p < 0.001).
  • Differentiable vs. Non-differentiable transformations: There was no significant difference in the performance of coverage-driven methods when restricted to only differentiable or non-differentiable transformations (p = 0.45).
  • Adversarial training harms benign accuracy: Retraining models with adversarial examples (both coverage-driven and gradient-based) statistically significantly decreased accuracy on benign datasets compared to original models (p = 0.002).
  • Adversarial training fails to defend against coverage-driven attacks: Statistical tests confirmed that adversarial training with gradient-based methods could not defend against test cases generated by coverage-driven methods (p < 0.05).

Limitations and Future Work

The authors acknowledge that their work replicates and extends previous findings, confirming that coverage-driven methods are less effective than gradient-based methods. A key limitation highlighted is the inability of adversarial training with gradient-based methods to repair defects uncovered by coverage-driven methods. This suggests that more specialized defensive strategies for coverage-driven test cases are needed. The paper concludes by emphasizing the need for further research into these defensive strategies.

Summary updated

Abstract

Deep neural networks (DNN) have been widely applied in modern life, including critical domains like autonomous driving, making it essential to ensure the reliability and robustness of DNN-powered systems. As an analogy to code coverage metrics for testing conventional software, researchers have proposed neuron coverage metrics and coverage-driven methods to generate DNN test cases. However, Yan et al. doubt the usefulness of existing coverage criteria in DNN testing. They show that a coverage-driven method is less effective than a gradient-based method in terms of both uncovering defects and improving model robustness. In this paper, we conduct a replication study of the work by Yan et al. and extend the experiments for deeper analysis. A larger model and a dataset of higher resolution images are included to examine the generalizability of the results. We also extend the experiments with more test case generation techniques and adjust the process of improving model robustness to be closer to the practical life cycle of DNN development. Our experiment results confirm the conclusion from Yan et al. that coverage-driven methods are less effective than gradient-based methods. Yan et al. find that using gradient-based methods to retrain cannot repair defects uncovered by coverage-driven methods. They attribute this to the fact that the two types of methods use different perturbation strategies: gradient-based methods perform differentiable transformations while coverage-driven methods can perform additional non-differentiable transformations. We test several hypotheses and further show that even coverage-driven methods are constrained only to perform differentiable transformations, the uncovered defects still cannot be repaired by adversarial training with gradient-based methods. Thus, defensive strategies for coverage-driven methods should be further studied.
BibTeX
@inproceedings{yang2022revisiting,
  author = {Zhou Yang and Jieke Shi and Muhammad Hilmi Asyrofi and David Lo},
  title = {{Revisiting Neuron Coverage Metrics and Quality of Deep Neural Networks}},
  booktitle = {SANER},
  year = {2022},
  doi = {10.1109/saner53432.2022.00056},
}
Figure