Enhancing mutation testing for deep neural networks: a novel approach to generating high-quality mutants
摘要
In deep neural network (DNN) testing, high-quality test cases are essential to ensure the effectiveness and completeness of the testing. Mutation testing has been used in DNN testing to evaluate the quality of test cases. However, existing methods don’t consider the importance of different neurons; they randomly select neurons for mutation, resulting in low-quality mutants. To address this issue, we propose a novel method for generating high-quality mutants tailored for DNNs. Our approach first analyzes the output distribution of neurons and calculates their activation thresholds. Depending on these thresholds, we identify the behavior of neurons and select the most frequently activated neurons for each category as category-critical neurons. Next, we mutate these category-critical neurons to produce a candidate set of high-quality mutants. Although mutating category-critical neurons could reveal more errors, some mutants can cause significant changes in DNNs, making them easily killed and reducing the effectiveness of mutation testing. Thus, we further optimize the candidate set to get high-quality mutants. We calculate each mutant’s Category Above Ratio (CAR) score according to its execution behavior. Lastly, mutants whose CAR score is greater than or equal to the CAR threshold will be selected as higher-quality mutants. We also validate our method on several popular datasets and models. Experimental results demonstrate that our approach generates higher-quality mutants than random methods, reducing the number of mutants by 79.7% to 96.3%, while maintaining the effectiveness of mutation testing. Furthermore, retraining models with test cases generated by high-quality mutants could improve the robustness of the models.