Model training method, device and electronic equipment based on federated learning

By calculating the gradient factor and adding random noise in federated learning using noise intermediate results and local label data in federated learning, the problems of low efficiency and accuracy loss of model training in federated learning are solved, and efficient model training and data security are achieved.

CN114912630BActive Publication Date: 2025-01-10SHANGHAI FUSHU TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210625232.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-02
Publication Date
2025-01-10
Estimated Expiration
2042-06-02

AI Technical Summary

Technical Problem

Model training efficiency in existing federated learning is inefficient, and due to the need for third-party roles to encrypt data, it leads to reduced processing efficiency and loss of accuracy.

Method used

During the model training process, the second party multiplies the feature data with the noise model parameters, generates a noise intermediate result and sends it to the first party for denoising processing, and calculates it using the denoising intermediate result and local label data. Gradient factors are added and random noise is sent to the second party to update their model parameters, eliminating the complex process of data encryption by third party roles.

Benefits of technology

This improves the efficiency of model training, avoids accuracy loss during model training, and makes the model training process consistent with the conventional model training process without federated learning, ensuring data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114912630B_ABST
    Figure CN114912630B_ABST
Patent Text Reader

Abstract

The present application provides a model training method, device and electronic device based on federated learning, which relates to the field of computer technology. In the model training process of this method, the second participant sends the noisy intermediate result obtained by multiplying the feature data with the model parameters with noise to the first participant, and the first participant continues the subsequent model training after denoising the noisy intermediate result. In this way, by adding noise to the data to achieve the encryption effect, the complex process of data encryption by a third party is omitted, thereby improving the efficiency of model training. In addition, through denoising, the model training process can also be made consistent with the conventional model training process without federated learning, thereby avoiding the loss of accuracy in the model training process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a model training method, device and electronic device based on federated learning. Background Art

[0002] Federated learning is also known as federated machine learning, joint learning, and alliance learning. Federated learning is a machine learning framework that can effectively help multiple institutions use data and conduct machine learning modeling while meeting the requirements of user privacy protection and data security.

[0003] Federated learning can unite different participants to conduct machine learning modeling, and participants do not need to expose their own data to other participants and coordinators. Therefore, federated learning can effectively protect user privacy and data security, and can solve the problem of data silos.

[0004] At present, in the process of multiple parties using federated learning for joint modeling, in order to ensure the security of data transmitted during the interaction, the interaction data is usually encrypted by a third-party role trusted by all participants. However, this method requires the interaction data to be sent to the third-party role first, and then the third-party role encrypts the data through complex encryption methods. As the amount of data that needs to be processed increases, this method will undoubtedly greatly reduce the efficiency of model training. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a model training method, device and electronic device based on federated learning, so as to improve the problem of low efficiency of model training in existing methods.

[0006] In a first aspect, an embodiment of the present application provides a model training method based on federated learning, which is applied to a first participant including label data, and the method includes:

[0007] De-noising a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data, and the noisy intermediate result is an intermediate result generated by the second participant according to the feature data and its current model parameters with noise;

[0008] Determine a gradient factor based on the denoising intermediate result and the local label data, add random noise to the gradient factor to obtain a noise gradient factor, and then send it to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient;

[0009] Obtaining a local update gradient of a local model parameter according to the gradient factor;

[0010] The local model parameters are updated using the local update gradient.

[0011] In the above implementation process, during the model training process, the second participant sends the noisy intermediate result obtained by multiplying the feature data with the noisy model parameters to the first participant, and the first participant performs denoising on the noisy intermediate result and continues the subsequent model training. In this way, by adding noise to the data to achieve the encryption effect, the complex process of data encryption by the third party role is omitted, and the efficiency of model training is improved. In addition, through denoising, the model training process can also be kept consistent with the conventional model training process without federated learning, thereby avoiding the loss of accuracy during the model training process.

[0012] Optionally, the denoising of the noisy intermediate result with noise sent by the second participant in the current model training process includes:

[0013] Statistics on the accumulated random noise generated during the previous model training process;

[0014] Based on the accumulated random noise, a noise intermediate result with noise sent by the second participant in the current model training process is denoised.

[0015] In the above implementation process, denoising is performed by statistically accumulating random noise, so that although the model parameters subsequently updated by the second participant are noisy, they can be used for model training to achieve the same effect as the noise-free model parameters, thereby ensuring the accuracy of model training.

[0016] Optionally, the denoising of the noisy intermediate result with noise sent by the second participant in the current model training process based on the accumulated random noise includes:

[0017] Receiving a multiplication result of the feature data sent by the second participant at the beginning of model training and a transposed matrix of the feature data;

[0018] The noisy intermediate result with noise sent by the second participant in the current model training process is denoised according to the multiplication result and the accumulated random noise.

[0019] In the above implementation process, the second participant sends the multiplication result to the first participant, so that the second participant will not directly disclose the characteristic data to the first participant, thereby ensuring data security.

[0020] Optionally, the accumulated random noise is obtained by accumulating the random noise generated in each previous model training process by attenuating it at a preset ratio.

[0021] Optionally, the first participant further includes feature data, and the determining of the gradient factor based on the denoising intermediate result and the local label data includes:

[0022] A gradient factor is determined based on the denoising intermediate result, local label data and local feature data.

[0023] Optionally, the noise intermediate result is a noise intermediate result encrypted by the second participant based on a homomorphic encryption method, and the determining of the gradient factor based on the denoised intermediate result and local label data includes:

[0024] decrypting the encrypted noise intermediate result to obtain a decrypted noise intermediate result;

[0025] Determine the gradient factor based on the decrypted noisy intermediate result and the local label data;

[0026] The step of adding random noise to the gradient factor to obtain a noise gradient factor and then sending the noise gradient factor to the second participant includes:

[0027] Encrypting the noise gradient factor using a homomorphic encryption method to obtain an encrypted noise gradient factor;

[0028] The encrypted noise gradient factor is sent to the second participant, and the second participant obtains the updated gradient of its model parameter according to the encrypted noise gradient factor.

[0029] In the above implementation process, the noise gradient factor is encrypted using homomorphic encryption, which can further ensure the security of data transmission.

[0030] In a second aspect, an embodiment of the present application provides a model training device based on federated learning, which runs on a first participant including label data, and the device includes:

[0031] A denoising module, configured to denoise a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data, and the noisy intermediate result is an intermediate result generated by the second participant based on the feature data and its current model parameters with noise;

[0032] a gradient factor calculation module, configured to determine a gradient factor based on the denoising intermediate result and local label data, and to add random noise to the gradient factor to obtain a noise gradient factor, and then send the noise gradient factor to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient;

[0033] A gradient calculation module, used to obtain a local update gradient of a local model parameter according to the gradient factor;

[0034] A parameter updating module is used to update the local model parameters using the local update gradient.

[0035] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.

[0037] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 A flowchart of a model training method based on federated learning provided in an embodiment of the present application;

[0040] Figure 2 A structural block diagram of a model training device based on federated learning provided in an embodiment of the present application;

[0041] Figure 3 A schematic diagram of the structure of an electronic device for executing a model training method based on federated learning provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application.

[0043] It should be noted that the terms "system" and "network" in the embodiments of the present invention can be used interchangeably. "Multiple" means two or more. In view of this, in the embodiments of the present invention, "multiple" can also be understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previously associated objects are in an "or" relationship.

[0044] The embodiment of the present application provides a model training method based on federated learning. During the model training process, the second participant sends the noise intermediate result obtained by multiplying the feature data with the model parameters with noise to the first participant. The first participant performs denoising on the noise intermediate result and continues the subsequent model training. In this way, by adding noise to the data to achieve the encryption effect, the complex process of data encryption by a third party is omitted, thereby improving the efficiency of model training. In addition, through denoising, the model training process can also be kept consistent with the conventional model training process without federated learning, thereby avoiding the loss of accuracy during the model training process.

[0045] Please refer to Figure 1 , Figure 1 A flowchart of a model training method based on federated learning provided in an embodiment of the present application, the method comprising the following steps:

[0046] Step S110: De-noising the noisy intermediate result sent by the second participant in the current model training process to obtain a denoised intermediate result.

[0047] Among them, the first participant contains label data and may also contain feature data, and the second participant contains feature data but no label data, so the first participant and the second participant can jointly conduct vertical federated learning model training.

[0048] In order to conduct joint model training, the second participant can pass its own feature data to the first participant. In order to ensure that its own feature data is not known by the first participant, the second participant can send the intermediate result generated by its own feature data and its current model parameters with noise as the noisy intermediate result to the first participant. It should be noted here that in the first model training, the model parameters of the second participant are randomly generated initial model parameters, and the noise carried by the initial model parameters is 0. In the second model training, its model parameters are updated. Since its model parameters are obtained according to the noise gradient factor with noise sent by the first participant, the model parameters of the second participant in the subsequent model training process contain actual noise. At this time, the noisy intermediate result can be obtained by multiplying the noisy model parameters with the feature data.

[0049] Among them, although the first participant can remove the noise carried in the noise intermediate result after denoising, it cannot infer the characteristic data of the second participant. This can ensure that the characteristic data of the second participant will not be known to the first participant, ensuring data security.

[0050] Step S120: Determine a gradient factor based on the denoising intermediate result and the local label data, add random noise to the gradient factor to obtain a noise gradient factor, and then send it to the second participant.

[0051] When calculating the gradient factor, it can be calculated based on the denoising intermediate result and the local label data. Of course, in some embodiments, if the first participant has feature data locally, the gradient factor can also be calculated based on the denoising intermediate result, the local feature data, and the label data.

[0052] In order to facilitate the second participant to simultaneously perform model training, the first participant can add random noise to the gradient factor to obtain a noise gradient factor, and send the noise gradient factor to the second participant. In this way, the second participant cannot infer the first participant's label data based on the noise gradient factor, thereby ensuring the security of the first participant's label data.

[0053] After the second participant obtains the noise gradient factor, it can obtain the update gradient of its model parameters according to the noise gradient factor, and use the update gradient to update the model parameters. The model parameters finally obtained by the second participant are also model parameters with random noise added by the first participant, which can eliminate the possibility that the second participant can infer the label data of the first participant through the trained model parameters when the first participant only has label data.

[0054] Step S130: Obtain the local update gradient of the local model parameter according to the gradient factor.

[0055] Step S140: Update local model parameters using local update gradients.

[0056] After the first participant calculates the gradient factor, it can calculate the updated gradient of the model parameters based on the gradient factor, and then use the updated gradient to update the local model parameters. The first participant can then continue to repeat the above steps until the model converges to complete the model training.

[0057] In the above implementation process, during the model training process, the second participant sends the noisy intermediate result obtained by multiplying the feature data with the noisy model parameters to the first participant, and the first participant performs denoising on the noisy intermediate result and continues the subsequent model training. In this way, by adding noise to the data to achieve the encryption effect, the complex process of data encryption by the third party role is omitted, and the efficiency of model training is improved. In addition, through denoising, the model training process can also be kept consistent with the conventional model training process without federated learning, thereby avoiding the loss of accuracy during the model training process.

[0058] On the basis of the above embodiments, the first participant may include, in the method of denoising the noisy intermediate result: counting the accumulated random noise generated in the previous model training process, and denoising the noisy intermediate result with noise sent by the second participant in the current model training process based on the accumulated random noise, where the noise carried in the noisy intermediate result is the accumulated random noise of the first participant in the current model training process.

[0059] It can be understood that the first participant and the second participant can conduct multiple times (i.e., multiple rounds) of model training. During each model training process, when the first participant performs denoising, it can first count the accumulated random noise generated in the previous round of model training. For example, the first participant will generate random noise in each round of model training to superimpose noise on the gradient factor, so the accumulated random noise can be obtained by superimposing the random noise generated in the previous rounds, and the model parameters of the second participant are updated based on the noise gradient factor sent by the first participant. Therefore, the model parameters finally obtained by the second participant are equivalent to the superposition of the accumulated random noise of the first participant in multiple rounds of model training. In this way, the second participant can obtain model parameters with noise, so as to minimize the possibility of the second participant inferring the label data of the first participant through the model parameters.

[0060] Therefore, the denoising process of the first participant may be to remove the accumulated random noise from the noisy intermediate result, thereby achieving denoising process on the noisy intermediate result.

[0061] In the above implementation process, denoising is performed by statistically accumulating random noise, so that although the model parameters subsequently updated by the second participant are noisy, they can be used for model training to achieve the same effect as the noise-free model parameters, thereby ensuring the accuracy of model training.

[0062] On the basis of the above embodiments, in the specific implementation process of denoising based on accumulated random noise, the first participant can receive the multiplication result of its feature data and the transposed matrix of the feature data sent by the second participant at the beginning of model training, and then denoise the noisy intermediate result with noise sent by the second participant in the current model training process according to the multiplication result and the accumulated random noise.

[0063] That is to say, in order to prevent its own characteristic data from being leaked to the first participant, the second participant sends the multiplication result of its own characteristic data and the transposed matrix of the characteristic data to the first participant when sending its own characteristic data to the first participant. In this way, the first participant cannot directly obtain the characteristic data of the second participant, thereby ensuring the security of the characteristic data of the second participant.

[0064] Since the noisy intermediate result is generated by the second participant combining its own feature data with the model parameters carrying noise, the feature data of the second participant is required to participate in the calculation when performing denoising. However, in order to ensure that the feature data of the second participant is not leaked, the multiplication result of the feature data of the second participant and its transposed matrix is ​​used for calculation here.

[0065] Based on the above embodiment, the above-mentioned accumulated random noise can be obtained by accumulating the random noise generated in each previous model training process by attenuating it according to a preset ratio.

[0066] For example, the current model training is the third model training, and the accumulated random noise is obtained by attenuating the random noise generated in the previous two times according to a preset ratio. The preset ratio here can be determined based on the update formula of the model parameters in the second participant. Different model trainings may have different model parameter update formulas, and their preset ratios may also be different.

[0067] It can be understood that when the model parameters of the second participant are updated, their model parameters are updated after the gradient is calculated according to the noise gradient factor, so their model parameters are also updated according to a certain gradient descent, which is equivalent to the noise superimposed in their model parameters being updated attenuated at a certain ratio. In this way, the accumulated random noise is also accumulated at a preset ratio, so that the model parameters updated by the second participant are closer to the actual model parameters, thereby making the model training process consistent with the actual model training process and avoiding loss of model accuracy.

[0068] On the basis of the above embodiment, in order to further ensure the security of data transmission, the above-mentioned noise intermediate result is the noise intermediate result encrypted by the second participant based on the homomorphic encryption method. Therefore, when determining the gradient factor, the encrypted noise intermediate result can be decrypted first to obtain the decrypted noise intermediate result, and then the gradient factor can be determined based on the decrypted noise intermediate result and the local label data. The first participant can use the homomorphic encryption method to encrypt the noise gradient factor to obtain the encrypted noise gradient factor, and then send the encrypted noise gradient factor to the second participant, so that the second participant can obtain the updated gradient of its model parameters according to the encrypted noise gradient factor.

[0069] In this implementation, not only noise is added to the data transmission process, but encryption is also performed. Although noise is added to the data during the model training process, the data can be denoised to theoretically ensure that the model training process is consistent with the conventional model training process without federation. Encryption by the participating parties can further ensure data security. There is no need for a third party to encrypt the data, and the process of sending the data to a third party for encryption can be omitted, which also improves the efficiency of model training to a certain extent.

[0070] It should be noted that in this application, noise is added to the data by the first participant to achieve the effect of data encryption, so there is no need for a trusted third party to encrypt the data transmission between the participants. The third party role is cancelled in this application, thereby avoiding the problem that the data security of other participants is affected due to security risks caused by the third party role.

[0071] The above process is described below with a specific embodiment, and the following process takes the training of the logistic regression model as an example. It can be understood that the method of the present application is not limited to the logistic regression model, and can also be applied to the training of other models, such as neural network models.

[0072] The specific steps include:

[0073] (1) The second participant sends the multiplication result of its own feature data and its transposed matrix to the first participant. The multiplication result is represented by X B X B T , where X B Represents the characteristic data of the second participant, which is a two-dimensional matrix, X B T Represents the transposed matrix of feature data;

[0074] (2) The first participant generates initial model parameters during initial model training and b0, the second participant generates the initial model parameters

[0075] (3) Then the model training batch k starts from 0 (indicating the first model training) until the model converges, and the following steps are executed in a loop:

[0076] 1) First-party local computing (represents the local feature data X during the k-th model training A and The multiplication result is a one-dimensional vector with a length of N) and (represents the accumulated random noise accumulated from the previous k-1 times during the k-th model training), Among them, lr represents the machine learning rate, noise i represents the newly generated random noise during the i-th model training process (i in the formula ranges from 0 to k-1), λ refers to the L2 regularization coefficient during the logistic regression model training, also known as the penalty term coefficient. When calculating the cumulative noise, it objectively plays the role of the attenuation rate, which is equivalent to the above-mentioned preset attenuation ratio;

[0077] 2) The second party calculates the noise intermediate result locally Represents the model parameters of the second participant in the k-th model training process. When k is equal to 1, Equal to w B0 , the second party will Send to the first party;

[0078] 3) The first party Perform denoising, the denoising formula is: Then calculate the gradient factor Among them, σ represents the sigmoid function, y represents the label data, and N k Indicates the number of feature data during the k-th model training;

[0079] 4) The first participant adds the gradient factor d k Superimpose noise to obtain the noise gradient factor Will Send to a second party;

[0080] 5) The first party shall Computing Gradients as well as The first participant updates the model parameters according to the gradient, as well as

[0081] 6) The second participant calculates the gradient based on the noise gradient factor Update model parameters based on gradients

[0082] 7) The k value is increased by 1, and the step returns to 1), and the above steps are continued to continue training until the model converges and the training is completed.

[0083] From the above steps, it can be seen that after the first participant superimposes noise in the gradient factor, the noise is also superimposed in the model parameters of the second participant. The subsequent noise intermediate result sent by the second participant to the first participant is equivalent to superimposing the accumulated random noise of the first participant. In this way, the first participant can perform denoising, and denoising can be performed during each model training process. In this way, the training process of the model can be theoretically guaranteed to be consistent with the training process of the conventional logistic regression model without federation. In addition, after the training is completed, the model parameters obtained by the second participant are with the noise added by the first participant. Therefore, the second participant cannot infer the label data of the first participant based on the model parameters, ensuring the data security of the first participant.

[0084] In some embodiments, when using a trained model for prediction, such as using a trained logistic regression model for data classification, data classification can only be performed with the consent of all first parties and second parties, thereby ensuring the interests of all parties.

[0085] Please refer to Figure 2 , Figure 2 The structure block diagram of a model training device 200 based on federated learning provided in an embodiment of the present application, the device 200 may be a module, program segment or code on an electronic device. It should be understood that the device 200 is similar to the above Figure 1 The method embodiment corresponds to and can be executed Figure 1 The various steps involved in the method embodiment and the specific functions of the device 200 can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here.

[0086] Optionally, the device 200 includes:

[0087] A denoising module 210 is used to denoise a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data, and the noisy intermediate result is an intermediate result generated by the second participant based on the feature data and its current model parameters with noise;

[0088] A gradient factor calculation module 220 is used to determine a gradient factor based on the denoising intermediate result and local label data, and to add random noise to the gradient factor to obtain a noise gradient factor, and then send the noise gradient factor to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient;

[0089] A gradient calculation module 230, configured to obtain a local update gradient of a local model parameter according to the gradient factor;

[0090] The parameter updating module 240 is used to update the local model parameters using the local update gradient.

[0091] Optionally, the denoising module 210 is used to count the accumulated random noise generated in the previous model training process; and denoise the noisy intermediate result sent by the second participant in the current model training process based on the accumulated random noise.

[0092] Optionally, the denoising module 210 is used to receive the multiplication result of the feature data sent by the second participant at the beginning of model training and the transposed matrix of the feature data; and denoise the noisy intermediate result sent by the second participant during the current model training process based on the multiplication result and the accumulated random noise.

[0093] Optionally, the accumulated random noise is obtained by accumulating the random noise generated in each previous model training process by attenuating it at a preset ratio.

[0094] Optionally, the first participant further includes feature data, and the gradient factor calculation module 220 is used to determine the gradient factor based on the denoising intermediate result, local label data and local feature data.

[0095] Optionally, the noise intermediate result is a noise intermediate result encrypted by the second participant based on the homomorphic encryption method, and the gradient factor calculation module 220 is used to decrypt the encrypted noise intermediate result to obtain a decrypted noise intermediate result; determine the gradient factor based on the decrypted noise intermediate result and local label data; encrypt the noise gradient factor using the homomorphic encryption method to obtain an encrypted noise gradient factor; send the encrypted noise gradient factor to the second participant, and the second participant obtains the updated gradient of its model parameters according to the encrypted noise gradient factor.

[0096] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0097] Please refer to Figure 3 , Figure 3 A structural diagram of an electronic device for executing a model training method based on federated learning provided in an embodiment of the present application, the electronic device may include: at least one processor 310, such as a CPU, at least one communication interface 320, at least one memory 330 and at least one communication bus 340. Among them, the communication bus 340 is used to realize direct connection and communication between these components. Among them, the communication interface 320 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 330 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 330 can optionally also be at least one storage device located away from the aforementioned processor. Computer-readable instructions are stored in the memory 330. When the computer-readable instructions are executed by the processor 310, the electronic device executes the above-mentioned Figure 1 The method process is shown.

[0098] Understandably, Figure 3 The structure shown is for illustration only, and the electronic device may also include Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown. Figure 3 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0099] The present application embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the following is performed: Figure 1 The method process in the method embodiment shown is executed by the electronic device.

[0100] The present embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: denoising a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data; determining a gradient factor based on the denoised intermediate result and local label data, and adding random noise to the gradient factor to obtain a noise gradient factor, and then sending the noise gradient factor to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient; obtaining a local update gradient of the local model parameters according to the gradient factor; and updating the local model parameters using the local update gradient.

[0101] In summary, the embodiments of the present application provide a model training method, device and electronic device based on federated learning. In the model training process, the second participant sends the noise intermediate result obtained by multiplying the feature data with the model parameters with noise to the first participant. The first participant performs denoising on the noise intermediate result and continues the subsequent model training. In this way, by adding noise to the data to achieve the encryption effect, the complex process of data encryption by a third party is omitted, thereby improving the efficiency of model training. Moreover, through denoising, the model training process can also be kept consistent with the conventional model training process without federated learning, thereby avoiding the loss of accuracy in the model training process.

[0102] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0103] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0104] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0105] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0106] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A model training method based on federated learning, characterized in that: Applied to a first party containing label data, the method comprises: De-noising a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data, and the noisy intermediate result is an intermediate result generated by the second participant according to the feature data and its current model parameters with noise; Determine a gradient factor based on the denoising intermediate result and the local label data, add random noise to the gradient factor to obtain a noise gradient factor, and then send it to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient; Obtaining a local update gradient of a local model parameter according to the gradient factor; Updating the local model parameters using the local update gradient; The noisy intermediate result is a noisy intermediate result encrypted by the second participant based on a homomorphic encryption method, and the gradient factor is determined based on the denoised intermediate result and the local label data, including: decrypting the encrypted noise intermediate result to obtain a decrypted noise intermediate result; Determine the gradient factor based on the decrypted noisy intermediate result and the local label data; The step of adding random noise to the gradient factor to obtain a noise gradient factor and then sending the noise gradient factor to the second participant includes: Encrypting the noise gradient factor using a homomorphic encryption method to obtain an encrypted noise gradient factor; The encrypted noise gradient factor is sent to the second participant, and the second participant obtains the updated gradient of its model parameter according to the encrypted noise gradient factor.

2. The method according to claim 1, characterized in that The denoising process of the noisy intermediate result with noise sent by the second participant in the current model training process includes: Statistics on the accumulated random noise generated during the previous model training process; Based on the accumulated random noise, a noise intermediate result with noise sent by the second participant in the current model training process is denoised.

3. The method according to claim 2, characterized in that The denoising process of the noise intermediate result with noise sent by the second participant in the current model training process based on the accumulated random noise includes: Receiving a multiplication result of the feature data sent by the second participant at the beginning of model training and a transposed matrix of the feature data; The noisy intermediate result with noise sent by the second participant in the current model training process is denoised according to the multiplication result and the accumulated random noise.

4. The method according to claim 2, characterized in that: The accumulated random noise is obtained by accumulating the random noise generated in each previous model training process at a preset attenuation ratio.

5. The method according to claim 1, characterized in that The first participant further includes feature data, and the gradient factor is determined based on the denoising intermediate result and the local label data, including: A gradient factor is determined based on the denoising intermediate result, local label data and local feature data.

6. A model training device based on federated learning, characterized in that: Running on a first party containing tag data, the device comprises: A denoising module, used for denoising a noisy intermediate result with noise sent by a second participant in the current model training process to obtain a denoised intermediate result, wherein the second participant includes feature data; a gradient factor calculation module, configured to determine a gradient factor based on the denoising intermediate result and local label data, and to add random noise to the gradient factor to obtain a noise gradient factor, and then send the noise gradient factor to the second participant, so that the second participant obtains an update gradient of its model parameters according to the received noise gradient factor, and updates its model parameters using the update gradient; A gradient calculation module, used to obtain a local update gradient of a local model parameter according to the gradient factor; A parameter updating module, used to update the local model parameters using the local update gradient; The noisy intermediate result is a noisy intermediate result encrypted by the second participant based on a homomorphic encryption method, and the gradient factor is determined based on the denoised intermediate result and the local label data, including: decrypting the encrypted noise intermediate result to obtain a decrypted noise intermediate result; Determine the gradient factor based on the decrypted noisy intermediate result and the local label data; The step of adding random noise to the gradient factor to obtain a noise gradient factor and then sending the noise gradient factor to the second participant includes: Encrypting the noise gradient factor using a homomorphic encryption method to obtain an encrypted noise gradient factor; The encrypted noise gradient factor is sent to the second participant, and the second participant obtains the updated gradient of its model parameter according to the encrypted noise gradient factor.

7. The device according to claim 6, characterized in that The denoising module is used to count the accumulated random noise generated in the previous model training process; based on the accumulated random noise, denoise the noisy intermediate result sent by the second participant in the current model training process.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 5 is executed.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is performed.

Citation Information

Patent Citations

  • A combined deep learning training method based on a privacy protection technology

    CN109684855A

  • Privacy protection method and system based on federated learning, and storage medium

    CN112199702A