Source-linked AI summary
DeepMutation: Mutation Testing of Deep Learning Systems
Lei Ma, Fuyuan Zhang, Jiyuan Sun, Minhui Xue, Bo Li, Felix Juefei-Xu, Chao Xie, Li Li, Yang Liu, Jianjun Zhao, Yadong Wang
TL;DR
DL test accuracy alone does not establish robustness or generality, and traditional mutation testing does not directly fit DL systems. DeepMutation addresses this gap with source-level and model-level fault injection, evaluating test-data quality through mutant detection. Experiments on MNIST, CIFAR-10, and three DL models demonstrate the techniques’ usefulness.
Problem
DL models can achieve high test accuracy while lacking generality and robustness, while traditional mutation testing cannot be directly applied because DL systems differ fundamentally from conventional software.
Source: §I · p. 1Method
DeepMutation injects faults through source-level operators on training data and programs and model-level operators directly on DL models, then evaluates test data by detected mutant behavior differences.
Source: §I · p. 2, §III · p. 3Results
Experiments on MNIST and CIFAR-10 with three DL models demonstrate the usefulness of the proposed mutation-testing techniques for measuring test-data quality.
Source: §I · p. 2, C. Mutation Testing Evaluation and… · p. 8, §VII · p. 10Takeaways & Limitations
Mutation testing provides a proposed measurement toward designing and constructing higher-quality DL test datasets and potentially facilitating robustness enhancement.
Source: §I · p. 2The selected datasets and DL models may threaten validity, and randomness in source-level mutant-model training can produce different models from the same training data.
Source: E. Threats To Validity · p. 9
Abstract
from arXiv · showhide
Deep learning (DL) defines a new data-driven programming paradigm where the internal system logic is largely shaped by the training data. The standard way of evaluating DL models is to examine their performance on a test dataset. The quality of the test dataset is of great importance to gain confidence of the trained models. Using an inadequate test dataset, DL models that have achieved high test accuracy may still lack generality and robustness. In traditional software testing, mutation testing is a well-established technique for quality evaluation of test suites, which analyzes to what extent a test suite detects the injected faults. However, due to the fundamental difference between traditional software and deep learning-based software, traditional mutation testing techniques cannot be directly applied to DL systems. In this paper, we propose a mutation testing framework specialized for DL systems to measure the quality of test data. To do this, by sharing the same spirit of mutation testing in traditional software, we first define a set of source-level mutation operators to inject faults to the source of DL (i.e., training data and training programs). Then we design a set of model-level mutation operators that directly inject faults into DL models without a training process. Eventually, the quality of test data could be evaluated from the analysis on to what extent the injected faults could be detected. The usefulness of the proposed mutation testing techniques is demonstrated on two public datasets, namely MNIST and CIFAR-10, with three DL models.
I. INTRODUCTION
DeepMutation adapts mutation testing to DL systems, whose behavior depends on training data, programs, network structures, and weights. It evaluates test-data quality by measuring detection of faults injected at source and model levels.
Motivation
- DL robustness and generality cannot be inferred reliably from accuracy on a prepared test dataset alone.The paper identifies systematic evaluation of test-data quality as necessary for confidence in DL systems.Source: §I · p. 1
- Traditional mutation testing cannot be directly transferred because DL behavior is shaped by training data, training programs, network structures, and learned weights.Training data and training programs produce the weights that determine much of the model’s behavior.Source: §I · p. 1
Framework
- DeepMutation evaluates test-data quality by generating mutants and checking whether candidate tests detect output differences between original and mutated DL models.A test input detects a mutant when the original and mutant models produce inconsistent outputs; more detected differences indicate higher test-data quality.Source: §I · p. 1
- The framework combines eight source-level operators on training data and programs with eight model-level operators that inject faults directly into DL models.Model-level mutation avoids retraining and supports efficient generation of many fine-grained mutants.Source: §I · p. 2
Evaluation
- The framework includes two DL-specific metrics for quantitative measurement of test quality and was evaluated on MNIST, CIFAR-10, and three DL models.The evaluation is presented as demonstrating usefulness for designing and constructing higher-quality test datasets.Source: §I · p. 2
II. BACKGROUND
DL software uses a data-driven programming paradigm in which training data and programs shape a neural network’s encoded logic. This differs fundamentally from traditional software, whose developer-written source code specifies decomposable logic units.
A. Programming Paradigms
- Traditional software implements developer-crafted logic in source-code units such as classes, methods, statements, and branches.These units can be tested as targets of software-quality measurements such as statement and branch coverage.Source: A. Programming Paradigms · p. 2
- DL software programs core logic through model training using large amounts of data, with logic encoded in neural-network weights and nonlinear activation functions.Developers collect training data specifying desired behavior and prepare a training program describing network structure and runtime training behavior.Source: A. Programming Paradigms · p. 2
- The source-level mutation-testing workflow for DL systems targets the training data and training program rather than only conventional executable code.This workflow reflects the data-driven construction process described for DL software.Source: A. Programming Paradigms · p. 2, Figure 3 · p. 3
B. Mutation Testing
Mutation testing evaluates test-data quality by injecting faults into software and measuring whether tests detect the resulting behavioral differences. DeepMutation applies this principle to DL sources and models through specialized operators and metrics.
B. Mutation Testing
- Traditional mutation testing creates faulty program mutants by applying predefined operators that slightly modify an original program.For example, an operator may replace a ‘+’ operator with ‘−’.Source: B. Mutation Testing · p. 3
- Tests are first filtered by executing the complete test set on the original program, retaining passed tests for mutant analysis.A mutant is killed when a retained test exposes behavior different from the original program.Source: B. Mutation Testing · p. 3
- Mutation score is traditionally the ratio of killed mutants to all generated mutants and indicates test-set quality.The paper notes that this metric is inappropriate for DL systems because large test sets can kill mutants easily and reduce precision.Source: B. Mutation Testing · p. 3
- DeepMutation introduces source-level operators that modify DL training data or training programs to create mutated inputs for retraining.The source-level workflow applies operators to generate D′ and P′, then trains mutated models for testing.Source: §III · p. 3, A. Source-level Mutation Testing… · p. 3, B. Source-level Mutation Operators for… · p. 3
- The framework defines quantitative mutation-testing metrics for evaluating DL test-data quality and uses data and program mutation operators to introduce potential faults.Training-data operators reflect potential collection problems and may apply globally or locally within a dataset.Source: §III · p. 3, B. Source-level Mutation Operators for… · p. 3, 1) Data Mutation Operators · p. 3
1) Data Mutation Operators:
The framework mutates training data and programs to simulate faults that can arise during DL system development. Its data operators cover duplication, labeling, deletion, ordering, and noise, while related program operators alter layers and activations.
Data Mutation Operators
- Data Repetition duplicates a small portion of training data to simulate repeated collection from similar sources.Source: 1) Data Mutation Operators · p. 4
- Label Error changes labels on training examples to simulate mislabeled data.Source: 1) Data Mutation Operators · p. 4
- Data Missing removes training examples, representing inadvertent or mistaken deletion during data preparation.Source: 1) Data Mutation Operators · p. 4
- Data Shuffle changes training-data order because training procedures can be sensitive to presentation order.Source: 1) Data Mutation Operators · p. 4
- Noise Perturbation adds random perturbations to training data, such as pixel noise in images.Source: 1) Data Mutation Operators · p. 4
Program Mutation Operators
- Source-level program operators include layer removal, layer addition, and activation-function removal, with structural compatibility restrictions for layer changes.Source: 2) Program Mutation Operators · p. 4
C. Mutation Testing Metrics for DL Systems
DL mutation testing evaluates test data using class-sensitive mutant behavior rather than the traditional mutant-count score alone. It filters incorrect original-model cases, controls mutant quality by error rate, and highlights sensitive regions near decision boundaries.
Metric Setup
- Only test points correctly handled by the original model are evaluated against generated mutant models.Source: C. Mutation Testing Metrics for DL… · p. 4
Mutation Score
- A test point kills a mutant class when the original model correctly assigns that class but the mutant does not.Source: C. Mutation Testing Metrics for DL… · p. 5
- The DL mutation score aggregates the classes killed across mutants and normalizes by the number of mutants and classes.Source: C. Mutation Testing Metrics for DL… · p. 5
Mutant Quality Control
- Mutants with excessively high error rates on the filtered test data are excluded because they differ too greatly from the original model.Source: C. Mutation Testing Metrics for DL… · p. 5
Average Error Rate
- Average error rate measures the overall behavioral difference introduced by mutation operators across mutant models.Source: C. Mutation Testing Metrics for DL… · p. 5
Interpretation
- Data near the original decision boundary are more likely to kill mutant models, increasing the mutation score and average error rate.Source: C. Mutation Testing Metrics for DL… · p. 5
IV. MODEL-LEVEL MUTATION TESTING OF DL SYSTEMS
Model-level mutation testing directly modifies trained DL models instead of retraining models after changing training data or programs. The approach uses eight operators spanning weights, neurons, activations, and layers to generate mutants more efficiently.
Workflow
- Model-level mutation testing targets the trained model M, avoiding the source-level changes to training data D and program P.Source: A. Model-Level Mutation Testing… · p. 5, §IV · p. 5
- The workflow filters test inputs through the original model before running the correctly processed data on each generated mutant.Source: A. Model-Level Mutation Testing… · p. 5
Motivation
- Direct model modification is expected to improve mutant-generation efficiency by avoiding the training procedure.Source: A. Model-Level Mutation Testing… · p. 5, B. Model-level Mutation Operators for… · p. 5
Weight-level Operators
- Gaussian Fuzzing samples a weight from N(w, σ^2), with 99.7% probability placing it within [w −3σ, w + 3σ].Source: B. Model-level Mutation Operators for… · p. 6
Neuron-level Operators
- Weight Shuffling randomly exchanges a neuron's connection weights, while Neuron Effect Blocking resets outgoing connection weights to zero.Source: B. Model-level Mutation Operators for… · p. 6
- Neuron Activation Inverse changes a neuron's pre-activation output sign, and Neuron Switch exchanges two neurons within a layer.Source: B. Model-level Mutation Operators for… · p. 6
Layer-level Operators
- Layer Deactivation, Layer Addition, and activation-function removal alter layer transformations under input-output shape constraints where required.Source: B. Model-level Mutation Operators for… · p. 6
V. EVALUATION
DeepMutation was implemented with Keras and TensorFlow and evaluated on two practical datasets and three DL model architectures. The supplied passages describe the evaluation scope but report no outcome values.
Implementation
- DeepMutation implements source-level and model-level mutation testing techniques using Keras with a TensorFlow backend.Source: §V · p. 6
Evaluation Subjects
- The evaluation uses two practical datasets and three DL model architectures to demonstrate the proposed framework's usefulness.Source: §V · p. 6
A. Subject Dataset and DL Models
The evaluation uses MNIST and CIFAR-10 with three DL models, while controlled datasets vary sampling scope and class balance to assess test-data quality. Candidate datasets are filtered through original models before mutation analysis.
- MNIST contains 60,000 training and 10,000 test images across 10 digit classes, while CIFAR-10 contains 50,000 training and 10,000 test images across 10 classes.Source: A. Subject Dataset and DL Models · p. 7
- The study evaluates three DL models with 107,786, 694,402, and 1,147,978 trainable parameters.Source: A. Subject Dataset and DL Models · p. 7
- Controlled settings sample approximately 10% of either original training data or accompanied test data.Source: 1) Test Data · p. 7
- Each setting pairs uniformly sampled data covering all classes with non-uniformly sampled data focused mainly on a single class.Source: 1) Test Data · p. 7
- Passed candidate data generate 30 dataset pairs across two settings, three models, and five repetitions.Source: 1) Test Data · p. 7
2) DL Mutant Model Generation:
The framework generates source-level and model-level DL mutants, executes passed candidate data against them, and evaluates test data using average error rate and mutation score. Results favor uniformly sampled data, while dataset size and mutation level can change outcomes.
DL Mutant Model Generation
- Source-level mutation retrains models after mutating 1% of training data or applying program-level operators, whereas model-level mutation directly alters sampled weights, neurons, or eligible layers.Source: 2) DL Mutant Model Generation · pp. 7–8
- The execution phase runs passed candidate data on mutant models and calculates mutation score and average error rate after filtering high-error mutants.Source: C. Mutation Testing Evaluation and… · p. 8
Results
- Average error rates range from 0.13% to 17.20%, with uniformly sampled data achieving higher average error rates in all controlled settings.Source: C. Mutation Testing Evaluation and… · p. 8
- Uniform sampling also produces higher averaged mutation scores across all controlled data-pair settings.Source: C. Mutation Testing Evaluation and… · p. 8
- For source-level testing of model B, 1,000 uniformly sampled test data yield 0.66% AER versus 0.49% for 5,000 uniformly sampled training data.Source: C. Mutation Testing Evaluation and… · p. 8
- The same 1% mutation ratio produces different mutation scores for source-level and model-level testing, including lower scores for model A but higher scores for model B at source level.Source: C. Mutation Testing Evaluation and… · p. 9
- Many cases still have low mutation scores, indicating low-quality evaluated tests in the studied high-dimensional setting.Source: C. Mutation Testing Evaluation and… · p. 9
D. Mutation Testing of Original Test Data by Class
The study evaluates original test data separately by class to examine whether different classes provide different mutation-testing evidence for DL models.
- For MNIST and CIFAR-10, the accompanied test data are separated into ten class-specific datasets and filtered on models A, B, and C.Source: 1) Test Data and Mutant Models · p. 9
- Class-specific test data can obtain different mutation scores and average error rates across models.Source: 1) Test Data and Mutant Models · p. 9
1) Test Data and Mutant Models:
Class-level mutation testing identifies differences in the testing value of data from individual classes and supports targeted enhancement of weak test data. The study also notes dataset and model selection as a validity threat.
Mutation Testing Results of Test Data by Class
- For model A, class 3 has the lowest mutation score and AER, at 6.25% and 1.48%, respectively.Source: 2) Mutation Testing Results of Test… · p. 9
- A higher AER does not necessarily produce a higher mutation score: model A’s class 1 has larger AER but smaller mutation score than class 2.Source: 2) Mutation Testing Results of Test… · p. 9
- Mutation testing quantitatively analyzes test-data quality by class and helps localize weak data.Source: 2) Mutation Testing Results of Test… · p. 9
Threats To Validity
- The paper identifies the selection of subject datasets and DL models as a threat to validity.Source: E. Threats To Validity · p. 9
Mutation Testing of Traditional Software
- DeepMutation is presented as the first DL mutation-testing framework combining source-level and model-level mutators.Source: A. Mutation Testing of Traditional… · p. 10
B. Testing and Verification of DL Systems
Existing DL testing and verification techniques address aspects such as adversarial-example generation and safety-property verification, while DeepMutation introduces mutation testing to evaluate DNN test-data quality. The framework applies source-level and model-level fault injection and is demonstrated on MNIST and CIFAR-10 with three DL models.
- Existing DL testing mainly probes accuracy, while DeepXplore generates adversarial examples to achieve neuron coverage through white-box differential testing.Source: B. Testing and Verification of DL… · p. 10
- VERIVIS verifies DNN safety properties under specified input transformations, but its transformations remain simpler than potential real-world transformations.Source: B. Testing and Verification of DL… · p. 10
- Formal verification for DNNs is promising, yet most demonstrations use simple architectures, leaving scalable verification for complex real-world networks as an open direction.Source: B. Testing and Verification of DL… · p. 10
- DeepMutation is presented as mostly orthogonal to existing testing and verification because it systematically evaluates DNN test-data quality through mutation testing.Source: B. Testing and Verification of DL… · p. 10
- The framework injects faults into training data, training programs, and trained models, then uses mutation-testing metrics to measure test-data quality.Source: §VII · p. 10
- The paper describes this work as an initial exploratory attempt and identifies broader mutation operators and human-fault comparability as future work.Source: §VII · p. 10
Related papers
This paper cites
- TensorFlow: A system for large-scale machine learning2016
- Towards Evaluating the Robustness of Neural Networks2016
- Reluplex: An Efficient SMT Solver for Verifying Deep Neural Networks2017
- DeepXplore: Automated Whitebox Testing of Deep Learning Systems2017
- Generating Adversarial Examples with Adversarial Networks2018