Fuzzing method based on seed queue optimization
By optimizing the seed queue through core neuron selection and uncertainty score calculation, the problems of non-targeted and low-efficiency seed selection in existing fuzz testing methods are solved, and efficient deep learning model fault detection and robustness improvement are achieved.
Patent Information
- Application Number
- CN202511122042.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-08-12
AI Technical Summary
Existing fuzzy 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 optimize seed selection in a targeted manner, affecting the robustness of deep learning models.
By designing a core neuron selection strategy to screen sensitive and critical neurons, combining the uncertainty score calculation method and uncertainty seed selection strategy, we optimize the seed queue construction, quantify the mutation potential of the seeds, and give priority to selecting efficient seeds for testing.
It significantly improves the fuzz testing efficiency and fault detection rate of deep learning models, improves the robustness of the model, and enables more efficient discovery of potential vulnerabilities.
Smart Images

Figure CN120633748B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of fuzzy testing methods, and relates to a fuzzy testing method based on seed queue optimization. BACKGROUND
[0002] In recent years, deep learning has been widely applied in many fields such as robots, autonomous driving, fault diagnosis and smart home. Research shows that deep learning models are vulnerable to adversarial attacks, which cause the deep learning model to make wrong decisions after adding a small perturbation to the input. It poses a threat to the quality of deep learning systems, especially when they are applied to safety-critical areas. Wrong decisions can cause significant economic losses, and even cause casualties. Therefore, before the deployment of deep learning systems, comprehensive and systematic quality assessment of deep learning models is needed.
[0003] Fuzzy testing is a general vulnerability mining method, which is widely used in testing deep learning models at present. This method generates diversified test inputs automatically, systematically explores the behavior boundary of the model, 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 select initial test samples for fuzzy testing from the corpus. The quality of these samples directly affects the efficiency of fuzzy testing. Seed queue construction can be divided into three categories: construction strategy based on distance between seeds, construction strategy based on neuron information and construction strategy based on algorithm.
[0005] In the construction strategy based on the distance between seeds, DeepHyperion (Zohdinasab T, Riccio V, Gambi A, et al. Deephyperion: exploring the feature space of deep learning-based systems through illumination search [C] / / Proceedings of the 30th ACM SIGSOFT International Symposium on Software Testing and Analysis, 2021:79-90.) selects the seeds that are most likely to cause the target model to make mistakes or errors in model recognition in a search manner, and selects the most diverse seed set by calculating the Manhattan distance between pairs. The advantage of this method is to improve the diversity of seeds. However, this method does not consider the influence of seeds on model decisions, but only relies on the geometric distance between seeds, and fails to optimize the selection process of seeds, thus there is a risk of low test efficiency and missed detection.
[0006] In the construction strategy based on neuron information, Huang et al. (Huang D, Bu Q, Fu Y, et al. Neuron Sensitivity-Guided Test Case Selection[J]. ACM Transactions on Software Engineering and Methodology, 2024, 33(7): 1-32.) proposed the NSS method, which uses the sensitivity neuron information induced by the test case to select valuable test cases. However, the selected neurons only focus on sensitivity and ignore the influence of the output of the final layer of the model, which is not comprehensive enough.
[0007] In summary, the existing methods based on the distance between seeds fail to consider the influence of seeds on model decision-making and only focus on distance calculation between seeds; the technology based on neuron information pays attention to neuron activation, but does not fully consider the multi-dimensional role of neurons in the decision-making process, affecting the test efficiency; in addition, the construction strategy based on algorithm has high computational complexity and often focuses on the diversity of seeds, without fully considering the internal neurons of deep learning models, so it may not be able to effectively find potential vulnerabilities in deep learning models. SUMMARY
[0008] The purpose of the present application is to provide a fuzzy testing method based on seed queue optimization, the constructed seed queue has high uncertainty, which can effectively improve the fuzzy testing efficiency of deep learning model.
[0009] The technical solution adopted by the present application is:
[0010] The fuzzy testing method based on seed queue optimization is implemented according to the following steps:
[0011] 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;
[0012] 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 to the seed queue;
[0013] Step 3, perform random mutation operation on the image seed queue obtained in step 2 to generate new mutant seeds, design an uncertainty seed selection strategy to evaluate each mutant seed, and re-add the mutant seeds that meet the conditions to the seed queue as seeds for subsequent testing.
[0014] The present application has the following beneficial effects:
[0015] (1) The fuzzy test method of the present application selects the neurons that have greater contribution to decision-making or are highly sensitive to small changes through the core neuron selection strategy, optimizes the neuron selection process, and significantly improves the test efficiency; through the uncertainty score calculation method, the uncertainty score of each seed is obtained, the potential of the seed in discovering potential vulnerabilities of the target deep learning model is quantified, the seed with a higher score is preferentially selected and saved to the seed queue, and the test is further enhanced in pertinence and efficiency; through the uncertainty seed selection strategy, the seed with a decreased prediction probability or triggering new coverage is preferentially selected for subsequent testing, and potential defects in the deep learning model are more efficiently discovered, thereby significantly enhancing the robustness of the deep learning model;
[0016] (2) Compared with the mainstream seed queue construction method, the results show that the seed queue constructed by the method of the present application has high uncertainty and can effectively improve the fuzzy test efficiency of the deep learning model. Experiments on MNIST, CIFAR-10 and ImageNet data sets show that the fault detection rate of the method of the present application is increased by 3.16%, 1.86% and 1.17% compared with the mainstream method. The method of the present application can effectively select seeds with high mutation potential, thereby improving the efficiency of fuzzy test vulnerability mining. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 is a framework diagram of the fuzzy test method of the present application;
[0018] Figure 2 is a schematic diagram of the influence of image conversion on a heat map;
[0019] Figure 3 is a framework diagram of the seed selection strategy in the method of the present application;
[0020] Figure 4 is a comparison diagram of the neuron selection strategy effect in the embodiment of the present application, wherein the test case selection ratio is 5%;
[0021] Figure 5 is a comparison diagram of the neuron selection strategy effect in the embodiment of the present application, wherein the test case selection ratio is 10%;
[0022] Figure 6 is a comparison diagram of the fault diversity in the embodiment of the present application when the MNIST data set and LeNet1 model are used;
[0023] Figure 7 is a comparison diagram of the fault diversity in the embodiment of the present application when the CIFAR10 data set and VGG16 model are used;
[0024] Figure 8is a fault diversity comparison chart when the ImageNet dataset and the VGG16 model are used in the embodiment of the present application;
[0025] Figure 9 is a fault detection rate comparison chart of different seed selection strategies when the MNIST dataset and the LeNet1 model are used in the embodiment of the present application;
[0026] Figure 10 is a fault detection rate comparison chart of different seed selection strategies when the CIFAR10 dataset and the VGG16 model are used in the embodiment of the present application;
[0027] Figure 11 is a fault detection rate comparison chart of different seed selection strategies when the ImageNet dataset and the VGG16 model are used in the embodiment of the present application. DETAILED DESCRIPTION
[0028] The present application will be described in detail below in combination with the drawings and specific embodiments.
[0029] The fuzzy testing method based on seed queue optimization of the present application extracts a neuron set with greater decision contribution from all test cases by designing a core neuron selection strategy, and combines a neuron set sensitive to rotation, fuzzing and other operations to construct a core neuron set, which provides a basis for subsequent seed queue construction. The seed is comprehensively evaluated and sorted from three dimensions of output score, prediction probability score and heat map region change score of the core neuron by designing an uncertainty score calculation method, and the variation potential is quantified. The uncertainty seed selection strategy is designed to preferentially select seeds with decreased prediction probability or triggering new coverage to participate in subsequent testing.
[0030] The overall framework of the fuzzy testing method based on seed queue optimization of the present application is shown in Figure 1 The specific implementation is as follows:
[0031] Step 1: The core neuron selection strategy is designed to screen out neurons in the deep neural network model with greater decision contribution or highly sensitive to slight changes.
[0032] 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.
[0033] 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):
[0034] (1)
[0035] 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.
[0036] A key neuron is defined as a neuron whose output value for the original image is greater than 0.9 and whose output value difference between the two images is less than 0.1 when the original image and the transformed image are input into the deep learning model. 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):
[0037] (2)
[0038] 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.
[0039] The core neuron set is the union of sensitive neurons and key neurons as shown in formula (3):
[0040] (3)
[0041] Step 2: Design an uncertainty score calculation method to calculate the confidence, core neuron output and heat Figure Three 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.
[0042] 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):
[0043] (4)
[0044] 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.
[0045] 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.
[0046] 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):
[0047] (5)
[0048] 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.
[0049] 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.
[0050] 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):
[0051] (6)
[0052] in, and Represents the heatmaps of the original image and the transformed image at positions ( i , j ), H ×W represent the spatial size of the heat map, respectively the height and width of the heat map H W . HS calculates the activation difference of the original image and the heat map after image transformation in spatial position i j . It reflects the changes of the model's focus area on the transformed image. The larger the HS value, the greater the change in the focus area of the transformed heat map, which implies that the model's decision basis has changed significantly, thereby increasing the risk of model error judgment. Therefore, a larger HS value indicates that the image is more likely to reveal potential vulnerabilities.
[0053] Figure 2 The figure shows the effects of different processing on an original image, as well as the corresponding heat map visualization. The images in the first row are the images after different processing of the original image, the middle row is the heat map corresponding to the processed images, and the heat map represents the importance or attention of different regions in the image through color. The third row is the effect of superimposing the heat map on the processed image, so that the influence of different processing on the key regions of the image can be seen more intuitively. This kind of display is commonly used in the field of computer vision, helping to analyze the influence of image enhancement, transformation and other operations on the attention distribution of the model.
[0054] The final uncertainty score is calculated as shown in equation (7):
[0055] (7)
[0056] Step 3, first, randomly mutate the image seed queue obtained in step 2 to generate new mutant seeds, then use the designed uncertainty seed selection strategy to evaluate each mutant seed, if the prediction probability of the mutant seed decreases compared to the original seed, or it triggers a new coverage area, then it is re-added to the seed queue as a seed for subsequent testing. By selecting these seeds, potential vulnerabilities of the model can be discovered more efficiently, thereby enhancing the relevance and efficiency of the test.
[0057] In the process of fuzz testing, seeds with increased coverage are re-added to the seed queue for subsequent testing, because these seeds may bring new coverage. Based on this idea, the invention designs an uncertainty seed selection strategy. When a seed has a correct prediction probability that decreases during fuzz testing, it means that the mutation of the seed makes the prediction of the deep learning model close to the decision boundary, or the seed triggers a new coverage, then continue to mutate the seed, which may reveal new potential errors of the model. The strategy is shown in equation (8):
[0058] (8)
[0059] where,p orig representative seed x correct prediction probability in the deep learning model, p mut representative mutated seed x mut correct prediction probability, delta p representative change range of correct prediction probability. When the correct prediction probability of the original seed x is higher than the correct prediction probability of the mutated seed p orig x mut p mut , and the difference is greater than the threshold delta p , it means that the seed mutation makes the prediction result of the model close to the decision boundary, has greater uncertainty, and thus may reveal potential errors.
[0060] The uncertainty seed selection strategy proposed in the present application is to input the mutated seed into the deep learning model to be tested after inputting the test seed for seed mutation. If the prediction probability of the correct label of the deep learning model decreases or the mutation seed triggers a new coverage after coverage analysis, the mutation seed is re-added to the seed queue for subsequent fuzz testing, and the flow chart is as shown in Figure 3 .
[0061] Embodiment 1
[0062] (1) Experimental setup
[0063] In order to verify the effectiveness of the seed queue construction method in the present application, the present application is compared with the existing seed queue construction methods DFuzzer, SOO-ADV, NSS and DeepGini, and the comparison is carried out in the following aspects:
[0064] a. Selecting different proportions of test seed set for fault detection rate comparison.
[0065] b. Selecting different proportions of test seed set for deep learning model accuracy improvement comparison.
[0066] Neuron coverage (NC): used to measure the sufficiency of deep learning model testing, which is defined as the ratio of activated neurons to the total number of neurons.
[0067] Fault detection rate (FDR): as an evaluation index to measure the effectiveness of the seed queue construction method. Specifically, FDR is defined as the ratio of the number of DNN error classification test cases to the total number of selected test cases.
[0068] Fault diversity (FTCR): The ability to select different faults is quantitatively evaluated. FTCR refers to the proportion of the type of error introduced by the selected test case in all the types of errors introduced by the samples.
[0069] In this embodiment, three benchmark datasets widely used in image classification tasks are selected, namely MNIST, CIFAR-10 and ImageNet. These datasets are widely used in the field of deep learning testing and are often used for various research and experiments. Detailed information about these datasets and the models used for evaluation is shown in Table 1.
[0070] The MNIST dataset is a large handwritten digit collection, which contains 60,000 examples of the training set and 10,000 examples of the test set, and can provide rich data support for handwritten digit recognition related research.
[0071] The CIFAR-10 dataset consists of 60,000 color images with a size of 32x32, covering 10 categories, with 6,000 images for each category. The rich image categories and quantities make it an ideal choice for evaluating the performance of image classification algorithms.
[0072] The ImageNet dataset is a large image dataset, where each data is an image data with a dimension of 224 224 3. This dataset contains 1000 categories, with more than 1 million images in the training set and more than 50,000 images in the test set.
[0073] In terms of models, for the MNIST dataset, this embodiment uses LeNet-1 and LeNet-5 models for evaluation. For the CIFAR-10 dataset, this embodiment uses VGG-16, VGG-19 and ResNet20 models for evaluation. For the ImageNet dataset, VGG-16, VGG-19 and ResNet50 are used. These models are widely used in deep learning testing tasks and have been proven to be effective image classification models in many previous studies. The detailed information of the datasets and models is shown in Table 1.
[0074] Table 1: Datasets and models
[0075]
[0076] Embodiment 2:
[0077] On the basis of embodiment 1, in order to explore whether the seed selection strategy based on uncertainty guidance can improve the test performance and clarify the specific way of improvement, this embodiment carries out related research under the condition of different number of seed inputs. In order to ensure the fairness of comparison, different seed selection strategy methods provide the same unified data set, and require each method to select the same number of test seeds from it.
[0078] The randomness that may exist in the test process will interfere with the results. For each configuration, five simulation experiments are carried out, and then the average value of the five results is taken to reduce the influence of randomness. When compared with the random selection strategy, five different seed sets are randomly selected from the data set, and each seed set is run once for testing, and finally the average value of the five test results is taken. After selecting the test seed set in different ways, in order to evaluate the effectiveness of the selected seed set, this embodiment selects two representative fuzzers, DeepXplore and DLFuzz, for related experiments.
[0079] The experimental environment of this embodiment is Ubuntu 22.04 system, the programming language is Python, and PyTorch 2.0 deep learning framework is used for experiments. The hardware configuration uses NVIDIA GeForce RTX 4090 graphics card, and all experiments are carried out in GPU environment.
[0080] Embodiment 3:
[0081] On the basis of embodiment 2, this embodiment compares the fault detection rate of the seed queue construction method of the application with DFuzzer, SOO-ADV, NSS and DeepGini under DeepXplore and DLFuzz fuzzers, and uses two different test case selection ratios of 5% and 10%. The comparison test of DeepXplore fuzzer is shown in Table 2, and the comparison test of DLFuzz fuzzer is shown in Table 3.
[0082] Table 2 Comparison of fault detection rates (unit: %) of the method of the application and DFuzzer, SOO-ADV, NSS and DeepGini under DeepXplore fuzzer
[0083]
[0084] The experimental comparison finds that the fault detection rates of DFuzzer, SOO-ADV, NSS and DeepGini are all lower than the method. To further illustrate the performance difference of each method, under the DeepXplore fuzzer, the fault detection rate comparison experiments are carried out for different data sets and different target models. Taking the MNIST data set L-1 and selecting 5% test cases as an example, the fault detection rate of the method is 79.2%, which is the highest value in this group, higher than DFuzzer (71.3%), SOO-ADV (73.5%), NSS (74.7%) and DeepGini (69.4%). Under the CIFAR-10 data set and the ImageNet data set, the fault detection rate of the method is higher than that of the comparison method, and the average is increased by 6.32% and 2.68%. The key reason is that DeepGini prioritizes test cases according to model output, which makes DeepGini only detect test cases with low prediction confidence. The specific performance is that the Gini value of the last layer of the neural network is large. In this case, DeepGini cannot detect the error behavior generated by activating the core neurons in the model. For NSS, it only prioritizes according to sensitive neurons, and the consideration is not comprehensive enough, and more key factors that affect the priority of test cases are not covered. The method considers not only the output information of the last layer of neurons, but also the output information of the core neurons and the attention area of the target model reflected by the heat map. These factors can more comprehensively quantify the mutation potential of test cases, thereby digging out more vulnerabilities.
[0085] Under the DLFuzz fuzzer, for the L-1 and L-5 structures of the MNIST data set, when selecting 5% test cases, the fault detection rate of the method is as high as 83.5% and 83.2% respectively, which is significantly higher than the rest of the comparison methods; when selecting 10% test cases, the fault detection rate of the method under L-1 and L-5 structures is 74.3% and 72.1% respectively, which also has an advantage. For V-16, V-19 and R-20 models of CIFAR-10 data set, the fault detection rate of the method is increased by 6.03%, 4.42% and 6.1% compared with the comparison method. Under the ImageNet data set, the fault detection rate of the method is increased by 3.87%, 3.08% and 4.02% compared with the comparison method. Overall, the experimental results show that under the DLFuzz fuzzer, the seed queue construction method has better performance in quantifying the mutation potential of seeds than other comparison methods, and can more effectively detect faults.
[0086] Table 3 Comparison of fault detection rates (%) of the method of the present application and DFuzzer, SOO-ADV, NSS, DeepGini under the DLFuzz fuzzer
[0087]
[0088] Example 4
[0089] On the basis of Example 3, in order to verify the effectiveness of the core neuron selection strategy proposed in the present application, the sensitivity neuron selection strategy of NSS and the last layer neuron used by SOO-ADV were selected and applied to the neuron selection link of the method of the present application. Taking DeepXPlore as an example, the comparison of fault detection rates is shown in Figure 4 and Figure 5
[0090] Among them, when the proportion of test cases selected is set to 5% and 10% respectively, the core neuron of the method of the present application is significantly better than the NSS and SOO-ADV strategies in terms of fault detection rate. Even if the NSS and SOO-ADV strategies are applied to the method of the present application, the fault detection rate is lower than that of the method of the present application, but it is still higher than that of the NSS and SOO-ADV strategies alone. This is mainly due to the core neuron selection strategy of the present application, which not only considers the vulnerable neurons, but also fully takes into account the neurons with a large proportion in the decision-making process. At the same time, the number of layers of the selected neurons is not limited to the last layer, but a more comprehensive consideration is made.
[0091] Example 5
[0092] On the basis of Example 4, detecting more types of errors may be as important as detecting more errors, so the fault diversity was tested according to different test case selection ratios. The experimental results are shown in Figures 6-8 It can be seen that, under all data set and model combinations, the method of the present application achieves better fault diversity compared with random selection and the comparison method. Specifically, when more than about 5% of the candidate samples are selected, the curve of the method of the present application is always higher than that of the other methods.
[0093] Example 6
[0094] On the basis of embodiment 5, the seed selection strategy proposed by the application fully weighs the neuron coverage and the fault detection rate. In the process of inputting test cases into the target model, if the neuron coverage is improved or the prediction probability is reduced in one iteration, the test case will be added to the seed queue again and will be preferentially selected for test execution. This is because when new coverage is triggered, the possibility of detecting model errors will be significantly improved; and when the prediction probability is reduced, it indicates that the fuzzing method makes the model closer to the decision boundary at this test case, so it is more likely to be identified as an error by the target model. In order to verify the effectiveness of this strategy, the coverage-oriented selection strategy and the prediction probability-oriented selection strategy are applied to the method of the application in this embodiment, and the fault detection rate is compared, and the specific experimental results are shown in Figures 9-11
[0095] After experiments on three different data set and model combinations, the experimental results clearly show that the seed selection strategy proposed by the application is significantly better than 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 selection ratio of test cases is low, the prediction probability-oriented selection strategy temporarily leads the coverage-oriented selection strategy in terms of fault detection rate. However, as the selection ratio gradually increases, the fault detection rate of the coverage-oriented selection strategy begins to surpass that of the prediction probability-oriented selection strategy. This phenomenon powerfully verifies the previous theoretical assumption that when new coverage is triggered, the possibility of detecting model errors will be significantly improved, further highlighting the key role of coverage guidance in the model testing process.
[0096] Embodiment 7:
[0097] On the basis of Embodiment 6, this embodiment re-trains the corresponding deep learning model by using the adversarial test cases. The improvement of the model classification accuracy after re-training is shown in Table 4. Table 4 shows the comparison of the improvement of the model accuracy of the present method and DFuzzer, SOO-ADV, NSS, DeepGini and other methods under the DeepXPlore fuzzer. For the MNIST dataset, when 5% of the test cases are selected, the model accuracy of the present method is improved by 1.78%, which is higher than that of DFuzzer by 1.26%, SOO-ADV by 1.57%, NSS by 1.53% and Gini by 1.42%; when the selection ratio of test cases is increased to 10%, the model accuracy of the present method is improved by 1.85%, which is still higher than that of the comparison methods. For the V-19 model of the CIFAR-10 dataset, the accuracy of the present method is improved by 2.65% and 2.85% under the selection ratios of 5% and 10% of test cases, respectively, which is better than that of other comparison methods in both cases. For the R-50 model of the ImageNet dataset, the model accuracy of the present method is improved higher than that of the comparison methods when the selection ratios of test cases are 5% and 10%.
[0098] Table 4 Comparison of the improvement of the model accuracy of the present method and DFuzzer, SOO-ADV, NSS, DeepGini under the DeepXPlore fuzzer (unit: %)
[0099]
[0100] Table 5 shows the comparison of the improvement of the model accuracy of the present method and DFuzzer, SOO-ADV, NSS, DeepGini after re-training the original classification model by using the error test cases found under the DLFuzz fuzzer. In the L-1 and L-5 models of the MNIST dataset, when 5% of the test cases are selected, the model accuracy of the present method is improved by 2.11% and 2.04%, respectively, which is higher than that of DFuzzer by 1.43% and 1.37%, SOO-ADV by 1.77% and 1.74%, NSS by 1.64% and 1.34%, and DeepGini by 1.54% and 1.55%; when 10% of the test cases are selected, the accuracy of the present method is improved by 2.17% and 2.13% in the L-1 and L-5 models, respectively, which is also better than that of the comparison methods. For different deep learning models of the CIFAR-10 dataset and the ImageNet dataset, the model accuracy improvement effect of the present method is also better than that of the comparison methods. In summary, the experimental results show that the present method has a better effect than the comparison methods in improving the model accuracy by using adversarial test cases.
[0101] Table 5 Comparison of accuracy improvement (unit: %) of the method of the present application and DFuzzer, SOO-ADV, NSS, DeepGini model under the DLFuzz fuzzer
[0102]
Claims
1. A fuzz testing method based on seed queue optimization, characterized in that, The following steps are specifically implemented: Step 1, design the core neuron selection strategy, screen out the sensitive neurons and key neurons in the deep neural network model, and constitute the core neuron set; Step 2, design the uncertainty score calculation method, calculate the uncertainty score of each image seed, and save the image seed with higher score to the seed queue; Step 3, perform random mutation operation on the image seed queue obtained in step 2 to generate new mutation seeds, design the uncertainty seed selection strategy to evaluate each mutation seed, and re-add the mutation seeds meeting the conditions to the seed queue as seeds for subsequent testing; In step 2, the difference values of the original image and the image after image conversion in the confidence, core neuron output and heat map dimensions are calculated, and the weighted sum of the three difference values is obtained to obtain the uncertainty score of each image seed; wherein the difference in the confidence dimension, i.e. the prediction probability score, quantifies the uncertainty of the model in terms of input by calculating the difference in probabilities between the highest softmax output and the second highest softmax output; in particular, given a DNN model f and input x the calculation formula of the prediction probability score is as follows: wherein, Cls is a set of classes, denotes the maximum of Cls in the index of the maximum i i.e. while is the input x output probability vector over all classes; The calculation process of the core neuron output score is: the original image and the image after image conversion are input into the target deep learning model, the distance between the activation values of the original image core neuron and the activation values of the image core neuron after image conversion is compared, and 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; The difference value of the heat map dimension is the heat map region change score, which compares the distance between the heat map distribution of the original image and the heat map distribution of the image after image conversion, and the specific calculation formula is as follows: wherein, and respectively represent the activation values of the heat map of the original image and the image after image conversion on the position (x, y) of the image, i , j ), H x W represents the spatial size of the heat map, respectively the height H and the width W of the heat map; 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.
2. The seed queue optimization based fuzzing method of claim 1, wherein, In step 1, the sensitive neuron is a neuron highly sensitive to small changes, which is defined as: input the original image and the image after image conversion into the deep learning model, and the union of the activated neurons minus the intersection is the sensitive neuron set, and the calculation method is as follows: wherein, a set of neurons activated by the original image, a set of neurons activated by the image transformed by the image transformation; ∪ denotes a union set, and ∩ denotes an intersection set.
3. The seed queue optimization based fuzzing method of claim 1, wherein, In step 1, the key neuron is a neuron with greater contribution to decision making, which is defined as: input the original image and the image after image conversion into the deep learning model, if the output value of a neuron for the original image is greater than 0.9, and the output value difference of the neuron under the input of the two images is less than 0.1, then this neuron is the key neuron, and the calculation method is as follows: 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 seed queue optimization based fuzzing method of claim 1, wherein, The uncertainty seed selection strategy in step 3 is to input the mutation seed into the deep learning model to be tested after the seed mutation of the test seed, if the prediction probability of the deep learning model output correct label decreases, or the mutation seed triggers a new coverage area, then it is re-added to the seed queue for subsequent fuzzy 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