Model training method and device for reducing adversarial mobility and medium
By adding adversarial perturbation and early termination algorithms to model training, the time and cost of model training against transferability are reduced, the problem of robustness and accuracy trade-offs in existing technologies is solved, and efficient black-box defense capabilities are achieved.
Patent Information
- Application Number
- CN202410817066.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-24
AI Technical Summary
When existing technology reduces adversarial transferability, it is difficult to ensure the robustness and accuracy of the model at the same time, and the computational cost is high, which limits the scalability of the defense training of the big data model.
By obtaining the training set and adding adversarial perturbations, the gradient descent algorithm is used to update model parameters, calculate cosine similarity and terminate the iteration process early, reduce the number of iterations of adversarial sample generation, delete samples with zero forgetting times to train the target model, and ensure that the model is Orthogonality and parameter consistency in adversarial spaces.
It significantly reduces model training time and computing costs, improves defense capabilities, achieves efficient black-box adversarial defense, and reduces the computational complexity of the adversarial sample generation process.
Smart Images

Figure CN118691889A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing, and in particular relates to a model training method, device and medium for reducing adversarial migration. Background Art
[0002] Deep neural networks (DNNs) continue to set new state-of-the-art performance in multiple machine learning fields, such as image classification, object detection, and natural language processing. As a result, DNNs are now widely used in industries such as smart manufacturing, autonomous driving, and healthcare. However, the emergence of adversarial examples can easily undermine the performance of DNNs, exposing the problem of DNNs' lack of robustness. This poses a severe challenge to the security of DNN-based artificial intelligence models in real-world scenarios, especially considering the easy transferability of adversarial examples. Adversarial transferability refers to the ability of adversarial examples against one network to undermine the performance of other networks. Accordingly, a powerful black-box attack method, transfer-based attack, has become popular due to its simplicity and efficiency, that is, generating adversarial examples against a proxy model to attack the victim model, which makes it easier for adversaries to attack unseen models and is more in line with realistic attack scenarios.
[0003] To address this important security issue, researchers have proposed different methods to defend against adversarial attacks. Some studies have proposed or improved adversarial training to obtain robust networks that can correctly classify adversarial examples. Other studies have proposed gradient masking algorithms to confuse gradient-based attack mechanisms. In addition, there are adversarial detection methods that aim to identify whether an example is adversarial or benign before it is input into a DNN. Among these adversarial defense methods, adversarial training is the most effective. However, this method has a fatal weakness, which is the trade-off between the classification accuracy of clean images and the effectiveness of adversarial defense. In other words, the defender cannot ensure both robustness and accuracy at the same time.
[0004] Recently, some scholars have redefined this task as reducing the transferability of adversarial examples as a way to defend against transfer-based black-box adversarial attacks. These attacks are based on the assumption that the source model and the victim model have similar decision boundaries. Therefore, scholars have proposed a concept called "heterogeneous optimization", which is to train the two models in a way that their decision boundaries are orthogonal to each other. In this way, the transferability of adversarial examples against one model is cut off, allowing the other model to evade black-box adversarial attacks. Adam et al. achieved this goal by training two models simultaneously to maximize their gradient similarity in the benign image domain. They also theoretically verified the effectiveness of heterogeneous optimization using Taylor approximation expansion, further ensuring the effectiveness of the algorithm. Yang et al. emphasized the significant nonlinearity of CNN decision boundaries, which hinders heterogeneous optimization and limits the reduction of adversarial transferability. To address this problem, they proposed a model smoothing technique to further reduce the mutual transferability between the two models.
[0005] However, these two research works can only guarantee that the decision boundaries of the two models are mutually orthogonal in the benign example domain. In the adversarial subspace, the decision boundaries of the two models may be parallel or intersecting, thereby weakening the ability of the resulting heterogeneous model to resist black-box adversarial examples. Theoretically, the Taylor approximation method adopted by Adam ignores the fact that the adversarial perturbation is not an approximate small value. Therefore, directly applying the first-order approximation will result in a large approximation error. Therefore, adversarial examples generated using the source model can still successfully attack the unknown target model. In addition, heterogeneous optimization is achieved by maximizing the similarity between the source model and the target model, during which the parameters of the two models are updated simultaneously. This changes the standard training trajectory of the source model, making the decision boundary of the resulting source model different from the decision boundary of the source model exploited by the adversarial attacker. Therefore, the target model is not truly heterogeneous with the actual source model, which greatly affects the defense performance.
[0006] The idea that is most closely related to this method is to perform orthogonal optimization of the interface in all noise sample domains during the entire process of generating adversarial samples. This ensures that the decision boundaries of the two models are orthogonal in the entire adversarial space, further defending against black-box adversarial attacks. At the same time, during the orthogonal optimization process, the parameters of the source model are kept unchanged, and only the parameters of the target model are updated. This ensures that the source model trained at the same time as the target model is as consistent as possible with the standard training source model used by the attacker, thereby ensuring that the target model and the actual source model are truly heterogeneous, and black-box adversarial defense is achieved. However, this method consumes a lot of computational and time costs, which is not conducive to expanding to the defense training of big data models. In order to make black-box defense of big data models possible, it is necessary to study efficient new algorithms. Summary of the invention
[0007] The purpose of the present invention is to address the deficiencies of the prior art and provide a model training method, device and medium for reducing adversarial migration, thereby reducing computing costs and making it possible to use this method on big data.
[0008] The object of the present invention is to achieve the following technical solution: a model training method for reducing adversarial migration, comprising the following steps:
[0009] (1) Obtain a training set, including several pictures and corresponding labels, and initialize the number of forgetting times for each picture to 0;
[0010] (2) Add adversarial perturbations to each sample in the training set to generate an adversarial sample set;
[0011] (3) For each sample in the training set, the cross entropy loss value of the proxy model and the first target model is calculated respectively, and the parameters of the proxy model and the first target model are updated using the gradient descent algorithm;
[0012] (4) For each adversarial example in the adversarial example set, calculate the cosine similarity between the updated proxy model and the first target model, and use the gradient descent algorithm to update the parameters of the first target model;
[0013] (5) Repeat steps (3) to (4) several times. In each training cycle, record whether the samples that were once correctly classified are misclassified. If so, the number of forgetting times is increased by one. Otherwise, the number of forgetting times remains unchanged.
[0014] (6) Delete the samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
[0015] Furthermore, the step (2) includes the following sub-steps:
[0016] (2.1) Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0017] (2.2) Using the source model f in step (2.1) s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0018] (2.3) Using the proxy model f in step (2.2) and the parameters θ of the first target model g in step (1.1) f and θ g , calculate the cosine similarity L of the two models co s;
[0019] (2.4) Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0020] (2.5) Repeat step (2.4) T times to obtain the final adversarial sample x T .
[0021] Furthermore, the step (2) includes the following sub-steps:
[0022] (2.1) Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0023] (2.2) Using the source model f in step (2.1) s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0024] (2.3) Using the proxy model f in step (2.2) and the parameters θ of the first target model g in step (1.1) f and θ g , calculate the cosine similarity L of the two models co s;
[0025] (2.4) Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0026] (2.5) Calculate the proxy model in sample x respectively t-1 and sample x t The cosine similarity loss values are recorded as L t-1 and L t ;
[0027] (2.6) Based on L t-1 and L t The ratio of determines whether to stop iteration;
[0028] (2.7) If the iteration is stopped, the sample of the current iteration is an adversarial sample.
[0029] Furthermore, the step (6) includes the following sub-steps:
[0030] (6.1) For each of the remaining samples, calculate the cross entropy loss value of the proxy model and the second target model respectively, and use the gradient descent algorithm to update the parameters of the proxy model and the second target model;
[0031] (6.2) For each adversarial sample corresponding to the remaining samples, calculate the cosine similarity between the updated proxy model and the second target model, and use the gradient descent algorithm to update the parameters of the second target model;
[0032] (6.3) Repeat steps (6.1) to (6.2) several times to obtain a trained second target model.
[0033] The present invention also provides a model training device for reducing adversarial migration, comprising:
[0034] The data acquisition module is used to obtain the training set, including several pictures and corresponding labels. The number of forgetting times for each picture is initialized to 0;
[0035] The adversarial sample generation module is used to add adversarial perturbations to each sample in the training set to generate an adversarial sample set;
[0036] The first model training module is used to calculate the cross entropy loss value of the proxy model and the first target model for each sample in the training set, and update the parameters of the proxy model and the first target model using the gradient descent algorithm; for each adversarial sample in the adversarial sample set, calculate the cosine similarity between the updated proxy model and the first target model, and update the parameters of the first target model using the gradient descent algorithm; repeat this process, and in each training cycle, record whether the sample that was once correctly classified is misclassified. If so, the number of forgetting times is increased by one, otherwise the number of forgetting times remains unchanged;
[0037] The second model training module is used to delete samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
[0038] Furthermore, the adversarial sample generation module includes:
[0039] Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0040] Using the source model f s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0041] Using the parameters θ of the proxy model f and the first target model g f and θ g , calculate the cosine similarity L of the two models cos ;
[0042] Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0043] Let t = t + 1, until t = T, stop iteration, and get the final adversarial sample x T .
[0044] Furthermore, the adversarial sample generation module includes:
[0045] Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0046] Using the source model f s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0047] Using the parameters θ of the proxy model f and the first target model g f and θ g , calculate the cosine similarity L of the two models cos ;
[0048] Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0049]
[0050] Calculate the proxy model in sample x respectively t-1 and sample x t The cosine similarity loss values are recorded as L t-1 and L t ;
[0051] Based on L t-1 and L t The ratio of determines whether to stop iteration;
[0052] If the iteration is stopped, the sample of the current iteration is an adversarial sample.
[0053] Furthermore, the second model training module includes:
[0054] For each of the remaining samples, the cross entropy loss value of the proxy model and the second target model is calculated respectively, and the parameters of the proxy model and the second target model are updated using the gradient descent algorithm;
[0055] For the adversarial sample corresponding to each sample in the remaining samples, calculate the cosine similarity between the updated proxy model and the second target model, and use the gradient descent algorithm to update the parameters of the second target model;
[0056] Repeat this process to obtain the trained second target model.
[0057] The present invention also provides a model training device for reducing adversarial migration, comprising one or more processors for implementing the above-mentioned model training method for reducing adversarial migration.
[0058] The present invention also provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, is used to implement the above-mentioned model training method for reducing adversarial migration.
[0059] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0060] 1. The method of the present invention can significantly reduce the model training time.
[0061] 2. The embodiment of the present invention also proposes a method of reducing the number of iterations of each adversarial sample generation process by early termination, thereby achieving a constant multiple reduction in computational efficiency. In addition to considering the loss function gradient of the deep network model during the adversarial sample generation process, the early termination algorithm also takes the loss function value into consideration. If the increase in the loss function value brought by the adversarial sample in the new iteration cycle is not large, it is considered that the attack intensity brought to the adversarial sample by continuing the iteration is not large, so it is terminated early. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0063] Figure 1 A flow chart of a model training method for reducing adversarial migration provided by an embodiment of the present invention;
[0064] Figure 2 A flow chart of an algorithm for early termination provided by an embodiment of the present invention;
[0065] Figure 3 A schematic diagram of a model training device module for reducing adversarial migration provided by an embodiment of the present invention;
[0066] Figure 4 A schematic diagram of a hardware structure provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0067] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.
[0068] A model training method for reducing adversarial migration of the present invention, such as Figure 1 As shown, the following steps are included:
[0069] (1) Obtain a training set, including several pictures and corresponding labels, and initialize the number of forgetting times for each picture to 0;
[0070] (2) Add adversarial perturbations to each sample in the training set to generate an adversarial sample set;
[0071] In one embodiment, the number of iterations is fixed to generate adversarial samples, specifically including the following steps:
[0072] a. Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0073] b. Using the source model f in step (a) s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0074] c. Using the proxy model f in step (b) and the parameters θ of the first target model g in step (a) f and θ g , calculate the cosine similarity L of the two models co s;
[0075] d. Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0076] e. Repeat step (d) T times to obtain the final adversarial sample x T .
[0077] In another embodiment, an early termination algorithm is designed to generate adversarial examples, such as Figure 2 As shown, the specific steps include:
[0078] I. Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized;
[0079] II. Using the source model f in step I s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture;
[0080] III. Using the proxy model f in step II and the parameters θ of the first target model g in step I f and θ g , calculate the cosine similarity L of the two models co s;
[0081] IV. Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle
[0082] V. Calculate the proxy model in sample x respectively t-1 and sample x t The cosine similarity loss values are recorded as L t-1 and L t ;
[0083] VI. Based on L t-1 and L t The ratio of determines whether to stop the iteration; specifically, if L t-1 and L t If the ratio is greater than or equal to the preset threshold ρ, the iteration is stopped;
[0084] VII. If the iteration is stopped, the sample of the current iteration is an adversarial sample.
[0085] (3) For each sample in the training set, the cross entropy loss values of the proxy model and the first target model are calculated respectively, and the parameters of the proxy model and the target model are updated using the gradient descent algorithm;
[0086] (4) For each adversarial example in the adversarial example set, calculate the cosine similarity between the updated proxy model and the first target model, and use the gradient descent algorithm to update the parameters of the first target model;
[0087] (5) Repeat steps (3) to (4) several times. In each training cycle, record whether the samples that were once correctly classified are misclassified. If so, the number of forgetting times is increased by one. Otherwise, the number of forgetting times remains unchanged.
[0088] (6) Delete the samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
[0089] In one embodiment, the step (6) includes the following sub-steps:
[0090] (6.1) For each of the remaining samples, calculate the cross entropy loss value of the proxy model and the second target model respectively, and use the gradient descent algorithm to update the parameters of the proxy model and the second target model;
[0091] (6.2) For each adversarial sample corresponding to the remaining samples, calculate the cosine similarity between the updated proxy model and the second target model, and use the gradient descent algorithm to update the parameters of the second target model;
[0092] (6.3) Repeat steps (6.1) to (6.2) several times to obtain a trained second target model.
[0093] In one embodiment, on the CIFAR10 dataset, the source model is a fully trained VGG19, the proxy model is a randomly initialized VGG19, and the target model to be sought is a randomly initialized GoogLeNet. The above method is used to perform training to reduce adversarial transferability, and a fully trained GoogLeNet network is obtained. Using the source model VGG19, adversarial samples are generated through PGD, MI2-FGSM, TI2-FGSM and C&W attack methods to attack the fully trained GoogLeNet network. The attack success rate is 0.2% lower than the original algorithm, but the model training time is reduced by 47%. It can be seen that while achieving efficient computing, this method also ensures that the defense capability remains almost unchanged, or even slightly improved.
[0094] The present invention also provides a model training device for reducing adversarial migration, such as Figure 3 As shown, including:
[0095] The data acquisition module is used to obtain the training set, including several pictures and corresponding labels. The number of forgetting times for each picture is initialized to 0;
[0096] The adversarial sample generation module is used to add adversarial perturbations to each sample in the training set to generate an adversarial sample set;
[0097] The first model training module is used to calculate the cross entropy loss value of the proxy model and the first target model for each sample in the training set, and update the parameters of the proxy model and the target model using the gradient descent algorithm; for each adversarial sample in the adversarial sample set, calculate the cosine similarity between the updated proxy model and the first target model, and update the parameters of the first target model using the gradient descent algorithm; repeat this process, and in each training cycle, record whether the sample that was once correctly classified is misclassified. If so, the number of forgetting times is increased by one, otherwise the number of forgetting times remains unchanged;
[0098] The second model training module is used to delete samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
[0099] It should be noted that the device embodiment shown in this embodiment matches the content of the above method embodiment, and the content of the above method embodiment can be referred to, which will not be repeated here. Corresponding to the embodiment of the above invention name method, the present invention also provides an embodiment of the invention name device.
[0100] See also Figure 4 A model training device for reducing adversarial migration provided by an embodiment of the present invention includes one or more processors for implementing a model training method for reducing adversarial migration in the above embodiment.
[0101] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0102] An embodiment of a model training device for reducing adversarial migration of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From the hardware level, such as Figure 4 As shown, it is a hardware structure diagram of any device with data processing capability where a model training device for reducing adversarial migration of the present invention is located, except Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.
[0103] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0104] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0105] An embodiment of the present invention also provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, a model training method for reducing adversarial migration in the above embodiment is implemented.
[0106] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of any device with data processing capability and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0107] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.
Claims
1. A model training method for reducing adversarial transferability, It is characterized in that The following steps are involved: (1) Obtain a training set, including several pictures and corresponding labels, and initialize the number of forgetting times for each picture to 0; (2) Add adversarial perturbations to each sample in the training set to generate an adversarial sample set; (3) For each sample in the training set, the cross entropy loss value of the proxy model and the first target model is calculated respectively, and the parameters of the proxy model and the first target model are updated using the gradient descent algorithm; (4) For each adversarial example in the adversarial example set, calculate the cosine similarity between the updated proxy model and the first target model, and use the gradient descent algorithm to update the parameters of the first target model; (5) Repeat steps (3) to (4) several times. In each training cycle, record whether a sample that was once correctly classified is misclassified. If so, the number of forgetting times is increased by one. Otherwise, the number of forgetting times remains unchanged. (6) Delete the samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
2. The method according to claim 1, It is characterized in that The step (2) comprises the following sub-steps: (2.1) Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized; (2.2) Using the source model f in step (2.1) s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture; (2.3) Using the proxy model f in step (2.2) and the parameters θ of the first target model g in step (1.1) f and θ g , calculate the cosine similarity L of the two models cos ; ( 2.4) Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle (2.5) Repeat step (2.4) T times to obtain the final adversarial sample x T .
3. The method according to claim 1, It is characterized in that The step (2) comprises the following sub-steps: (2.1) Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized; (2.2) Using the source model f in step (2.1) s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture; (2.3) Using the proxy model f in step (2.2) and the parameters θ of the first target model g in step (1.1) f and θ g , calculate the cosine similarity L of the two models cos ; ( 2.4) Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle (2.5) Calculate the proxy model in sample x respectively t-1 and sample x t The cosine similarity loss values are recorded as L t-1 and L t ; (2.6) Based on L t-1 and L t The ratio of determines whether to stop iteration; (2.7) If the iteration is stopped, the sample of the current iteration is an adversarial sample.
4. The method according to claim 1, It is characterized in that The step (6) comprises the following sub-steps: (6.1) For each of the remaining samples, calculate the cross entropy loss value of the proxy model and the second target model respectively, and use the gradient descent algorithm to update the parameters of the proxy model and the second target model; (6.2) For each adversarial sample corresponding to the remaining samples, calculate the cosine similarity between the updated proxy model and the second target model, and use the gradient descent algorithm to update the parameters of the second target model; (6.3) Repeat steps (6.1) to (6.2) several times to obtain a trained second target model.
5. A model training device for reducing adversarial transferability, It is characterized in that include: The data acquisition module is used to obtain the training set, including several pictures and corresponding labels. The number of forgetting times for each picture is initialized to 0; The adversarial sample generation module is used to add adversarial perturbations to each sample in the training set to generate an adversarial sample set; The first model training module is used to calculate the cross entropy loss value of the proxy model and the first target model for each sample in the training set, and update the parameters of the proxy model and the first target model using a gradient descent algorithm; For each adversarial sample in the adversarial sample set, calculate the cosine similarity between the updated proxy model and the first target model, and use the gradient descent algorithm to update the parameters of the first target model; Repeat this process. In each training cycle, record whether the samples that were once correctly classified are misclassified. If so, the number of forgetting times is increased by one, otherwise the number of forgetting times remains unchanged. The second model training module is used to delete samples with zero forgetting times, and the remaining samples and their corresponding adversarial samples are used to train the second target model.
6. The device according to claim 5, It is characterized in that The adversarial sample generation module includes: Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized; Using the source model f s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture; Using the parameters θ of the proxy model f and the first target model g f and θ g , calculate the cosine similarity L of the two models cos ; Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle Let t = t + 1, until t = T, stop iteration, and get the final adversarial sample x T .
7. The device according to claim 5, It is characterized in that The adversarial sample generation module includes: Given the amplitude constraint range ε of the adversarial perturbation, the number of iterations T to generate adversarial samples, and the given source model f s , the architecture of the first target model g that is randomly initialized; Using the source model f s The architecture information of the model is used to randomly initialize a proxy model f with the same architecture; Using the parameters θ of the proxy model f and the first target model g f and θ g , calculate the cosine similarity L of the two models cos ; Calculate the cosine similarity L cos The gradient of the dataset sample x Adversarial examples in the current iteration cycle Calculate the proxy model in sample x respectively t-1 and sample x t The cosine similarity loss values are recorded as L t-1 and L t ; Based on L t-1 and L t The ratio of determines whether to stop iteration; If the iteration is stopped, the sample of the current iteration is an adversarial sample.
8. The device according to claim 5, It is characterized in that The second model training module includes: For each of the remaining samples, the cross entropy loss value of the proxy model and the second target model is calculated respectively, and the parameters of the proxy model and the second target model are updated using the gradient descent algorithm; For the adversarial sample corresponding to each sample in the remaining samples, calculate the cosine similarity between the updated proxy model and the second target model, and use the gradient descent algorithm to update the parameters of the second target model; Repeat this process to obtain the trained second target model.
9. A model training device for reducing adversarial transferability, It is characterized in that It includes one or more processors for implementing a model training method for reducing adversarial migration as described in any one of claims 1-4.
10. A computer-readable storage medium having a program stored thereon, It is characterized in that When the program is executed by a processor, it is used to implement a model training method for reducing adversarial migration as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Text general confrontation defense method and system based on confrontation training
CN115146055A
Vision-language pre-training model-oriented multi-modal migration countermeasure attack method
CN117094000A
Model training method and device for reducing adversarial sample mobility
CN117634584A
Visual pre-training model-based migration adversarial attack method and analysis device
CN117809130A
