Federated learning modeling optimization method, device, medium and computer program product

By encrypting the predicted values ​​of the local model in federated learning and generating encrypted model gradients and losses, optimizing the local model to be trained to obtain the target federated model, the problem of low security in the prior art federated learning model is solved, and higher security and protection effects are achieved.

CN112926073BActive Publication Date: 2025-06-06WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110287309.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-17
Publication Date
2025-06-06
Estimated Expiration
2041-03-17

AI Technical Summary

Technical Problem

In the prior art, there are security risks when building a logistic regression model based on federated learning. The feature owner may obtain the privacy data of the tag owner by replacing the ciphertext content.

Method used

By obtaining the predicted value of the local model to be trained and encrypting based on preset random numbers, the encrypted model gradient and loss are generated, and the local model is optimized to obtain the target federated model. This method keeps the model parameters and gradients in the ciphertext state during the iteration process to prevent malicious participants from fetching privacy data.

Benefits of technology

It effectively improves the security of building a logistic regression model based on federated learning, prevents malicious participants from embezzling privacy data from other participants, and resists malicious attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112926073B_ABST
    Figure CN112926073B_ABST
Patent Text Reader

Abstract

The present application discloses a federated learning modeling optimization method, device, medium and computer program product, the method comprising: obtaining a local model prediction value, and encrypting the local model prediction value based on a preset first random number and a preset second random number to obtain a first random number encryption value and a second random number encryption value; sending the first random number encryption value and the second random number encryption value to a second device, so that the second device can generate each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value and the local sample label; receiving each random number encryption intermediate parameter sent by the second device, and generating an encrypted model gradient and an encrypted model loss based on each random number encryption intermediate parameter; optimizing the local model to be trained based on the encrypted model loss and the encrypted model loss to obtain a target federated model. The present application solves the technical problem of low security when constructing a logistic regression model based on federated learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology in Fintech, and in particular to a federated learning modeling optimization method, device, medium and computer program product. Background Art

[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements on technology, such as higher requirements on the distribution of corresponding to-do items in the financial industry.

[0003] With the continuous development of computer technology, the application of federated learning is becoming more and more extensive. At present, when constructing a logistic regression model through federated learning, the label owner participating in federated learning usually needs to send the homomorphically encrypted label to the unlabeled feature owner, and then the feature owner calculates the homomorphically encrypted gradient and homomorphically encrypted loss based on the homomorphically encrypted label, and sends the homomorphically encrypted gradient and homomorphically encrypted loss to the label owner. After the label owner decrypts the homomorphically encrypted gradient and homomorphically encrypted loss, the model gradient and model loss in the plaintext state are sent to the feature owner. The feature owner can update the local model. However, if the feature owner, after receiving the homomorphically encrypted label, sends the ciphertext content (homomorphically encrypted label) that he wants to know to the label owner instead of the homomorphically encrypted gradient and homomorphically encrypted loss, and then the label owner decrypts and feeds back the decryption result to the feature owner, the feature owner can obtain the sample label of the label owner, which will cause the sample label as the private data of the label owner to be leaked. Therefore, the current method of constructing a federated logistic regression model based on federated learning still has security risks. Summary of the invention

[0004] The main purpose of this application is to provide a federated learning modeling optimization method, device, medium and computer program product, aiming to solve the technical problem of low security when building a logistic regression model based on federated learning in the prior art.

[0005] To achieve the above-mentioned object, the present application provides a federated learning modeling optimization method, which is applied to a first device and includes:

[0006] Obtain a local model prediction value corresponding to the local model to be trained, and encrypt the local model prediction value based on a preset first random number and a preset second random number to obtain a first random number encrypted value and a second random number encrypted value;

[0007] Sending the first random number encrypted value and the second random number encrypted value to a second device, so that the second device generates random number encrypted intermediate parameters based on the first random number encrypted value and the second random number encrypted value and a local sample label;

[0008] Receiving each random number encrypted intermediate parameter sent by the second device, and generating an encrypted model gradient and an encrypted model loss based on each random number encrypted intermediate parameter;

[0009] Based on the encrypted model loss and the encrypted model gradient, the local model to be trained is optimized to obtain a target federated model.

[0010] To achieve the above object, the present application provides a federated learning modeling optimization method, which is applied to a second device and includes:

[0011] Receive a first random number encrypted value and a second random number encrypted value sent by the first device, wherein the first random number encrypted value and the second random number encrypted value are generated by the first device by encrypting a local model prediction value corresponding to the local model to be trained based on a preset first random number and a preset second random number, respectively;

[0012] Generate random number encryption intermediate parameters based on the first random number encryption value, the second random number encryption value and the local sample label;

[0013] Sending each of the random number encrypted intermediate parameters to the first device, so that the first device generates an encrypted model gradient and an encrypted model loss based on each of the random number encrypted intermediate parameters;

[0014] Interact with the first device to determine the state of model iteration training, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model.

[0015] The present application also provides a federated learning modeling optimization device, which is a virtual device and is applied to a first device. The federated learning modeling optimization device includes:

[0016] A random number encryption module is used to obtain a local model prediction value corresponding to the local model to be trained, and to encrypt the local model prediction value based on a preset first random number and a preset second random number to obtain a first random number encrypted value and a second random number encrypted value;

[0017] a sending module, configured to send the first random number encrypted value and the second random number encrypted value to a second device, so that the second device generates random number encryption intermediate parameters based on the first random number encrypted value and the second random number encrypted value and a local sample label;

[0018] A generation module, configured to receive each random number encrypted intermediate parameter sent by the second device, and generate an encrypted model gradient and an encrypted model loss based on each random number encrypted intermediate parameter;

[0019] An optimization module is used to optimize the local model to be trained based on the encrypted model loss and the encrypted model gradient to obtain a target federated model.

[0020] The present application also provides a federated learning modeling optimization device, which is a virtual device and is applied to a second device. The federated learning modeling optimization device includes:

[0021] A receiving module, configured to receive a first random number encrypted value and a second random number encrypted value sent by a first device, wherein the first random number encrypted value and the second random number encrypted value are generated by the first device by encrypting a local model prediction value corresponding to a local model to be trained based on a preset first random number and a preset second random number, respectively;

[0022] A generating module, configured to generate each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value and a local sample label;

[0023] A sending module, used for sending each of the random number encrypted intermediate parameters to a first device, so that the first device generates an encrypted model gradient and an encrypted model loss based on each of the random number encrypted intermediate parameters;

[0024] An interaction module is used to interact with the first device to determine the model iteration training status, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain a target federated model.

[0025] The present application also provides a federated learning modeling optimization device, which is a physical device, and includes: a memory, a processor, and a program of the federated learning modeling optimization method stored in the memory and executable on the processor. When the program of the federated learning modeling optimization method is executed by the processor, the steps of the federated learning modeling optimization method as described above can be implemented.

[0026] The present application also provides a medium, which is a readable storage medium, on which is stored a program for implementing a federated learning modeling optimization method, and when the program of the federated learning modeling optimization method is executed by a processor, the steps of the federated learning modeling optimization method as described above are implemented.

[0027] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned federated learning modeling optimization method when executed by a processor.

[0028] The present application provides a method, device, medium and computer program product for modeling optimization of federated learning. Compared with the prior art, the label owner participating in federated learning usually needs to send the homomorphically encrypted label to the unlabeled feature owner, and then the feature owner calculates the homomorphically encrypted gradient and homomorphically encrypted loss based on the homomorphically encrypted label, and sends the homomorphically encrypted gradient and homomorphically encrypted loss to the label owner, and then the label owner decrypts the homomorphically encrypted gradient and homomorphically encrypted loss, and then feeds back the model gradient and model loss in plaintext to the feature owner for model update. The present application first obtains the local model prediction value corresponding to the local model to be trained, and then encrypts the local model prediction value based on a preset first random number and a preset second random number, respectively, to obtain a first random number encryption value and a second random number encryption value, and then sends the first random number encryption value and the second random number encryption value to a second device, so that the second device can generate each random number encryption intermediate parameter based on the first random number encryption value and the second random number encryption value and the preset sample label, and then receive each random number encryption sent by the second device. The encrypted intermediate parameters are encrypted based on the random number encrypted intermediate parameters, and the encrypted model gradient and the encrypted model loss are generated. When the first device and the second device interact with each other during federated learning, the second device sends only the encrypted intermediate parameters to the first device, and there is no need to send the homomorphically encrypted label. The first device also does not need to send the ciphertext content to the second device during the iteration process, and the second device decrypts and then feeds back the plaintext content. Therefore, the first device cannot obtain the privacy data of the second device by replacing the ciphertext content, and then optimizes the local model to be trained based on the encryption model loss and the encryption model gradient to obtain the target federated model. Before the end of the iteration, the model parameters and the model gradient are in the ciphertext state. Therefore, the technical defect that if the feature owner, after receiving the homomorphically encrypted label, sends the ciphertext content (homomorphically encrypted label) that he wants to know to the label owner instead of the homomorphically encrypted gradient and the homomorphically encrypted loss, and then the label owner decrypts and feeds back the decryption result to the feature owner, the feature owner can obtain the sample label of the label owner is overcome, thereby improving the security of building a logistic regression model based on federated learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0031] Figure 1 This is a flowchart of the first embodiment of the federated learning modeling optimization method of the present application;

[0032] Figure 2 A schematic diagram of the interaction process when the first device and the second device are jointly trained in the federated learning modeling optimization method of the present application;

[0033] Figure 3 This is a flow chart of the second embodiment of the federated learning modeling optimization method of the present application;

[0034] Figure 4 A schematic diagram of the device structure of the hardware operating environment involved in the federated learning modeling optimization method in the embodiment of the present application;

[0035] Figure 5 A schematic diagram of the hardware architecture of federated learning involved in the embodiment of the present application.

[0036] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0037] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0038] The present application embodiment provides a federated learning modeling optimization method. In the first embodiment of the federated learning modeling optimization method of the present application, refer to Figure 1 , the federated learning modeling optimization method is applied to a first device, and the federated learning modeling optimization method includes:

[0039] Step S10, obtaining a local model prediction value corresponding to the local model to be trained, and encrypting the local model prediction value based on a preset first random number and a preset second random number, respectively, to obtain a first random number encrypted value and a second random number encrypted value;

[0040] In this embodiment, it should be noted that the local model to be trained is an untrained logistic regression model, and the local model prediction value is the logistic regression value output by the local model to be trained, which is expressed as the product of the model parameters and features of the local model to be trained. For example, assuming that feature A is X, and the model parameter of the local model to be trained corresponding to feature A is W, then the local model prediction value is WX.

[0041] In addition, it should be noted that the federated learning modeling optimization method is applied to vertical federated learning, and in the first round of iterative training of the local model to be trained, the parameters of the local model to be trained are in a plaintext state, and starting from the second round of iterative training of the local model to be trained, the model parameters of the local model to be trained are all in a homomorphically encrypted ciphertext state.

[0042] Obtain a local model prediction value corresponding to the local model to be trained, and encrypt the local model prediction value based on a preset first random number and a preset second random number, respectively, to obtain a first random number encrypted value and a second random number encrypted value. Specifically, obtain the local model prediction value corresponding to the local model to be trained, when in the first round of iterative training of the local model to be trained, the local model prediction value is in a plaintext state, and then based on a preset first random number mixing method, mix the preset first random number with the local model prediction value to obtain a first random number encrypted value, and based on a preset second random number mixing method, mix the preset second random number with the local model prediction value to obtain a second random number encrypted value, and when not in the first round of iterative training of the local model to be trained, the local The model prediction value is in a homomorphically encrypted ciphertext state, and then based on a preset first random number mixing method, the homomorphically encrypted preset first random number is mixed with the local model prediction value in a homomorphically encrypted state to obtain a first random number encrypted value, and based on a preset second random number mixing method, the preset second random number is mixed with the local model prediction value to obtain a second random number encrypted value, wherein the preset first random number mixing method is a preset data calculation method based on the preset first random number to encrypt the local model prediction value, and the preset second random number mixing method is a preset data calculation method based on the preset second random number to encrypt the local model prediction value, wherein the preset first random number mixing method and the preset second random number mixing method include summation and product, etc.

[0043] In another embodiment, when the local model prediction value is in a plain text state during the first round of iterative training of the local model to be trained, the local model prediction value corresponding to the local model to be trained is obtained, and the local model prediction value is encrypted based on a preset first random number and a preset second random number, respectively, to obtain the first random number encrypted value and the second random number encrypted value. The steps include:

[0044] Obtain a local model prediction value corresponding to the local model to be trained, and based on a preset first random number mixing method, mix a preset first random number with the local model prediction value to obtain a first random number mixed value, and then based on the homomorphic encryption public key shared by the second device, homomorphically encrypt the first random number mixed value to obtain a first random number encrypted value, and based on a preset second random number mixing method, mix a preset second random number with the local model prediction value to obtain a second random number mixed value, and then based on the homomorphic encryption public key, homomorphically encrypt the second random number mixed value to obtain a second random number encrypted value.

[0045] The step of encrypting the local model prediction value based on the preset first random number and the preset second random number to obtain the first random number encrypted value and the second random number encrypted value comprises:

[0046] Step S11, generating the first random number encrypted value based on the preset first random number and the local model prediction value;

[0047] In this embodiment, it should be noted that before executing step S10, the second device generates a homomorphically encrypted public key and a homomorphically encrypted private key, and shares the homomorphically encrypted public key with the first device.

[0048] Based on the preset first random number and the local model prediction value, the first random number encrypted value is generated. Specifically, the preset first random number and the local model prediction value are summed to obtain the first random number encrypted value. For example, assuming that the local model prediction value is [[WX]], the preset first random number is r 1 , then the first random number encryption value is [[WX]]+r 1 , where [[]] is a homomorphic encryption symbol, indicating that the data in the homomorphic encryption symbol is in a homomorphic encryption state.

[0049] Step S12, calculate the homomorphic encrypted product between the local model prediction value and the preset second random number to obtain the second random number encrypted value.

[0050] In this embodiment, the homomorphically encrypted product between the local model prediction value and the preset second random number is calculated to obtain the second random number encrypted value. Specifically, the preset second random number is homomorphically encrypted to obtain the homomorphically encrypted preset second random number, and then the product of the local model prediction value and the homomorphically encrypted preset second random number is calculated under homomorphic encryption to obtain the second random number encrypted value. For example, assuming that the local model prediction value is [[WX]], the preset second random number is r 2 , then the second random number encryption value is [[WX*r 2 ]], where [[]] is a homomorphic encryption symbol, indicating that the data in the homomorphic encryption symbol is in a homomorphic encryption state.

[0051] Step S20, sending the first random number encrypted value and the second random number encrypted value to a second device, so that the second device generates random number encryption intermediate parameters based on the first random number encrypted value and the second random number encrypted value and a local sample label;

[0052] In this embodiment, it should be noted that each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter and a third random number homomorphic encryption parameter, wherein the first random number homomorphic encryption parameter is used to calculate the homomorphic encrypted model gradient corresponding to the local model to be trained, and the second random number homomorphic encryption parameter and the third random number homomorphic encryption parameter are used to calculate the homomorphic encrypted model loss corresponding to the local model to be trained.

[0053] In addition, it should be noted that the first device is the feature owner in federated learning, which is used to provide unlabeled feature data in the federated learning modeling process, and the second device is the label provider in federated learning, which is used to provide local sample labels in the federated learning modeling process.

[0054] The first random number encrypted value and the second random number encrypted value are sent to the second device, so that the second device can generate each random number encryption intermediate parameter based on the first random number encrypted value and the second random number encrypted value and the local sample label. Specifically, the first random number encrypted value and the second random number encrypted value are sent to the second device, and then the second device receives the first random number encrypted value and the second random number encrypted value, and decrypts the first random number encrypted value and the second random number encrypted value based on the homomorphic encryption private key to obtain a first random number mixed value corresponding to the first random number encrypted value and a second random number mixed value corresponding to the second random number encrypted value. value, and then substitute the first random number mixed value and the obtained local sample label into the preset intermediate parameter calculation formula to calculate the mixed random number intermediate parameter, and then based on the homomorphic encryption public key, homomorphically encrypt the mixed random number intermediate parameter to obtain the first random number homomorphic encryption parameter, and based on the homomorphic encryption public key, homomorphically encrypt the square value of the first random number mixed value to obtain the second random number homomorphic encryption parameter, and based on the homomorphic encryption public key, homomorphically encrypt the product of the second random number mixed value and the local sample label to obtain the third random number homomorphic encryption parameter, wherein the preset intermediate parameter calculation formula is as follows:

[0055]

[0056] Among them, d B is the intermediate parameter of the mixed random number, WX+r 1 is the first random number mixing value, r 1 is a preset first random number, WX is a local model prediction value in plain text, y is the local sample label, and the first random number homomorphic encryption parameter is [[d B ]], the second random number homomorphic encryption parameter is [[(WX+r 1 ) 2 ]], the third random number homomorphic encryption parameter is [[yWX*r 2 ]] or [[yWX]]*r 2 , wherein the second random number mixed value is WX*r 2 , r 2 is a preset second random number.

[0057] Step S30, receiving each random number encrypted intermediate parameter sent by the second device, and generating an encrypted model gradient and an encrypted model loss based on each random number encrypted intermediate parameter;

[0058] In this embodiment, it should be noted that each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter and a third random number homomorphic encryption parameter.

[0059] Receive each random number encryption intermediate parameter sent by the second device, and generate an encryption model gradient and an encryption model loss based on each random number encryption intermediate parameter. Specifically, receive the first random number homomorphic encryption parameter, the second random number homomorphic encryption parameter and the third random number homomorphic encryption parameter sent by the second device, and then eliminate the random number influence on the first random number homomorphic encryption parameter, the second random number homomorphic encryption parameter and the third random number homomorphic encryption parameter, respectively, to obtain the first homomorphic encryption intermediate parameter, the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter, and then substitute the first homomorphic encryption intermediate parameter into the preset model gradient calculation formula to generate the encryption model gradient, and substitute the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter into the preset model loss calculation formula to generate the encryption model loss, wherein the process of eliminating the random number influence on the first random number homomorphic encryption parameter, the second random number homomorphic encryption parameter and the third random number homomorphic encryption parameter respectively is as follows:

[0060]

[0061] Among them, r 1 is the preset first random number, r 2 is the preset second random number, [[d B ]] is the first random number homomorphic encryption parameter, [[d]] is the first homomorphic encryption intermediate parameter, [[(WX+r 1 ) 2 ]] is the second random number homomorphic encryption parameter, [[(WX) 2 ]] is the second homomorphic encryption intermediate parameter, [[yWX]]*r 2 is the third random number homomorphic encryption parameter, and [[yWX]] is the third homomorphic encryption intermediate parameter.

[0062] The step of generating the encrypted model gradient and the encrypted model loss based on each of the encrypted intermediate parameters includes:

[0063] Step S31, respectively eliminating the random number influence on each of the random number encryption intermediate parameters to obtain each homomorphic encryption parameter;

[0064] In this embodiment, the random number influence is eliminated for each of the random number encryption intermediate parameters to obtain each homomorphic encryption parameter. Specifically, the first random number homomorphic encryption parameter is subtracted from a preset first random number of a first preset multiple to obtain a first homomorphic encryption intermediate parameter, and the second random number homomorphic encryption parameter, the product of the preset first random number of the second preset multiple and the local model prediction value, and the square value of the preset first random number are subtracted to obtain a second homomorphic encryption intermediate parameter, and the third random number homomorphic encryption parameter is divided by the preset second random number to obtain a third homomorphic encryption intermediate parameter, wherein the calculation formula for generating the first homomorphic encryption intermediate parameter, the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter may be specifically referred to the content in step S30, which will not be repeated here.

[0065] Step S32: Generate the encrypted model gradient and the encrypted model loss based on the local feature values ​​corresponding to each of the homomorphic encrypted values ​​and the local model prediction values.

[0066] In this embodiment, based on the local feature values ​​corresponding to each of the homomorphic encryption values ​​and the local model prediction value, the encrypted model gradient and the encrypted model loss are generated. Specifically, the first homomorphic encryption intermediate parameter is substituted into the preset model gradient calculation formula to generate the encrypted model gradient, and the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter are substituted into the preset model loss calculation formula to generate the encrypted model loss, wherein the preset model gradient calculation formula is as follows:

[0067] [[g]]=[[d]]*X

[0068] Wherein, [[g]] is the encrypted model gradient, [[d]] is the first homomorphic encryption intermediate parameter, X is the feature vector corresponding to the local model prediction value, wherein X may be a feature vector composed of feature values, and in addition, the preset model loss calculation formula is as follows:

[0069]

[0070] Where, [[l(W)]] is the encryption model loss, [[(WX) 2 ]] is the second homomorphic encryption intermediate parameter, and [[yWX]] is the third homomorphic encryption intermediate parameter.

[0071] The homomorphic encryption parameters include a first homomorphic encryption intermediate parameter, a second homomorphic encryption intermediate parameter, and a third homomorphic encryption intermediate parameter.

[0072] The step of generating the encrypted model gradient and the encrypted model loss based on each of the homomorphic encryption parameters and the local eigenvalues ​​corresponding to the local model prediction value comprises:

[0073] Step S321, generating the encryption model gradient by calculating the product of the first homomorphic encryption intermediate parameter and the local eigenvalue;

[0074] In this embodiment, the encrypted model gradient is generated by calculating the product of the first homomorphic encryption intermediate parameter and the local eigenvalue. Specifically, the encrypted model gradient is obtained by calculating the product between the first homomorphic encryption intermediate parameter and the local eigenvalue.

[0075] Step S322: Generate the encryption model loss by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter.

[0076] In this embodiment, the encryption model loss is generated by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter. Specifically, the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter are input into a preset model loss calculation formula to generate the encryption model loss by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter. The preset model loss calculation formula is as shown in step S32 and will not be repeated here.

[0077] Step S40: Optimize the local model to be trained based on the encrypted model loss and the encrypted model gradient to obtain a target federated model.

[0078] In this embodiment, based on the encryption model loss and the encryption model gradient, the local model to be trained is optimized to obtain a target federated model. Specifically, based on the encryption model loss and the encryption model loss, the local model to be trained is optimized by performing model iteration training state judgment interaction and decryption interaction with the second device to obtain a target federated model.

[0079] In one implementation, the step of optimizing the local model to be trained based on the encryption model loss and the encrypted model loss by performing model iteration training state judgment interaction and decryption interaction with the second device to obtain the target federated model includes:

[0080] Based on the encryption model loss, the model iteration training status is judged interactively with the second device to determine whether the iterative training of the local model to be trained is completed. If so, the encrypted model parameters of the local model to be trained are decrypted through decryption interaction with the second device to obtain the target model parameters in plain text, and then the local model to be trained with the target model parameters is used as the target federal model. If not, the encrypted model parameters of the local model to be trained are updated based on the encryption model gradient, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned to.

[0081] The step of optimizing the local model to be trained based on the encryption model loss and the encryption model gradient to obtain the target federated model includes:

[0082] Step S41, sending the encrypted model loss to the second device, so that the second device can generate a target judgment result for judging whether the iterative training of the local model to be trained is completed based on the decrypted encrypted model loss;

[0083] In this embodiment, the encrypted model loss is sent to the second device so that the second device can generate a target judgment result for judging whether the iterative training of the local model to be trained has been completed based on the decrypted encrypted model loss. Specifically, the encrypted model loss is sent to the second device, and then the second device decrypts the encrypted model loss based on the homomorphically encrypted private key to obtain the target model loss, and then based on the target model loss, judges whether the iterative training of the local model to be trained has been completed to obtain the target judgment result.

[0084] Step S42, receiving the target judgment result, if the target judgment result is that the local model to be trained converges, decrypting the model parameters of the local model to be trained by performing decryption interaction with the second device to obtain the target federated model;

[0085] In this embodiment, the target judgment result is received. If the target judgment result is that the local model to be trained has converged, the model parameters of the local model to be trained are decrypted by performing decryption interaction with the second device to obtain the target federal model. Specifically, the target judgment result is received. If the target judgment result is that the local model to be trained has converged, the encrypted model parameters of the local model to be trained of the mixed random number are sent to the second device, so that the second device can decrypt the encrypted model parameters of the mixed random number based on the private key of homomorphic encryption to obtain the plaintext model parameters of the mixed random number. Then the first device receives the plaintext model parameters of the mixed random number, eliminates the random number influence on the plaintext model parameters of the mixed random number, obtains the target model parameters, and uses the local model to be trained with the target model parameters as the target federal model.

[0086] Step S43, if the target judgment result is that the local model to be trained has not converged, then based on the encrypted model gradient, the local model to be trained is optimized, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned.

[0087] In this embodiment, specifically, if the target judgment result is that the local model to be trained has not converged, then based on the encrypted model gradient, the local model to be trained is optimized, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned to perform the next round of iteration until the target judgment result is that the local model to be trained has converged, wherein the optimization of the local model to be trained based on the encrypted model gradient can be specifically as follows:

[0088] [[W t+1 ]]=[[W t ]]-η*[[g]]

[0089] Among them, [[W t+1 ]] is the homomorphically encrypted model parameter in the t+1th iteration when iteratively training the local model to be trained, [[W t ]] is the homomorphically encrypted model parameter in the tth iteration when iteratively training the local model to be trained, [[g]] is the encrypted model parameter, and η is the learning step size, such as Figure 2 The figure shows a schematic diagram of the interaction process of the first device and the second device during joint training in an embodiment of the present application, wherein A is the first device, B is the second device, x1, x2, x3 are all features, y is the local sample label, and the Taylor expansion d in the second device is d B , [[d]] in the second device is the first random number homomorphic encryption parameter [[d B ]], [[d]] in the first device is the first homomorphic encryption intermediate parameter.

[0090] In addition, it should be noted that when constructing a logistic regression model through federated learning in the prior art, the label owner participating in the federated learning usually needs to send the homomorphically encrypted label to the feature owner participating in the federated learning, and then the feature owner calculates the homomorphically encrypted loss and gradient based on the homomorphically encrypted label, and feeds back the homomorphically encrypted loss and gradient to the label owner for decryption. In the federated learning process, there is an interactive process in which one federated learning participant holds the homomorphically encrypted private data of another federated learning participant, and the federated learning participant needs to send the homomorphically encrypted data to be decrypted (loss and gradient) to another federated learning participant for decryption to obtain the decryption result. In this interactive process, if the federated learning participant is a malicious participant, the malicious participant can directly replace the homomorphically encrypted data to be decrypted with the homomorphically encrypted private data of the other federated participant and feed it back to the other federated participant for decryption, thereby achieving the purpose of obtaining the private data of the other federated learning participant. Therefore, the federated learning process for constructing a logistic regression model in the prior art has a technical defect that cannot resist malicious attacks by malicious participants.

[0091] In the embodiment of the present application, the local model prediction value corresponding to the local model to be trained is first obtained, and based on the preset first random number and the preset second random number, the local model prediction value is encrypted respectively to obtain a first random number encryption value mixed with the preset first random number and a second random number encryption value mixed with the preset second random number, and the first random number encryption value and the second random number encryption value are sent to the second device, so that the second device will not directly hold the homomorphically encrypted privacy data of the first device, and even if the second device decrypts the first random number encryption value and the second random number encryption value, the local model prediction value of the mixed random number is obtained, which ensures the privacy of the local model prediction value and prevents the privacy data of the first device from being leaked. Then, the second device generates each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value and the local sample label to avoid sending the homomorphically encrypted sample label directly to the first device, and then the first device receives each random number encryption intermediate parameter sent by the second device, and generates an encrypted model gradient and an encrypted model loss based on each random number encryption intermediate parameter, and then the first device generates an encrypted model gradient and an encrypted model loss based on the encrypted model loss and the encrypted model gradient. By optimizing the local model to be trained, the target federated model can be obtained. Therefore, in the entire federated learning process of the present application, there is no interactive process in which one federated learning participant holds the homomorphically encrypted privacy data of another federated learning participant, and the federated learning participant needs to send the homomorphically encrypted data to be decrypted (loss and gradient) to another federated learning participant for decryption to obtain the decryption result. Therefore, in the federated learning process of the present application, malicious participants cannot obtain the mapping data of other federated learning participants, and thus the federated learning process of the present application can resist malicious attacks from malicious participants. Furthermore, although the first device needs to send the encrypted model loss to the second device for decryption, the second device can directly determine whether the model converges based on the decrypted model loss, and feedback the model convergence result to the first device without feedback of the decryption result, so as to prevent the first device from obtaining the sample label in the second device based on the interactive process of directly feedback the decryption result, thereby ensuring the privacy of the sample label in the second device, and thus avoiding the situation in which the first device sends other homomorphically encrypted data to the second device for decryption and obtains the privacy data of the second device. Therefore, the federated learning process of the present application has the ability to resist malicious attacks from malicious participants.

[0092] The embodiment of the present application provides a method for modeling optimization of federated learning. Compared with the prior art, the label owner participating in federated learning usually needs to send the homomorphically encrypted label to the unlabeled feature owner, and then the feature owner calculates the homomorphically encrypted gradient and homomorphically encrypted loss based on the homomorphically encrypted label, and sends the homomorphically encrypted gradient and homomorphically encrypted loss to the label owner, and then the label owner decrypts the homomorphically encrypted gradient and homomorphically encrypted loss, and then feeds back the model gradient and model loss in plaintext to the feature owner for model update. The embodiment of the present application first obtains the local model prediction value corresponding to the local model to be trained, and then encrypts the local model prediction value based on a preset first random number and a preset second random number, respectively, to obtain a first random number encryption value and a second random number encryption value, and then sends the first random number encryption value and the second random number encryption value to a second device, so that the second device can generate each random number encryption intermediate parameter based on the first random number encryption value and the second random number encryption value and the preset sample label, and then receive each random number encryption intermediate parameter sent by the second device. number, and based on each of the random numbers, encrypt the intermediate parameters to generate the encrypted model gradient and the encrypted model loss, wherein, during the federated learning, during the interaction between the first device and the second device, the second device sends only the encrypted intermediate parameters to the first device, and there is no need to send the homomorphically encrypted label, and the first device does not need to send the ciphertext content to the second device during the iteration, and the second device decrypts and then feeds back the plaintext content, so the first device cannot obtain the privacy data of the second device by replacing the ciphertext content, and then optimizes the local model to be trained based on the encryption model loss and the encryption model gradient to obtain the target federated model, wherein before the end of the iteration, the model parameters and the model gradient are in the ciphertext state, so it overcomes the technical defect that if the feature owner, after receiving the homomorphically encrypted label, sends the ciphertext content (homomorphically encrypted label) that he wants to know to the label owner instead of the homomorphically encrypted gradient and the homomorphically encrypted loss, and then the label owner decrypts and feeds back the decryption result to the feature owner, the feature owner can obtain the sample label of the label owner, thereby improving the security of building a logistic regression model based on federated learning.

[0093] Further, refer to Figure 3 Based on the first embodiment of the present application, in another embodiment of the present application, the federated learning modeling optimization method is applied to a second device, and the federated learning modeling optimization method includes:

[0094] Step A10, receiving a first random number encrypted value and a second random number encrypted value sent by the first device, wherein the first random number encrypted value and the second random number encrypted value are generated by the first device by encrypting a local model prediction value corresponding to the local model to be trained based on a preset first random number and a preset second random number, respectively;

[0095] In this embodiment, it should be noted that the first random number encryption value and the second random number encryption value are generated by the first device based on a preset first random number and a preset second random number, respectively encrypting the local model prediction value corresponding to the local model to be trained in step A20. The specific process of generating each random number encryption intermediate parameter based on the first random number encryption value and the second random number encryption value and the local sample label can refer to the specific content in step S10 and its detailed steps, which will not be repeated here.

[0096] Wherein, each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter and a third random number homomorphic encryption parameter,

[0097] The step of generating each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value and the local sample label comprises:

[0098] Step A21, decrypting the first random number encrypted value and the second random number encrypted value to obtain a first random number mixed value and a second random number mixed value;

[0099] In this embodiment, the first random number encrypted value and the second random number encrypted value are decrypted to obtain a first random number mixed value and a second random number mixed value. Specifically, based on a homomorphic encrypted private key, the first random number encrypted value and the second random number encrypted value are decrypted respectively to obtain a first random number mixed value corresponding to the first random number encrypted value and a second random number mixed value corresponding to the second random number encrypted value.

[0100] Step A22, generating a mixed random number intermediate parameter based on the first random number mixed value and the local sample label;

[0101] In this embodiment, based on the first random number mixed value and the local sample label, a mixed random number intermediate parameter is generated. Specifically, the first random number mixed value and the local sample label are input into a preset intermediate parameter calculation formula to calculate the mixed random number intermediate parameter, wherein the preset intermediate parameter calculation formula is as follows:

[0102]

[0103] Among them, d Bis the intermediate parameter of the mixed random number, WX+r 1 is the first random number mixing value, r 1 is a preset first random number, WX is a local model prediction value in plain text state, and y is the local sample label.

[0104] Step A23, performing homomorphic encryption on the mixed random number intermediate parameter to obtain the first random number homomorphic encryption parameter;

[0105] In this embodiment, the mixed random number intermediate parameter is homomorphically encrypted to obtain the first random number homomorphically encrypted parameter. Specifically, based on the homomorphically encrypted public key, the mixed random number intermediate parameter is encrypted into the first random number homomorphically encrypted parameter.

[0106] Step A24, performing homomorphic encryption on the square value of the first random number mixed value to obtain the second random number homomorphic encryption parameter;

[0107] In this embodiment, the square value of the first random number mixed value is homomorphically encrypted to obtain the second random number homomorphic encryption parameter. Specifically, the square value of the first random number mixed value is calculated, and based on the homomorphically encrypted public key, the square value of the first random number mixed value is homomorphically encrypted to obtain the second random number homomorphically encrypted parameter.

[0108] Step A25, homomorphically encrypt the product of the second random number mixed value and the local sample label to obtain the third random number homomorphic encryption parameter.

[0109] In this embodiment, the product of the second random number mixed value and the local sample label is homomorphically encrypted to obtain the third random number homomorphic encryption parameter. Specifically, the product of the second random number mixed value and the local sample label is calculated, and based on the public key of homomorphic encryption, the product of the second random number mixed value and the local sample label is homomorphically encrypted to obtain the third random number homomorphic encryption parameter. For example, assuming that the second random number mixed value is WX*r 2 , the local sample label is y, then the third random number homomorphic encryption parameter is [[yWX*r 2 ]].

[0110] Additionally, in another implementation, the method of generating the third random number homomorphic encryption parameter further includes:

[0111] Based on the public key of homomorphic encryption, the local sample label is homomorphically encrypted to obtain the homomorphically encrypted local sample label, and then based on the homomorphically encrypted local sample label and the second random number encrypted value, the product of the local sample label in the homomorphic encryption state and the second random number encrypted value is calculated by homomorphic encryption multiplication to obtain the third random number homomorphic encryption parameter. For example, assuming that the second random number mixed value is [[WX]]*r 2 , the local sample label is y, then the third random number homomorphic encryption parameter is [[yWX]]*r 2 .

[0112] Step A30, sending each of the random number encrypted intermediate parameters to the first device, so that the first device generates an encrypted model gradient and an encrypted model loss based on each of the random number encrypted intermediate parameters;

[0113] In this embodiment, it should be noted that each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter and a third random number homomorphic encryption parameter, wherein the first random number homomorphic encryption parameter is used to calculate the encryption model gradient, and the second random number homomorphic encryption parameter and the third random number homomorphic encryption parameter are used to calculate the encryption model loss.

[0114] Step A40, interacting with the first device to determine the state of model iteration training, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model.

[0115] In this embodiment, the model iteration training status judgment interaction is performed with the first device, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model. Specifically, the encrypted model loss sent by the first device is received, and based on the decrypted encrypted model loss, a target judgment result is generated to determine whether the iterative training of the local model to be trained is completed, and the target judgment result is fed back to the first device, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the target judgment result to obtain the target federated model.

[0116] The step of performing model iteration training state judgment interaction with the first device so that the first device optimizes the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model includes:

[0117] Step A41, receiving the encrypted model loss sent by the first device, and decrypting the encrypted model loss to obtain a local model loss;

[0118] In this embodiment, the encrypted model loss sent by the first device is received, and the encrypted model loss is decrypted to obtain the local model loss. Specifically, the encrypted model loss sent by the first device is received, and the encrypted model loss is decrypted based on the homomorphic encrypted private key to obtain the local model loss in plain text.

[0119] Step A42, judging whether the iterative training of the local model to be trained is completed according to the local model loss, and obtaining a judgment result of the model iterative training state;

[0120] In this embodiment, based on the local model loss, it is determined whether the iterative training of the local model to be trained is completed, and a model iterative training status judgment result is obtained. Specifically, it is determined whether the local model loss has converged. If so, it is determined that the local model to be trained is in an iterative training completed state. If not, it is determined that the local model to be trained is in a non-iterative training completed state, thereby obtaining a model iterative training status judgment result.

[0121] Step A43: Send the model iteration training status judgment result to the first device, so that the first device optimizes the local model to be trained based on the model iteration training status judgment result and the encrypted model loss to obtain the target federated model.

[0122] In this embodiment, the model iteration training status judgment result is sent to the first device, so that the first device can optimize the local model to be trained based on the model iteration training status judgment result and the encrypted model loss to obtain the target federal model. Specifically, the model iteration training status judgment result is sent to the first device, and then the first device receives the model iteration training status judgment result. If the first device determines that the iterative training of the local model to be trained is completed based on the model iteration training status judgment result, the encrypted model parameters of the local model to be trained are decrypted through decryption interaction with the second device to obtain the target federal model. If the first device determines that the iterative training of the local model to be trained is not completed based on the model iteration training status judgment result, the encrypted model parameters of the local model to be trained are updated based on the encrypted model gradient, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned. The specific steps of optimizing the local model to be trained based on the model iteration training status judgment result and the encrypted model loss to obtain the target federal model can refer to the specific contents of step S40 and its detailed steps, which will not be repeated here.

[0123] The embodiment of the present application provides a method for optimizing modeling of federated learning. Compared with the prior art, the label owner participating in federated learning usually needs to send the homomorphically encrypted label to the unlabeled feature owner, and then the feature owner calculates the homomorphically encrypted gradient and homomorphically encrypted loss based on the homomorphically encrypted label, and sends the homomorphically encrypted gradient and homomorphically encrypted loss to the label owner, and then the label owner decrypts the homomorphically encrypted gradient and homomorphically encrypted loss, and then feeds back the model gradient and model loss in the plaintext state to the feature owner for model update. The embodiment of the present application receives a first random number encryption value and a second random number encryption value sent by a first device, wherein the first random number encryption value and the second random number encryption value are encrypted and generated by the first device based on a preset first random number and a preset second random number, respectively, to the local model prediction value corresponding to the local model to be trained, and then based on the first random number encryption value and the second random number encryption value and the local sample label, each random number encryption intermediate parameter is generated, and then each of the random number encryption intermediate parameters is sent to the first device for the first device to use based on each of the random number encryption values. The first device encrypts the intermediate parameters, generates the encrypted model gradient and the encrypted model loss, and then interacts with the first device to judge the model iteration training state, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model. It should be noted that when the first device and the second device interact, the second device sends only the encrypted intermediate parameters to the first device, and there is no need to send the homomorphically encrypted label, and the first device does not need to send the ciphertext content to the second device during the iteration process, and the second device decrypts and then feeds back the plaintext content. Therefore, the first device cannot obtain the privacy data of the second device by replacing the ciphertext content. Therefore, it overcomes the technical defect that if the feature owner, after receiving the homomorphically encrypted label, sends the ciphertext content (homomorphically encrypted label) that he wants to know to the label owner instead of the homomorphically encrypted gradient and homomorphically encrypted loss, and then the label owner decrypts and feeds back the decryption result to the feature owner, the feature owner can obtain the sample label of the label owner, thereby improving the security of building a logistic regression model based on federated learning.

[0124] Reference Figure 4 , Figure 4 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.

[0125] like Figure 4As shown, the federated learning modeling optimization device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0126] Optionally, the federated learning modeling optimization device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0127] Those skilled in the art will understand that Figure 4 The structure of the federated learning modeling optimization device shown in the figure does not constitute a limitation of the federated learning modeling optimization device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0128] like Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a federated learning modeling optimization program. The operating system is a program that manages and controls the hardware and software resources of the federated learning modeling optimization device, and supports the operation of the federated learning modeling optimization program and other software and / or programs. The network communication module is used to realize communication between the components inside the memory 1005, and communication with other hardware and software in the federated learning modeling optimization system.

[0129] exist Figure 4 In the federated learning modeling optimization device shown, the processor 1001 is used to execute the federated learning modeling optimization program stored in the memory 1005 to implement the steps of any of the above-mentioned federated learning modeling optimization methods.

[0130] The specific implementation methods of the federated learning modeling optimization device of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.

[0131] The embodiment of the present application further provides a federated learning modeling optimization device, which is applied to a first device and includes:

[0132] A random number encryption module is used to obtain a local model prediction value corresponding to the local model to be trained, and to encrypt the local model prediction value based on a preset first random number and a preset second random number to obtain a first random number encrypted value and a second random number encrypted value;

[0133] a sending module, configured to send the first random number encrypted value and the second random number encrypted value to a second device, so that the second device generates random number encryption intermediate parameters based on the first random number encrypted value and the second random number encrypted value and a local sample label;

[0134] A generation module, configured to receive each random number encrypted intermediate parameter sent by the second device, and generate an encrypted model gradient and an encrypted model loss based on each random number encrypted intermediate parameter;

[0135] An optimization module is used to optimize the local model to be trained based on the encrypted model loss and the encrypted model gradient to obtain a target federated model.

[0136] Optionally, the generating module is further used for:

[0137] Eliminate the random number influence on each random number encryption intermediate parameter to obtain each homomorphic encryption parameter;

[0138] Based on the local feature values ​​corresponding to each of the homomorphic encrypted values ​​and the local model prediction values, the encrypted model gradient and the encrypted model loss are generated.

[0139] Optionally, the generating module is further used for:

[0140] Generate the encrypted model gradient by calculating the product of the first homomorphic encryption intermediate parameter and the local eigenvalue;

[0141] The encryption model loss is generated by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter.

[0142] Optionally, the random number encryption module is further used for:

[0143] Based on the preset first random number and the local model prediction value, generate the first random number encrypted value;

[0144] Calculate the homomorphically encrypted product between the local model prediction value and the preset second random number to obtain the second random number encrypted value.

[0145] Optionally, the optimization module is further used for:

[0146] Sending the encrypted model loss to the second device, so that the second device can generate a target judgment result for judging whether the iterative training of the local model to be trained is completed based on the decrypted encrypted model loss;

[0147] receiving the target judgment result, and if the target judgment result is that the local model to be trained converges, decrypting the model parameters of the local model to be trained by performing decryption interaction with the second device to obtain the target federated model;

[0148] If the target judgment result is that the local model to be trained has not converged, the local model to be trained is optimized based on the encrypted model gradient, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned.

[0149] The specific implementation of the federated learning modeling optimization device of the present application is basically the same as the various embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.

[0150] The embodiment of the present application further provides a federated learning modeling optimization device, which is applied to a second device and includes:

[0151] A receiving module, configured to receive a first random number encrypted value and a second random number encrypted value sent by a first device, wherein the first random number encrypted value and the second random number encrypted value are generated by the first device by encrypting a local model prediction value corresponding to a local model to be trained based on a preset first random number and a preset second random number, respectively;

[0152] A generating module, configured to generate each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value and a local sample label;

[0153] A sending module, used for sending each of the random number encrypted intermediate parameters to a first device, so that the first device generates an encrypted model gradient and an encrypted model loss based on each of the random number encrypted intermediate parameters;

[0154] An interaction module is used to interact with the first device to determine the model iteration training status, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain a target federated model.

[0155] Optionally, the interaction module is further used for:

[0156] receiving the encrypted model loss sent by the first device, and decrypting the encrypted model loss to obtain a local model loss;

[0157] According to the local model loss, determine whether the iterative training of the local model to be trained is completed, and obtain a model iterative training status judgment result;

[0158] The model iteration training status judgment result is sent to the first device, so that the first device optimizes the local model to be trained based on the model iteration training status judgment result and the encrypted model loss to obtain the target federated model.

[0159] Optionally, the generating module is further used for:

[0160] Decrypting the first random number encrypted value and the second random number encrypted value to obtain a first random number mixed value and a second random number mixed value;

[0161] Generate a mixed random number intermediate parameter based on the first random number mixed value and the local sample label;

[0162] Performing homomorphic encryption on the mixed random number intermediate parameter to obtain the first random number homomorphic encryption parameter;

[0163] Performing homomorphic encryption on the square value of the first random number mixed value to obtain the second random number homomorphic encryption parameter;

[0164] Perform homomorphic encryption on the product of the second random number mixed value and the local sample label to obtain the third random number homomorphic encryption parameter.

[0165] The specific implementation of the federated learning modeling optimization device of the present application is basically the same as the various embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.

[0166] An embodiment of the present application provides a medium, which is a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of the federated learning modeling optimization method described in any one of the above items.

[0167] The specific implementation methods of the readable storage medium of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.

[0168] An embodiment of the present application provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement the steps of any of the above-mentioned federated learning modeling optimization methods.

[0169] The specific implementation methods of the computer program product of the present application are basically the same as the embodiments of the above-mentioned federated learning modeling optimization method, and will not be repeated here.

[0170] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A federated learning modeling optimization method, It is characterized in that The federated learning modeling optimization method is applied to a first device, and the federated learning modeling optimization method includes: Obtain a local model prediction value corresponding to the local model to be trained, and generate a first random number encrypted value based on a preset first random number and the local model prediction value; Calculate the homomorphically encrypted product of the local model prediction value and a preset second random number to obtain a second random number encrypted value; Sending the first random number encrypted value and the second random number encrypted value to a second device, so that the second device generates random number encrypted intermediate parameters based on the first random number encrypted value and the second random number encrypted value and a local sample label; Receive each random number encryption intermediate parameter sent by the second device, eliminate the random number influence of each random number encryption intermediate parameter, and obtain each homomorphic encryption parameter; generate an encryption model gradient and an encryption model loss based on each homomorphic encryption parameter and the local eigenvalue corresponding to the local model prediction value; Based on the encrypted model loss and the encrypted model gradient, optimizing the local model to be trained to obtain a target federated model; Each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter, and a third random number homomorphic encryption parameter. The step of generating each random number encryption intermediate parameter based on the first random number encryption value, the second random number encryption value, and the local sample label includes: Decrypting the first random number encrypted value and the second random number encrypted value to obtain a first random number mixed value and a second random number mixed value; Generate a mixed random number intermediate parameter based on the first random number mixed value and the local sample label; Performing homomorphic encryption on the mixed random number intermediate parameter to obtain the first random number homomorphic encryption parameter; Performing homomorphic encryption on the square value of the first random number mixed value to obtain the second random number homomorphic encryption parameter; Performing homomorphic encryption on the product of the second random number mixed value and the local sample label to obtain the third random number homomorphic encryption parameter; The homomorphic encryption parameters include a first homomorphic encryption intermediate parameter, a second homomorphic encryption intermediate parameter, and a third homomorphic encryption intermediate parameter. The step of generating an encrypted model gradient and an encrypted model loss based on each of the homomorphic encryption parameters and a local eigenvalue corresponding to the local model prediction value includes: Generate the encrypted model gradient by calculating the product of the first homomorphic encryption intermediate parameter and the local eigenvalue; The encryption model loss is generated by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter.

2. The federated learning modeling optimization method as claimed in claim 1, It is characterized in that The step of optimizing the local model to be trained based on the encryption model loss and the encryption model gradient to obtain the target federated model comprises: Sending the encrypted model loss to the second device, so that the second device can generate a target judgment result for judging whether the iterative training of the local model to be trained is completed based on the decrypted encrypted model loss; receiving the target judgment result, and if the target judgment result is that the local model to be trained converges, decrypting the model parameters of the local model to be trained by performing decryption interaction with the second device to obtain the target federated model; If the target judgment result is that the local model to be trained has not converged, the local model to be trained is optimized based on the encrypted model gradient, and the step of obtaining the local model prediction value corresponding to the local model to be trained is returned.

3. A federated learning modeling optimization method, It is characterized in that The federated learning modeling optimization method is applied to a second device, and the federated learning modeling optimization method includes: Receive a first random number encrypted value and a second random number encrypted value sent by a first device, wherein the first random number encrypted value is generated based on a preset first random number and a local model prediction value, and the second random number encrypted value is obtained by calculating a homomorphic encrypted product between the local model prediction value and a preset second random number; Based on the first random number encryption value, the second random number encryption value and the local sample label, each random number encryption intermediate parameter is generated, each of the random number encryption intermediate parameters includes a first random number homomorphic encryption parameter, a second random number homomorphic encryption parameter and a third random number homomorphic encryption parameter, and the first random number mixed value and the second random number mixed value are obtained by decrypting the first random number encryption value and the second random number encryption value; based on the first random number mixed value and the local sample label, a mixed random number intermediate parameter is generated; the mixed random number intermediate parameter is homomorphically encrypted to obtain the first random number homomorphic encryption parameter; the square value of the first random number mixed value is homomorphically encrypted to obtain the second random number homomorphic encryption parameter; the product of the second random number mixed value and the local sample label is homomorphically encrypted to obtain the third random number homomorphic encryption parameter; Send each of the random number encryption intermediate parameters to the first device, so that the first device can eliminate the random number influence on each of the random number encryption intermediate parameters, and obtain a first homomorphic encryption intermediate parameter, a second homomorphic encryption intermediate parameter, and a third homomorphic encryption intermediate parameter; generate an encryption model gradient by calculating the product of the first homomorphic encryption intermediate parameter and the local eigenvalue; generate an encryption model loss by calculating the difference between the second homomorphic encryption intermediate parameter and the third homomorphic encryption intermediate parameter; Interact with the first device to determine the state of model iteration training, so that the first device can optimize the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model.

4. The federated learning modeling optimization method as claimed in claim 3, It is characterized in that The step of performing model iteration training state judgment interaction with the first device so that the first device optimizes the local model to be trained based on the encrypted model gradient and the encrypted model loss to obtain the target federated model includes: receiving the encrypted model loss sent by the first device, and decrypting the encrypted model loss to obtain a local model loss; According to the local model loss, determine whether the iterative training of the local model to be trained is completed, and obtain a model iterative training status judgment result; The model iteration training status judgment result is sent to the first device, so that the first device optimizes the local model to be trained based on the model iteration training status judgment result and the encrypted model loss to obtain the target federated model.

5. A federated learning modeling optimization device, It is characterized in that The federated learning modeling optimization device includes: a memory, a processor, and a program stored in the memory for implementing the federated learning modeling optimization method. The memory is used to store a program for implementing a federated learning modeling optimization method; The processor is used to execute a program for implementing the federated learning modeling optimization method to implement the steps of the federated learning modeling optimization method as described in any one of claims 1 to 2 or 3 to 4.

6. A medium, the medium being a readable storage medium, It is characterized in that The readable storage medium stores a program for implementing the federated learning modeling optimization method, and the program for implementing the federated learning modeling optimization method is executed by a processor to implement the steps of the federated learning modeling optimization method as described in any one of claims 1 to 2 or 3 to 4.

7. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the federated learning modeling optimization method as described in any one of claims 1 to 2 or 3 to 4 are implemented.

Citation Information

Patent Citations

  • Federated learning training data privacy enhancement method and system

    CN110572253A

  • Longitudinal federation learning method, device, system for improving safety, and storage medium

    CN110704860A