Model training method based on sample filtering and related equipment

By identifying and removing backdoor samples during the model training phase, and utilizing a dual-channel filtering mechanism and semi-supervised learning, the problem of low model reliability caused by untrusted data sets in the existing technology is solved, and effective defense under different poisoning rates is achieved. and maintenance of prediction accuracy.

CN118627583APending Publication Date: 2024-09-10BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410563212.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing defense strategies can easily lead to a decrease in the prediction accuracy of the model when dealing with untrusted data sets, and are difficult to effectively defend against backdoor attacks under different poisoning rates, resulting in low model reliability.

Method used

A model training method based on sample filtering is adopted. By identifying and removing backdoor samples, the dual-channel filtering mechanism and semi-supervised learning are used to train the labeled backdoor samples and clean samples to ensure the prediction accuracy of the model on clean samples.

Benefits of technology

It effectively improves the security and robustness of the model, can effectively defend against backdoor attacks under different poisoning rates, and maintains the model's prediction accuracy on clean samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627583A
    Figure CN118627583A
Patent Text Reader

Abstract

The invention provides a model training method based on sample filtering and related equipment. The method comprises the steps of obtaining a training sample set; training a discriminator used for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator; determining a second back door sample in the training sample set based on the AUM value of the training sample set; removing the original labels of the first back door positive sample and the second back door positive sample to obtain an intermediate sample set; and performing semi-supervised training based on the complementary set of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of model training, and in particular to a model training method based on sample filtering and related equipment. Background Art

[0002] The effectiveness of deep neural networks depends on a large number of training samples. Users often collect data from untrusted data sources to save time and cost, which is becoming a target for attackers. Attackers change the predictions of the model by changing a part of the training samples. Existing defense strategies also have the problem of reduced accuracy of benign samples, easy to cause unknown errors, easy to be bypassed by adaptive attacks designed by attackers, and ineffective due to the poisoning rate of attacks, resulting in low reliability of the trained model. Summary of the invention

[0003] The present disclosure proposes a model training method based on sample filtering and related equipment, so as to solve the technical problem that the reliability of the trained model is low due to the unreliable training samples to a certain extent.

[0004] In a first aspect, the present disclosure provides a model training method based on sample filtering, comprising:

[0005] Get a training sample set;

[0006] Training a discriminator for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator;

[0007] Determining a second backdoor sample in the training sample set based on the AUM value of the training sample set;

[0008] Removing original labels from the first backdoor positive sample and the second backdoor sample to obtain an intermediate sample set;

[0009] Semi-supervised training is performed based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

[0010] In a second aspect of the present disclosure, a model training device based on sample filtering is provided, comprising:

[0011] A sample acquisition module is used to obtain a training sample set;

[0012] A first sample module, used for training a discriminator for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator;

[0013] A second sample module, configured to determine a second backdoor sample in the training sample set based on the AUM value of the training sample set;

[0014] A label removal module, used to remove original labels of the first backdoor positive sample and the second backdoor sample to obtain an intermediate sample set;

[0015] The model training module is used to perform semi-supervised training based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

[0016] In a third aspect of the present disclosure, an electronic device is provided, comprising one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method described in the first aspect.

[0017] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided. When the computer program is executed by one or more processors, the processors execute the method described in the first aspect.

[0018] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.

[0019] As can be seen from the above, the present disclosure provides a model training method based on sample filtering and related equipment, which eliminates the influence of untrusted training sets (which may contain backdoor data) during the training phase. By analyzing the different loss differences between backdoor samples and clean samples during the training period, a dual-channel sample filtering method is designed to deal with backdoor samples under different poisoning rates. Finally, the backdoor samples with labels removed are semi-supervisedly learned with clean samples to train a clean model. The prediction accuracy of the model on clean samples can be maintained while eliminating backdoor attacks, thereby effectively improving the security and robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A schematic diagram of a model training architecture based on sample filtering according to an embodiment of the present disclosure.

[0022] Figure 2 The figure is a schematic diagram of the hardware structure of an exemplary electronic device according to an embodiment of the present disclosure.

[0023] Figure 3 The present invention is a flowchart of a model training method based on sample filtering according to an embodiment of the present invention.

[0024] Figure 4 A schematic diagram of a model training method based on sample filtering according to an embodiment of the present disclosure.

[0025] Figure 5 It is a schematic diagram of a model training device based on sample filtering according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0027] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0028] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0029] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0030] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0031] Figure 1 FIG. 1 is a schematic diagram showing a model training architecture based on sample filtering according to an embodiment of the present disclosure. Figure 1 , the model training architecture 100 based on sample filtering may include a server 110, a terminal 120, and a network 130 providing a communication link. The server 110 and the terminal 120 may be connected via a wired or wireless network 130. The server 110 may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, security services, and CDN.

[0032] The terminal 120 may be implemented in hardware or software. For example, when the terminal 120 is implemented in hardware, it may be various electronic devices having a display screen and supporting page display, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, and desktop computers, etc. When the terminal 120 device is implemented in software, it may be installed in the electronic devices listed above; it may be implemented as multiple software or software modules (such as software or software modules used to provide distributed services), or it may be implemented as a single software or software module, which is not specifically limited here.

[0033] It should be noted that the model training method based on sample filtering provided in the embodiment of the present application can be executed by the terminal 120 or by the server 110. It should be understood that Figure 1 The number of terminals, networks and servers in the embodiment is only for illustration and is not intended to limit the number of terminals, networks and servers. Any number of terminals, networks and servers may be provided as required.

[0034] Figure 2 FIG. 2 shows a schematic diagram of the hardware structure of an exemplary electronic device 200 provided in an embodiment of the present disclosure. Figure 2 As shown, the electronic device 200 may include: a processor 202, a memory 204, a network module 206, a peripheral interface 208 and a bus 210. The processor 202, the memory 204, the network module 206 and the peripheral interface 208 are connected to each other in communication within the electronic device 200 through the bus 210.

[0035] Processor 202 may be a central processing unit (CPU), a model trainer based on sample filtering, a neural network processor (NPU), a microcontroller (MCU), a programmable logic device, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or one or more integrated circuits. Processor 202 may be used to perform functions related to the technology described in this disclosure. In some embodiments, processor 202 may also include multiple processors integrated into a single logical component. For example, Figure 2 As shown, processor 202 may include a plurality of processors 202a, 202b, and 202c.

[0036] The memory 204 may be configured to store data (eg, instructions, computer code, etc.). Figure 2 As shown, the data stored in the memory 204 may include program instructions (for example, program instructions for implementing the model training method based on sample filtering of the embodiment of the present disclosure) and data to be processed (for example, the memory may store configuration files of other modules, etc.). The processor 202 may also access the program instructions and data stored in the memory 204, and execute the program instructions to operate on the data to be processed. The memory 204 may include a volatile storage device or a non-volatile storage device. In some embodiments, the memory 204 may include a random access memory (RAM), a read-only memory (ROM), an optical disk, a magnetic disk, a hard disk, a solid-state drive (SSD), a flash memory, a memory stick, etc.

[0037] The network module 206 can be configured to provide communication with other external devices to the electronic device 200 via a network. The network can be any wired or wireless network capable of transmitting and receiving data. For example, the network can be a wired network, a local wireless network (e.g., Bluetooth, WiFi, near field communication (NFC) etc.), a cellular network, the Internet or a combination thereof. It is understood that the type of network is not limited to the above specific examples. In some embodiments, the network module 306 can include any number of network interface controllers (NICs), radio frequency modules, transceivers, modems, routers, gateways, adapters, cellular network chips, etc., in any combination.

[0038] The peripheral interface 208 can be configured to connect the electronic device 200 to one or more peripheral devices to achieve information input and output. For example, the peripheral devices can include input devices such as a keyboard, a mouse, a touch pad, a touch screen, a microphone, and various sensors, and output devices such as a display, a speaker, a vibrator, and an indicator light.

[0039] The bus 210 can be configured to transmit information between various components of the electronic device 200 (e.g., the processor 202, the memory 204, the network module 206, and the peripheral interface 208), such as an internal bus (e.g., a processor-memory bus), an external bus (USB port, PCI-E bus), etc.

[0040] It should be noted that, although the architecture of the electronic device 200 only shows the processor 202, the memory 204, the network module 206, the peripheral interface 208 and the bus 210, in the specific implementation process, the architecture of the electronic device 200 may also include other components necessary for normal execution. In addition, it can be understood by those skilled in the art that the architecture of the electronic device 200 may also only include the components necessary for implementing the embodiments of the present disclosure, and does not necessarily include all the components shown in the figure.

[0041] Deep neural network models are gradually replacing various key tasks. However, the effectiveness of deep neural networks depends on a large number of training samples. Users often collect data from untrusted data sources to save time and cost, which is becoming the target of attackers. Attackers change the prediction of the model by changing a part of the training samples. For example, the attacker adds backdoor triggers to a part of the benign samples taken from the data set he manipulates, and then changes the labels of these samples to the target labels the attacker wants. During the training process, the model establishes a connection between the backdoor trigger features and the target label, resulting in good performance on benign samples during the model reasoning process, while the model will output the prediction the attacker wants in samples with triggers. The offensive efficiency and offensive concealment of model backdoor attacks are constantly improving. The evolution of offensive methods is mainly focused on the design of triggers, including: embedding images in samples in proportion (Blended), inverting triggers by activating a set of specific neurons (Trojan), designing backdoor injection functions through adversarial sample examples of samples (DEFEAT), image feature layer transformation (BppAttack), etc.

[0042] Currently, there are some solutions that can reduce or eliminate the impact of backdoors on models, mainly including:

[0043] (1) Defense based on input preprocessing: After model training is completed, a preprocessing module is added before model inference, the purpose of which is to destroy possible triggers in the image while minimizing the change in the prediction of benign samples. Specifically, a pretrained autoencoder (replicator neural networks) can be used as a preprocessor. A two-stage image preprocessing method can also be introduced. First, the model interpretability tool (GradCam) is used to extract the area of ​​the input image that the model pays most attention to and remove it. In the second stage, a GAN is used to generate a supplementary area to be removed. The image can also be blocked with square pixel pattern blocks to destroy potential triggers. Image style transfer can also be used for preprocessing. Li et al. used strong data augmentation to change the input image.

[0044] (2) Defense based on model reconstruction: directly modify the suspicious model to eliminate potential backdoors. Therefore, even if the trigger is included in the input sample, the reconstructed model will still predict them correctly because the backdoor in the model has been removed. Since backdoor-related neurons are usually dormant when predicting benign samples, these neurons can be pruned to remove hidden backdoors. Specifically, the trained neural network is first pruned, and then the pruned network is fine-tuned to combine the benefits of pruning and fine-tuning defenses. Adversarial weight perturbations can also be used to amplify the differences between normal neurons and backdoor neurons. It is also possible to use the trained model as a teacher model and a small amount of clean data as a training set to train a student model using knowledge distillation. Subsequently, fine-tuning is performed and the student model is used to perform the final inference task.

[0045] (3) Defense based on model diagnosis: Directly determine whether a model has been embedded with a backdoor and refuse to deploy models that have been attacked by backdoors. A given model can be diagnosed, and the feature differences between normal models and backdoor models can be used to classify whether the model has been embedded with a backdoor. A heat map can also be generated using the model interpretability tool (GradCam), and the model can be diagnosed based on the three abnormal features in the heat map. Benign models and infected DNNs have significant topological differences, which can be used to diagnose suspicious models.

[0046] (4) Defense based on poisoning suppression: Defense based on poisoning suppression reduces the effectiveness of poisoned samples during training to prevent the creation of hidden backdoors. Powerful data enhancement methods (such as CutMix) can be introduced during training to effectively prevent the creation of hidden backdoors during training (the backdoors are destroyed by data enhancement methods and retained). It is also possible to isolate a small number of trusted backdoor samples and increase the gradient of these samples in subsequent training stages. It is also possible to use the high-dimensional feature layer in the model (usually the layer before the fully connected layer) to cluster the training samples and determine the poisoned samples corresponding to the clusters.

[0047] However, existing defense strategies still have problems. The input preprocessing method changes the characteristics of the original input, which may cause the preprocessed image to not meet the distribution of the original training set, resulting in a decrease in the accuracy of benign samples, and different types of tasks (images or text) require different preprocessing schemes. The model reconstruction-based method directly modifies the structure or parameters of the trained model. Since this is an empirical approach, directly modifying the model before determining the model backdoor generation mechanism may cause unknown errors. Defense based on model diagnosis relies on the defender's customized feature extraction method, which is easily bypassed by the adaptive attack designed by the attacker. The poisoning suppression-based solution can generally cope with most scenarios (when the defender has the training process authority). The existing poisoning suppression-based solution may fail due to the attack poisoning rate.

[0048] Therefore, how to design a universal backdoor attack defense solution to train a clean model on an untrusted dataset; how to ensure that it is effective when attackers use different attacks and design different poisoning rates during the attack; and how to reject backdoor samples as target labels while identifying benign samples as correct labels after the model is deployed have become technical problems that need to be solved urgently.

[0049] In view of this, the embodiments of the present disclosure provide a model training method and related equipment. The influence of untrusted training sets (which may contain backdoor data) is eliminated during the training phase. By analyzing the different loss differences between backdoor samples and clean samples during the training period, a dual-channel sample filtering method is designed to deal with backdoor samples under different poisoning rates. Finally, the backdoor samples with labels removed are semi-supervisedly learned with clean samples to train a clean model. The prediction accuracy of the model on clean samples can be maintained while eliminating backdoor attacks, thereby effectively improving the security and robustness of the model.

[0050] According to the disclosed embodiment, after each round of training, the cross entropy of the label distribution corresponding to the clean data set and the poisoned data set is calculated. It can be concluded that for the three dirty label attacks (BadNet, Trojan, Blended), when the poisoning rate is relatively high (1%), the average training loss of the backdoor samples decreases rapidly in the early stage of training. However, as the poisoning rate decreases, the loss of the backdoor samples first has an upward stage and then decreases in subsequent training. In the two clean label attacks (SIG, CL), it is basically satisfied that the average training loss of the backdoor samples is always lower than the average training loss of the clean samples.

[0051] Specifically, in the first backdoor sample (high confidence backdoor sample) selection stage, a sample training feature extraction stage t can be determined. h , by correcting the cross entropy loss to a flooding loss and h At the end, we isolate some positive and negative samples according to the loss, label all positive samples with different labels by activating clustering, and then use the labeled positive and negative sample data sets to train a backdoor discriminator to screen the original data set with these samples. In the second backdoor sample (noise backdoor sample) selection stage, we can determine a noise evaluation round t n , (t n <<t h ). h At the end of n The noise score of each sample is calculated to filter out samples that exhibit high noise properties. In the semi-supervised learning stage, the labels of all isolated datasets can be removed and combined with the labeled complementary dataset for semi-supervised learning to train a normal clean model.

[0052] See also Figure 3 , Figure 3 A schematic flow chart of a model training method based on sample filtering according to an embodiment of the present disclosure is shown. The model training method based on sample filtering according to an embodiment of the present disclosure can be deployed on a server side. Figure 3 In the present invention, the model training method 300 based on sample filtering may further include the following steps.

[0053] In step S310, a training sample set is obtained.

[0054] The training set can refer to a set of data instances with known labels. The training set includes multiple training samples, and each training sample can contain two key pieces of information: features and labels. Features can be data attributes or variables that describe each sample, such as numbers, texts, image pixels, etc. Labels can be target variables or output variables, which are annotations of the correct answer or expected output of each sample.

[0055] When simulating the application scenario of the method according to the embodiment of the present disclosure, it can be assumed that the attacker controls the user's data pipeline, that is, the attacker directly provides the user with a poisoned data set or the user crawls data with backdoor samples on the Internet. The attacker can arbitrarily modify the samples and corresponding labels of the data set to achieve the optimization goal of the backdoor attack; poison up to 50% of the data set; cannot control the training process of the model, and cannot directly modify the structure or parameters of the model. The defender has a model and a data set with unreliable sources; does not have a small amount of clean sample data to use; can actually control the training process, including information such as sample loss during training.

[0056] In step S320, a discriminator for identifying backdoor positive samples is trained based on the training sample set, and a first backdoor positive sample in the training sample set is determined based on the discriminator.

[0057] The high-confidence backdoor sample selection module corresponds to the feature that the average loss of backdoor samples is lower than the average loss of clean samples when the poisoning rate is high. The idea at this stage is to use the training loss to separate a small number of confident backdoor samples and a small number of confident clean samples, and train a discriminator that can discriminate backdoor samples from these two parts of samples. The reason for this is that the recall rate of backdoor samples is not high by setting the threshold separation through training loss alone. The recall rate of backdoor samples can be improved by using the discriminator. In addition, in order to improve the recall rate of backdoor samples, the training loss function is changed, the positive and negative sample labels are calibrated through feature clustering, and the operation of ensemble is adopted. Finally, the original data set is input into the discriminator to obtain the samples that the discriminator considers to be backdoor samples and remove their labels.

[0058] In some embodiments, training a discriminator for identifying backdoor positive samples based on the training sample set includes:

[0059] Extracting features from the training sample set based on the initialized first model and calculating the Flooding loss of each training sample in the training sample set;

[0060] Determine a first intermediate backdoor positive sample and a first intermediate backdoor negative sample in the training sample set based on the Flooding loss, a first threshold number, and a second threshold number;

[0061] The second model is trained based on the first intermediate backdoor positive sample and the first intermediate backdoor negative sample to obtain the discriminator.

[0062] Sample isolation: The original untrusted dataset is trained normally and a sample training feature extraction phase is set up. h At th During this period, the original cross entropy loss is:

[0063]

[0064] Change to Flooding loss L flooding =|Lce-b|+b.

[0065] Flooding loss increases the loss of samples whose cross entropy loss (Lce) is lower than the gradient correction threshold b to 2b-Lce during each training process. In this case, in the next training, the loss of backdoor samples generally decreases quickly while the loss of clean samples generally decreases slowly, thereby increasing the difference in the loss of backdoor samples and clean samples. h At the end of the stage, the cross entropy loss of each sample is calculated and it is considered that most of the backdoor positive samples are concentrated in the area with low cross entropy loss, while most of the backdoor negative (clean) samples are concentrated in the area with high cross entropy loss. Set two thresholds τ p and τ n Used to extract backdoor positive and negative samples. Based on existing work and experiments, τ p =1%,τ n =8%.

[0066] In some embodiments, determining a first intermediate backdoor positive sample and a first intermediate backdoor negative sample in the training sample set based on the Flooding loss, the first threshold number, and the second threshold number includes:

[0067] Determine a first threshold number of the training samples with the lowest Flooding loss as the first intermediate backdoor positive samples;

[0068] And, determining the training samples with a second threshold number having the highest Flooding loss as the first intermediate backdoor negative samples.

[0069] In some embodiments, method 300 further includes: extracting features from the training sample set based on the initialized first model to obtain a second model.

[0070] In some embodiments, training the second model based on the first intermediate backdoor positive sample and the first intermediate backdoor negative sample to obtain the discriminator includes:

[0071] Inputting the first intermediate backdoor positive sample into the second model to obtain a high-dimensional feature of the first intermediate backdoor positive sample;

[0072] The high-dimensional features are reduced in dimension and clustered to obtain a backdoor classification result of at least one of the first intermediate backdoor positive samples;

[0073] The first intermediate backdoor negative sample is used as a non-backdoor class, and the third model is trained in combination with the classification result of the first intermediate backdoor positive sample to obtain the discriminator; wherein the third model is of the same type as the first model.

[0074] The extracted backdoor positive and negative samples are used as training sets to train a discriminator that can identify the backdoor model. The model selection is generally the same as the model used to train the initial data set. The backdoor positive samples can be simply marked as one category and the backdoor negative samples as another category. This method has a good effect when the poisoning rate is high, but when the poisoning rate gradually decreases, the performance of flooding isolation data gradually decreases. p The accuracy of the isolated backdoor positive samples is not high enough, which leads to the degradation of the discriminator performance. To solve this problem, a purification operation will be performed on the backdoor positive samples. Specifically, the training extraction stage t h The original model is used to input all backdoor positive sample sets into the model to obtain the output of each sample. The last fully connected layer of the model is taken as the high-dimensional feature layer of the sample and the high-dimensional feature vector corresponding to each sample is subjected to PCA dimensionality reduction and then Kmeans clustering is performed. Suppose the original data sample is Each row represents a feature output vector of a sample. To reduce the data to k dimensions, first calculate the covariance matrix of the data:

[0075]

[0076] Then calculate the eigenvalues ​​and corresponding eigenvectors of the covariance matrix ∑. Select the eigenvectors corresponding to the first k eigenvalues, and these eigenvectors constitute the transformation matrix W. Use the transformation matrix to perform a linear transformation on the original data matrix X, and finally obtain the data matrix Y after dimensionality reduction.

[0077] Y=XW.

[0078] The number of clusters can be determined by the silhouette coefficient (an indicator for evaluating clustering, where a(i) represents the average distance from sample point i to each point in the cluster, and b(i) represents the average distance from sample point i to each point in other clusters) to anchor the samples containing several types of features in the positive samples, and then the positive sample set is classified and labeled with different labels according to these features, and all samples in the negative sample set are labeled with another different label.

[0079]

[0080] Since the model's feature outputs for the same backdoor samples are similar, classifying backdoor samples with the highest possible purity into one category can significantly improve the performance of the discriminator.

[0081] In some embodiments, determining a first backdoor positive sample in the training sample set based on the discriminator includes:

[0082] Inputting the training sample set into the discriminator to obtain a classification result for each training sample in the training sample set;

[0083] The training sample whose classification result belongs to the backdoor classification result is determined as the first backdoor positive sample.

[0084] Specifically, the discriminator can be trained using a labeled set of positive and negative backdoor samples, the original data set can be input into the trained discriminator, and the labels of samples that the discriminator considers to be backdoor samples can be removed.

[0085] Although the trained discriminator is very efficient in identifying backdoor samples, when the poisoning rate is too high (usually >50%), the absolute number of backdoor samples, which account for a small proportion (<5%), is still relatively large. In addition, there is a probability of jitter in the positive and negative sample isolation stage and the discriminator training stage (the backdoor sample is not correctly isolated in a single time or the discriminator fails in a single training). The recall rate can be improved by ensemble. Specifically, run this module n times and remove the sample labels that the discriminator considers to be backdoor samples each time. In the end, it can smoothly achieve a high recall rate of backdoor samples without affecting the accuracy of subsequent semi-supervised learning.

[0086] In step S330, a second backdoor sample in the training sample set is determined based on the AUM value of the training sample set.

[0087] Among them, when the poisoning rate of the corresponding backdoor sample selection stage is low, the average loss of the backdoor sample increases first and then decreases compared with the average loss of the clean sample. Since this feature is similar to the noise data feature in label noise learning, the backdoor samples and clean samples can be separated by quantifying the noise properties of the samples. The AUM (Area Under the Margin) value of the sample is calculated and sorted, and then the suspicious samples are divided by the threshold and the original labels of the suspicious samples are removed.

[0088] In some embodiments, determining a second backdoor sample in the training sample set based on the AUM value of the training sample set includes:

[0089] Obtaining an AUM value of the training sample based on a difference between a sample label logic value and a non-sample label logic value of each training sample in the training sample set;

[0090] The training samples with the lowest preset proportion in the AUM values ​​are determined as the second backdoor samples.

[0091] Among them, an indicator is sought to represent that these backdoor samples are difficult to learn in the early stage of training. There are two directions that affect the model learning of noisy backdoor samples during training: the target label and the non-backdoor features (i.e., non-trigger features) of the noisy backdoor samples. This will lead to inaccurate predictions of the model when predicting backdoor samples in the early stage of training. AUM is used to quantify this indicator of prediction inaccuracy. It first records an observation value M for each sample during training. This observation value M is the logit of the sample label in the logits (the scalar corresponding to the sample label output in logits) of the logical value of this sample (the model output vector before softmax) minus the maximum logit of the non-sample label (the scalar corresponding to the maximum output of the non-sample label in logits). If M is positive, it means that the model predicts correctly this time. If M is negative, it means that the model misclassifies this time and the larger |M| is, the more confident the model is in the result of this classification. Then the M values ​​of multiple rounds are averaged as an indicator of a sample to quantify whether a sample is difficult to learn. Corresponding to the training characteristics of the noisy backdoor samples, the M value of the noisy backdoor samples in the early stage of training is more likely to be negative, while the M value of the clean samples in the early stage of training is more likely to be positive. Therefore, the AUM index of the noisy backdoor samples will be much lower than the AUM value of the clean samples.

[0092] A noise evaluation round t can be set n (This t n The phase will be with t h The stages are parallel and t n < <t h to extract the samples that initially exhibit noise). n During this period, the AUM evaluation index of each sample is recorded. n At the end, a threshold τ is passed n Isolate some samples with the lowest AUM scores and unlabel them. τ n The value of should not be too small to result in low recall rate of noise backdoor samples, nor too high to result in too many samples being isolated and affecting the model training accuracy. For example, you can set τ n is 0.1. Similarly, setting τ n It can cope with attacks with arbitrary poisoning rates because the poisoning rate is often lower than 0.01 when the backdoor samples exhibit noise characteristics. The isolation rate of 0.1 achieves a high recall rate of backdoor samples without affecting the accuracy of subsequent semi-supervised learning.

[0093] This paper analyzes the learning behavior of backdoor samples during the training phase and designs corresponding defense measures based on the characteristic performance of backdoor samples under different poisoning rates. Specifically, by identifying the abnormal performance of backdoor samples during the training process, a targeted filtering strategy is adopted to protect the model from the influence of backdoor attacks.

[0094] The disclosed technical solution adopts a dual-pipeline sample filtering mechanism to separate abnormal backdoor samples through two paths. Specifically, on the one hand, high-confidence backdoor samples are identified through loss threshold and training discriminator, and on the other hand, noisy backdoor samples that are difficult to learn are screened out through label noise learning, thereby effectively filtering out potential backdoor samples.

[0095] In step S340, the original labels of the first backdoor positive sample and the second backdoor sample are removed to obtain an intermediate sample set.

[0096] Semi-supervised learning is performed using the unlabeled data separated from the above two stages and the remaining labeled data in the original dataset. Since the backdoor samples have been unlabeled, the association between the target label and the backdoor trigger is destroyed, so a clean model without embedded backdoors is finally trained. The semi-supervised learning method of FixMatch is adopted.

[0097] The present disclosure effectively identifies and isolates backdoor samples during the training phase by learning label noise and training the discriminator. Compared with other solutions that fail at low poisoning rates or require uncertain thresholds maintained by defenders, the present disclosure can recall more than 95% of backdoor samples at several fixed thresholds and train the final clean model using semi-supervised learning.

[0098] In step S350, semi-supervised training is performed on the intermediate sample set based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

[0099] The present disclosure adopts a semi-supervised learning training mode, that is, model training is performed when part of the data is unlabeled. By performing semi-supervised learning on labeled data and unlabeled data that has been filtered through the pipeline, the model's generalization ability for clean samples can be improved, so that the trained model can meet the accuracy requirements.

[0100] In some embodiments, performing semi-supervised training based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model includes:

[0101] Inputting the complement and the intermediate sample set into an initialized neural network model for training to obtain a distribution loss based on the complement and a consistency loss based on the intermediate sample set;

[0102] The weight parameters of the neural network model are adjusted to minimize the weighted sum of the distribution loss and the consistency loss to obtain the trained model.

[0103] Merge the data selected by the two sample selection modules into an unlabeled dataset: Du , compare this unlabeled dataset with its labeled complement Perform standard semi-supervised training. Select Fixmatch as the semi-supervised training method.

[0104] Assume that L sup represents the distribution loss on labeled data (using cross entropy loss), L unsup represents the consistency loss on unlabeled data (using the cross entropy between the pseudo-label of the weakly enhanced image sample and the predicted output of the strongly enhanced image sample), λ is a hyperparameter that balances the loss of labeled data and unlabeled data, and the optimization goal of Fixmatch semi-supervised is

[0105]

[0106] where θ is the model parameter.

[0107] It can be seen that by analyzing the learning behavior of backdoor samples during the model training phase, corresponding filtering measures are designed based on the characteristic performance of backdoor samples under different poisoning rates. Compared with traditional defense methods based on input reconstruction or model reconstruction, this solution is more targeted at the characteristics of backdoor attacks, can more effectively identify and filter out potential backdoor samples, and improves the accuracy and effectiveness of defense.

[0108] The present invention has been experimentally verified by applying a variety of advanced backdoor attack methods on multiple benchmark datasets, proving that the present invention can maintain the prediction accuracy of the model on clean samples while eliminating backdoor attacks. The average levels of backdoor attack success rate (ASR) and accuracy loss rate (ADR) on all tested benchmark datasets are better than the existing model backdoor defense solutions.

[0109] In some embodiments, before step S350, the method further includes:

[0110] Determining whether the number of the intermediate sample sets is less than a preset number;

[0111] In response to the number of the intermediate sample sets being less than the preset number, semi-supervised training is performed on the intermediate sample sets based on the complement of the intermediate sample sets in the training sample set.

[0112] In some embodiments, method 300 may further include:

[0113] In response to the number of the intermediate sample sets being greater than or equal to the preset number, refusing to perform model training.

[0114] Among them, when the unlabeled intermediate sample set D is found uWhen there are too many samples, it means that the original training sample set contains more backdoor samples, and the training sample set has been attacked and refuses to be trained.

[0115] In some embodiments, method 300 may further include:

[0116] Get the data to be processed;

[0117] The data to be processed is input into the trained model to obtain the corresponding output result.

[0118] Furthermore, in some embodiments, the data to be processed may include image data, text data, audio data, or audio and video data. Furthermore, in some embodiments, the trained model may be used to process data classification, target detection or target recognition, semantic segmentation, or instance segmentation. Specifically, taking image data as an example, the trained model may be used to process tasks such as image classification, target detection, semantic segmentation, instance segmentation, image recognition and verification, image super-resolution, image restoration and enhancement, optical character recognition, stereo vision, and three-dimensional reconstruction.

[0119] See also Figure 4 , Figure 4 A schematic diagram of a model training method based on sample filtering according to an embodiment of the present disclosure is shown. Specifically, a backdoor attack scenario in a general model classification task is taken as an example, such as a task scenario for image classification. A data set of backdoor attacks of unknown methods with unknown poisoning rates may be used as a training sample set (for example, simulating a badnet attack on a data set with a poisoning rate of 10%) to train the initial model model_s.

[0120] The first backdoor positive sample selection stage: First, a training feature extraction stage t can be selected h= 20 batches, input the original training sample set into the initial model model_s for training, and use flooding loss for sorting. After 20 batches of training are completed, calculate the flooding loss of each current sample and sort them, take the top 1% of samples with the lowest loss value as the first intermediate backdoor positive samples and the top 8% of samples with the highest loss value as the first intermediate backdoor negative samples, and at the same time retain the model model_s'. Input the top 1% of the first intermediate backdoor positive samples into the model after the training feature extraction stage and take the output vector of the previous layer of the fully connected layer as the high-dimensional feature of the sample. Perform PCA classification on these high-dimensional features, and then use the silhouette coefficient for evaluation. Take the value of the silhouette coefficient closest to 1 as the number of clusters and label the data within the cluster with the same label, and label the data between clusters with different labels. The first intermediate is regarded as an independent cluster and labeled. Input the labeled data into a newly initialized initial model model_s, and use the cross entropy loss loss function for standard classification training. Train 100 batches to obtain the discriminator. The original training sample set is input into the discriminator, and the first backdoor positive sample corresponding to the non-backdoor negative sample label is removed from the label and added to the unlabeled intermediate sample set.

[0121] The second backdoor sample selection stage: in the training feature extraction stage t h The first two batches (t n ) At the end of the process, the AUM value corresponding to each sample is calculated and sorted by the logical value logits output by each sample. The 10% samples with the lowest AUM value are removed as the second-last samples and added to the unlabeled intermediate sample set.

[0122] Semi-supervised learning stage: The unlabeled intermediate sample sets obtained in the first two stages, namely the first backdoor sample selection stage and the second backdoor sample selection stage, are subjected to fixmatch semi-supervised training with their complement in the original training sample set (still using the initial model model_s), and finally a model that is not affected by the backdoor and has the required accuracy is obtained.

[0123] Among them, 97.72% of the backdoor samples were recalled in the first backdoor sample selection stage, and 0.04% of the backdoor samples were recalled in the second backdoor sample selection stage, and a total of 97.72% of the backdoor samples were recalled. In this embodiment, the poisoning rate is 10%, and the backdoor samples meet the training characteristics of high-confidence backdoor samples. The attack success rate (ASR) of the model completed after semi-supervised learning training is 0.68%, the model clean sample accuracy (CA) is 94.7%, and the precision decay rate (ADR) is 0.27.

[0124] It can be seen that according to the method of the embodiment of the present disclosure, by observing the learning behavior of the backdoor samples during the training process, it is found that the backdoor samples and clean samples show different characteristics under different poisoning rates. Based on the analysis of the characteristics of the backdoor samples, a scheme for filtering backdoor samples during the training phase is proposed. The scheme uses two fixed isolation thresholds, combined with label noise learning and training discriminators, to effectively identify and filter out backdoor samples, thereby ensuring the security of the model. In the training phase, the influence of untrusted training sample sets (the training sample sets may contain backdoor data) is eliminated, and by analyzing the different loss differences between the backdoor samples and the clean samples during the training period, a dual-channel sample filtering method is used to deal with backdoor samples under different poisoning rates. Finally, the backdoor samples with labels removed are semi-supervisedly learned with the clean samples to train the clean model. The prediction accuracy of the model on clean samples can be maintained while eliminating backdoor attacks, thereby effectively improving the security and robustness of the model. It can deal with the threat of backdoor attacks on deep neural network models during training. By analyzing the characteristic performance of backdoor samples and designing targeted filtering strategies, it ensures the security and prediction accuracy of the model, providing strong protection against increasingly complex network security threats.

[0125] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.

[0126] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0127] Based on the same technical concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a model training device based on sample filtering, see Figure 5 , the model training device based on sample filtering includes:

[0128] A sample acquisition module is used to obtain a training sample set;

[0129] A first sample module, used for training a discriminator for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator;

[0130] A second sample module, configured to determine a second backdoor sample in the training sample set based on the AUM value of the training sample set;

[0131] A label removal module, used to remove original labels of the first backdoor positive sample and the second backdoor sample to obtain an intermediate sample set;

[0132] The model training module is used to perform semi-supervised training based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

[0133] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0134] The device of the above embodiment is used to implement the corresponding model training method based on sample filtering in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0135] Based on the same technical concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the sample filtering-based model training method as described in any of the above embodiments.

[0136] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0137] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the model training method based on sample filtering as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0138] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.

[0139] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0140] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0141] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.

Claims

1. A model training method based on sample filtering, comprising: Get a training sample set; Training a discriminator for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator; Determining a second backdoor sample in the training sample set based on the AUM value of the training sample set; Removing original labels from the first backdoor positive sample and the second backdoor sample to obtain an intermediate sample set; Semi-supervised training is performed based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

2. The method according to claim 1, wherein Training a discriminator for identifying backdoor positive samples based on the training sample set includes: Extracting features from the training sample set based on the initialized first model and calculating the Flooding loss of each training sample in the training sample set; Determine a first intermediate backdoor positive sample and a first intermediate backdoor negative sample in the training sample set based on the Flooding loss, a first threshold number, and a second threshold number; The second model is trained based on the first intermediate backdoor positive sample and the first intermediate backdoor negative sample to obtain the discriminator.

3. The method according to claim 2, wherein: Also includes: Extracting features from the training sample set based on the initialized first model to obtain a second model; Then, the second model is trained based on the first intermediate backdoor positive sample and the first intermediate backdoor negative sample to obtain the discriminator, including: Inputting the first intermediate backdoor positive sample into the second model to obtain a high-dimensional feature of the first intermediate backdoor positive sample; The high-dimensional features are reduced in dimension and clustered to obtain a backdoor classification result of at least one first intermediate backdoor positive sample; The first intermediate backdoor negative sample is used as a non-backdoor class, and the third model is trained in combination with the classification result of the first intermediate backdoor positive sample to obtain the discriminator; wherein the third model is of the same type as the first model.

4. The method according to claim 3, wherein: Determining a first backdoor positive sample in the training sample set based on the discriminator includes: Inputting the training sample set into the discriminator to obtain a classification result for each training sample in the training sample set; The training sample whose classification result belongs to the backdoor classification result is determined as the first backdoor positive sample.

5. The method according to claim 1, wherein: Determining a second backdoor sample in the training sample set based on the AUM value of the training sample set includes: Obtaining an AUM value of the training sample based on a difference between a sample label logic value and a non-sample label logic value of each training sample in the training sample set; The training samples with the lowest preset proportion in the AUM values ​​are determined as the second backdoor samples.

6. The method according to claim 2, wherein: Determining a first intermediate backdoor positive sample and a first intermediate backdoor negative sample in the training sample set based on the Flooding loss, the first threshold quantity, and the second threshold quantity includes: Determine a first threshold number of the training samples with the lowest Flooding loss as the first intermediate backdoor positive samples; And, determining the training samples with a second threshold number having the highest Flooding loss as the first intermediate backdoor negative samples.

7. The method according to claim 1, wherein: Performing semi-supervised training based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model, including: Inputting the complement and the intermediate sample set into an initialized neural network model for training to obtain a distribution loss based on the complement and a consistency loss based on the intermediate sample set; The weight parameters of the neural network model are adjusted to minimize the weighted sum of the distribution loss and the consistency loss to obtain the trained model.

8. A model training device for sample filtering, comprising: A sample acquisition module is used to obtain a training sample set; A first sample module, used for training a discriminator for identifying backdoor positive samples based on the training sample set, and determining a first backdoor positive sample in the training sample set based on the discriminator; A second sample module, configured to determine a second backdoor sample in the training sample set based on the AUM value of the training sample set; A label removal module, used to remove original labels of the first backdoor positive sample and the second backdoor sample to obtain an intermediate sample set; The model training module is used to perform semi-supervised training based on the complement of the intermediate sample set in the training sample set and the intermediate sample set to obtain a trained model.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program. 10 . A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method according to claim 1 .