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

arXiv:1805.05206v2cs.SE

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. 1
  • Method

    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. 3
  • Results

    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. 10
  • Takeaways & Limitations

    Mutation testing provides a proposed measurement toward designing and constructing higher-quality DL test datasets and potentially facilitating robustness enhancement.

    Source: §I · p. 2

    The 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 · show

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

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

Mutation Score

Mutant Quality Control

Average Error Rate

Interpretation

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

Motivation

Weight-level Operators

Neuron-level Operators

Layer-level Operators

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

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.

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

Threats To Validity

Mutation Testing of Traditional Software

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
Loading 1805.05206v2…