Training devices, training methods, and recording media

By training the model using a loss function that maximizes KL divergence by adding noise to the model parameters, the problem of low generalization performance in adversarial training is solved, achieving robustness against adversarial examples and high-precision prediction of noise-free data.

CN117546183BActive Publication Date: 2026-11-10NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180099182.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-17
Publication Date
2026-11-10
Estimated Expiration
2041-06-17

AI Technical Summary

Technical Problem

Existing technologies employ adversarial training to train models that suffer from low generalization performance and reduced prediction performance on noise-free data.

Method used

The model is trained to flatten the loss surface by using a loss function that maximizes the KL divergence of the loss value with and without noise added to the model parameters.

Benefits of technology

Train a model that ensures robustness against adversarial examples and can make high-accuracy predictions even on noise-free data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117546183B_ABST
    Figure CN117546183B_ABST
Patent Text Reader

Abstract

The training device (10) acquires training data for a model to predict labels on input data containing adversarial examples. Furthermore, the training device (10) trains the model using a loss function and the training data containing adversarial examples, wherein the loss function is a loss function that, with and without noise added to the model's parameters, maximizes the KL divergence of the loss value in the model by adding noise, and flattens the loss surface for the parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a training apparatus, a training method, and a recording medium for a model. Background Technology

[0002] Previously, there have been attacks that use adversarial examples to add noise to the data being classified, causing the classifier to make incorrect judgments. Countermeasures against these adversarial examples include adversarial training, which uses adversarial examples to train the model (classifier).

[0003] However, models trained through adversarial training suffer from low generalization performance. This is because the loss landscape (shape of the loss function) of the weights in a model trained through adversarial training is sharp. Therefore, to flatten the loss landscape, there are techniques that add noise (perturbation) to the weights in the direction that maximizes the model's loss.

[0004] Existing technical documents

[0005] Non-patent literature

[0006] Non-patent literature 1: Diederik P. Kingma, Max Welling, “Auto-Encoding Variational Bayes”, [Searched June 4, 2021], URL<URL:https: / / arxiv.org / pdf / 1312.6114.pdf>

[0007] Non-patent literature 2: Dongxian Wu, Shu-Tao Xia, Yisen Wang, “Adversarial Weight Perturbation Helps Robust Generalization”, [Searched June 4, 2021], URL<URL:https: / / arxiv.org / pdf / 2004.05884> Summary of the Invention

[0008] The problem that the invention aims to solve

[0009] However, the aforementioned techniques suffer from reduced predictive performance on noise-free data. Therefore, the objective of this invention is to solve the above-mentioned problems and train a model that can ensure robustness against adversarial examples and make high-accuracy predictions even on noise-free data.

[0010] To address the aforementioned issues, the present invention is characterized by comprising: a data acquisition unit that acquires training data for a model used to predict labels on input data containing adversarial examples; and a training unit that trains the model using a loss function and the training data containing the adversarial examples, wherein the loss function is a loss function that, with and without noise added to the parameters of the model, adds noise to the parameters such that the KL divergence of the loss value in the model is maximized, and flattens the loss surface for the parameters.

[0011] The effects of the invention

[0012] According to the present invention, a model can be trained that ensures robustness against adversarial examples and makes high-precision predictions even for noise-free data. Attached Figure Description

[0013] Figure 1 This is a diagram showing an example of the structure of a training device.

[0014] Figure 2 This is a diagram illustrating the reasoning behind the equation that, in order to find the MAX v in equation (10), we need to find the eigenvector h corresponding to the largest eigenvalue λ of the Fisher information matrix G.

[0015] Figure 3 This is a flowchart illustrating an example of the processing steps of a training device.

[0016] Figure 4 This is a flowchart illustrating an example of the processing steps of a training device.

[0017] Figure 5 This is a diagram used to illustrate an application example of the training device.

[0018] Figure 6 This is a graph showing the experimental results for a model trained by the training device.

[0019] Figure 7 This is a diagram illustrating an example of the structure of a computer that executes a training program. Detailed Implementation

[0020] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, the present invention is not limited to the embodiments described below.

[0021] [Overview of the training device]

[0022] The training apparatus of this embodiment uses data containing adversarial examples (data with added noise) to train a model that predicts the labels of the input data. Here, the training apparatus uses a loss function as the loss function used in the training of the model, which is a loss function that, with and without noise added to the model parameters, maximizes the KL divergence of the loss values ​​in the model by adding noise to the parameters and flattens the loss surface for the parameters.

[0023] Thus, the training device can train a model that ensures robustness against adversarial examples and can predict labels with high accuracy even for noise-free data.

[0024] [Example of a training device structure]

[0025] use Figure 1 The structure of the training device 10 will be described as an example. The training device 10 includes, for example, an input unit 11, an output unit 12, a communication control unit 13, a storage unit 14, and a control unit 15.

[0026] Input unit 11 is an interface for accepting various types of data input. For example, input unit 11 accepts data input used in the training and prediction processes described later. Output unit 12 is an interface for outputting various types of data. For example, output unit 12 outputs the labels of the data predicted by control unit 15.

[0027] The communication control unit 13, implemented by a NIC (Network Interface Card) or similar device, controls the communication between the control unit 15 and external devices such as servers connected via the network. For example, the communication control unit 13 controls the communication between the control unit 15 and management devices such as those managing data used as training subjects.

[0028] The storage unit 14 is implemented by semiconductor storage elements such as RAM (Random Access Memory) and flash memory, or storage devices such as hard disks and optical disks, and stores parameters of the model trained through the training process described later.

[0029] The control unit 15 is implemented, for example, by a CPU (Central Processing Unit), and executes the processing program stored in the storage unit 14. Thus, as... Figure 1 As illustrated, the control unit 15 functions as the acquisition unit 15a, the training unit 15b, and the prediction unit 15c.

[0030] The acquisition unit 15a acquires the data used in the training and prediction processes described later via the input unit 11 or the communication control unit 13.

[0031] Training unit 15b uses data containing adversarial examples as training data to train a model that predicts the labels of the input data. Here, training unit 15b uses a loss function as the loss function used in training the model, which is a loss function that, with and without noise added to the model parameters, maximizes the KL divergence of the loss values ​​in the model when noise is added, and flattens the loss surface for the parameters.

[0032] Here, the basic idea of ​​the training method for the model in training unit 15b will be explained. For example, the model used as the training object is a model representing the probability distribution of the label y of the data x, expressed by the parameter θ, through equation (1). In addition, f in equation (1) is a vector representing the label output by the model.

[0033] [Mathematical Expression 1]

[0034]

[0035] Then, the training unit 15b determines the model parameters θ in a way that minimizes the value of the loss function represented by equation (2), thereby training the model. Here, p(y|x) represents the true probability.

[0036] [Mathematical Expression 2]

[0037] l(x,y;0)p-(y[x)log-Pθ(y|x)·(2)

[0038] Here, the training unit 15b trains the model so that it can correctly predict the label even for adversarial examples (refer to Equation (3)) in which noise η has been added to the data x. That is, the training unit 15b performs adversarial training as shown in Equation (4).

[0039] [Mathematical Expression 3]

[0040]

[0041] [Mathematical Expression 4]

[0042]

[0043] In the past, in the adversarial training (AT) of the aforementioned model, in order to improve the generalization performance of the model, there was a method to flatten the loss surface for the weights by adding noise (perturbation) to the weights (model parameters). The loss function in this method (Adversarial Weight Perturbation (AWP)) is represented by equations (5) and (6). Furthermore, w (weight) is the parameter of the model used for training, equivalent to θ mentioned above. α is a coefficient that adjusts the magnitude of the noise (v), and α is set to a value that matches the scale calculated in the Frobenius norm of w. That is, the parameter has scale invariance, so α plays the role of absorbing the change in scale.

[0044] [Mathematical Expression 5]

[0045]

[0046] [Mathematical Expression 6]

[0047]

[0048] a: Adjust the noise level coefficient

[0049] w: Model parameters

[0050] 2: Noise in the model parameters

[0051] ⊙:Hadamardi

[0052] Here, since we want to flatten the weight loss landscape visualized through filter normalization, α is defined as shown in Equation (7) below to obtain noise (perturbation) that matches the scale of w for each filter. In addition, k is the filter index.

[0053] [Mathematical Expression 7]

[0054]

[0055] Therefore, the update formula used to make v the largest is expressed as in equation (8).

[0056] [Mathematical Expression 8]

[0057]

[0058] Furthermore, in previous studies, it has been confirmed that updating v once is sufficient to maximize the above. Additionally, the update formula for w is expressed as shown in equation (9) below.

[0059] [Mathematical Expression 9]

[0060]

[0061] Here, in the AWP described above, noise is added to w in a way that maximizes the loss value, but the training unit 15b adds noise to w in a way that maximizes the KL divergence of the loss value. The loss function is represented by equation (10) below. In addition, ρ(w) in equation (10) is equivalent to ρ(w) shown in equation (5).

[0062] [Mathematical Expression 10]

[0063]

[0064]

[0065] vKL: Noise generated to maximize KL divergence.

[0066] To find the MAX v in equation (10), we need to find the eigenvector h corresponding to the largest eigenvalue λ of the Fisher information matrix G. Figure 2 The formula that serves as the reason is shown.

[0067] Therefore, the update formula for making v the largest is shown in equation (11).

[0068] [Mathematical Expression 11]

[0069]

[0070] Furthermore, since the Fischer information matrix is ​​enormous, eigenvalue decomposition for negative numbers would be too time-consuming. Therefore, power iteration is used, for example, to compute the largest eigenvalue. Additionally, when computing the Fischer information matrix, the following mathematical expression (12) needs to be calculated.

[0071] [Mathematical Expression 12]

[0072]

[0073] This is because the output dimension is larger than the input dimension, making back propagation, commonly used in deep learning, computationally inefficient. Therefore, it is desirable to compute gradients via forward propagation, but existing deep learning libraries like PyTorch do not provide a built-in forward propagation mode. Therefore, the ROP trick described in Reference 1 below is used to implement forward propagation.

[0074] (Document 1)[Adding functionality]Hessian and Fisher Information vectorproducts, https: / / discuss.pytorch.org / t / adding-functionality-hessian-and-fisher-information-vector-products / 23295 / 2

[0075] The training unit 15b uses training data containing adversarial examples and the aforementioned loss function to train a model that predicts the labels of the input data. That is, the training unit 15b uses the training data to find the parameters θ of the model that minimize the loss calculated by the aforementioned loss function.

[0076] The prediction unit 15c uses the trained model to predict the labels of the input data. For example, the prediction unit 15c calculates the probability of each label of the newly acquired data by applying the trained parameters θ to the above equation (1), and outputs the label with the highest probability. Thus, for example, when the input data is an adversarial example, the training device 10 can also output the correct label.

[0077] [Training Processing]

[0078] Next, refer to Figure 3 An example of the training processing steps of the training device 10 will be explained. Figure 3 The process shown begins, for example, when there is an operational input indicating the start of the training process.

[0079] First, the acquisition unit 15a acquires training data containing adversarial examples (S1). Next, the training unit 15b trains a model representing the probability distribution of labels on the input data using the training data and a loss function (S2). Furthermore, as described above, this loss function is one that, with and without noise added to the model's parameters, maximizes the KL divergence of the loss values ​​in the model by adding noise, and flattens the loss surface for the parameters. The training unit 15b stores the parameters of the model trained in S2 in the storage unit 14.

[0080] [Predictive Processing]

[0081] Next, refer to Figure 4 An example of label prediction processing of input data performed by training device 10 will be illustrated. Figure 4 The process shown begins, for example, when there is an operational input indicating the start of the predictive process.

[0082] First, the acquisition unit 15a acquires data that will be used as the prediction target for the label (S11). Next, the prediction unit 15c uses the model trained by the training unit 15b to predict the label of the data acquired in S11 (S12). For example, the prediction unit 15c calculates p(x') of the data x' acquired in S11 by applying the trained parameter θ to the above equation (1), and outputs the label with the highest probability. Thus, for example, even if the data x' is an adversarial example, the training device 10 can output the correct label.

[0083] [Examples of Training Device Applications]

[0084] The training device 10 described above can also be used for anomaly detection in data. (See reference...) Figure 5 An application example in this case will be explained. Here, the example is the case where the function of the prediction unit 15c described above is integrated into the detection device 20.

[0085] For example, training device 10 trains the model (adversarial training) using teacher data (training data) obtained from data acquisition device and the aforementioned loss function. Then, when detection device 20 obtains new data x' from data acquisition device, it uses the trained model to calculate p(x') of data x'. Finally, detection device 20 outputs a report on whether data x' is an anomalous data based on the label with the highest probability.

[0086] [Experimental Results]

[0087] Next, in Figure 6 The results of an evaluation experiment on the label prediction accuracy of the model trained by the training device 10 of this embodiment are shown. In this experiment, robust accuracy and natural accuracy were evaluated for the model trained by the training device 10 of this embodiment.

[0088] Robust accuracy represents the classification accuracy (the accuracy of predicting the data's labels) on data with adversarial examples. Natural accuracy, on the other hand, represents the classification accuracy on noise-free data. Both robust accuracy and natural accuracy are valued from 0 to 100. The models trained using AT and AWP are compared. The experimental conditions are as follows.

[0089] Image dataset: Cifar10

[0090] Deep learning model: ResNet18

[0091] Adversarial Examples: PGD

[0092] PGD ​​parameters: eps = 8 / 255, train_iter = 7, eval_iter = 20, eps_iter = 0.01, rand_init = True, clip_min = 0.0, clip_max = 1.0

[0093] like Figure 6 As shown, the model trained by training device 10 has higher robustness accuracy and naturalness accuracy compared to the model trained by AT. Furthermore, compared to the model trained by AWP, the model trained by training device 10 of this embodiment has slightly lower robustness accuracy, but significantly higher naturalness accuracy.

[0094] Therefore, it can be confirmed that the model trained by the training device 10 is a model that can ensure robustness against adversarial examples and make high-precision predictions even for noise-free data.

[0095] [System architecture, etc.]

[0096] Furthermore, the structural elements of each part shown in the diagram are functional conceptual elements and do not necessarily need to be physically configured as illustrated. That is, the specific way in which the devices are distributed / integrated is not limited to the way shown in the diagram, and can be configured in any unit, functionally or physically, in a distributed / integrated manner, depending on various loads, usage conditions, etc. In addition, all or any part of the processing functions performed by each device can be implemented by a CPU and the program executed by that CPU, or as hardware based on wiring logic.

[0097] Furthermore, all or part of the processes described in the above embodiments that are performed automatically can also be performed manually, or all or part of the processes described as performed manually can also be performed automatically by known methods. In addition, the processing steps, control steps, specific names, and information including various data and parameters shown in the above description and drawings can be arbitrarily changed, except where specifically stated.

[0098] [program]

[0099] The training device 10 described above can be implemented by installing the program as a packaged software or online software on a desired computer. For example, by having an information processing device execute the program described above, the information processing device can function as the training device 10. The information processing device mentioned here includes desktop or laptop personal computers. In addition, information processing devices also include smartphones, mobile phones, mobile communication terminals such as PHS (Personal Handyphone System), and terminals such as PDA (Personal Digital Assistant).

[0100] Alternatively, the training device 10 can also be implemented as a server device that uses a user's terminal device as a client and provides services related to the aforementioned processing to that client. In this case, the server device can be implemented as a web server or as a cloud service that provides the aforementioned processing-related services through outsourcing.

[0101] Figure 7 This diagram illustrates an example of a computer executing a training program. The computer 1000, for example, has a memory 1010 and a CPU 1020. Additionally, the computer 1000 has a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These components are connected via a bus 1080.

[0102] The memory 1010 includes ROM (Read Only Memory) 1011 and RAM (Random Access Memory) 1012. ROM 1011 stores, for example, boot programs such as BIOS (Basic Input Output System). Hard disk drive interface 1030 is connected to hard disk drive 1090. Disk drive interface 1040 is connected to disk drive 1100. Removable storage media, such as hard disks or optical discs, are inserted into disk drive 1100. Serial port interface 1050 is connected, for example, to mouse 1110 and keyboard 1120. Video adapter 1060 is connected, for example, to monitor 1130.

[0103] The hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, the program that defines each process executed by the training device 10 described above is implemented as a program module 1093 containing computer-executable code. The program module 1093 is stored, for example, in the hard disk drive 1090. For example, a program module 1093 for performing processes with the same functional structure as those in the training device 10 is stored in the hard disk drive 1090. Alternatively, the hard disk drive 1090 can be replaced by an SSD (Solid State Drive).

[0104] Furthermore, the data used in the processing of the above-described embodiment is stored as program data 1094 in, for example, memory 1010 or hard disk drive 1090. And, CPU 1020 reads program modules 1093 and program data 1094 stored in memory 1010 or hard disk drive 1090 into RAM 1012 and executes them as needed.

[0105] Furthermore, program module 1093 and program data 1094 are not limited to being stored in hard disk drive 1090; for example, they can also be stored in removable storage media and read by CPU 1020 via disk drive 1100, etc. Alternatively, program module 1093 and program data 1094 can also be stored in other computers connected via a network (LAN (Local Area Network), WAN (Wide Area Network), etc.). Moreover, program module 1093 and program data 1094 can be read by CPU 1020 from other computers via network interface 1070.

[0106] Label Explanation

[0107] 10 Training Devices

[0108] 11 Input Section

[0109] 12 Output Section

[0110] 13. Communications Control Department

[0111] 14 Storage Department

[0112] 15. Control Department

[0113] 15a Acquisition Department

[0114] 15b Training Department

[0115] 15c Forecasting Department

[0116] 20 Detection devices

Claims

1. A training device, characterized in that, have: The data acquisition unit acquires training image data for a model used to predict labels on input images containing adversarial examples; and The training unit trains the model using a loss function and training image data containing the adversarial examples. The loss function is defined as follows: noise is added to the parameters of the model such that the KL divergence of the loss values ​​in the model is maximized both with and without the added noise, and the loss surface with respect to the parameters is flattened. The loss function is expressed by the following formula: Where w are the parameters of the model, ρ(w) is the loss function of the model with respect to the parameters w, v is the noise added to the parameters w, and D KL It is the KL divergence, ⊙ represents the Hadamard product, and α is a coefficient defined for the model filter k. k = ||w k ||, where ||w|| is the norm of the weight w of filter k, and k is the index of the filter.

2. The training device according to claim 1, characterized in that, The training unit uses the training image data to determine the parameters of the model that minimize the loss calculated by the loss function.

3. The training device according to claim 1, characterized in that, The training device also includes a prediction unit that uses the trained model to predict the label of the input image.

4. A training method, performed by a training device, characterized in that, The training method includes the following steps: Obtain training image data for a model used to predict labels on input images containing adversarial examples; and The model is trained using a loss function and training image data containing the adversarial examples. The loss function is one that adds noise to the parameters of the model such that the KL divergence of the loss values ​​in the model is maximized both with and without the added noise, and the loss surface with respect to the parameters is flattened. The loss function is expressed by the following formula: Where w are the parameters of the model, ρ(w) is the loss function of the model with respect to the parameters w, v is the noise added to the parameters w, and D KL It is the KL divergence, ⊙ represents the Hadamard product, and α is a coefficient defined for the model filter k. k = ||w k ||, where ||w|| is the norm of the weight w of filter k, and k is the index of the filter.

5. A recording medium storing a training program for causing a computer to perform the following steps: Obtain training image data for a model used to predict labels on input images containing adversarial examples; and The model is trained using a loss function and training image data containing the adversarial examples. The loss function is one that adds noise to the parameters of the model such that the KL divergence of the loss values ​​in the model is maximized both with and without the added noise, and the loss surface with respect to the parameters is flattened. The loss function is expressed by the following formula: Where w are the parameters of the model, ρ(w) is the loss function of the model with respect to the parameters w, v is the noise added to the parameters w, and D KL It is the KL divergence, ⊙ represents the Hadamard product, and α is a coefficient defined for the model filter k. k = ||w k ||, where ||w|| is the norm of the weight w of filter k, and k is the index of the filter.

Citation Information

Patent Citations

  • Steel rail crack acoustic emission signal detection method based on improved least square generative adversarial network

    CN110879254A

  • Latent code for unsupervised domain adaptation

    US20210019629A1