Weight-based Semantic Testing Approach for Deep Neural Networks

Amany Alshareef, Nicolas Berthier, Sven Schewe, Xiaowei HuangAISafety/SafeRL @ IJCAI 2023

Introduction

Deep Neural Networks (DNNs) have become central to modern software, yet their "black-box" nature presents significant challenges for quality assurance. Traditional software testing relies on explicit requirements, whereas DNNs are data-driven. Current testing methods often rely on structural coverage metrics, such as Neuron Coverage, which simply count the number of activated neurons. However, high neuron coverage does not necessarily correlate with model robustness or the thoroughness of decision-logic testing. Many neurons may fire without significantly influencing the final output. To address this, this research proposes a semantic testing approach that prioritizes the internal features most critical to a model's behavior.

Methodology

The proposed framework shifts the focus from syntactic neuron activations to semantic feature representations through a multi-stage process.

1. Bayesian Network Abstraction

Rather than analyzing individual neurons, the framework utilizes dimensionality reduction techniques like Principal Component Analysis (PCA) or Independent Component Analysis (ICA) to extract latent features from hidden layers. These features and their interdependencies are then modeled as an Abstract Bayesian Network (BN). This abstraction provides a high-level view of the model's internal logic.

The Abstract Bayesian Network represents the causal relationships between latent features extracted from DNN layers.

2. Importance Weighting

Recognizing that not all features contribute equally to the model's output, the researchers employ a sensitivity analysis algorithm to assign importance weights. Features that cause significant shifts in the output distribution when perturbed are assigned higher weights. This ensures that testing efforts are concentrated on the most influential parts of the network.

Conditional probability tables and node weights used to quantify the importance of specific feature intervals.

3. Semantic Coverage Metrics

The framework introduces two primary metrics:

  • Weight-based Feature Coverage (WFCov): Measures the extent to which high-importance feature intervals are exercised by a test set.
  • Weight-based Feature Dependence Coverage (WFdCov): Evaluates how well the causal relationships between important features have been explored.

Experimental Evaluation

The approach was evaluated on two benchmark datasets: Fashion-MNIST (89.03% accuracy) and CIFAR-10 (81.00% accuracy), using complex Convolutional Neural Networks (CNNs). The metrics were integrated into the DeepConcolic testing tool to guide the generation of new test cases by prioritizing under-tested, high-weight regions.

Results and Discussion

The weight-based approach demonstrated several advantages over unweighted methods. Firstly, WFCov provided a more stable and "honest" assessment of coverage; unweighted metrics often dilute results by counting irrelevant features. Secondly, the weighted guidance allowed for faster convergence during test generation. Finally, the method proved highly effective at identifying adversarial vulnerabilities by systematically targeting high-weight feature intervals that unweighted approaches typically overlook.

Conclusion

While the framework introduces some computational overhead due to sensitivity analysis and depends on the quality of the BN abstraction, it represents a significant step toward semantic-aware DNN testing. Future work will explore the scalability of this approach to larger architectures, such as Transformer-based models.

Summary updated

BibTeX
@inproceedings{alshareef2023weight,
  author = {Amany Alshareef and Nicolas Berthier and Sven Schewe and Xiaowei Huang},
  title = {{Weight-based Semantic Testing Approach for Deep Neural Networks}},
  booktitle = {AISafety/SafeRL @ IJCAI},
  year = {2023},
}
Figure