A method for detecting and defending against data poisoning attacks

Through technologies such as multi-layer nested integrated training and k-means clustering algorithm, the backdoor triggers in data poisoning attacks are detected and repaired, which solves the problems of multi-poisoned data synergy and backdoor detection in the existing technology, and realizes the detection of backdoors under the black box model. Effective defense and data cleaning improve the defense capabilities and accuracy of the model.

CN118503974BActive Publication Date: 2024-09-17NO 30 INST OF CHINA ELECTRONIC TECH GRP CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410979124.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-09-17
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

Existing data poisoning attack defense methods are ineffective when faced with the combined force of multiple poisoned data, and cannot effectively detect and repair backdoor triggers without knowing the algorithm type and model structure, affecting the accuracy and security of the model.

Method used

Use a multi-layer nested ensemble training method to detect and clean the data set, identify poisoned data by calculating the standard deviation and error rate of the classification model, and use K-L divergence to measure the disagreement between models, combined with k-means clustering algorithm and trigger scanning Targeting methods locate and repair backdoor triggers and build trigger blockers to neutralize their effects.

Benefits of technology

It achieves effective detection and repair of backdoor triggers without knowing the algorithm type and model structure, improves the model's defense capabilities, reduces the loss of prediction accuracy, and supports data security in untrusted computing environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503974B
    Figure CN118503974B
Patent Text Reader

Abstract

The present invention discloses a method for detecting and defending against data poisoning attacks, which includes: cleaning a training data set containing poisoned data to obtain a clean training set; repairing backdoor data, and constructing a trigger interceptor to offset the impact of backdoor triggering. The present invention can effectively detect poisoned data and accurately defend against data poisoning attacks, and repair the model backdoor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data security, and in particular to a method for detecting and defending against data poisoning attacks. Background Art

[0002] Algorithms determine the lower limit of intelligent model performance, while data determines the upper limit of intelligent model performance. Nowadays, research on data expansion, feature selection, and other data-related topics are becoming increasingly mature. Attackers have also turned their attention to this, and federated learning and open source data have become their testing grounds for carefully fabricating poisoned data and carrying out data poisoning attacks.

[0003] The defense methods for data poisoning attacks are divided into active defense and passive defense. The characteristic of passive defense is that it can only detect, clean up and repair after the attack occurs. It is a "special medicine" for data poisoning attacks. It mainly uses defense methods based on training detection to achieve passive defense; the characteristic of active defense is that it focuses more on preventing problems before they happen. Measures are taken before the attack occurs to strengthen the "protection body" of the classification model itself. There are mainly defense methods based on robust training and defense methods based on data enhancement.

[0004] (1) Defense method based on training detection

[0005] The training data is combined with the machine learning algorithm to obtain a classification model that is suspected to be poisoned. This model is directly used to classify each training data and calculate the label. If the obtained label is different from the real label of the data, the data is poisoned data and is deleted from the training data. This method is simple and practical, but it can only be used to detect known training data. If the model backdoor is caused by the combined efforts of multiple poisoned data, it will not be effective in defense.

[0006] (2) Defense method based on data enhancement

[0007] Data enhancement refers to processing the training set by special methods to obtain more data, which also offsets the effect of poisoned data. For example, in the face recognition task, photos are compressed, rotated, enlarged, cropped, and Gaussian noise is added to expand the training set, and finally the classification model is trained on the new training set. This method can reduce the impact of data poisoning attacks, but it cannot get rid of the impact of poisoned data.

[0008] (3) Defense method based on robust training

[0009] The robustness of a model refers to the ability of the model to continue to operate normally under dangerous and abnormal circumstances. The robustness of the classification model can be improved through methods such as ensemble learning, which can enhance the resistance and tolerance of the classification model to a certain amount of poisoned data and form "immunity" to data poisoning. Ensemble learning trains multiple classification models for a classification task at the same time, and each model draws its own results and votes on the same sample. This method can effectively resist data poisoning attacks, but it will affect the accuracy of the classification model itself, and requires sufficiently large training data to support multiple classification models. Summary of the invention

[0010] In view of this, the present invention provides a method for detecting and defending against data poisoning attacks.

[0011] The present invention discloses a method for detecting and defending against data poisoning attacks, which comprises:

[0012] Step 1: Clean the training data set containing poisoned data to obtain a clean training set;

[0013] Step 2: Fix the backdoor data and build a trigger interceptor to offset the impact of the backdoor trigger.

[0014] Furthermore, the step 1 comprises:

[0015] First, select m training models and calculate the standard deviation of the m training models ;according to The training dataset containing poisoned data in increasing order The training data points in To sort, for The i-th training sample in yes Labels;

[0016] If the clean data in training Less than or equal to Sample size , then continue to calculate the training data set containing poisoned data ;

[0017] And based on The classification model is obtained by training the artificial intelligence algorithm and calculating the data samples The error rate of the classification model obtained based on ;like , then stop the iteration and update so that , and increase the model training error ,in, To use clean data The error rate of the classification model obtained based on is the error limit;

[0018] Until clean data Greater than Sample size , output clean training set .

[0019] Furthermore, the following formula is used to calculate the training data set containing poisoned data: :

[0020]

[0021] in, is the dataset label, and Y is the dataset label set.

[0022] Furthermore, the increase in model training error ,include:

[0023]

[0024]

[0025] in, is the training error obtained in the i-th cycle iteration, is the training size increment, [ ] is the matrix symbol.

[0026] Furthermore, the erroneous impact of a sample point on classification accuracy is used to decide whether to use it for training a classification model. The divergence of the classification model on the poisoned sample point is greater than that on the clean sample point. The KL divergence is used to measure the divergence between classification models. Compared with normal data samples that follow a normal data distribution, the divergence of poisoned data samples is higher.

[0027] Furthermore, the step 2 comprises:

[0028] Traverse each data stream The data in data is used to determine whether there is a backdoor trigger using the trigger scanning and positioning method. If it is determined to exist, the k-means clustering algorithm is used to cluster based on the main features of the data to confirm whether the backdoor trigger causes a change in the prediction result. If a change occurs, the backdoor reconfirmation method is used to confirm whether it is a real backdoor trigger. Finally, based on the results of the k-means clustering algorithm, the backdoor is repaired and the repaired data stream is saved.

[0029] After the traversal is completed, the prediction set and backdoor set are finally obtained.

[0030] Furthermore, the trigger scanning positioning method includes:

[0031] The k-means clustering algorithm is used for the main features of all samples in the data, and the backdoor is prevented from being triggered through the trigger blocking program and pure training data is generated. , if the pure training data If the corresponding data data is tested by the backdoor trigger and different results are obtained, the backdoor location is recorded, and the backdoor reconfirmation method is used on the data to further confirm whether it is a backdoor, and finally the location of the backdoor trigger is obtained. Combined with the clean training set data obtained by the model nested training method , take the common element set and get the final pure training data .

[0032] Furthermore, the backdoor reconfirmation method includes:

[0033] Select k random correctly classified data from the training data ;

[0034] Use trigger repair procedures to extract data features;

[0035] Traversal All the feature Fea of ​​the data that needs to be confirmed in the data are processed by the backdoor trigger to obtain new features , if the original feature Fea and the corresponding new feature After backdoor confirmation, if a different result is obtained, the counter is incremented by 1; based on the counter and data And the training threshold , to determine whether it is a real backdoor.

[0036] Furthermore, if the counter and data The ratio of the length of is greater than the training threshold , then the input sample is judged to be a real backdoor, otherwise it is a fake backdoor caused by the trigger’s interceptor.

[0037] Due to the adoption of the above technical solution, the present invention has the following advantages:

[0038] 1. Use multi-layer nested ensemble training methods to detect and clean data sets, and obtain clean samples of detoxified data in a practical and effective manner to avoid being affected by poisoned samples and support the defense of model backdoors.

[0039] 2. Currently, backdoor defense is mostly aimed at weak attack models or white box assumptions. The defense method of the present invention is a completely black box method that can be used without knowing the algorithm type and the internal structure of the model. It is a method loosely coupled with the algorithm model. It can accurately detect the location of the backdoor and repair the backdoor to avoid being affected again, and the loss of prediction accuracy is very small. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0041] Figure 1 The present invention is a flowchart of a method for detecting and defending against data poisoning attacks according to an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The present invention is further described in conjunction with the accompanying drawings and embodiments, and the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present invention.

[0043] The use scenario of this invention assumes that the potential victim does not have large-scale computing capabilities and can only entrust the training work to a potential untrustworthy party (computing cluster provider). The potential victim cannot access the training process, let alone discover and suppress the backdoor trigger. Based on this use scenario, see Figure 1 The present invention provides an embodiment of a method for detecting and defending against data poisoning attacks, which is mainly divided into two parts: data cleaning and model backdoor defense:

[0044] S1.1, Data cleaning technology:

[0045] The nested training method is used to detect and remove poisoned data, that is, the erroneous impact of training points on classification accuracy is used to decide whether they should be used for training. The classification model will have large disagreements on the poisoned sample points, while the disagreement of clean samples is much smaller. The KL divergence is used to measure the disagreement between models. Compared with normal data samples that follow the normal data distribution, the disagreement of poisoned data samples is higher. The model training method is a data cleaning method based on model nested training. First, preprocessing is performed. Drawing on the idea of ​​the k-fold validation method, the data set is divided into m equal parts, and each m-1 data set is synthesized into a new training set with a sample capacity of Q. A total of m different training data sets are created, and then a set of m different classification models are trained based on the machine learning algorithm. Then, the standard deviation of the diversified classifiers for each training point in the data set is calculated. Next, the training data points are sorted in increasing order of the standard deviation. Sort by is a training dataset containing poisoned data, Label.

[0046] In each iteration, first, the sample size Q is set. Next, the classification model is trained using new training data and the machine learning algorithm and the classification error is calculated. Finally, the increase in error rate is focused on. If it exceeds a preset threshold, , then stop and return to the latest combined training data set. The data outside the latest combined training data set are poisoned samples, which are directly discarded, and finally the goal of training sample cleaning is achieved. The nested training method is shown below, where and is the intermediate parameter, Clean data in training, is using The error rate of the classification model is obtained based on the data sample. Intelligent algorithms used in classification models, such as SVM, CNN, etc. , and finally get a clean training set after preliminary processing , is the training size increment, For the error limit, the specific training process is as follows:

[0047] First, select m training models, the model set is , and calculate the standard deviation of m training models , and the data is divided into m parts and recorded as , …, The calculation formula is as follows:

[0048]

[0049] in, For use data The first training model trained, For use data The second training model trained, For use The mth training model trained, To calculate the standard deviation of m classification models;

[0050] Then follow In ascending order Sort and initialize , .

[0051] Then conduct cycle training. , then continue to calculate new data sets, the calculation formula is as follows.

[0052]

[0053] in, is the dataset label, and Y is the dataset label set.

[0054] And based on the training data set containing poisoned data Get the classification model after artificial intelligence algorithm training and calculate the classification error rate .if , then stop the iteration and update so that , and increase the training error

[0055]

[0056] is the training error obtained in the i-th cycle iteration.

[0057] Finally, we can get a clean training set The algorithm is as follows.

[0058]

[0059] S1.2, Model backdoor defense technology:

[0060] The method provided by the model backdoor defense technology is not to deactivate and then detect a set of neurons that may trigger the backdoor, but to repair the backdoor data and build a trigger blocker to offset the impact of the backdoor trigger. First, randomly search the data stream and place trigger blockers of the main features (main colors for image data) in the data to locate the position of the backdoor trigger. Placing a trigger blocker by the position of the backdoor trigger will change the characteristics of the model prediction results to detect the location of the backdoor trigger. And the change in prediction can support the calculation of the true prediction results of the clean version of the backdoor image. Once the location is detected, a fixed version of the data is generated by placing a trigger blocker at that location, which is composed of the main features of the input data.

[0061] The model backdoor defense method can detect in real time, so the input data is stream data (such as stream image img_list, network traffic cyberdata_list, etc.) and detects which data samples in the stream are backdoors. In addition, the method fixes the backdoor attack by converting each data to the classifier to restore it to a correctly predicted security state. To this end, the method first performs a search operation to locate the backdoor position (see the backdoor reconfirmation method shown in Algorithm 4). After discovering the backdoor position of the data, the backdoor is prevented from being triggered by triggering the blocking program and generating pure training data In order to make Become the corresponding This method uses the main features of data to identify and defend backdoor triggers. Combined with the clean training set obtained by Algorithm 1 , take the common element set for purification, and obtain the final pure training data after purification .

[0062] After finding the location of the backdoor trigger, the location information is modified by placing the trigger interceptor at the discovered location (corresponding to lines 6-7 of Algorithm 2). If the trigger blocking program is placed on the backdoor, the prediction result will be changed, and the backdoor reconfirmation method will be used to further confirm the existence of the backdoor. After traversing the data stream Data_list, the backdoor set Backdoor_set contains the set of all detected backdoor images and the corresponding correct predictions, where the training parameters , is the backdoor trigger repair, Pos is the position of the backdoor trigger, Size is the data stream size, ω is the training parameter, Prediction_set is the prediction set, Backdoor_set is the backdoor set, and Data_list is the data stream. The model backdoor defense method is described as follows:

[0063] First initialize .

[0064] Then iterate through each Inside (Data), use the trigger scanning positioning method to determine whether there is a backdoor trigger. If it is determined to exist, the k-means clustering algorithm is used for the main features of the data (the main difference of the picture is the main color, and the traffic data is the port number, number of connections, etc.).

[0065] Next, confirm whether the backdoor trigger causes a change in the prediction result. If , then the backdoor reconfirmation method is used to confirm whether it is really a backdoor trigger. Finally, based on the result of the mean clustering algorithm, the backdoor is repaired and the repaired data stream is saved.

[0066] Finally, we get the prediction set and backdoor collection The algorithm is described as follows.

[0067]

[0068] In order to find the correct position of the backdoor trigger and better repair the backdoor, the following trigger scanning positioning method will be used to locate the position of all backdoor triggers, where It is the backdoor trigger detection. The trigger scanning positioning method is described as follows:

[0069] First initialize _triggers Then, the k-means clustering algorithm is used for the main features of all samples in the data (the main difference of the picture is the main color, and the traffic data is the port number, number of connections, etc.). If the pure training data The corresponding data data is detected by the backdoor trigger If different results are obtained, the backdoor location is recorded, and the backdoor reconfirmation method is used on the data to further confirm whether it is a backdoor. Finally, the location of the backdoor trigger is obtained. The algorithm is described as follows.

[0070]

[0071] After obtaining the location of the backdoor trigger and the input sample, it is necessary to confirm whether the sample is a real backdoor or a fake backdoor caused by the trigger interceptor. This requires a backdoor reconfirmation method. The process of confirming the backdoor is shown in Algorithm 4, where the correctly classified sample is , It is the backdoor reconfirmation function.

[0072] First initialize the conversion counter , and select k random correctly classified data from the training data:

[0073]

[0074] Next, a trigger repair procedure is used to extract data features, such as pixels of an image and a feature of traffic data:

[0075]

[0076] Traverse all the feature Feas that need to confirm the data, and get new features after the data passes through the backdoor trigger , if the original feature Fea and the corresponding new feature Confirmed by backdoor If different results are obtained, the counter Add 1. Finally, by calculating , determine whether it exceeds the training threshold. Because this method requires appropriate value, in order to effectively determine whether it is a backdoor. If it is too high, it is likely a fake backdoor. The calculation method of is as follows:

[0077]

[0078] The specific algorithm is shown in Algorithm 4 below.

[0079]

[0080] The present invention adopts the idea of ​​multi-fold data reuse and combines the divergence of the classifier integration mechanism to filter potential poisoned samples, solving the problem of lack of effectiveness in poisoned sample detection due to insufficient data volume and a significant decrease in the classification accuracy of the integrated classifier.

[0081] The present invention adopts the idea of ​​a backdoor trigger suppressor to solve the problem that model backdoor defense requires reconstruction of the algorithm model. The present invention can be seamlessly embedded in the deployed intelligent model and support any large system defense based on ML (machine learning).

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for detecting and defending against data poisoning attacks, characterized in that: include: Step 1: Use the model nesting training method to clean the training data set containing poisoned data to obtain a clean training set; Step 2: Fix the backdoor data and build a trigger interceptor to offset the impact of the backdoor trigger; Specifically: First, select m training models and calculate the standard deviation of the m training models ;according to The training dataset containing poisoned data in increasing order The training data points in To sort, for The i-th training sample in yes Labels; If the clean data in training Less than or equal to Sample size , then continue to calculate the training data set containing poisoned data ; And based on The classification model is obtained by training the artificial intelligence algorithm and calculating the data samples The error rate of the classification model obtained based on ;like , then stop the iteration and update so that , and increase the model training error ,in, To use clean data The error rate of the classification model obtained based on is the error limit; Until clean data Greater than Sample size , output clean training set ; The step 2 comprises: Traverse each data stream The data in data is used to determine whether there is a backdoor trigger using the trigger scanning and positioning method. If it is determined to exist, the k-means clustering algorithm is used to cluster based on the main features of the data to confirm whether the backdoor trigger causes a change in the prediction result. If a change occurs, the backdoor reconfirmation method is used to confirm whether it is a real backdoor trigger. Finally, based on the results of the k-means clustering algorithm, the backdoor is repaired and the repaired data stream is saved. After the traversal is completed, the prediction set and backdoor set are finally obtained; The trigger scanning positioning method includes: The k-means clustering algorithm is used for the main features of all samples in the data, and the backdoor is prevented from being triggered through the trigger blocking program and pure training data is generated. , if the pure training data If the corresponding data data is tested with the backdoor trigger and different results are obtained, the backdoor location is recorded, and the backdoor reconfirmation method is used on the data to further confirm whether it is a backdoor, and finally the location of the backdoor trigger is obtained; then combined with the clean training set obtained in step 1 , take the common element set and get the final pure training data ; The backdoor reconfirmation method comprises: Select k random correctly classified data from the training data ; Use trigger repair procedures to extract data features; Traversal All the feature Fea of ​​the data that needs to be confirmed in the data are processed by the backdoor trigger to obtain new features , if the original feature Fea and the corresponding new feature After backdoor confirmation, if a different result is obtained, the counter is incremented by 1; based on the counter and data And the training threshold , to determine whether it is a real backdoor.

2. The method according to claim 1, characterized in that The following formula is used to calculate the training data set containing poisoned data : in, is the dataset label, and Y is the dataset label set.

3. The method according to claim 1, characterized in that The increase in model training error ,include: in, is the training error obtained in the i-th cycle iteration, is the training size increment, [ ] is the matrix symbol.

4. The method according to claim 1, characterized in that The erroneous impact of a sample point on classification accuracy is used to decide whether to use it for training a classification model. The divergence of the classification model on the poisoned sample point is greater than that on the clean sample point. The KL divergence is used to measure the divergence between classification models. Compared with normal data samples that follow a normal data distribution, the divergence of poisoned data samples is higher.

5. The method according to claim 1, characterized in that If the counter and data The ratio of the length of is greater than the training threshold , then the input sample is judged to be a real backdoor, otherwise it is a fake backdoor caused by the trigger’s interceptor.