Learning device, determination device, learning method and program
Patent Information
- Application Number
- JP2024524056
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-01-31
- Estimated Expiration
- 2042-05-31
AI Technical Summary
Existing machine learning models, particularly neural networks, face challenges in robustness against adversarial samples due to the large number of parameters required, which limits the number of networks that can be used in ensemble learning and affects storage capacity and processing speed.
The implementation of a learning device that uses shared and non-shared parameters across multiple neural networks, with mask initialization to differentiate between them, allows for efficient parameter updating and reduces the number of parameters needed, enabling more neural networks to be used in ensemble learning while improving robustness.
This approach reduces the storage requirements for parameter values, allows for a larger number of neural networks in ensemble learning, and enhances the robustness of the system against adversarial samples by optimizing parameter sharing and updating.
Abstract
Description
Learning device, determination device, learning method, and recording medium
[0001] The present invention relates to a learning device, a determination device, a learning method, and a recording medium.
[0002] A determination device using multiple machine learning models, such as a determination device using ensemble learning, may be configured. For example, Patent Literature 1 discloses that a neural network (NN) is used in ensemble learning for face recognition and the like. Non-Patent Literature 1 also discloses ensemble-based robust training (ERT). In robust training based on ensemble learning, ensemble learning is performed so that the resulting determination device is less likely to be fooled by adversarial examples (AX). A determination device that is less likely to be fooled by adversarial examples means that the determination device is less likely to make erroneous determinations when an adversarial example is input.
[0003] WO2017 / 126482 publication
[0004] Huanrui Yang, 8 others, “DVERGE: Diversifying Vulnerabilities for Enhanced Robust Generation of Ensemble”, NeurIPS2020, 2020.
[0005] It is preferable that a decision device that uses multiple machine learning models can store a relatively small number of parameter values.
[0006] An example of an object of the present invention is to provide a learning device, a determination device, a learning method, and a recording medium that can solve the above-mentioned problems.
[0007] According to a first aspect of the present invention, a learning device includes a mask initialization means for determining mask information indicating, for parameters of a machine learning model having a plurality of parameters, a distinction between shared parameters that are provided in common to a plurality of the machine learning models and non-shared parameters that are provided for each machine learning model; a loss function calculation means for calculating values of a loss function for training data based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and a parameter update means for updating the values of the shared parameters and the non-shared parameters using the values of the loss function.
[0008] According to a second aspect of the present invention, a learning method includes the steps of: determining mask information for a machine learning model having a plurality of parameters, the mask information indicating a distinction between shared parameters that are provided in common to a plurality of the machine learning models and non-shared parameters that are provided for each machine learning model; calculating values for training data of a loss function based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and updating values of the shared parameters and the non-shared parameters using the value of the loss function.
[0009] According to a third aspect of the present invention, a recording medium is a recording medium having recorded thereon a program for causing a computer to execute the following steps: determining mask information indicating, for parameters of a machine learning model having a plurality of parameters, a distinction between shared parameters that are provided in common to a plurality of the machine learning models and non-shared parameters that are provided for each machine learning model; calculating values for training data of loss functions based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and updating the values of the shared parameters and the non-shared parameters using the values of the loss function.
[0010] According to the above-described learning device, determination device, learning method, and recording medium, the number of parameter values that must be stored in a determination device that uses multiple machine learning models can be relatively reduced.
[0011] FIG. 1 is a diagram showing an example of a plurality of neural networks in which all parameters are configured as unshared parameters. FIG. 2 is a diagram showing an example of a plurality of neural networks including shared parameters. FIG. 3 is a schematic block diagram showing an example of the functional configuration of a learning device according to a first embodiment. FIG. 4 is a flowchart showing an example of a processing procedure of the learning device according to the first embodiment. FIG. 5 is a flowchart showing an example of a processing procedure of a loss function calculation of the learning device according to the first embodiment. FIG. 6 is a schematic block diagram showing an example of the functional configuration of a learning device according to a second embodiment and a third embodiment. FIG. 7 is a flowchart showing an example of a processing procedure of the learning device according to the second embodiment. FIG. 8 is a flowchart showing an example of a processing procedure of the learning device according to the third embodiment. FIG. 9 is a schematic block diagram showing an example of the functional configuration of a determination device according to a fourth embodiment. FIG. 10 is a schematic block diagram showing an example of the functional configuration of a learning device according to a fifth embodiment. FIG. 11 is a flowchart showing an example of a processing procedure of a learning method according to a sixth embodiment. FIG. 12 is a schematic block diagram showing the configuration of a computer according to at least one embodiment.
[0012] The following describes embodiments of the present invention, but the following embodiments do not limit the scope of the invention as claimed. Furthermore, not all of the combinations of features described in the embodiments are necessarily essential to the solution of the invention.
[0013] First, an example of a neural network including shared parameters in the embodiment will be compared with an example of a neural network in which all parameters are configured as non-shared parameters.
[0014] FIG. 1 shows an example of multiple neural networks in which all parameters are configured as non-shared parameters. NN1 and NN2 shown in FIG. 1 are neural networks with the same structure. Specifically, NN1 and NN2 are fully connected neural networks with layers 1, 2, and 3, respectively, and each layer has four nodes. Each node is configured using a neuron model (artificial neuron).
[0015] In both NN1 and NN2, all parameters are provided for each neural network. Figure 1 shows an example in which it is determined for each node whether parameters are provided for each neural network or shared by multiple neural networks, and parameters are provided for each neural network for all nodes.
[0016] A parameter provided for each neural network is also referred to as a non-shared parameter. A node for which a parameter is determined to be provided for each neural network is also referred to as a node with a non-shared parameter. In FIG. 1, a node with a non-shared parameter is indicated by a circle (○). On the other hand, a parameter provided as a shared parameter for multiple neural networks is also referred to as a shared parameter. A node for which a parameter is determined to be provided as a shared parameter for multiple neural networks is also referred to as a node with a shared parameter.
[0017] Parameters in a neural network are set according to the type of neural network. For example, in the case of a perceptron, examples of parameters include a weight coefficient set for each connection between nodes and a bias set for each node for calculating the node output. Also, in a generalized neural network in which the activation function is not limited to the step function in a perceptron, examples of parameters include a weight coefficient set for each connection between nodes and a bias set for each node for calculating the node output. Also, in a spiking neural network (SNN), examples of parameters include a weight coefficient set for each connection between nodes and a firing threshold set for each node.
[0018] In addition, when it is determined for each node whether a parameter is provided for each neural network or shared among multiple neural networks, a parameter provided for a connection between nodes can be treated as belonging to the node that receives the input of information transmitted through that connection. Specifically, a parameter provided for a connection in which a node based on a non-shared parameter is the input node may be a non-shared parameter. Also, a parameter provided for a connection in which a node based on a shared parameter is the input node may be a shared parameter.
[0019] Multiple neural networks such as NN1 and NN2 can be used, for example, in ensemble learning. In ensemble learning, a system including multiple machine learning models is trained. This system determines the system output based on the outputs of the multiple machine learning models, for example by taking a majority vote of the outputs of the multiple machine learning models. Hereinafter, a system that includes multiple machine learning models and determines the system output based on the outputs of the multiple machine learning models will be referred to as an ensemble system. Furthermore, the machine learning models included in the ensemble system will be referred to as "machine learning models in the ensemble." For example, a neural network included in the ensemble system will be referred to as a "neural network in the ensemble."
[0020] Figure 2 shows an example of multiple neural networks that include shared parameters. NN3 and NN4 shown in Figure 2 are neural networks with the same structure. Specifically, NN3 and NN4 are fully connected neural networks with layers 1, 2, and 3, respectively, and each layer has four nodes. Each node is configured using a neuron model.
[0021] In NN1 and NN2 in Fig. 1, all parameters are unshared parameters, whereas NN3 and NN4 in Fig. 2 include shared parameters. In Fig. 2, nodes with unshared parameters are indicated by a circle (○), and nodes with shared parameters are indicated by a double circle (◎).
[0022] Since NN3 and NN4 have the same structure, parameters at the same position in the neural network structure can be associated with each other, and parameters at the same position can be shared. In the example of Figure 2, nodes at the same position in the neural network structure of NN3 and NN4 are nodes with shared parameters. As a result, parameters at the same position in the neural network structure of NN3 and NN4 are shared parameters.
[0023] In this way, for multiple neural networks with the same structure, parameters at the same position in the neural network structure can be associated with each other, and parameters at the same position can be shared. Sharing parameters among multiple neural networks is also referred to as multiple neural networks sharing parameters.
[0024] By sharing only some of the parameters among multiple neural networks, the multiple neural networks can be configured as different neural networks while reducing the memory area required for configuring the multiple neural networks. Here, two neural networks are said to be the same if they have the same structure and all of the values of parameters at the same positions in the neural network structure are the same. On the other hand, if the structures of two neural networks are different, the two neural networks are said to be different. Even if two neural networks have the same structure, if the values of at least one set of parameters at the same positions in the neural network structure are different, the two neural networks are also said to be different.
[0025] Different neural networks may output different values for the same input data. By configuring multiple neural networks as different neural networks, it is possible to configure a system that determines the output of the system based on the outputs of these multiple neural networks. For example, a majority voting model that takes a majority vote of the outputs of these multiple neural networks may be configured as the system.
[0026] For example, when multiple neural networks that share only some of their parameters are used for robust training based on ensemble learning, the number of neural networks in the ensemble can be increased while reducing the memory area required to configure the multiple neural networks, compared to when using neural networks in which all parameters are provided for each neural network, and this is expected to improve robustness.
[0027] One of the critical issues regarding the safety of machine learning models is the problem of adversarial samples (EX). Adversarial samples are input data intentionally generated using small perturbations that can cause a machine learning model to make a wrong decision. A method is needed to make machine learning models such as neural networks robust against adversarial samples.
[0028] Ensemble learning-based robust training (ERT) is one method for making machine learning models more robust against adversarial samples. Ensemble learning is a learning method for improving predictive ability for unknown data by using a majority vote or other method with multiple neural networks that have been trained individually.
[0029] Robustness training based on ensemble learning is a learning method that aims to achieve robust predictions as a system using multiple neural networks by training the neural networks in the ensemble to be less likely to be fooled (to make incorrect judgments) by adversarial samples simultaneously. In robustness training based on ensemble learning, it is expected that robustness will improve by increasing the number of neural networks in the ensemble.
[0030] When neural networks in which all parameters are configured as unshared parameters are used for robust training based on ensemble learning, the number of parameters increases in proportion to the number of neural networks. In this case, a large number of neural networks requires a large memory capacity to store the parameter values, which may lead to processing delays. Furthermore, in this case, due to limitations on the memory capacity available for storing parameter values, it may be impossible to increase the number of neural networks sufficiently, and it may be impossible to ensure sufficient robustness.
[0031] In contrast, when a neural network in which only some parameters are configured as shared parameters is used for robust training based on ensemble learning, the number of parameters can be reduced by parameter sharing compared to when a neural network in which all parameters are configured as unshared parameters is used. This is expected to result in a relatively fast processing speed. In addition, in this case, the number of neural networks can be relatively large, which is expected to improve robustness.
[0032] In the above description, a neural network is used as the machine learning model, but the machine learning model is not limited to this. Various machine learning models can be used that can update parameters using a learning method such as backpropagation, have multiple parameters, and can share parameters in ensemble learning. Examples of such machine learning models include neural networks, support vector machines (SVMs), and random forests.
[0033] Although the following description will be given using a neural network as the machine learning model, the machine learning model is not limited to this. Various machine learning models can be used as long as they can update parameters using a learning method such as backpropagation and have multiple parameters that can be shared in ensemble learning.
[0034] Furthermore, in the above description, an example of ensemble learning using multiple machine learning models has been described. However, a system using multiple machine learning models is not limited to determining the system output by taking a majority vote of the outputs of the multiple machine learning models, as in ensemble learning. For example, a system using multiple machine learning models may weight the outputs of the multiple machine learning models and then take a majority vote to determine the system output. Furthermore, in addition to or instead of determining the system output using the outputs of the multiple machine learning models, a system using multiple machine learning models may calculate an index value related to the outputs of the multiple machine learning models, such as the variance or reliability of the outputs of the multiple machine learning models. Furthermore, although an example of using backpropagation as a machine learning technique has been described, applicable machine learning techniques are not limited to this.
[0035] Hereinafter, a system using multiple machine learning models is not limited to one that determines the system output by taking a majority vote of the outputs of the multiple machine learning models. For example, a system using multiple machine learning models may weight the outputs of the multiple machine learning models and then take a majority vote to determine the system output. Furthermore, a system using multiple machine learning models may calculate index values related to the outputs of the multiple machine learning models, such as the variance or reliability of the outputs of the multiple machine learning models, in addition to or instead of determining the system output using the outputs of the multiple machine learning models. Hereinafter, applicable machine learning techniques are not limited to backpropagation.
[0036] As in the above explanation, in the following description, it is assumed that each neural network in the ensemble has the same structure, and the position of the shared parameters of each neural network is also the same in the structure of the neural network.
[0037] First Embodiment In the ensemble learning-based robust training (ERT) of the first embodiment, the positions of shared parameters of neural networks (NNs) in the ensemble are randomly determined, and the neural network parameters are learned by solving the optimization problem of equation (7) described below. First, if the number of neural networks in the ensemble is K, the shared vector and the unshared vector, which are vectors having neural network parameters as elements, can be expressed as in equation (1).
[0038]
[0039] θ is a vector indicating the parameters of one neural network in the ensemble. As mentioned above, the neural networks in the ensemble have the same structure and therefore the same number of parameters. |θ| represents the number of parameters for one neural network in the ensemble.
[0040] R |θ| represents a set of vectors of dimension |θ| (size |θ|) with elements of real numbers. The parameter vector of the neural network is |θ| is an element of θ s is a shared parameter vector that holds parameters shared between neural networks. s stands for shared. θ j ns (1≦j≦K) is a non-shared parameter vector that holds the parameters of the jth neural network that are not shared between neural networks. ns stands for non-shared. Hereinafter, the jth neural network in the ensemble will also be referred to simply as the jth neural network. In this case, 1≦j≦K.
[0041] As shown in equation (1), both the shared parameter vector and the non-shared parameter vector can be vectors whose elements are real numbers equal to the number of parameters for one neural network in the ensemble. During operation using the learning results, only some elements indicated by the mask are accessed (written and read) for both the shared parameter vector and the non-shared parameter vector. Elements that are not accessed do not need to be allocated storage capacity, such as memory. Therefore, in a determination device configured using a trained neural network and used during operation, parameter sharing can reduce the storage capacity required to store parameter values.
[0042] A shared mask vector M for representing the shared position of the shared parameter vector can be expressed as in equation (2).
[0043]
[0044] The shared mask vector M is a |θ|-dimensional binary vector, and the value of each element is 0 or 1. An element value of 1 represents a shared position. The shared position is the position of an element in the shared parameter vector that corresponds to a shared parameter. There is a one-to-one correspondence between the elements of the shared parameter vector and the parameters of one neural network in the ensemble. Therefore, it can be said that the shared mask vector M indicates the position of the shared parameter in the structure of the neural network. The shared mask vector M is an example of mask information.
[0045] The unshared mask vector ^M for representing the unshared positions of the unshared parameter vector can be expressed as in equation (3).
[0046]
[0047] The non-shared mask vector ^M is also a |θ|-dimensional binary vector, and the value of each element is 0 or 1. An element value of 1 represents a non-shared position. The non-shared position is the position of an element in the non-shared parameter vector that corresponds to a non-shared parameter. There is a one-to-one correspondence between the elements of the non-shared parameter vector and the parameters of one neural network in the ensemble. Therefore, it can be said that the non-shared mask vector ^M indicates the position of the non-shared parameter in the structure of the neural network. The non-shared mask vector ^M is the shared mask vector M with the 0s and 1s inverted.
[0048] Extraction of the shared parameters from the shared parameter vector can be expressed as in equation (4).
[0049]
[0050] In the formula, the open circle (○) represents the Hadamard product, which calculates the element-wise product of vectors. That is, if z = x○y, then z i = x i xy i (1≦i≦|θ|). The vector "θ" obtained as a result of the calculation of equation (4) s In "M", elements in shared positions indicate the value of the shared parameter, and the value of elements in non-shared positions is 0.
[0051] Extraction of the unshared vector from the unshared parameter vector of the j-th neural network can be expressed as in equation (5).
[0052]
[0053] As mentioned above, ○ represents the Hadamard product. The vector "θ s In "M", elements at non-shared positions indicate the values of non-shared parameters, and the values of elements at shared positions are 0.
[0054] Parameter vector θ of the jth neural network j can be expressed as in equation (6).
[0055]
[0056] Parameter vector θ j is a vector indicating the parameter values of the j-th neural network. j The shared position represented by the shared mask vector M is assigned to the shared vector θ s The unshared position represented by the unshared mask vector ^M has the elements of the unshared parameter vector θ of the j-th neural network. j ns It has elements of.
[0057] Next, the optimization problem of equation (7) will be explained.
[0058]
[0059] In formula (7), "x s " is the input data to the neural network, such as image data, and "y s " is x s Similarly, the correct class label (class value) for "x t " is the input data to the neural network, and "y t " is x t Here, "x" is the correct class label. s " and "x t " are input data belonging to different classes. s ≠y t "Δf θj (x s , x t , l) represents the adversarial perturbation (noise) and is calculated by the following equation (8).
[0060]
[0061] In Equation (8), "l" represents a selected layer of the neural network. "δ" represents the adversarial perturbation (noise). "|δ| ∞ "≦ε" indicates that the magnitude of δ in the ∞ norm is equal to or less than the given ε. s +δ" is x s represents the input data with adversarial perturbation δ added to f l θj (x s+δ) is the parameter vector θ j In the j-th neural network when using s represents the output (vector) of the lth layer when +δ is input. l θj (x t ) is the parameter vector θ j In the j-th neural network when using t represents the output (vector) of the lth layer when the input is 2 2 " represents the 2-norm, and "|f l θj (x s +δ)-f l θj (x t ) | 2 2 " represents the distance between these outputs. δ "d(δ)" represents finding δ that minimizes d(δ).
[0062] Therefore, "Δf" in equation (8) θj (x s , x t , l) is the noise δ of magnitude ε or less for the output of the lth layer of the jth neural network. s When the noise δ is added to x t In other words, this noise δ is the noise that is closest to the output of the l-th layer of the j-th neural network. s x t This is the minimum noise that can cause a false positive.
[0063] Returning to equation (7), "x s +Δf θj (x s , x t , l) is the adversarial perturbation Δf obtained by Equation (8). θj (x s , x t , l) to x s represents the input data given to "CEf θi(x, y) is the cross entropy loss function, and when input data x and class label y are given, the parameter vector θ i is a function that outputs a value small enough that the i-th neural network can correctly classify x as y when using θi (x s +Δf θj (x s , x t , l), y s ) is x s , the parameter vector θ j Even if an adversarial perturbation is added that causes the l-th layer of the j-th neural network to make a misjudgment when using the parameter vector θ i The i-th neural network when using s This is a function that outputs a relatively small value when it correctly judges that
[0064] "Σ j≠i CEf θi (·,·)" indicates that the cross-entropy is calculated for all neural networks different from the j-th neural network and then summed up. (xs,ys),(xt,yt),l Σ j≠i CEf θi (・,・)" is (x s , y s ), (x t , y t ), l, it represents the expected value of the sum of the cross entropies. s , θ1 ns , …, θ K ns}E (xs,ys),(xt,yt),l Σ j≠i CEf θi (·,·)" is the parameter vector θ of each neural network that minimizes the expected value of the sum of the cross entropies mentioned above. s , θ1 ns , …, θ K ns It represents the search for
[0065] FIG. 3 is a schematic block diagram showing an example of the functional configuration of the learning device 100 according to the first embodiment. The learning device 100 includes a control unit 110 and a storage unit 130. The control unit 110 includes a mask initialization unit 111, a parameter initialization unit 112, a training data acquisition unit 113, and a learning unit 114. The learning unit 114 includes a mini-batch sampling unit 115, a layer selection unit 116, a parameter determination unit 117, a loss function calculation unit 118, and a parameter update unit 119. The storage unit 130 includes a training data storage unit 131. Note that the learning device 100 may include other components, and the storage unit 130 may be provided external to the learning device 100. In the ensemble learning-based robustness training (ERT) according to the first embodiment, the positions of shared parameters of neural networks (NNs) in the ensemble are randomly determined, and the parameters of the neural networks are learned. Let K be the number of neural networks in the ensemble.
[0066] The mask initialization unit 111 initializes the shared mask vector M and the unshared mask vector ^M. The mask initialization unit 111 is an example of a mask initialization means. The initialization of the shared mask vector M and the unshared mask vector ^M performed by the mask initialization unit 111 can be considered as a process of randomly selecting a shared parameter from among one parameter of the neural network. As described above, the shared mask vector M and the unshared mask vector ^M can be expressed as in equation (9).
[0067]
[0068] Specifically, the mask initialization unit 111 randomly initializes the shared mask vector M so that the elements of p × |θ| are 1, where p is the proportion. The mask initialization unit 111 also initializes the mask vector M by inverting 0 and 1 in each element of the mask vector M as the non-shared mask vector ^M. p indicates the proportion of shared parameters of the neural networks in the ensemble. The value of p may be predetermined depending on the available storage capacity. Alternatively, the initial value of the shared mask vector M may be predetermined, and the mask initialization unit 111 may store the initial value of the shared mask vector M in advance.
[0069] The parameter initialization unit 112 initializes the shared parameter vector θ s and the non-shared parameter vector θ1 ns , …, θ K ns As described above, the shared parameters and the non-shared parameters can be expressed as in equation (10).
[0070]
[0071] For example, the parameter initialization unit 112 may assign a random number to each element of the parameter vector to randomly initialize the parameter values. Alternatively, the initial values of each parameter may be determined in advance, and the parameter initialization unit 112 may store the initial values of the parameters as the initial values of each element of the parameter vector in advance.
[0072] The training data storage unit 131 stores (a set of) training data X used for learning the neural network. tr The training data X tr can be expressed as in equation (11).
[0073]
[0074] "x s " is the input data to the neural network, such as image data, and "y s " is x s Similarly, the correct class label (class value) for "x t " is the input data to the neural network, and "y t " is x t Here, "x" is the correct class label. s " and "x t " are input data belonging to different classes. s ≠y t is.
[0075] The training data acquisition unit 113 acquires the training data X stored in the training data storage unit 131. tr Get.
[0076] The learning unit 114 uses the training data Xtr The parameter vectors of the neural networks in the ensemble are updated by iterative backpropagation using the algorithm.
[0077] The mini-batch sampling unit 115 samples the training data X tr Specifically, the mini-batch sampling unit 115 samples a mini-batch B used for one learning session from the training data X tr From, a subset is randomly sampled and set as mini-batch B.
[0078] The layer selector 116 selects the adversarial perturbation Δf θj (x s , x t , l) is generated.
[0079] The parameter determination unit 117 determines a parameter vector for each neural network. The parameter determination unit 117 is an example of a parameter determination means. As described above, the parameter vector θ of the j-th neural network j can be expressed as in equation (12).
[0080]
[0081] Specifically, the parameter determination unit 117 determines a shared mask vector M, an unshared mask vector ^M, and a shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j (1≦j≦K) is determined (calculated). s and θ j ns (1≦j≦K) is initialized or updated.
[0082] The parameter determination unit 117 determines the parameter vector θ jThe process of determining the parameter vector θ can be considered as the process of configuring the j-th neural network. Specifically, a model template is provided that is shared by K neural networks having the same structure. The model template is a template in which the parameters of the neural network are represented by a parameter vector, and a neural network is configured by inputting values to the parameter vector. The parameter vector θ determined by the parameter determination unit 117 is j The j-th neural network is constructed by applying to the model template.
[0083] The loss function calculation unit 118 calculates the mini-batch B={(x s , y s , x t , y t )} is input to each j-th neural network (1≦j≦K) to propagate information, and the loss function Loss of equation (13) is calculated.
[0084]
[0085] In the formula (13), "Δf θj (x s , x t , l) is the adversarial perturbation shown in equation (8). "l" is the layer l selected by the layer selection unit 116. This adversarial perturbation is x with respect to the output of the l-th layer of the j-th neural network. s x t This is the minimum noise that can cause a misjudgment. s +Δf θj (x s , x t , l) is the adversarial perturbation Δf θj (x s , x t , l) to x s represents the input data given to "CEf θi (x, y) is the cross-entropy loss function, and when input data x and class label y are given, the parameter vector θ i is a function that outputs a value small enough that the i-th neural network can correctly classify x as y when usingθi (x s +Δf θj (x s , x t , l), y s ) is x s , the parameter vector θ j Even if an adversarial perturbation is added that causes the l-th layer of the j-th neural network to make a misjudgment when using the parameter vector θ i The i-th neural network when using s It is a function that outputs a value small enough to correctly judge that "Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) represents the sum of the cross-entropies of all neural networks different from the j-th neural network. (xs,ys,xt,yt)∈B Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s )) is the sum of all elements (x s , y s , x t , y t ) represents taking the expected value (average value) of the sum of cross entropies. The loss function calculation unit 118 corresponds to an example of a loss function calculation means.
[0086] The parameter update unit 119 updates the parameters by backpropagating the error information using the backpropagation method. The parameter update unit 119 corresponds to an example of a parameter updating means. Specifically, the parameter update unit 119 calculates the partial derivative of the loss function Loss shown in Equation (14) and updates θ s Update.
[0087]
[0088] Equation (14) is θ s element (θ s )i For (1≦i≦|θ|), ∂Loss / ∂(θ s ) i This means that the parameter update unit 119 calculates (θ s ) i (θ s ) i -α×∂Loss / ∂(θ s ) i In addition, the parameter update unit 119 calculates the partial derivative of the loss function Loss shown in equation (15) and updates θ j ns Update (j=1, . . . , K).
[0089]
[0090] Equation (15) is θ j ns element (θ j ns ) i For (1≦i≦|θ|), ∂Loss / ∂(θ j ns ) i This means that the parameter update unit 119 calculates (θ j ns ) i (θ j ns ) i -α×∂Loss / ∂(θ j ns ) i Update to.
[0091] For example, after completing a predetermined number of learning rounds, the learning unit 114 calculates the parameter vector θ s , θ1 ns , …, θ K ns is output as the learning result.
[0092] Next, the operation of the learning device 100 will be described with reference to Fig. 4 and Fig. 5. Fig. 4 is a flowchart showing an example of a processing procedure of the learning device 100 according to the first embodiment. Fig. 5 is a flowchart showing an example of a processing procedure of the learning device 100 for calculating a loss function.
[0093] First, the mask initialization unit 111 initializes a shared mask vector M and an unshared mask vector ^M (step S101). For example, the mask initialization unit 111 randomly initializes the shared mask vector M, and then initializes the unshared mask vector ^M by inverting 0 and 1 in each element of the mask vector M.
[0094] Next, the parameter initialization unit 112 initializes the shared parameter vector θ s and the non-shared parameter vector θ1 ns , …, θ K ns (Step S102). The parameter initialization unit 112, for example, assigns a random number to each element of these parameter vectors.
[0095] Next, the training data acquisition unit 113 acquires the training data X tr = {(x s , y s , x t , y t ) i} (1≦i≦K) (step S103). Next, the mini-batch sampling unit 115 obtains the training data X tr From this, the mini-batch B used for one learning session is s , y s , x t , y t ) (step S104). Next, the layer selection unit 116 samples the adversarial perturbation Δf θj (x s , x t , l) is selected (step S105).
[0096] Next, the parameter determination unit 117 determines the shared mask vector M, the unshared mask vector ^M, and the shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j = θ s ○M+θ jns Determine (calculate) ∘^M (1≦j≦K) (step S106). Here, ∘ represents the Hadamard product. θ s and θ j ns (1≦j≦K) is initialized or updated.
[0097] The loss function calculation unit 118 calculates the mini-batch B={(x s , y s , x t , y t )} is propagated through each j-th neural network (1≦j≦K) to calculate the loss function Loss of equation (13) (step S107).
[0098] 5. Next, the loss function calculation unit 118 calculates the element (x s , y s , x t , y t ) in the j-th neural network (step S201). Next, the loss function calculation unit 118 selects one of the adversarial perturbations Δf θj (x s , x t , l) is calculated (step S202).
[0099] Next, the loss function calculation unit 118 calculates x in the i-th neural network, which is different from the j-th neural network. s Adversarial perturbation Δf θj (x s , x t , l) is added to the sum of the cross entropies Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) is calculated (step S203).
[0100] Next, the loss function calculation unit 118 determines whether the sum of cross-entropies has been calculated for all elements of mini-batch B (step S204). If the calculation has not been performed for all elements, the loss function calculation unit 118 returns the process to step S201. On the other hand, if the calculation has been performed for all elements, the loss function calculation unit 118 proceeds to step S205.
[0101] Next, the loss function calculation unit 118 calculates the loss function Loss=(1 / |B|)×Σ (xs,ys,xt,yt)∈B Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) is calculated (step S205).
[0102] Returning to Fig. 4, the parameter update unit 119 then back-propagates the error information and calculates ∂Loss / ∂θ by the gradient method. s Calculate θ s (step S108). The parameter update unit 119 also backpropagates the error information and updates ∂Loss / ∂θ by the gradient method. j ns Calculate θ j ns is updated (j=1, . . . , K) (step S109).
[0103] Next, the learning unit 114 determines whether learning has been performed a predetermined number of times (step S110). If learning has not been performed a predetermined number of times, the learning unit 114 returns the process to step S104. On the other hand, if learning has been performed a predetermined number of times, the learning unit 114 moves the process to step S111. Next, the learning unit 114 (control unit 110) calculates the parameter vector θ of the neural network. s , θ1 ns , …, θ K ns is output (step S111).
[0104] This completes the processing procedure of the learning device 100 according to the first embodiment shown in Figures 4 and 5. Note that, in step S110, the learning termination condition is that learning has been performed a predetermined number of times, but this is not limited to this. For example, the learning termination condition may be that the decrease in the loss function is smaller than a predetermined threshold.
[0105] As described above, the mask initialization unit 111 initializes the shared and non-shared mask vectors, the parameter initialization unit 112 initializes the parameter vector, and the training data acquisition unit 113 acquires training data. The mini-batch sampling unit 115 samples the mini-batches, the layer selection unit 116 selects a layer, the parameter determination unit 117 determines the parameter vector using the shared and non-shared mask vectors, and the loss function calculation unit 118 calculates the loss function. The parameter update unit 119 updates the parameters, and the learning unit 114 outputs the parameter vector after completing a predetermined number of learning rounds.
[0106] As a result, the learning device 100 can reduce the number of parameters of neural networks in an ensemble in robust training (ERT) based on ensemble learning. Therefore, the learning device 100 can reduce the storage capacity of a memory or the like, thereby increasing the number of neural networks in an ensemble. Therefore, the learning device 100 can improve robustness in robust training based on ensemble learning.
[0107] Furthermore, the mask initialization unit 111 determines a shared mask vector that distinguishes between shared parameters shared by multiple neural networks and non-shared parameters provided for each neural network. The loss function calculation unit 118 calculates the value of a loss function based on multiple neural networks to which the shared parameters, non-shared parameters, and parameter values indicated by the shared mask vector are applied, for the training data. The parameter update unit 119 updates the values of the shared parameters and non-shared parameters using the value of the loss function. The learning device 100 enables multiple neural networks to share a portion of each other. Therefore, the learning device 100 can relatively reduce the number of parameter values that a determination device using multiple trained neural networks needs to store.
[0108] Furthermore, the parameter determination unit 117 configures one of the multiple neural networks by including a parameter vector in which parameters for one neural network are configured as a vector, and by setting shared parameter values from the shared parameter vector to elements of the parameter vector that are designated as shared parameters by the shared mask vector, and by setting non-shared parameter values from the non-shared parameter vector to elements of the parameter vector that are designated as non-shared parameters by the shared mask vector, among the elements of the parameter vector. According to the learning device 100, since the values of both the shared parameters and the non-shared parameters are represented by vectors, the parameter values can be calculated using matrix calculations, enabling relatively fast calculations.
[0109] Furthermore, the mask initialization unit 111 determines a shared mask vector so as to randomly select a shared parameter from among the parameters for one neural network. This allows the learning device 100 to select a shared parameter from among the parameters for one neural network by the simple process of randomly selecting the shared parameter. If the desired learning result is not obtained, the learning may be repeated, including the selection of the shared parameter by the mask initialization unit 111.
[0110] The loss function is a function that outputs a relatively small value when other neural networks do not make a misjudgment on input data that has been given an adversarial perturbation that causes one neural network to make a misjudgment. The learning device 100 is expected to obtain a classification device that is robust against adversarial perturbations by performing ensemble learning of neural networks using this loss function. Specifically, even if one of the neural networks obtained by ensemble learning makes a wrong judgment (incorrect class identification) on input data that has been given an adversarial perturbation, the other neural networks are expected to make a correct judgment (correct class identification) on the input data.
[0111] Second Embodiment In the ensemble learning-based robust training (ERT) of the second embodiment, the positions of the shared parameters of the neural networks (NNs) in the ensemble are also determined by learning. That is, in the ERT of the second embodiment, the neural network parameters and the positions of the shared parameters are learned by solving the optimization problem of the following equation (23). In the second embodiment, the positions of the shared parameters are also determined by learning, so the positions of the shared parameters are changed during learning. For example, in FIG. 2, the positions of the shared parameters indicated by double circles are changed during learning. In other respects, the second embodiment is similar to the first embodiment.
[0112] The shared parameters and unshared parameters in the second embodiment are the same as those in the first embodiment. As in the first embodiment, if the number of neural networks in the ensemble is K, the shared vectors and unshared vectors can be expressed as in Equation (16).
[0113]
[0114] The shared mask vector M in the second embodiment is similar to that in the first embodiment. Meanwhile, in the second embodiment, a real vector corresponding to the shared mask vector M is provided. This real vector is also referred to as an alternative vector for the shared mask vector M, or simply as an alternative vector, and is represented by S. S is a variable (variable vector) and is also referred to as an alternative variable. The shared mask vector M and the alternative vector S can be expressed as in equation (17).
[0115]
[0116] M is a |θ|-dimensional vector whose elements are 0 or 1, with 1 representing a shared position. Since the elements of the shared mask vector M are discrete values, it is difficult to directly optimize it using a learning method that uses differentiation, such as backpropagation. For this reason, optimization is performed using a substitute variable (substitute vector) S of M, whose elements take continuous values. S is a |θ|-dimensional vector whose elements are real values between 0 and 1. After optimizing S, the values of the elements at the top m positions (0≦m≦|θ|) with the highest element values are set to 1, and the rest are set to 0, thereby determining the shared mask vector M. Here, p is the proportion of shared parameters. p can be expressed as in equation (18).
[0117]
[0118] m may be a predetermined positive integer.
[0119] The non-shared mask vector ^M in the second embodiment is similar to that in the first embodiment. A real vector corresponding to the non-shared mask vector ^M can be calculated by 1-S. This real vector is also referred to as an alternative vector for the non-shared mask vector ^M, or simply as an alternative vector, and is represented by 1-S or ^S. Furthermore, since S is referred to as an alternative variable, 1-S or ^S is also referred to as an alternative variable. A variable equivalent to ^S may be provided, and 1-S may be substituted into it. The non-shared mask vector ^M and the alternative vector ^S can be expressed as in equation (19).
[0120]
[0121] ^M is also a |θ|-dimensional vector with element values of 0 or 1, where 1 represents an unshared position. ^M is the inverse of M's 0 and 1. The substitution variable ^S corresponding to the unshared mask vector ^M is also a |θ|-dimensional vector with elements that are real values between 0 and 1. The value of each element of ^S is 1 minus the value of the element at the corresponding position in S.
[0122] During learning, the shared parameter vector M may be calculated from the alternative vector S. In this case, the shared parameter vector θ s The shared parameters can be extracted from the shared mask vector M in the same way as in the first embodiment, and can be expressed as in the above equation (4). In this way, the shared parameter vector θ can be extracted from the shared mask vector M. s The case of extracting shared parameters from will be explained in the third embodiment.
[0123] On the other hand, in the second embodiment, the elements of the alternative vector S are used as coefficients by which the shared parameters are multiplied. The multiplication of the elements of the alternative vector S by the shared parameters can be expressed as in equation (20).
[0124]
[0125] As mentioned above, O represents the Hadamard product, which computes the element-wise product of vectors.
[0126] When calculating the shared parameter vector M from the alternative vector S during training, the unshared parameter vector θ of the j-th neural network is j ns The extraction of the non-shared parameters from the j-th neural network can be performed using the non-shared mask vector ^M, as in the first embodiment, and can be expressed as in the above equation (5). j The calculation of can be performed in the same way as in the first embodiment, and can be expressed as in equation (6). In the third embodiment described later, these processing methods can be used.
[0127] On the other hand, in the second embodiment, the elements of the non-alternative vector 1-S are used as coefficients by which the non-shared parameters are multiplied. The multiplication of the elements of the non-alternative vector 1-S by the non-shared parameters of the j-th neural network can be expressed as in Equation (21).
[0128]
[0129] As mentioned above, the circle represents the Hadamard product.
[0130] In the second embodiment, the parameter vector is calculated by adding the value obtained by multiplying the elements of the alternative vector S by the shared parameter and the value obtained by multiplying the elements of the non-alternative vector 1-S by the non-shared parameter. j can be expressed as in equation (22).
[0131]
[0132] Next, the optimization problem of equation (23) will be explained.
[0133]
[0134] In formula (23), "x s " is the input data to the neural network, such as image data, and "y s " is x s Similarly, the correct class label (class value) for "x t " is the input data to the neural network, and "yt " is x t Here, "x" is the correct class label. s " and "x t " are input data belonging to different classes. s ≠y t "Δf θj (x s , x t , l) represents the adversarial perturbation (noise) and is the same as that calculated by equation (8) in the first embodiment. θj (x s , x t , l) is the output of the lth layer of the jth neural network, x s x t This is the minimum noise that can cause a false positive.
[0135] "x s +Δf θj (x s , x t , l) is the adversarial perturbation Δf obtained by Equation (8). θj (x s , x t , l) to x s represents the input data given to "CEf θi (x, y) is the cross entropy loss function, and when input data x and class label y are given, the parameter vector θ i When the i-th neural network is used, it outputs a smaller value as it correctly classifies x as y. θi (x s +Δf θj (x s , x t , l), y s ) is x s , the parameter vector θ j Even if an adversarial perturbation is added that causes the l-th layer of the j-th neural network to make a misjudgment when using the parameter vector θ i The i-th neural network when using s This is a function that outputs a value small enough to correctly judge that
[0136] "Σ j≠i CEf θi (·,·)" indicates that the cross-entropy is calculated for all neural networks different from the j-th neural network and then summed up. (xs,ys),(xt,yt),l Σ j≠i CEf θi (・,・)" is (x s , y s ), (x t , y t ), l, it represents the expected value of the sum of the cross entropies. s , θ1 ns , …, θ K ns}E (xs,ys),(xt,yt),l Σ j≠i CEf θi (·,·)" is the parameter vector θ of each neural network that minimizes the expected value of the sum of the cross entropies mentioned above. s , θ1 ns , …, θ K ns and the shared mask vector M is calculated.
[0137] In the second and third embodiments, the alternative vector S is used instead of the shared mask vector M as one of the targets for which values are calculated in optimization. As described above, the shared mask vector M takes on a discrete value, and therefore methods using differentiation such as backpropagation cannot be applied to solve the optimization problem. Therefore, the optimization problem is constructed using the alternative vector S instead of the shared mask vector M, and the shared mask vector M is calculated from the resulting alternative vector S.
[0138] In the second embodiment, the shared mask vector M is calculated from the alternative vector S obtained at the end of learning according to the ratio p shown in equation (18) as described above. On the other hand, in the third embodiment described later, the parameter vector θ of the jth (1≦j≦K) neural network is calculated using the backpropagation method. jWhen updating the value of , the value of the alternative vector S is updated. Then, the shared mask vector M is obtained from the updated alternative vector S according to the ratio p shown in equation (18) as described above. Then, using the obtained shared mask vector (updated shared mask vector), the shared parameter vector θ s and the non-shared parameter vector θ j ns Update.
[0139] FIG. 6 is a schematic block diagram showing an example of the functional configuration of a learning device 200 according to the second embodiment. The learning device 200 includes a control unit 210 and a storage unit 230. The control unit 210 includes a mask initialization unit 211, a parameter initialization unit 212, a training data acquisition unit 213, a learning unit 214, and a mask determination unit 221. The learning unit 214 includes a mini-batch sampling unit 215, a layer selection unit 216, a parameter determination unit 217, a loss function calculation unit 218, a mask update unit 219, and a parameter update unit 220. The storage unit 230 includes a training data storage unit 231. Note that the learning device 200 may include other components, and the storage unit 230 may be provided external to the learning device 200. In the ensemble learning-based robustness training (ERT) according to the second embodiment, the positions of shared parameters of neural networks (NNs) within the ensemble are determined by learning, and the parameters of the neural networks are learned. As above, let K be the number of neural networks in the ensemble.
[0140] The mask initialization unit 211 initializes a substitution variable (substitution vector) S corresponding to the shared mask vector M. The mask initialization unit 211 corresponds to an example of a mask initialization means. As described above, the substitution variables S and ^S can be expressed as in equation (24).
[0141]
[0142] Specifically, the mask initialization unit 211 randomly initializes the substitution variable S. The elements of S are real values between 0 and 1. Alternatively, the initial value of the substitution variable S may be determined in advance, and the mask initialization unit 211 may store the initial value of the substitution variable S in advance.
[0143] The parameter initialization unit 212 is similar to the parameter initialization unit 112. The parameter initialization unit 212 initializes the shared parameter vector θ s and the non-shared parameter vector θ1 ns , …, θ K ns As described above, the shared parameters and the non-shared parameters can be expressed as in equation (25).
[0144]
[0145] For example, the parameter initialization unit 212 may assign a random number to each element of the parameter vector to randomly initialize the parameter values. Alternatively, the initial values of each parameter may be determined in advance, and the parameter initialization unit 112 may store the initial values of the parameters as the initial values of each element of the parameter vector in advance.
[0146] The training data storage unit 231 is similar to the training data storage unit 131. The training data storage unit 231 stores (a set of) training data X used for learning the neural network. tr As mentioned above, the training data X tr can be expressed as in equation (26).
[0147]
[0148] The learning unit 214 uses the training data X tr Using the above, the parameter vectors of the neural networks in the ensemble and the substitution variable S of the shared mask vector are updated by the iterative error backpropagation method to perform learning.
[0149] The mini-batch sampling unit 215 is similar to the mini-batch sampling unit 115. The mini-batch sampling unit 215 samples the training data X tr Specifically, the mini-batch sampling unit 215 samples a mini-batch B used for one learning session from the training data X tr From, a subset is randomly sampled and set as mini-batch B.
[0150] The layer selector 216 is similar to the layer selector 116. The layer selector 216 selects the adversarial perturbation Δf θj (x s , x t , l) is generated.
[0151] The parameter determination unit 217 determines a parameter vector for each neural network. The parameter determination unit 217 is an example of a parameter determination means. As described above, the parameter vector θ of the j-th neural network j can be expressed as in equation (27).
[0152]
[0153] Specifically, the parameter determination unit 117 determines a substitution variable S corresponding to the shared mask vector, a substitution variable ^S=1−S corresponding to the non-shared mask vector, and a shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j (1≦j≦K) is determined (calculated). s and θ j ns (1≦j≦K) is initialized or updated.
[0154] The loss function calculation unit 218 is the same as the loss function calculation unit 118. The loss function calculation unit 218 corresponds to an example of a loss function calculation means. The loss function calculation unit 218 calculates a mini-batch B={(x s , y s , x t , y t )} is propagated through each j-th neural network (1≦j≦K) to calculate the loss function Loss of equation (28).
[0155]
[0156] The loss function Loss in equation (28) is similar to the loss function Loss in equation (13).
[0157] The mask update unit 219 backpropagates the error information by the error backpropagation method to update the substitution variable S. The mask update unit 219 corresponds to an example of a mask updating means. Specifically, the mask update unit 219 calculates the partial derivative of the loss function Loss shown in equation (29) and updates S.
[0158]
[0159] Equation (29) is the element S of S. i For (1≦i≦|θ|), ∂Loss / ∂S i For example, the mask update unit 219 calculates S i To, S i -α×∂Loss / ∂S i In addition, the mask update unit 219 updates S i is adjusted to be in the range of [0, 1]. For example, the calculated S i The value of S i < 0, the mask update unit 219 updates S i The value of S is set to 0. i The value of S i If S is greater than 1, the mask update unit 219 updates S i The value of is set to 1.
[0160] The parameter update unit 220 is similar to the parameter update unit 119. The parameter update unit 220 corresponds to an example of a parameter update means. The parameter update unit 220 updates the parameters by backpropagating error information using the backpropagation method. Specifically, the parameter update unit 220 calculates the partial derivative of the loss function Loss shown in equation (30) and updates θ s Update.
[0161]
[0162] Equation (30) is similar to equation (14). For example, the parameter update unit 220 updates (θ s ) i (θ s ) i -α×∂Loss / ∂(θ s ) iUpdate to.
[0163] Furthermore, the parameter update unit 220 calculates the partial derivative of the loss function Loss shown in equation (31) and calculates θ j ns Update (j=1, . . . , K).
[0164]
[0165] Equation (31) is similar to equation (15). For example, the parameter update unit 220 updates (θ j ns ) i (θ j ns ) i -α×∂Loss / ∂(θ j ns ) i Update to.
[0166] After completing a predetermined number of learning rounds, the learning unit 214 s , θ1 ns , …, θ K ns and the substitution variable S are output as the learning result.
[0167] The mask determination unit 221 determines a mask vector M. Specifically, the mask determination unit 221 determines the mask vector M such that the positions of the top p × |θ| = m largest values for the substitution variable S output from the learning unit 214 are set to 1, and the other positions are set to 0. Here, p is the proportion of the shared parameters shown in equation (18).
[0168] Next, the operation of the learning device 200 according to the second embodiment will be described with reference to Fig. 7. Fig. 7 is a flowchart showing an example of a processing procedure of the learning device 200 according to the second embodiment. In the processing procedure according to the second embodiment, the parameter vector θ s , θ1 ns , …, θ K ns and the substitution variable S are updated simultaneously for each learning session.
[0169] First, the mask initialization unit 211 initializes a substitution variable (substitution vector) S corresponding to the shared mask vector M. (Step S301) The mask initialization unit 211 initializes the substitution variable S randomly, for example.
[0170] Next, the parameter initialization unit 212 initializes the shared parameter vector θ s and the non-shared parameter vector θ1 ns , …, θ K ns (Step S302). The parameter initialization unit 212 randomly initializes these parameter vectors by, for example, assigning random numbers to each element of the parameter vectors.
[0171] Next, the training data acquisition unit 213 acquires the training data X tr = {(x s , y s , x t , y t ) i} (1≦i≦K) (step S303). Next, the mini-batch sampling unit 215 obtains the training data X tr From this, the mini-batch B used for one learning session is s , y s , x t , y t ) (step S304). Next, the layer selection unit 216 samples the adversarial perturbation Δf θj (x s , x t , l) (step S305).
[0172] Next, the parameter determination unit 217 determines a substitution variable S for the shared mask vector, a substitution variable ^S=1−S for the non-shared mask vector, and a shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j = θ s ○M+θ j nsDetermine (calculate) ∘^M (1≦j≦K) (step S306). As mentioned above, ∘ represents the Hadamard product. S, θ s and θ j ns (1≦j≦K) is initialized or updated.
[0173] The loss function calculation unit 218 calculates the mini-batch B={(x s , y s , x t , y t )} is propagated through each j-th neural network (1≦j≦K), and the loss function Loss=(1 / |B|)×Σ (xs,ys,xt,yt)∈B Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) is calculated (step S307). The loss function Loss is calculated using the parameter vector θ j Except for the difference in the meaning of (1≦j≦K), this is the same as the processing procedure for calculating the loss function shown in FIG. 5 in the first embodiment.
[0174] Next, the mask update unit 219 backpropagates the error information, calculates ∂Loss / ∂S, and updates S (step S308). Next, the parameter update unit 220 backpropagates the error information, calculates ∂Loss / ∂θ s Calculate θ s (step S309). The parameter update unit 220 also backpropagates the error information to update ∂Loss / ∂θ j ns Calculate θ j ns is updated (j=1, . . . , K) (step S310).
[0175] Next, the learning unit 214 determines whether learning has been performed a predetermined number of times (step S311). If learning has not been performed a predetermined number of times, the learning unit 214 returns the process to step S304. On the other hand, if learning has been performed a predetermined number of times, the learning unit 214 proceeds to step S312.
[0176] Next, the mask determination unit 221 determines a mask vector M for the substitution variable S such that the positions of the top p×|θ|=m largest values are set to 1 and the other positions are set to 0 (step S312). Next, the learning unit 214 (control unit 210) determines the parameter vector θ of the neural network. s , θ1 ns , …, θ K ns and the mask vector M is output (step S313).
[0177] This completes the processing procedure of the learning device 200 according to the second embodiment of Fig. 7. In step S310, the learning termination condition is that the learning has been performed a predetermined number of times, but this is not limited to this. For example, the learning termination condition may be that the decrease in the loss function is smaller than a predetermined threshold.
[0178] As described above, the mask initialization unit 211 initializes the substitution variable S, the parameter initialization unit 212 initializes the parameter vector, and the training data acquisition unit 213 acquires training data. The mini-batch sampling unit 215 samples the mini-batch, the layer selection unit 216 selects a layer, the parameter determination unit 217 determines a parameter vector using the substitution variables S and ^S = 1 - S, and the loss function calculation unit 218 calculates the loss function. The mask update unit 219 updates the substitution variable S, and the parameter update unit 220 updates the parameters. The learning unit 214 outputs the parameter vector and the substitution variable S after completing a predetermined number of learning rounds. The mask determination unit 221 determines a mask vector from the substitution variable S.
[0179] As a result, the learning device 200 can reduce the number of parameters of neural networks in an ensemble in robust training (ERT) based on ensemble learning. Therefore, the learning device 200 can reduce the storage capacity of a memory or the like, thereby increasing the number of neural networks in the ensemble. Therefore, the learning device 200 can improve robustness in robust training based on ensemble learning.
[0180] Furthermore, since the learning device 200 determines the positions (mask vectors) of the shared parameters through learning, it is possible to more appropriately determine the positions and number of shared parameters. Furthermore, the learning device 200 of the second embodiment can perform processing faster than the processing method of the third embodiment described later.
[0181] Furthermore, the shared mask vector has a continuous value for each parameter in one neural network. The mask update unit 219 updates the value of each parameter in the shared mask vector (the value of the elements of the shared mask vector) using the value of the loss function. The learning device 200 can learn not only the values of the neural network parameters, but also the parameters to be used as shared parameters and their positions in the neural network structure. In this respect, the learning device 200 is expected to enable more accurate learning.
[0182] Third Embodiment In the ensemble learning-based robust training (ERT) of the third embodiment, the positions of the shared parameters of the neural network (NN) in the ensemble are also determined by learning, as in the second embodiment. That is, in the ERT of the third embodiment, the neural network parameters and the positions of the shared parameters are learned by solving the optimization problem of the above-mentioned equation (23). In the third embodiment, the positions of the shared parameters are also determined by learning, so the positions of the shared parameters are changed during learning. For example, the positions of the shared parameters indicated by double circles in FIG. 2 are changed during learning.
[0183] As described above, in the third embodiment, when updating the shared parameter vector and the unshared parameter vector using the error backpropagation method, the shared mask vector M is calculated (updated) from the updated alternative vector S, and the calculated shared mask vector is used to calculate parameter values of the neural network and calculate an error. In other respects, the third embodiment is similar to the second embodiment. A schematic block diagram showing an example of the functional configuration of the learning device 200 of the third embodiment is similar to the schematic block diagram showing an example of the functional configuration of the learning device 200 of the second embodiment shown in FIG. 6.
[0184] Next, the operation of the learning device 200 according to the third embodiment will be described with reference to Fig. 8 and Fig. 9. Fig. 8 and Fig. 9 are flowcharts showing an example of a processing procedure of the learning device 200 according to the third embodiment. In the processing procedure according to the third embodiment, learning of the substitution variable S is performed first, mask vectors M and ^M are determined from the substitution variable S, and the parameter vector θ s , θ1 ns , …, θ K ns Learn about the following.
[0185] First, the mask initialization unit 211 initializes a substitution variable (substitution vector) S corresponding to the shared mask vector M. (Step S401) The mask initialization unit 211 initializes the substitution variable S randomly, for example.
[0186] Next, the parameter initialization unit 212 initializes the shared parameter vector θ s and the non-shared parameter vector θ1 ns , …, θ K ns (Step S402). The parameter initialization unit 212 randomly initializes these parameter vectors by, for example, assigning random numbers to each element of the parameter vectors.
[0187] Next, the training data acquisition unit 213 acquires the training data X tr = {(x s , y s , x t , y t ) i} (1≦i≦K) (step S403). Next, the mini-batch sampling unit 215 obtains the training data X tr From the above, a mini-batch B={(x s , y s , x t , y t ) (step S404). Next, the layer selection unit 216 samples the adversarial perturbation Δf θj (x s , x t, l) (step S405).
[0188] Next, the parameter determination unit 217 determines a substitution variable S for the shared mask vector, a substitution variable ^S=1−S for the non-shared mask vector, and a shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j = θ s ○S+θ j ns Determine (calculate) ∘^S (1≦j≦K) (step S406), where ∘ represents the Hadamard product, and S is initialized or updated.
[0189] The loss function calculation unit 218 calculates the mini-batch B={(x s , y s , x t , y t )} is propagated through each j-th neural network (1≦j≦K), and the loss function Loss=(1 / |B|)×Σ (xs,ys,xt,yt)∈B Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) is calculated (step S407). The loss function calculation unit 218 calculates the loss function Loss using the parameter vector θ j Except for the difference in the meaning of (1≦j≦K), this is the same as the processing procedure for calculating the loss function shown in FIG. 5 in the first embodiment.
[0190] Next, the mask update unit 219 backpropagates the error information, calculates ∂Loss / ∂S, and updates S (step S408).
[0191] Next, the learning unit 214 determines whether learning A has been performed a predetermined number of times (step S409). If learning A has not been performed a predetermined number of times, the learning unit 214 returns the process to step S404. On the other hand, if learning A has been performed a predetermined number of times, the learning unit 214 proceeds to step S410.
[0192] Next, the mask determination unit 221 determines a mask vector M such that the top p × |θ| = m positions with the largest values for the substitution variable S are set to 1 and the other positions are set to 0 (step S410). Furthermore, the mask determination unit 221 determines a non-shared mask vector ^M by inverting 0 and 1 in each element of the mask vector M (step S410).
[0193] Next, the mini-batch sampling unit 215 samples the training data X tr From the above, a mini-batch B={(x s , y s , x t , y t ) (step S411). Next, the layer selection unit 216 samples the adversarial perturbation Δf θj (x s , x t , l) is selected (step S412).
[0194] Next, the parameter determination unit 217 determines the shared mask vector M, the unshared mask vector ^M, and the shared parameter vector θ s and the non-shared parameter vector θ j ns (1≦j≦K) and the parameter vector θ of each neural network j = θ s ○M+θ j ns Determine (calculate) ∘^M (1≦j≦K) (step S413). Here, ∘ represents the Hadamard product. θ s , θ j ns (1≦j≦K) is initialized or updated.
[0195] The loss function calculation unit 218 calculates the mini-batch B={(x s , y s , x t , y t)} is propagated through each j-th neural network (1≦j≦K), and the loss function Loss=(1 / |B|)×Σ (xs,ys,xt,yt)∈B Σ j≠i CEf θi (x s +Δf θj (x s , x t , l), y s ) is calculated (step S414). The loss function calculation unit 218 calculates the loss function Loss using the parameter vector θ j Except for the difference in the meaning of (1≦j≦K), this is the same as the processing procedure for calculating the loss function shown in FIG. 5 in the first embodiment.
[0196] Next, the parameter update unit 220 backpropagates the error information to obtain ∂Loss / ∂θ s Calculate θ s (step S415). The parameter update unit 220 also backpropagates the error information to update ∂Loss / ∂θ j ns Calculate θ j ns is updated (j=1, . . . , K) (step S416).
[0197] Next, the learning unit 214 determines whether learning B has been performed a predetermined number of times (step S417). If learning B has not been performed a predetermined number of times, the learning unit 214 returns the process to step S411. On the other hand, if learning B has been performed a predetermined number of times, the learning unit 214 proceeds to step S417.
[0198] Next, the learning unit 214 determines whether or not learning A and learning B have been performed a predetermined number of times (step S418). If learning A and learning B have not been performed a predetermined number of times, the learning unit 214 returns the process to step S404. On the other hand, if learning A and learning B have been performed a predetermined number of times, the learning unit 214 proceeds to step S419.
[0199] Next, the learning unit 214 (control unit 210) calculates the parameter vector θ of the neural network. s , θ1 ns , …, θ K nsand the mask vector M is output (step S419).
[0200] This completes the processing procedure of the learning device 200 according to the third embodiment shown in Figures 8 and 9. In step S418, the termination condition for learning A and learning B may be a single learning session. Furthermore, the termination condition for each learning session in steps S409, S417, and S418 is that the learning session has been performed a predetermined number of times. However, the termination condition for each learning session may be, for example, that the decrease in the loss function is smaller than a predetermined threshold value.
[0201] As described above, the mask initialization unit 211 initializes the substitution variable S, the parameter initialization unit 212 initializes the parameter vector, and the training data acquisition unit 213 acquires training data. In learning A, the mini-batch sampling unit 215 samples a mini-batch, the layer selection unit 216 selects a layer, the parameter determination unit 217 determines a parameter vector using the substitution variables S and ^S = 1 - S, the loss function calculation unit 218 calculates the loss function, and the mask update unit 219 updates the substitution variable S. After the learning unit 214 has performed learning A a predetermined number of times, the mask determination unit 221 determines a mask vector from the substitution variable S. Furthermore, in learning B, the mini-batch sampling unit 215 samples a mini-batch, the layer selection unit 216 selects a layer, the parameter determination unit 217 determines a parameter vector using the mask vectors M and ^M, the loss function calculation unit 218 calculates the loss function, and the parameter update unit 220 updates the parameters. After the learning unit 214 has performed learning B a predetermined number of times, the learning unit 214 further performs learning A and learning B a predetermined number of times, and then outputs the parameter vector and mask vector M.
[0202] As a result, the learning device 200 can reduce the number of parameters of neural networks in an ensemble in robust training (ERT) based on ensemble learning. Therefore, the learning device 200 can reduce the storage capacity of a memory or the like, thereby increasing the number of neural networks in the ensemble. Therefore, the learning device 200 can improve robustness in robust training based on ensemble learning.
[0203] Furthermore, since the learning device 200 determines the positions (mask vectors) of the shared parameters through learning, it is possible to more appropriately determine the positions and number of shared parameters. Furthermore, the learning device 200 of the third embodiment can perform learning with higher accuracy than the processing method of the second embodiment described above.
[0204] <Fourth embodiment> The fourth embodiment shows an example of a determination device using a neural network trained by the learning devices 100 and 200 of the first to third embodiments. Fig. 10 is a schematic block diagram showing an example of the functional configuration of a determination device 300 according to the fourth embodiment. The determination device 300 includes a plurality of neural networks 301 (neural network 1, ..., neural network K) and a majority voting unit 302.
[0205] The neural networks 301 are neural networks 1, ..., K trained by the learning devices 100, 200 of the first to third embodiments. These neural networks i (1 ≤ i ≤ K) share parameters (parameter vectors). When input data such as image data is input, each neural network i outputs a class label (class value).
[0206] When class labels (class values) are input from multiple neural networks 301, majority voting unit 302 takes a majority vote (using the most popular class label) and outputs the resulting class label. Note that majority voting unit 302 may weight the inputs from multiple neural networks 301. Furthermore, majority voting unit 302 may calculate values using other functions for the inputs from multiple neural networks 301 instead of taking a majority vote, and output the results.
[0207] According to the fourth embodiment, neural networks 1, ..., and K trained by the learning devices 100 and 200 of the first to third embodiments calculate class labels from input data, and the majority voting unit 302 takes a majority vote on the class labels and outputs the result. This allows for determination (class identification) with a reduced number of neural network parameters. Furthermore, since the number of neural networks in the ensemble can be increased, robustness can be improved.
[0208] 11 is a schematic block diagram showing an example of the functional configuration of a learning device 500 according to the fifth embodiment. In the configuration shown in Fig. 11, the learning device 500 includes a mask initialization unit 501, a loss function calculation unit 502, and a parameter update unit 503.
[0209] With this configuration, the mask initialization unit 501 determines mask information that indicates, for parameters of a machine learning model having multiple parameters, a distinction between shared parameters that are provided in common to multiple machine learning models and non-shared parameters that are provided for each machine learning model. The loss function calculation unit 502 calculates values of loss functions based on the multiple machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied, for training data. The parameter update unit 503 updates the values of the shared parameters and the non-shared parameters using the value of the loss function. The mask initialization unit 501 corresponds to an example of mask initialization means. The loss function calculation unit 502 corresponds to an example of loss function calculation means. The parameter update unit 503 corresponds to an example of parameter update means.
[0210] The learning device 500 can reduce the number of parameter values that a determination device using multiple machine learning models must store. For example, the learning device 500 can reduce the number of parameters of neural networks in an ensemble during robust training (ERT) based on ensemble learning. Therefore, the learning device 500 can reduce the storage capacity of memory, etc., and therefore increase the number of neural networks in the ensemble. Therefore, the learning device 500 can improve robustness during robust training based on ensemble learning.
[0211] Sixth Embodiment Fig. 12 is a flowchart showing an example of a processing procedure of a learning method according to the sixth embodiment. The learning method shown in Fig. 12 includes determining mask information (step S501), calculating a loss function (step S502), and updating shared parameters and non-shared parameters (step S503).
[0212] In determining mask information (step S501), the computer determines mask information that indicates, for parameters of a machine learning model having multiple parameters, a distinction between shared parameters that are provided to be shared by multiple machine learning models and non-shared parameters that are provided for each machine learning model. In calculating a loss function (step S502), the computer calculates a loss function based on the multiple machine learning models using training data. In updating the shared parameters and non-shared parameters (step S503), the computer updates the shared parameters and non-shared parameters using the value of the loss function through backpropagation.
[0213] The learning method shown in Figure 12 can reduce the number of parameter values that a determination device using multiple machine learning models must store. For example, the learning method shown in Figure 12 can reduce the number of parameters of neural networks in an ensemble in robust training (ERT) based on ensemble learning. Therefore, the learning method can reduce the storage capacity of memory, etc., and therefore increase the number of neural networks in the ensemble. Therefore, the learning method can improve robustness in robust training based on ensemble learning.
[0214] FIG. 13 is a schematic block diagram illustrating the configuration of a computer according to at least one embodiment. In the configuration illustrated in FIG. 13, the computer 400 includes a CPU (Central Processing Unit) 410, a main storage device 420, an auxiliary storage device 430, and an interface 440. One or more of the learning devices 100 and 200 may be implemented in the computer 400. In this case, the operation of each of the above-described processing units is stored in the auxiliary storage device 430 in the form of a program. The CPU 410 reads the program from the auxiliary storage device 430, loads it into the main storage device 420, and executes the above-described processing in accordance with the program. The CPU 410 also allocates storage areas in the main storage device 420 corresponding to each of the above-described storage units in accordance with the program. Communication between each device and other devices is achieved by the interface 440, which has a communication function, communicating under the control of the CPU 410.
[0215] When the learning device 100 is implemented in a computer 400, the operations of the mask initialization unit 111, the parameter initialization unit 112, the training data acquisition unit 113, and the learning unit 114, as well as the operations of the mini-batch sampling unit 115, the layer selection unit 116, the parameter determination unit 117, the loss function calculation unit 118, and the parameter update unit 119 included in the learning unit 114, are stored in the auxiliary storage device 430 in the form of a program. The CPU 410 reads the program from the auxiliary storage device 430, loads it into the main storage device 420, and executes the above-described processing in accordance with the program. The output of the learning device 100 is executed by the interface 440, which has an output function such as a communication function or a display function, and performs output processing under the control of the CPU 410.
[0216] When the learning device 200 is implemented in a computer 400, the operations of the mask initialization unit 211, the parameter initialization unit 212, the training data acquisition unit 213, the learning unit 214, and the mask determination unit 221, as well as the operations of the mini-batch sampling unit 215, the layer selection unit 216, the parameter determination unit 217, the loss function calculation unit 218, the mask update unit 219, and the parameter update unit 119 provided in the learning unit 114, are stored in the auxiliary storage device 430 in the form of a program. The CPU 410 reads the program from the auxiliary storage device 430, loads it into the main storage device 420, and executes the above-described processing in accordance with the program. The interface 440 has an output function such as a communication function or a display function, and executes output processing under the control of the CPU 410, thereby outputting the learning device 100.
[0217] Although an embodiment of the present invention has been described in detail above with reference to the drawings, the specific configuration is not limited to this embodiment, and design changes and the like are also included within the scope that does not deviate from the gist of the present invention.
[0218] A part or all of the above-described embodiments can be described as, but not limited to, the following supplementary notes.
[0219] (Supplementary Note 1) A learning device comprising: a mask initialization means for determining mask information indicating, for parameters of a machine learning model having a plurality of parameters, a distinction between shared parameters provided in common to the plurality of machine learning models and non-shared parameters provided for each machine learning model; a loss function calculation means for calculating, for training data, a value of a loss function based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and a parameter update means for updating the values of the shared parameters and the non-shared parameters using the value of the loss function.
[0220] (Supplementary Note 2) The learning device according to Supplementary Note 1 further comprises: parameter determination means for configuring one of the plurality of machine learning models by setting, for elements of the parameter vector, which includes a parameter vector in which parameters for one of the machine learning models are configured as a vector, the parameter vector being shared by a plurality of the machine learning models, values of shared parameters from the shared parameter vector in which the shared parameters are configured as a vector and which is provided as a shared parameter for the plurality of the machine learning models by the mask information, and setting, for elements of the parameter vector, which are non-shared parameters by the mask information, values of non-shared parameters from the non-shared parameter vector in which the non-shared parameters are configured as a vector and which is provided for each of the machine learning models.
[0221] (Supplementary Note 3) The learning device according to Supplementary Note 1 or Supplementary Note 2, wherein the mask initialization means determines the mask information so as to randomly select a shared parameter from among parameters for one of the machine learning models.
[0222] (Supplementary Note 4) The learning device according to any one of Supplementary Notes 1 to 3, wherein the mask information has a continuous value for each parameter in one of the machine learning models, and further comprising a mask update means for updating the value of each parameter in the mask information using the value of the loss function.
[0223] (Supplementary Note 5) The learning device according to any one of Supplementary Notes 1 to 4, wherein the calculation of the loss function by the loss function calculation means and the update of the shared parameters and the non-shared parameters by the parameter update means are repeated until a predetermined condition is satisfied.
[0224] (Supplementary Note 6) The learning device according to any one of Supplementary Notes 1 to 5, wherein the loss function is a function that outputs a relatively small value when input data to which an adversarial perturbation that causes one of the machine learning models to make a misjudgment is applied does not cause another of the machine learning models to make a misjudgment.
[0225] (Supplementary Note 7) The learning device according to any one of Supplementary Notes 1 to 6, wherein the machine learning model is a neural network.
[0226] (Supplementary Note 8) A determination device comprising: a plurality of the machine learning models trained by the learning device according to any one of Supplementary Notes 1 to 7; and majority voting means for taking a majority vote of outputs of the plurality of the machine learning models.
[0227] (Supplementary Note 9) A learning method comprising: a step by a computer of determining mask information for a machine learning model having a plurality of parameters, which indicates a distinction between shared parameters provided in common to a plurality of the machine learning models and non-shared parameters provided for each machine learning model; a step of calculating values for training data of a loss function based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and a step of updating values of the shared parameters and the non-shared parameters using the value of the loss function.
[0228] (Supplementary Note 10) A recording medium having recorded thereon a program for causing a computer to execute the following steps: determining mask information for a machine learning model having a plurality of parameters, the mask information indicating a distinction between shared parameters that are provided in common to a plurality of the machine learning models and non-shared parameters that are provided for each machine learning model; calculating values for training data of loss functions based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and parameter values indicated by the mask information are applied; and updating values of the shared parameters and the non-shared parameters using values of the loss function.
[0229] The embodiments of the present invention may be applied to a learning device, a determination device, a learning method, and a recording medium.
[0230] 100, 200 Learning device 110, 210 Control unit 111, 211 Mask initialization unit 112, 212 Parameter initialization unit 113, 213 Training data acquisition unit 114, 214 Learning unit 115, 215 Mini-batch sampling unit 116, 216 Layer selection unit 117, 217 Parameter determination unit 118, 218 Loss function calculation unit 219 Mask update unit 119, 220 Parameter update unit 221 Mask determination unit 130, 230 Storage unit 131, 231 Training data storage unit 300 Determination device 301 Neural network 302 Majority voting unit
Claims
1. A mask initialization means for determining mask information indicating a distinction between shared parameters provided as common parameters to a plurality of machine learning models and non-shared parameters provided for each machine learning model, for the parameters of a machine learning model having a plurality of parameters; a loss function calculation means for calculating a value of a loss function based on the plurality of machine learning models to which the shared parameters, the non-shared parameters, and the parameter values indicated by the mask information are applied, for training data; a parameter updating means for updating the values of the shared parameters and the non-shared parameters using the value of the loss function; A learning device comprising:
2. A parameter determination means for constituting one of the machine learning models, comprising: a parameter vector in which parameters for one of the machine learning models are configured as a vector; and a model template provided as shared by the plurality of machine learning models; for elements of the parameter vector that are set as shared parameters by the mask information, a value of a shared parameter is set from a shared parameter vector in which the shared parameters are configured as a vector and provided as shared by the plurality of machine learning models; and for elements of the parameter vector that are set as non-shared parameters by the mask information, a value of a non-shared parameter is set from a non-shared parameter vector in which the non-shared parameters are configured as a vector and provided for each of the machine learning models, thereby constituting one of the plurality of machine learning models. The learning device according to claim 1 , further comprising:
3. The mask initialization means determines the mask information so as to randomly select a shared parameter from among parameters of one of the machine learning models. The learning device according to claim 1 .
4. The mask information has a continuous value for each parameter in one of the machine learning models, The mask information further includes a mask update unit that updates a value for each parameter in the mask information by using the value of the loss function. The learning device according to claim 1 .
5. The calculation of the loss function by the loss function calculation means and the updating of the shared parameters and the non-shared parameters by the parameter update means are repeated until a predetermined condition is satisfied. The learning device according to claim 1 .
6. The loss function is a function that outputs a relatively small value when the other machine learning models do not misjudge input data to which adversarial perturbations that cause one of the machine learning models to misjudge are added. The learning device according to claim 1 .
7. The machine learning model is a neural network. The learning device according to claim 1 .
8. A plurality of the machine learning models trained by the learning device according to any one of claims 1 to 7; A majority voting means for taking a majority vote of the outputs of the plurality of machine learning models; A determination device comprising:
9. The computer A step of determining mask information indicating a distinction between shared parameters provided as common parameters to a plurality of machine learning models and non-shared parameters provided for each machine learning model, for the parameters of a machine learning model having a plurality of parameters; Calculating values of loss functions based on the machine learning models to which the shared parameters, the non-shared parameters, and the parameter values indicated by the mask information are applied, for training data; updating the values of the shared parameters and the non-shared parameters using the value of the loss function; Learning methods including:
10. On the computer, A step of determining mask information indicating a distinction between shared parameters provided as common parameters to a plurality of machine learning models and non-shared parameters provided for each machine learning model, for the parameters of a machine learning model having a plurality of parameters; Calculating values of loss functions based on the machine learning models to which the shared parameters, the non-shared parameters, and the parameter values indicated by the mask information are applied, for training data; updating the values of the shared parameters and the non-shared parameters using the value of the loss function; A program for executing.