Test Selection for Deep Learning Systems

Wei Ma, Mike Papadakis, Anestis Tsakmalis, Maxime Cordy, Yves Le Traon

TL;DR

This paper introduces novel metrics for automatically selecting challenging test data for deep learning (DL) models, moving beyond traditional code coverage. By leveraging the concept of "model uncertainty" derived from neuron dropout, these metrics effectively identify inputs that are likely to cause misclassifications and significantly improve model accuracy when used for retraining, outperforming existing methods.

What Problem Does This Paper Address?

Testing deep learning (DL) systems is notoriously difficult. Unlike traditional software, DL models' behavior is not directly tied to code logic but rather to the complex patterns learned from vast amounts of data. This makes standard testing techniques, like code coverage, inadequate. Consequently, selecting test data to effectively challenge DL models and uncover their weaknesses (misclassifications) is often a manual, ad-hoc process. This paper addresses the critical need for automated, systematic methods to select test data that can both reveal model flaws and enhance model performance through retraining.

Methods

The core of this paper lies in proposing new "model uncertainty" metrics for test selection. Instead of focusing on code coverage or input diversity, the authors hypothesize that inputs causing higher uncertainty in the DL model are more likely to lead to misclassifications and are thus more informative for testing and retraining.

Their approach utilizes neuron dropout, a technique where neurons are randomly deactivated during inference. By observing how the model's predictions vary across multiple runs with different neurons dropped out, they can estimate the model's uncertainty for a given input. Specifically, they propose:

  • Maximum Probability Score (MaxP): A simple metric based on the highest predicted class probability. Lower probabilities indicate higher uncertainty.
  • Variance Score: Measures the variance of prediction probabilities across multiple dropout runs. Higher variance suggests more uncertainty.
  • Weighted Variance Score: Normalizes the variance score by the highest prediction probability to account for the model's overall confidence.
  • Kullback-Leibler (KL) Score: Compares the distribution of predictions from dropout mutants to a uniform distribution, quantifying uncertainty.

These uncertainty-based metrics are then compared against existing "surprise adequacy" metrics, which focus on input diversity.

Datasets

The authors evaluate their proposed metrics on two widely-used image classification datasets:

  • CIFAR-10: A standard dataset with 60,000 labeled images across 10 classes.
  • Fashion-MNIST: A more challenging dataset consisting of 70,000 clothing images across 10 classes, chosen over the simpler MNIST dataset.

They also utilize adversarial data, generated using methods like FGSM, JSMA, and DeepFool, to test the robustness of their metrics.

Key Insights and Ideas

  • Uncertainty as a Proxy for Challenge: The central idea is that inputs causing high uncertainty in a DL model are precisely the ones that are hard for it to classify correctly. This is a more direct link to misclassification than traditional coverage metrics.
  • Dropout for Uncertainty Estimation: Leveraging neuron dropout, a technique already used for regularization, as a method to probe model uncertainty during inference is a novel application for test selection.
  • Informative Data for Retraining: The same uncertainty metrics that identify challenging test cases also highlight data that is most informative for improving the model's accuracy through retraining.
  • Limitations of Surprise Adequacy: The paper suggests that surprise adequacy metrics, while aiming for diversity, might not always select data that is truly close to class boundaries and thus challenging for well-trained models.

Key Results

  • Effective Test Selection: Uncertainty-based metrics (Var, KL, Varw, MaxP) showed a strong correlation with misclassifications, especially when combined with adversarial data.
  • Superior Retraining Performance: When used to select data for retraining, the proposed uncertainty metrics led to significant accuracy improvements. On one dataset, they achieved up to 80% higher gain compared to random selection and surprise adequacy metrics. On another, the gain was up to 29%.
  • Robustness to Adversarial Data: The uncertainty metrics demonstrated a good ability to distinguish between real, well-classified inputs and misclassified inputs (both real and adversarial), outperforming surprise adequacy metrics in this regard.
  • Faster Convergence: The use of uncertainty metrics for training data selection also led to faster model convergence during retraining.

Limitations and Future Work

  • Threats to Validity: The authors acknowledge potential threats to internal validity (implementation details, layer choice for LSA) and external validity (number of datasets, models, and adversarial generation algorithms considered).
  • Adversarial Data Only: When tested solely on adversarial data, the metrics showed reduced ability to discriminate between well-classified and misclassified inputs, possibly due to the rapid increase in uncertainty caused by adversarial attacks.
  • Future Work: The paper positions its work as a first step towards a long-term goal of equipping researchers and practitioners with systematic and objective test assessment metrics for self-learning systems. This suggests a continued focus on refining these metrics and exploring their application in broader DL testing scenarios.

Summary updated

BibTeX
@article{ma2021test,
  author = {Wei Ma and Mike Papadakis and Anestis Tsakmalis and Maxime Cordy and Yves Le Traon},
  title = {{Test Selection for Deep Learning Systems}},
  journal = {ACM Trans. Softw. Eng. Methodol.},
  year = {2021},
  doi = {10.1145/3417330},
}
Figure