Themis: Automatic and Efficient Deep Learning System Testing with Strong Fault Detection Capability

Dong Huang, Xiaofei Xie, Heming Cui · DOI

Abstract

Deep Learning Systems (DLSs) are increasingly deployed in safety-critical applications, yet testing them remains challenging due to their "black-box" nature and the reliance on manual threshold settings in existing tools. We present Themis, an automated testing framework that utilizes neuron "sensitivity" to input perturbations and statistical convergence as a coverage metric. Themis eliminates manual tuning, detects nearly 4x more faults than state-of-the-art tools, and significantly enhances model robustness through retraining.

Introduction

Testing Deep Learning Systems, such as those used in autonomous driving, is difficult because traditional software testing metrics do not apply to neural networks. Existing tools like DeepXplore and DeepGauge attempt to find faults—inputs where environmental noise causes failure—but they rely on human-defined "activation thresholds." This manual process is error-prone, lacks a theoretical foundation for completeness, and often results in weak correlation between detected faults and actual model error rates. Themis addresses these issues by introducing a sensitivity-based approach that automates the exploration of fault-inducing data flows.

Methodology

Themis operates on the principle that fault-inducing data flows are highly sensitive to input perturbations. A small change in input that causes a large shift in a neuron's output indicates a potential fault path.

Themis Workflow: Sensitivity Calculator, Convergence Coverage, and Maximizing Fuzzer

The framework consists of three primary phases:

  1. Sensitivity Calculator: Computes the numerical difference in activation values between clean and perturbed inputs for every neuron.
  2. Sensitivity Convergence Coverage: Instead of arbitrary thresholds, Themis employs a statistical approach using Monte Carlo Markov Chain (MCMC) to determine if neuron sensitivity distributions have converged. Convergence signifies that a neuron's behavior has been statistically fully explored.
  3. Sensitivity Maximizing Fuzzer: For neurons that have not yet converged, the system uses Gradient Ascent to adjust noise intensity, forcing the exploration of edge cases.

To maintain efficiency on large-scale models like ResNet, Themis utilizes a Sensitivity Sampler, which tracks a representative subset of neurons based on variance, providing a high-confidence approximation of total model coverage.

Experimental Evaluation

Themis was evaluated across ten DLSs and six diverse datasets, including MNIST (digits), Cifar10/ImageNet (images), Udacity (autonomous driving), and malware classification sets (Contagio/Drebin). It was compared against four state-of-the-art baselines: DeepXplore, DeepGauge, DeepImportance, and Surprise Adequacy.

Key Results

Themis demonstrated significant improvements over existing methods across several metrics:

  • Fault Detection: Themis detected an average of 3.78X more faults than baseline techniques at 100% coverage.
  • Correlation with Error Rate: The tool achieved a high correlation (0.70 to 0.95) between detected faults and actual model error rates, whereas baselines were often inconsistent.
  • Model Robustness: Retraining models with faults identified by Themis led to substantially higher accuracy gains.
Raw accuracy increase (%) across different DLSs and testing tools

As shown in the figure above, Themis consistently outperforms other tools in improving model accuracy after retraining, with an average improvement 14.7X greater than that of the baselines. Despite the complex statistical calculations, Themis only required approximately 27.1% more time than deterministic baselines, making it a viable solution for large-scale systems.

Conclusion and Limitations

Themis provides a mathematically grounded approach to DLS testing by replacing manual thresholds with statistical convergence. While it offers superior fault detection and efficiency, it is probabilistic in nature, providing a "statistically full" coverage (95% confidence) rather than a deterministic guarantee. Future work will focus on integrating Themis into safety-critical CI/CD pipelines and addressing the challenge of permanent fault elimination during retraining.

Summary updated

BibTeX
@inproceedings{huang2024themis,
  author = {Dong Huang and Xiaofei Xie and Heming Cui},
  title = {{Themis: Automatic and Efficient Deep Learning System Testing with Strong Fault Detection Capability}},
  booktitle = {ISSRE},
  year = {2024},
  doi = {10.1109/issre62328.2024.00050},
}
Figure