Fuzzy testing method based on seed queue optimization
By designing a core neuron selection strategy and uncertainty score calculation method, and optimizing the seed queue construction process, the problems of low testing efficiency and difficulty in discovering vulnerabilities in existing fuzz testing methods are solved, achieving more efficient fault detection and improved model robustness.
Patent Information
- Application Number
- CN202511122042.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-08-12
AI Technical Summary
Existing fuzz testing methods based on seed distance and neuron information have low testing efficiency and risk of missed detection in deep learning models, and fail to fully consider the impact of seeds on model decisions, making it difficult to effectively discover potential vulnerabilities in deep learning models.
A core neuron selection strategy was designed to screen out sensitive and critical neurons. The uncertainty score calculation method and uncertainty seed selection strategy were combined to optimize the seed queue construction process. By quantifying the uncertainty potential of seeds, seeds with high mutation potential were prioritized for testing.
It significantly improves the fuzz testing efficiency and fault detection rate of deep learning models, improves the robustness of the model, can more efficiently discover potential vulnerabilities, and improves the fault detection rate and model accuracy.
Smart Images

Figure CN120633748A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of fuzzy testing methods and relates to a fuzzy testing method based on seed queue optimization. Background Art
[0002] In recent years, deep learning has been widely used in many fields such as robotics, autonomous driving, fault diagnosis, and smart homes. Studies have shown that deep learning models are vulnerable to adversarial attacks, which cause deep learning models to make incorrect decisions after adding small perturbations to the input. This poses a threat to the quality of deep learning systems, especially when they are applied to safety-critical fields. Incorrect decisions can lead to significant economic losses and even casualties. Therefore, a comprehensive and systematic quality assessment of deep learning models is required before deep learning systems are deployed.
[0003] Fuzz testing is a general vulnerability discovery method that is currently widely used in testing deep learning models. This method automatically generates diverse test inputs, systematically explores the model's behavioral boundaries, and identifies potential security risks. It can be divided into five steps: seed queue construction, seed selection, neuron selection, seed mutation, and coverage analysis.
[0004] Seed queue construction is to screen out initial test samples for fuzz testing from the corpus. The quality of these samples directly affects the efficiency of fuzz testing. Seed queue construction can be divided into three categories: construction strategy based on seed distance, construction strategy based on neuron information, and construction strategy based on algorithm.
[0005] Among seed-distance-based construction strategies, DeepHyperion (Zohdinasab T, Riccio V, GambiA, et al. Deephyperion: exploring the feature space of deep learning-based systems through illumination search[C] / / Proceedings of the 30th ACM SIGSOFTInternational Symposium on Software Testing and Analysis, 2021:79–90.) searches for seeds that are likely to cause model errors or errors, and then calculates pairwise Manhattan distances to select the most diverse set of seeds. This approach improves seed diversity, but it doesn't consider the impact of seeds on model decision-making. Instead, it relies solely on the geometric distance between seeds, failing to optimize the seed selection process. Consequently, it risks low testing efficiency and missed detections.
[0006] Among strategies based on neuron information, Huang et al. (Huang D, Bu Q, Fu Y, et al. NeuronSensitivity-Guided Test Case Selection[J]. ACM Transactions on SoftwareEngineering and Methodology, 2024, 33(7): 1–32.) proposed the NSS method, which uses the sensitivity neuron information induced by test cases to select valuable test cases. However, the selected neurons only focus on sensitivity and ignore the impact of the model's final layer output, which is not comprehensive enough.
[0007] In summary, existing methods based on the distance between seeds fail to consider the impact of seeds on model decisions and only focus on calculating the distance between seeds. Although the technology based on neuron information focuses on neuron activation, it does not fully consider the multidimensional role of neurons in the decision-making process, which affects the test efficiency. In addition, the algorithm-based construction strategy has high computational complexity and often focuses on the diversity of seeds, but fails to fully consider the neurons inside the deep learning model. Therefore, it may not be able to effectively discover potential vulnerabilities in the deep learning model. Summary of the Invention
[0008] The purpose of the present invention is to provide a fuzz testing method based on seed queue optimization. The constructed seed queue has high uncertainty and can effectively improve the fuzz testing efficiency of deep learning models.
[0009] The technical solution adopted in the present invention is: The fuzz testing method based on seed queue optimization is implemented in the following steps: Step 1: Design a core neuron selection strategy to screen out sensitive neurons and key neurons in the deep neural network model to form a core neuron set; Step 2: Design an uncertainty score calculation method to calculate the uncertainty score of each image seed and save the image seeds with higher scores into the seed queue; In step 3, random mutation is performed on the image seed queue obtained in step 2 to generate new mutation seeds. An uncertain seed selection strategy is designed to evaluate each mutation seed, and the mutation seeds that meet the conditions are added back to the seed queue as seeds for subsequent tests.
[0010] The beneficial effects of the present invention are: (1) The fuzzy testing method of the present invention uses a core neuron selection strategy to screen out neurons that contribute significantly to decision-making or are highly sensitive to small changes, thereby optimizing the neuron selection process and significantly improving the test efficiency. Through the uncertainty score calculation method, the uncertainty score of each seed is obtained to quantify its potential in discovering potential vulnerabilities in the target deep learning model. Seeds with higher scores are preferentially selected and saved in the seed queue, further enhancing the pertinence and efficiency of the test. Through the uncertainty seed selection strategy, seeds with decreased prediction probability or triggering new coverage are preferentially selected to participate in subsequent testing, thereby more efficiently discovering potential defects in the deep learning model, thereby significantly enhancing the robustness of the deep learning model. (2) Experimental comparison with mainstream seed queue construction methods shows that the seed queue constructed by the proposed method has higher uncertainty and can effectively improve the efficiency of fuzz testing of deep learning models. Experiments were conducted on the MNIST, CIFAR-10, and ImageNet datasets. The results show that the fault detection rate of the proposed method is improved by 3.16%, 1.86%, and 1.17% respectively compared with the mainstream methods. The proposed method can effectively select seeds with high mutation potential, thereby improving the efficiency of fuzz testing vulnerability mining. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a framework diagram of the fuzzy testing method of the present invention; Figure 2 It is a schematic diagram of the effect of image transformation on heat map; Figure 3 It is a framework diagram of the seed selection strategy in the method of the present invention; Figure 4 This is a comparison chart of the effects of neuron selection strategies in the embodiment of the present invention, where the test case selection ratio is 5%; Figure 5 This is a comparison chart of the effects of neuron selection strategies in the embodiment of the present invention, where the test case selection ratio is 10%; Figure 6 This is a comparison chart of fault diversity when using the MNIST dataset and the LeNet1 model in an embodiment of the present invention; Figure 7 This is a comparison chart of fault diversity when using the CIFAR10 dataset and the VGG16 model in an embodiment of the present invention; Figure 8 This is a comparison chart of fault diversity when using the ImageNet dataset and the VGG16 model in an embodiment of the present invention; Figure 9 This is a comparison chart of fault detection rates using different seed selection strategies when using the MNIST dataset and the LeNet1 model in an embodiment of the present invention; Figure 10 This is a comparison chart of fault detection rates using different seed selection strategies when using the CIFAR10 dataset and the VGG16 model in an embodiment of the present invention; Figure 11 This is a comparison chart of fault detection rates for different seed selection strategies when using the ImageNet dataset and the VGG16 model in an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0013] The present invention is based on a fuzzy testing method optimized by seed queues. By designing a core neuron selection strategy, a neuron set with a large decision-making contribution is extracted from all test cases. At the same time, a neuron set that is sensitive to operations such as rotation and fuzziness is combined, and the two are taken as a union to construct a core neuron set, providing a basis for subsequent seed queue construction. By designing an uncertainty scoring calculation method, seeds are comprehensively evaluated and ranked based on three dimensions: the output score of the core neuron, the prediction probability score, and the heat map area change score, and their mutation potential is quantified. An uncertainty seed selection strategy is designed to give priority to seeds with a decreased prediction probability or that trigger new coverage for subsequent testing.
[0014] The overall framework of the fuzzy testing method based on seed queue optimization of the present invention is as follows Figure 1 As shown, please follow the steps below: Step 1: Through the designed core neuron selection strategy, the neurons in the deep neural network model that contribute more to decision-making or are highly sensitive to small changes are screened out.
[0015] In deep neural network models, the number of internal neurons is huge. Taking the VGG-16 model as an example, it contains as many as 21,012 neurons, and the VGG-19 model, which is widely used in deep learning tasks, has as many as 50,782 neurons. Although it is persuasive to prioritize seeds based on the output values of all neurons, calculating the activation values of all neurons is not only a time-consuming task, but also lacks pertinence, which seriously restricts the test efficiency. In order to effectively solve this problem, the method of the present invention proposes a core neuron selection strategy to optimize the neuron selection process and significantly improve the test efficiency. The core neuron set defined by the method of the present invention covers two types of neuron sets, one of which is neurons that are highly sensitive to small changes, and the other is the key neurons that occupy a large weight in the decision-making process mentioned above.
[0016] The sensitive neurons are defined as the union of the activated neurons minus the intersection when the original image and the images after six different image transformations, such as rotation, flipping, blurring, contrast conversion, brightness increase or brightness decrease, are input into the deep learning model. The calculation method is shown in formula (1): (1) in, represents the set of neurons activated by the original image, It represents the set of neurons activated by the image after image conversion, ∪ represents the union, and ∩ represents the intersection. The final result is the different parts of the activated neurons under the two image inputs, that is, the sensitive neuron set. A key neuron is defined as one in which, when the original image and the transformed image are input into the deep learning model together, the output value of a neuron for the original image is greater than 0.9, and the difference in the output value of the neuron under the two image inputs is less than 0.1. This indicates that the neuron has a large weight when making decisions for both the original image and the transformed image, and has a significant impact on the model's decision-making results. Its calculation method is shown in formula (2): (2) in, and The original image and the image after image conversion are respectively i The output value of a neuron; Indicates the i Whether a neuron is a key neuron, if it is a key neuron, the value is 1, otherwise it is 0.
[0017] The core neuron set is the union of sensitive neurons and key neurons as shown in formula (3): (3) Step 2: Design an uncertainty score calculation method to calculate the confidence, core neuron output and heat Figure 3 The uncertainty score of each seed is obtained by weighted summing up the differences in the three dimensions, so as to quantify its potential in discovering potential vulnerabilities in the target deep learning model. Seeds with higher scores are selected first and saved in the seed queue.
[0018] In order to reveal the faults in the model, it is expected to generate more test cases that are incorrectly predicted by the model. The number of incorrect predictions is closely related to the uncertainty of the seed. To this end, the method of the present invention proposes a prediction probability score, namely the PS (Predicton Score) indicator, to measure uncertainty. The PS indicator quantifies the model uncertainty of the input by calculating the probability difference between the highest softmax output and the second highest softmax output. Specifically, given a DNN model f and input x , the calculation formula of its PS value is shown in formula (4): (4) in, Cls is a collection of categories, Indicates Cls Chinese envoy Get the index of the maximum value i ,Right now ,and is input x Output probability vector over all classes.
[0019] PS provides a quantitative metric for assessing the uncertainty of a model's inputs. Intuitively, the smaller the PS value, the closer the input is to the decision boundary (the boundary between the two classes with the highest probability). Therefore, inputs with smaller PS values have greater uncertainty and are more helpful for fault detection.
[0020] Through the selected core neurons, the output score of the core neurons, namely the CNS (Core Neuron Score) score, can be calculated. The calculation process of the CNS score is to input the original seed and the image-transformed seed into the target deep learning model together, and compare the distance between the activation value of the core neurons of the original image and the activation value of the core neurons after six different image transformations. The larger the CNS value, the higher the uncertainty of the deep learning model prediction after the image transformation, and the more likely it is to reveal potential vulnerabilities in subsequent fuzz testing. The calculation formula of CNS is shown in Equation (5): (5) in, For the original image k The activation value of the core neurons, The image after image transformation is k The activation value of the core neurons, K represents the number of core neurons.
[0021] CNS calculates the difference in activation values on the corresponding core neurons between the original image and the image after various image transformations. The larger the CNS value, the greater the impact of the image transformation on the model prediction, thereby increasing the uncertainty of the model prediction and the possibility of discovering potential vulnerabilities. In deep learning, heatmaps are often used to visualize the areas of attention of neural networks for image classification tasks. By showing the activation strength of the network in different areas, it helps to understand the decision-making process of the model. Heatmaps can indirectly reflect the degree of attention of the model to various parts of the image, usually showing higher activation values in key areas of the image and lower activation values in unimportant areas. The method of the present invention proposes a heatmap area change score, namely HS (HeatmapScore), based on the degree of attention of the heatmap. HS compares the distance between the heatmap distribution of the original image and the heatmap distribution after six different image transformations. If the area of attention of the heatmap changes significantly after the image transformation, this also indirectly reflects the change in the decision-making basis of the deep learning model. As the change increases, the possibility of the model making an incorrect judgment also increases accordingly. The calculation formula of HS is shown in formula (6): (6) in, and Represents the heatmaps of the original image and the transformed image at positions ( i , j ), H × W Indicates the spatial size of the heat map, which is the height of the heat map H and width W HS calculates the heat map of the original image and the transformed image at the spatial position ( i , j ) reflects the change in the model's attention area in the transformed image. A larger HS value indicates a significant shift in the area the heatmap focuses on after the transformation, suggesting a significant change in the model's decision-making basis, which in turn increases the risk of the model making incorrect judgments. Therefore, a larger HS value indicates that the image is more likely to reveal potential vulnerabilities.
[0022] Figure 2 This image shows the effects of different processing steps on an original image, along with the corresponding heatmap visualizations. The first row shows the images after different processing steps, while the middle row shows the corresponding heatmaps. The heatmap uses color to indicate the importance or attention paid to different areas of the image. The third row shows the heatmap overlaid on the processed image, providing a more intuitive view of the impact of different processing steps on key image regions. This visualization is commonly used in computer vision to help analyze the impact of operations such as image enhancement and transformation on the model's attention distribution.
[0023] The calculation formula of the final uncertainty score is shown in formula (7): (7) In step 3, the image seed queue generated in step 2 is first randomly mutated to generate new mutant seeds. Then, using the designed uncertainty seed selection strategy, each mutant seed is evaluated. If the predicted probability of a mutant seed decreases compared to the original seed, or if it triggers new coverage areas, it is added back to the seed queue as a seed for subsequent testing. By selecting these seeds, potential model vulnerabilities can be discovered more efficiently, thereby enhancing the targetedness and efficiency of testing.
[0024] During the fuzz testing process, seeds with increased coverage will be added back to the seed queue for subsequent testing, as these seeds may bring new coverage. Based on this idea, the present invention designs an uncertain seed selection strategy. When the probability of a seed's correct prediction decreases during the fuzz testing process, it means that the mutation of the seed has caused the prediction of the deep learning model to approach the decision boundary, or the seed has triggered new coverage. Continuing to mutate the seed may reveal new potential errors in the model. This strategy is shown in Equation (8): (8) in, p orig Indicates seed x The probability of correct prediction in the deep learning model, p mut Indicates the mutated seed x mut The correct prediction probability, Δ p Indicates the change in the probability of correct prediction. x The correct prediction probability p orig Higher than the mutated seeds x mut The correct prediction probability p mut , and the difference is greater than the threshold Δ p , indicating that the seed mutation makes the model's prediction results close to the decision boundary, with greater uncertainty, which may reveal potential errors.
[0025] The uncertainty seed selection strategy proposed in this invention is to input the test seed for seed mutation and then input the mutated seed into the deep learning model to be tested. If the prediction probability of the correct label output by the deep learning model decreases or the mutated seed triggers new coverage after coverage analysis, it will be added back to the seed queue for subsequent fuzz testing. The flow chart is as follows: Figure 3 shown.
[0026] Example 1: (1) Experimental setup In order to verify the effectiveness of the seed queue construction method in the present invention, it is compared with the existing seed queue construction methods DFuzzer, SOO-ADV, NSS and DeepGini. The comparison is carried out in the following aspects: a. Comparison of fault detection rates when selecting test seed sets with different proportions.
[0027] b. Comparison of the accuracy improvement of deep learning models when selecting test seed sets with different proportions.
[0028] Neuron coverage (NC): used to measure the adequacy of deep learning model testing, which is defined as the ratio of activated neurons to the total number of neurons.
[0029] Failure Detection Rate (FDR): This is used as an evaluation metric to measure the effectiveness of the seed queue construction method. Specifically, FDR is defined as the ratio of the number of test cases misclassified by the DNN to the total number of selected test cases.
[0030] Fault Characteristic Criteria (FTCR): A quantitative assessment of the selectivity of different faults. FTCR refers to the ratio of the error types introduced by the selected test case to the error types introduced by all samples.
[0031] In this example, we selected three benchmark datasets widely used for image classification tasks: MNIST, CIFAR-10, and ImageNet. These datasets are extremely popular in deep learning testing and are often used in various research and experiments. Detailed information about these datasets and the models used for evaluation is listed in Table 1.
[0032] The MNIST dataset is a large collection of handwritten digits, which contains a training set of 60,000 examples and a test set of 10,000 examples. It can provide rich data support for research related to handwritten digit recognition.
[0033] The CIFAR-10 dataset consists of 60,000 color images of size 32×32, covering 10 categories, with each category containing 6,000 images. The rich image categories and number make it an ideal choice for evaluating the performance of image classification algorithms.
[0034] The ImageNet dataset is a large image dataset, in which each data is of dimension 224 224 3 image data, this dataset contains a total of 1000 categories, of which the training set has more than one million images and the test set has more than 50,000 images.
[0035] In terms of models, this example evaluated the MNIST dataset using the LeNet-1 and LeNet-5 models. For the CIFAR-10 dataset, this example evaluated the VGG-16, VGG-19, and ResNet-20 models. For the ImageNet dataset, VGG-16, VGG-19, and ResNet-50 were used. These models are widely used in deep learning testing tasks and have been proven to be effective image classification models in numerous previous studies. Details of the datasets and models are shown in Table 1.
[0036] Table 1 Datasets and models
[0037] Example 2: Building on Example 1, this example conducted research using different seed input numbers to explore whether uncertainty-guided seed selection strategies can improve test performance and clarify the specific ways in which this improvement occurs. To ensure a fair comparison, different seed selection strategies were provided with the same unified dataset, from which each method was required to select a consistent number of test seeds.
[0038] Randomness that may exist during the test process will interfere with the results. For each configuration, five simulation experiments are performed and the results of these five experiments are averaged to mitigate the impact of randomness. When comparing with the random selection strategy, five different seed sets are randomly selected from the dataset, and a test is run once for each seed set. Finally, the results of these five tests are averaged. After selecting the test seed sets using different methods, in order to evaluate the effectiveness of the selected seed sets, this example selected two representative fuzzers, DeepXplore and DLFuzz, for related experiments.
[0039] The experimental environment of this embodiment is Ubuntu 22.04 system, the programming language is Python, and the PyTorch 2.0 deep learning framework is used for experiments. The NVIDIA GeForce RTX 4090 graphics card is used in the hardware configuration. All experiments are performed in the GPU environment.
[0040] Example 3: Based on Example 2, this example compares the fault detection rate of the seed queue construction method of the present invention with DFuzzer, SOO-ADV, NSS, and DeepGini using the DeepXplore and DLFuzz fuzzers. Two different test case selection ratios, 5% and 10%, were used. The comparative test results for the DeepXplore fuzzer are shown in Table 2, and the comparative test results for the DLFuzz fuzzer are shown in Table 3.
[0041] Table 2 Comparison of fault detection rates (in %) of the proposed method and DFuzzer, SOO-ADV, NSS, and DeepGini under DeepXplore fuzzer
[0042] Experimental comparisons revealed that the fault detection rates of DFuzzer, SOO-ADV, NSS, and DeepGini were all lower than those of the proposed method. To further illustrate the performance differences among the methods, fault detection rate comparison experiments were conducted using the DeepXplore fuzzer on different datasets and target models. Using 5% of test cases from the MNIST dataset L-1 as an example, the proposed method achieved a fault detection rate of 79.2%, the highest in the group, exceeding DFuzzer (71.3%), SOO-ADV (73.5%), NSS (74.7%), and DeepGini (69.4%). On the CIFAR-10 and ImageNet datasets, the proposed method achieved higher fault detection rates than the comparison methods, with average improvements of 6.32% and 2.68% respectively. This is primarily due to DeepGini prioritizing test cases based on model outputs, which results in DeepGini only detecting test cases with low confidence in the model's predictions, as evidenced by the large Gini value in the final layer of the neural network. In this case, DeepGini cannot detect erroneous behavior caused by activating core neurons within the model. NSS prioritizes only based on sensitive neurons, which is incomplete and fails to cover more key factors that influence test case prioritization. The method proposed in this paper considers not only the output information of the last layer of neurons, but also the output information of core neurons and the attention area of the target model as reflected by heat maps. These factors can more comprehensively quantify the variation potential of test cases, thereby discovering more vulnerabilities.
[0043] Under the DLFuzz fuzzer, for the L-1 and L-5 structures of the MNIST dataset, when selecting 5% of test cases, the proposed method achieved fault detection rates of 83.5% and 83.2%, respectively, significantly exceeding those of the other comparison methods. When selecting 10% of test cases, the proposed method achieved fault detection rates of 74.3% and 72.1%, respectively, under the L-1 and L-5 structures, also demonstrating superiority. For the V-16, V-19, and R-20 models of the CIFAR-10 dataset, the proposed method achieved fault detection rates that were 6.03%, 4.42%, and 6.1%, respectively, compared to the comparison methods. On the ImageNet dataset, the proposed method achieved fault detection rates that were 3.87%, 3.08%, and 4.02%, respectively, compared to the comparison methods. Overall, the experimental results demonstrate that under the DLFuzz fuzzer, the proposed seed queue construction method outperforms the other comparison methods in quantifying seed mutation potential and is more effective in detecting faults.
[0044] Table 3 Comparison of fault detection rates (in %) between the proposed method and DFuzzer, SOO-ADV, NSS, and DeepGini under DLFuzz fuzzer
[0045] Example 4: On the basis of Example 3, in order to verify the effectiveness of the core neuron selection strategy proposed in the present invention, the sensitivity neuron selection strategy of NSS and the last layer of neurons used by SOO-ADV were selected and applied to the neuron selection link of the method of the present invention. Taking DeepXPlore as an example, the comparison of fault detection rates is as follows: Figure 4 and Figure 5 As shown: Among them, when the proportion of selected test cases is set to 5% and 10% respectively, the core neurons of the method of the present invention are significantly better than the NSS and SOO-ADV strategies in terms of fault detection rate. Even when the NSS and SOO-ADV strategies are applied to the method of the present invention, their fault detection rates are lower than those of the method of the present invention, but still higher than those of the case where the NSS and SOO-ADV strategies are used alone. This is mainly due to the core neuron selection strategy of the present invention, which not only takes into account the susceptible neurons, but also fully incorporates the neurons that account for a large proportion in the decision-making process. At the same time, the number of layers of neuron selection is not limited to the last layer, but a more comprehensive consideration is taken.
[0046] Example 5: Based on Example 4, detecting more types of errors may be as important as detecting more errors, so the fault diversity is tested according to different test case selection ratios. The experimental results are as follows: Figure 6-Figure 8As shown in the figure, it can be seen that under all data sets and model combinations, the method of the present invention achieves better fault diversity than the random selection and comparison methods. Specifically, when selecting candidate samples greater than about 5%, the curve of the method of the present invention is always higher than the curves of other methods.
[0047] Example 6: On the basis of Example 5, the seed selection strategy proposed in the present invention fully balances the neuron coverage and fault detection rate. In the process of inputting the test case into the target model, if the neuron coverage increases or the prediction probability decreases in a round of iteration, the test case will be re-added to the seed queue and will be selected as a priority to perform the test again. This is because when new coverage is triggered, the possibility of detecting model errors will increase significantly; and when the prediction probability decreases, it shows that the fuzzy testing method brings the model closer to the decision boundary on this test case, making it more likely to be identified as an error by the target model. In order to verify the effectiveness of this strategy, this embodiment applies a coverage-oriented selection strategy and a prediction probability-oriented selection strategy to the method of the present invention, and compares the fault detection rate. The specific experimental results are shown in the figure. Figures 9-11 shown.
[0048] After conducting experiments on three different data sets and model combinations, the experimental results clearly show that the seed selection strategy proposed in the present invention is significantly superior to the coverage-oriented selection strategy and the prediction probability-oriented selection strategy in terms of fault detection rate. At the same time, the experimental data also reveals the importance of the coverage-oriented selection strategy. When the test case selection ratio is low, the prediction probability-oriented selection strategy temporarily leads the coverage-oriented selection strategy in fault detection rate. However, as the selection ratio gradually increases, the fault detection rate of the coverage-oriented selection strategy begins to surpass the prediction probability-oriented selection strategy. This phenomenon strongly verifies the previous theoretical assumption that when new coverage is triggered, the possibility of model errors being detected will be greatly increased, further highlighting the key role of coverage guidance in the model testing process.
[0049] Example 7: On the basis of Example 6, this embodiment retrains the corresponding deep learning model by using adversarial test cases, and the improvement of the model classification accuracy after retraining is shown in Table 4. Table 4 shows the comparison of the method of the present invention with DFuzzer, SOO-ADV, NSS, DeepGini and other methods in terms of model accuracy improvement under the DeepXPlore fuzzer. For the MNIST data set, when 5% of the test cases are selected, the model accuracy of the method of the present invention is improved by 1.78%, exceeding DFuzzer's 1.26%, SOO-ADV's 1.57%, NSS's 1.53% and Gini's 1.42%; when the test case selection ratio is increased to 10%, the model accuracy of the method of the present invention is improved by 1.85%, which is still higher than the comparison method. For the V-19 model of the CIFAR-10 data set, at the test case selection ratio of 5% and 10%, the accuracy of the method of the present invention is improved by 2.65% and 2.85% respectively, which is better than other comparison methods in both cases. For the R-50 model of the ImageNet dataset, when the test ratio is 5% and 10%, the model accuracy improvement of the method of the present invention is higher than that of the comparison method.
[0050] Table 4 Comparison of the accuracy improvement (in %) of the proposed method and DFuzzer, SOO-ADV, NSS, and DeepGini models under DeepXPlore fuzzifier
[0051] Table 5 shows a comparison of the model accuracy improvement of the proposed method with DFuzzer, SOO-ADV, NSS, and DeepGini after retraining the original classification model using the discovered faulty test cases under the DLFuzz fuzzer. In the L-1 and L-5 models of the MNIST dataset, when 5% of test cases are selected, the model accuracy of the proposed method is improved by 2.11% and 2.04%, respectively, which is higher than DFuzzer's 1.43% and 1.37%, SOO-ADV's 1.77% and 1.74%, NSS's 1.64% and 1.34%, and DeepGini's 1.54% and 1.55%. When 10% of test cases are selected, the proposed method improves the accuracy of the L-1 and L-5 models by 2.17% and 2.13%, respectively, which is also better than the comparison methods. For different deep learning models on the CIFAR-10 dataset and ImageNet dataset, the proposed method also outperforms the comparison methods in improving model accuracy. In summary, the experimental results show that compared with the comparison method, the method of the present invention is more effective in improving the model accuracy with the help of adversarial test cases.
[0052] Table 5 Comparison of the accuracy improvement (in %) of the proposed method and DFuzzer, SOO-ADV, NSS, and DeepGini models under the DLFuzz fuzzer
Claims
1. A fuzzy testing method based on seed queue optimization, characterized in that: Please follow the steps below to implement it: Step 1: Design a core neuron selection strategy to screen out sensitive neurons and key neurons in the deep neural network model to form a core neuron set; Step 2: Design an uncertainty score calculation method to calculate the uncertainty score of each image seed and save the image seeds with higher scores into the seed queue; In step 3, random mutation is performed on the image seed queue obtained in step 2 to generate new mutation seeds. An uncertain seed selection strategy is designed to evaluate each mutation seed, and the mutation seeds that meet the conditions are added back to the seed queue as seeds for subsequent tests.
2. The fuzz testing method based on seed queue optimization according to claim 1 is characterized in that: In step 1, sensitive neurons are neurons that are highly sensitive to small changes. They are defined as follows: the original image and the image after image conversion are input into the deep learning model together, and the union of activated neurons minus the intersection is the sensitive neuron set, which is calculated as follows: in, represents the set of neurons activated by the original image, represents the set of neurons activated by the image after image transformation; ∪ represents the union and ∩ represents the intersection.
3. The fuzz testing method based on seed queue optimization according to claim 1 is characterized in that: In step 1, the key neuron is the neuron that contributes most to the decision. It is defined as follows: when the original image and the transformed image are input into the deep learning model together, if the output value of a neuron for the original image is greater than 0.9 and the difference between the output values of the neuron under the two image inputs is less than 0.1, then this neuron is considered a key neuron. Its calculation method is shown in the following formula: in, and The original image and the image after image conversion are respectively i The output value of a neuron; Indicates the i Whether a neuron is a key neuron, if it is a key neuron, the value is 1, otherwise it is 0.
4. The fuzz testing method based on seed queue optimization according to claim 1 is characterized in that In step 2, the differences between the original image and the transformed image in three dimensions: confidence, core neuron output, and heat map. These three differences are weighted and summed to obtain the uncertainty score of each image seed.
5. The fuzzy testing method based on seed queue optimization according to claim 4 is characterized in that: The difference in the confidence dimension is the predicted probability score, which quantifies the uncertainty of the model in terms of the input by calculating the probability difference between the highest softmax output and the second highest softmax output; specifically, given a DNN model f and input x , the calculation formula of its predicted probability score is as follows: in, Cls is a collection of categories, Indicates Cls Chinese envoy Get the index of the maximum value i ,Right now ,and is input x Output probability vector over all classes.
6. The fuzz testing method based on seed queue optimization according to claim 4 is characterized in that: The calculation process of the core neuron output score is as follows: the original image and the image after image conversion are input into the target deep learning model together, and the distance between the activation value of the core neuron of the original image and the activation value of the core neuron of the image after image conversion is compared. The calculation formula is as follows: in, For the original image k The activation value of the core neurons, The image after image conversion is k The activation value of the core neurons, K represents the number of core neurons.
7. The fuzzy testing method based on seed queue optimization according to claim 4 is characterized in that: The difference in heatmap dimensions is the heatmap area change score, which compares the distance between the heatmap distribution of the original image and the heatmap distribution of the image after image transformation. The specific calculation formula is as follows: in, and Represents the heat map of the original image and the image after image conversion at position ( i , j ), H × W Indicates the spatial size of the heat map, which is the height of the heat map H and width W ; The heatmap area change score is calculated by comparing the heatmaps of the original image and the transformed image at the spatial location ( i , j ), reflecting the changes in the model’s attention area on the transformed image.
8. The fuzz testing method based on seed queue optimization according to claim 1 is characterized in that: The uncertainty seed selection strategy in step 3 is to input the test seed for seed mutation, and then input the mutated seed into the deep learning model to be tested. If the prediction probability of the correct label output by the deep learning model decreases compared with the original seed, or the mutated seed triggers a new coverage area, it will be added back to the seed queue for subsequent fuzz testing.
Citation Information
Patent Citations
Hybrid method-based color image segmentation method
CN107481241A
Neural network fuzzy test method based on variation image entropy guidance
CN117218051A
Deep learning system fuzzy test diversity seed variation method
CN119204146A
Neural network fuzzy test seed selection and disturbance mutation resistance method
CN120430349A