DeepMutation: Mutation Testing of Deep Learning Systems

Lei Ma, Fuyuan Zhang, Jiyuan Sun, Minhui Xue, Bo Li 0026, Felix Juefei-Xu, Chao Xie, Li Li 0029, Yang Liu, Jianjun Zhao, Yadong Wang

Introduction

In traditional software engineering, the quality of a test suite is often measured by "code coverage." However, in Deep Learning (DL), logic is not explicitly defined in lines of code but is instead learned and stored within millions of weights. Consequently, the standard metric for DL systems—accuracy on a test set—can be misleading. If a test set is biased or lacks diversity, a model might achieve high accuracy while remaining fragile in real-world scenarios.

DeepMutation addresses this by adapting the concept of "mutation testing" to the DL paradigm. By intentionally injecting subtle faults into training data, code, or trained models, the framework measures how effectively a test suite can distinguish a "broken" model from a healthy one, providing a rigorous metric for test data quality.

The DeepMutation Framework

The authors propose a two-tiered mutation framework to simulate potential faults in the DL development lifecycle:

  1. Source-Level Mutation: These operators target the "ingredients" of the model. Data Mutations involve mislabeling samples or adding noise to the training set, while Program Mutations alter the training code itself (e.g., changing activation functions). While highly realistic, these require computationally expensive re-training for every mutant.
  2. Model-Level Mutation: These operators inject faults directly into the trained weights or architecture without re-training. Techniques include Gaussian Fuzzing (adding noise to weights), Neuron Effect Blocking (zeroing out outputs), and Layer Deactivation. This approach significantly improves efficiency, mirroring "bytecode mutation" in traditional software.

The "Kill" Metric

A test input is said to "kill" a mutant if the original model predicts the correct class but the mutated model predicts something else. The Mutation Score—the percentage of mutants killed by the test set—serves as the primary indicator of a test set's rigor.

Decision Boundary Sensitivity

A key insight of the research is that mutations often shift the decision boundaries of a model. Test data that resides close to these boundaries (sensitive regions) is far more effective at killing mutants than "easy" data points located deep within a class's territory.

Figure 4: Visualization of how mutation operators shift the original decision boundary, creating regions where test inputs can 'kill' the mutant.

Experimental Evaluation

The framework was evaluated using the MNIST and CIFAR-10 benchmarks across multiple neural network architectures, including LeNet-5. The results demonstrated that the mutation operators could successfully create models with Average Error Rates (AER) ranging from 0.13% to 17.20%, simulating both subtle "silent" bugs and major regressions.

Uniform vs. Non-Uniform Sampling

To prove the framework's utility, the authors compared "weak" test sets (non-uniform sampling focused on specific classes) against "strong," diverse test sets. DeepMutation correctly assigned significantly higher mutation scores to the diverse sets, confirming its ability to detect under-tested regions of the input space.

Figure 6: Comparison of mutation scores for uniform and non-uniform sampling across different models and data sizes, demonstrating the framework's sensitivity to test set quality.

Conclusion and Future Work

DeepMutation shifts the focus from evaluating the model to evaluating the evaluation itself. By providing a systematic way to "test the tests," it allows developers to identify class-level weaknesses and improve the robustness of DL systems. Future work aims to expand this framework to Recurrent Neural Networks (RNNs) and investigate how closely these synthetic mutations align with real-world human errors in DL development.

Summary updated

BibTeX
@inproceedings{ma2018deepmutation,
  author = {Lei Ma and Fuyuan Zhang and Jiyuan Sun and Minhui Xue and Bo Li and Felix Juefei-Xu and Chao Xie and Li Li and Yang Liu and Jianjun Zhao and Yadong Wang},
  title = {{DeepMutation: Mutation Testing of Deep Learning Systems}},
  booktitle = {ISSRE},
  year = {2018},
  url = {https://openreview.net/forum?id=47yOYx_V0V6S},
}
Figure