Model training method and device, data prediction method, medium, and electronic device
By using the target public key in privacy-preserving machine learning to encrypt the local model parameters and feature data of the joint logistic regression model, the problem of low feature data security caused by the collusion of Class A roles and Class C roles is solved, achieving more efficiency. and secure model training process.
Patent Information
- Application Number
- CN202011172930.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-28
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-10-28
AI Technical Summary
In the cross-feature scenario of privacy-preserving machine learning, the collusion of Class A characters and Class C characters can construct an equation through the inner product of cumulative weights and feature data to solve the actual content of the feature data, resulting in the security of the characteristic data of Class B characters. Low.
The target public key is used to encrypt the local model parameters and feature data of the joint logistic regression model. Through the encryption and decryption process between data holders in multi-party machine learning, the security of the encryption gradient is ensured and the feature data is prevented from being illegally obtained. .
It improves the security of feature data, prevents Class A characters and Class C characters from colluding to obtain feature data, and improves the efficiency and safety of model training.
Smart Images

Figure CN112288002B
Abstract
Description
Background Art
[0002] The "cross-feature" scenario in privacy-preserving machine learning belongs to the "cross-feature federation" in the knowledge federation theory system. It means that the training or inference samples used by multiple institutions are consistent, but the features are different. Only one institution holds the labels, and training and inference can be completed with the assistance of a trusted third-party institution without data.
[0003] In a privacy-preserving machine learning model, all participating institutions are divided into three roles: A, B, and C. Among them, the A role holds feature data and feature labels, the B role only holds features, and the C role holds neither feature data nor feature labels, and is an auxiliary role. Specifically, during the training process, the A role and the B role send the inner product of the encrypted weight and feature data to the C role, and then complete the model training with the assistance of the C role.
[0004] However, the above scheme has the following defects: if Class A and Class C characters collude, Class C characters can construct equations by accumulating the inner products of different weights and fixed feature data, and the actual content of the feature data can be solved as the training progresses, resulting in lower security of Class B character's feature data; by the same token, it can be inferred that the security of Class A character's feature data is also lower.
[0005] Therefore, it is necessary to provide a new model training method and device.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0007] The purpose of the present invention is to provide a model training method, a model training device, a data prediction method, a computer-readable storage medium and an electronic device, thereby at least to a certain extent overcoming the problem of low security of feature data caused by the limitations and defects of related technologies.
[0008] According to one aspect of the present disclosure, a model training method is provided, which is configured in a multi-party machine learning to provide a first data holder of first feature data and feature labels, and is used to train a joint logistic regression model. The model training method includes:
[0009] Encrypting the first local model parameter, the first feature data, and the feature label of the joint logistic regression model according to the target public key to obtain first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning;
[0010] Sending the first encrypted data to the second data holder, and receiving a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data according to the first encrypted data and using the target public key to obtain the second encrypted data;
[0011] Generate a first encrypted gradient according to the first intermediate variable and the first feature data, send the first encrypted gradient to the second data holder, and receive a decrypted first encrypted gradient sent by the second data holder by decrypting the first encrypted gradient using a second private key corresponding to the second public key;
[0012] The decrypted first encrypted gradient is decrypted using a first private key corresponding to the first public key to obtain a first plaintext gradient, and the first local model parameter is updated using the first plaintext gradient.
[0013] In an exemplary embodiment of the present disclosure, generating a first encrypted gradient according to the first intermediate variable and the first characteristic data includes:
[0014] Generate a first random vector;
[0015] The first encrypted gradient is generated according to the first intermediate variable, the first characteristic data and the first random vector.
[0016] In an exemplary embodiment of the present disclosure, decrypting the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient includes:
[0017] Decrypting the decrypted first encrypted gradient using the first random vector to obtain a first plaintext gradient to be decrypted;
[0018] The first plaintext gradient to be decrypted is decrypted again using a first private key corresponding to the first public key to obtain the first plaintext gradient.
[0019] In an exemplary embodiment of the present disclosure, the first encrypted gradient is sent to the second data holder, and the first encrypted gradient is decrypted using the second private key corresponding to the second public key sent by the second data holder, and the decrypted first encrypted gradient obtained includes:
[0020] Sending the first encrypted gradient to an auxiliary party in the multi-party machine learning, so that the auxiliary party sends the first encrypted gradient to the second data holder;
[0021] Receive the decrypted first encrypted gradient sent by the auxiliary party; wherein the decrypted first encrypted gradient is obtained by the second data holder using the second private key corresponding to the second public key to decrypt the first encrypted gradient, and sent to the auxiliary party.
[0022] According to one aspect of the present disclosure, a model training method is provided, which is configured in a second data holder providing second feature data in multi-party machine learning, and is used to train a joint logistic regression model. The model training method includes:
[0023] The second local model parameter of the joint logistic regression model and the second feature data are encrypted using a target public key to obtain second encrypted data; wherein the target public key is calculated based on a first public key held by a first data holder who provides first feature data and feature labels in multi-party machine learning, and a second public key held by the second data holder;
[0024] Receive first encrypted data sent by the first data holder, obtained by encrypting the first local model parameter, the first feature data, and the feature label of the joint logistic regression model using the target public key, and generate a first intermediate variable according to the first encrypted data and the second encrypted data;
[0025] Generate a second encrypted gradient according to the first intermediate variable and the second feature data, send the second encrypted gradient to the first data holder, and receive a decrypted second encrypted gradient sent by the first data holder by decrypting the second encrypted gradient using a first private key corresponding to the first public key;
[0026] The decrypted second encrypted gradient is decrypted using a second private key corresponding to the second public key to obtain a second plaintext gradient, and the second local model parameter is updated using the second plaintext gradient.
[0027] According to one aspect of the present disclosure, a data prediction method is provided, which is configured in a first data holder providing first data to be predicted in multi-party machine learning, and is used to perform data prediction according to a data prediction model obtained by training a joint logistic regression model, and the data prediction method includes:
[0028] Obtaining third data to be encrypted according to the first data to be predicted and the first local model parameter of the data prediction model, and encrypting the third data to be encrypted according to the target public key to obtain third encrypted data; wherein the data prediction model is obtained by training the joint logistic regression model according to any one of the model training methods; the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in the multi-party machine learning;
[0029] Sending the third encrypted data to the second data holder, and receiving the target data to be predicted sent by the second data holder, which is obtained based on the third encrypted data and the fourth encrypted data; wherein the fourth encrypted data is obtained by the second data holder encrypting the second data to be predicted using the target public key;
[0030] The target data to be predicted is decrypted using a first private key corresponding to the first public key, and the decrypted target data to be predicted is predicted using the data prediction model to obtain a prediction result.
[0031] In an exemplary embodiment of the present disclosure, sending the third encrypted data to the second data holder, and receiving the target data to be predicted obtained according to the third encrypted data and the fourth encrypted data sent by the second data holder, includes:
[0032] Sending the third encrypted data to an auxiliary party in the multi-party machine learning, so that the auxiliary party concatenates the third encrypted data and the fourth encrypted data sent by the second data holder to obtain the target data to be predicted;
[0033] Receive the target data to be predicted sent by the auxiliary party.
[0034] According to one aspect of the present disclosure, a model training device is provided, which is configured as a first data holder providing first feature data and feature labels in multi-party machine learning, and is used to train a joint logistic regression model. The model training device includes:
[0035] A first encryption module, used to encrypt the first local model parameter, the first feature data and the feature label of the joint logistic regression model according to a target public key to obtain first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning;
[0036] a first receiving module, configured to send the first encrypted data to the second data holder, and receive a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data according to the first encrypted data and the second encrypted data using the target public key;
[0037] a first encrypted gradient generating module, configured to generate a first encrypted gradient according to the first intermediate variable and the first characteristic data, send the first encrypted gradient to the second data holder, and receive a decrypted first encrypted gradient obtained by decrypting the first encrypted gradient using a second private key corresponding to the second public key, sent by the second data holder;
[0038] The first parameter updating module is used to decrypt the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient, and update the first local model parameter using the first plaintext gradient.
[0039] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it implements any one of the above-mentioned model training methods and any one of the above-mentioned data prediction methods.
[0040] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0041] Processor; and
[0042] A memory, configured to store executable instructions of the processor;
[0043] Wherein, the processor is configured to execute any one of the above-mentioned model training methods and any one of the above-mentioned data prediction methods by executing the executable instructions.
[0044] A model training method provided by an exemplary embodiment of the present invention, on the one hand, encrypts the first local model parameter, first feature data and feature label of a joint logistic regression model according to a target public key to obtain first encrypted data; then sends the first encrypted data to a second data holder, and receives a first intermediate variable generated by the second data holder according to the first encrypted data and the second encrypted data obtained by encrypting the second feature data using the target public key; then generates a first encrypted gradient according to the first intermediate variable and the first feature data, sends the first encrypted gradient to the second data holder, and receives the first encrypted gradient sent by the second data holder by decrypting the first encrypted gradient using the second private key corresponding to the second public key to obtain the decrypted first encrypted gradient; finally, decrypts the decrypted first encrypted gradient using the first private key corresponding to the first public key to obtain the first plaintext gradient, and updates the first local model parameter using the first plaintext gradient; since the first encrypted data and the second encrypted data included in the first encrypted gradient (that is, the inner product of the encrypted weight and the feature data) are respectively encrypted using the first public key held by the first data holder with and the second public key held by the second data holder, and the first private key corresponding to the first public key and the second private key corresponding to the second public key are respectively held by the first data holder and the second data holder, and the specific encryption and decryption processes are performed on the first data holder side, so there will be no problem of the first data holder or the second data holder colluding with a third party to obtain the feature data of the other party. Therefore, the problem that if a class A role and a class C role collude in the prior art, the class C role can construct an equation by accumulating the inner product of different weights and fixed feature data, and the actual content of the feature data can be solved as the training progresses, resulting in the low security of the feature data of the class B role; by the same token, it can be known that the security of the feature data of the class A role is also low, thereby improving the security of the feature data; on the other hand, since the overall training process is distributed among multiple parties, it avoids the problem of heavy data processing burden and low training efficiency caused by the need to train on one party, improves the update efficiency of the first local model parameters, and thereby improves the training efficiency of the model.
[0045] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0047] Figure 1 A flowchart of a model training method according to an example embodiment of the present invention is schematically shown.
[0048] Figure 2 A block diagram of a model training system according to an example embodiment of the present invention is schematically shown.
[0049] Figure 3 A flowchart of a method for generating a first encrypted gradient according to a first intermediate variable, first feature data, and a first random vector according to an exemplary embodiment of the present invention is schematically shown.
[0050] Figure 4 A flowchart of another model training method according to an example embodiment of the present invention is schematically shown.
[0051] Figure 5 A flow chart of a data prediction method according to an exemplary embodiment of the present invention is schematically shown.
[0052] Figure 6 A flowchart of another model training method according to an example embodiment of the present invention is schematically shown.
[0053] Figure 7 A flow chart schematically illustrates another data prediction method according to an exemplary embodiment of the present invention.
[0054] Figure 8 A block diagram of a model training device according to an example embodiment of the present invention is schematically shown.
[0055] Fig. 9 A block diagram schematically shows another model training device according to an exemplary embodiment of the present invention.
[0056] Fig.10 A block diagram of a data prediction device according to an exemplary embodiment of the present invention is schematically shown.
[0057] Fig.11 An electronic device for implementing the above-mentioned model training method and data prediction method according to an example embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0058] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0059] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0060] Privacy-preserving machine learning is an important branch of machine learning, which aims to study the joint training and reasoning of multiple institutions without exposing the local data (including feature data and labels) of each institution. The "cross-feature" scenario in privacy-preserving machine learning belongs to the "cross-feature federation" in the knowledge federation theory system, which means that the training or reasoning samples used by multiple institutions are consistent, but the features are different. Only one institution holds the label, and training and reasoning can be completed with the assistance of a trusted third-party institution without data. Given the wide application of logistic regression algorithms, privacy-preserving logistic regression in cross-feature scenarios also plays an important role in the field of privacy-preserving machine learning.
[0061] In a security model, all participating organizations are divided into three types of roles: A, B, and C. Among them, the A-type role holds feature data and feature labels, the B-type role only holds features, and the C-type role holds neither feature data nor feature labels, and is an auxiliary role. In addition, in the exemplary embodiment of the present invention, each time training or reasoning, the A-type and C-type roles are played by only one organization, denoted as A1 and C1, respectively. The B-type role can include multiple organizations. Assume that there are h B-type role organizations, denoted as B i, where i∈[1,h]. The network topology involved is a mesh structure, that is, the A-type role and the B-type role can communicate directly or through the C-type role; the A-type role communicates directly with the C-type role, and the B-type role communicates directly with the C-type role.
[0062] Based on the above security model, there are the following malicious collusion situations:
[0063] One is that A1 and C1 conspire to obtain the characteristic data of Class B characters;
[0064] One is, ( is not empty) and C1 collude to obtain the feature data or feature labels of the A-type role and other B-type roles;
[0065] Another is, ( is not empty) and A1 collude to obtain the characteristic data of other B-type characters.
[0066] The currently available public privacy-preserving logistic regression methods lack robustness against both the first and second malicious collusion scenarios mentioned above. The reasons for this are as follows:
[0067] One is: assuming that A1 and C1 collude, C1 can construct an equation by accumulating the inner product of different weights and fixed feature data. As the training progresses, the actual content of the feature data can be solved, resulting in lower security of the feature data of Class B characters; by the same token, it can be inferred that the security of the feature data of Class A characters is also lower.
[0068] The other is that since Class A and Class B roles need to redistribute the secrets of both parties with the assistance of Class C roles, if Class A and Class C roles collude, they can obtain the feature data of Class B roles, which makes the security of the feature data of Class B roles lower; by the same token, the security of the feature data of Class A roles is also lower.
[0069] Based on this, this exemplary embodiment first provides a model training method, which can be configured in the multi-party machine learning to provide the first data holder of the first feature data and feature labels, and can be used to train the joint logistic regression model. The first data holder can be a server, a server cluster or a cloud server, etc. Of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the model training method may include the following steps:
[0070] Step S110. Encrypt the first local model parameter, the first feature data, and the feature label of the joint logistic regression model according to the target public key to obtain first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning;
[0071] Step S120. Send the first encrypted data to the second data holder, and receive a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data according to the first encrypted data and the target public key to obtain the second encrypted data;
[0072] Step S130. Generate a first encrypted gradient according to the first intermediate variable and the first characteristic data, send the first encrypted gradient to the second data holder, and receive the first encrypted gradient decrypted by the second data holder using the second private key corresponding to the second public key to obtain the decrypted first encrypted gradient;
[0073] Step S140. Decrypt the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient, and update the first local model parameter using the first plaintext gradient.
[0074] In the above model training method, on the one hand, the first local model parameter, the first feature data and the feature label of the joint logistic regression model are encrypted according to the target public key to obtain the first encrypted data; then the first encrypted data is sent to the second data holder, and the first intermediate variable generated by the second data holder according to the first encrypted data and the second encrypted data after encrypting the second feature data is received; then the first encrypted gradient is generated according to the first intermediate variable and the first feature data, and the first encrypted gradient is sent to the second data holder, and the first encrypted gradient is decrypted using the second private key corresponding to the second public key sent by the second data holder to obtain the decrypted first encrypted gradient; finally, the decrypted first encrypted gradient is decrypted using the first private key corresponding to the first public key to obtain the first plaintext gradient, and the first local model parameter is updated using the first plaintext gradient; since the first encrypted data and the second encrypted data included in the first encrypted gradient (that is, the inner product of the encrypted weight and the feature data) are respectively obtained through the first public key held by the first data holder and the second data holder. The data is encrypted by the second public key held by the first data holder, and the first private key corresponding to the first public key and the second private key corresponding to the second public key are respectively held by the first data holder and the second data holder, and the specific encryption and decryption processes are performed on the first data holder side, so there will be no problem of the first data holder or the second data holder colluding with a third party to obtain the feature data of the other party. Therefore, the problem that if a class A role and a class C role collude in the prior art, the class C role can construct an equation by accumulating the inner product of different weights and fixed feature data, and the actual content of the feature data can be solved as the training progresses, resulting in the low security of the feature data of the class B role; by the same token, it can be known that the security of the feature data of the class A role is also low, thereby improving the security of the feature data; on the other hand, since the overall training process is distributed among multiple parties, it avoids the problem of heavy data processing burden and low training efficiency caused by the need to train on one party, improves the update efficiency of the first local model parameters, and thereby improves the training efficiency of the model.
[0075] Hereinafter, each step involved in the model training method of the exemplary embodiment of the present invention will be explained and illustrated in detail with reference to the accompanying drawings.
[0076] First, the model training system involved in the exemplary embodiment of the present invention is explained and described. Figure 2 As shown, the model training system may include: a first data holder 210 providing first feature data and feature labels, and a second data holder 220 providing second feature data; the first data holder and the second data holder are connected to each other via a network.
[0077] Among them, the first data holder can be used to: encrypt the first local model parameter, first feature data and feature label of the joint logistic regression model according to the target public key to obtain first encrypted data; and send the first encrypted data to the second data holder, and receive the first intermediate variable generated by the second data holder according to the first encrypted data and the second encrypted data after encrypting the second feature data; and generate a first encrypted gradient according to the first intermediate variable and the first feature data, send the first encrypted gradient to the second data holder, and receive the first encrypted gradient sent by the second data holder by decrypting the first encrypted gradient using the second private key corresponding to the second public key to obtain the decrypted first encrypted gradient; and decrypt the decrypted first encrypted gradient using the first private key corresponding to the first public key to obtain the first plaintext gradient, and use the first plaintext gradient to update the first local model parameters.
[0078] The second data holder can be used to: encrypt the second local model parameters and the second feature data of the joint logistic regression model using the target public key to obtain second encrypted data; and receive the first encrypted data sent by the first data holder, which is obtained by encrypting the first local model parameters, the first feature data and the feature label of the joint logistic regression model using the target public key, and generate a first intermediate variable based on the first encrypted data and the second encrypted data; and generate a second encrypted gradient based on the first intermediate variable and the second feature data, send the second encrypted gradient to the first data holder, and receive the second encrypted gradient sent by the first data holder, which is decrypted by using the first private key corresponding to the first public key, to obtain the decrypted second encrypted gradient; and decrypt the decrypted second encrypted gradient using the second private key corresponding to the second public key to obtain the second plaintext gradient, and update the second local model parameters using the second plaintext gradient.
[0079] Furthermore, the above-mentioned model training system may also include an auxiliary party 230, which is connected to the first data holder and the second data holder through a network. The auxiliary party may be used to receive a first encrypted gradient sent by the first data holder, send the first encrypted gradient to the second data holder, receive the decrypted first encrypted gradient sent by the second data holder after decrypting the first encrypted gradient, and then send the decrypted first encrypted gradient to the first data holder; and receive a second encrypted gradient sent by the second data holder, send the second encrypted gradient to the first data holder, receive the decrypted second encrypted gradient sent by the first data holder after decrypting the second encrypted gradient, and then send the decrypted second encrypted gradient to the second data holder.
[0080] Next, steps S110 to S140 are explained and illustrated in conjunction with the above data encryption system.
[0081] In step S110, the first local model parameter, the first feature data and the feature label of the joint logistic regression model are encrypted according to the target public key to obtain the first encrypted data; wherein the target public key is calculated based on the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning.
[0082] In this example embodiment, first, the first data holder may generate a first public key through an encryption algorithm, which may be Ec-Elgamal or other encryption algorithms, and this example does not impose any special restrictions on this, and receive a second public key generated by the second data holder through the encryption algorithm, and then generate a target public key based on the first public key and the second public key.
[0083] Secondly, after obtaining the target public key, the target public key can be used to encrypt the first local model parameters of the joint logistic regression model, the first feature data and the feature label to obtain the first encrypted data. Specifically, it may include: first, generating the first data to be encrypted according to the first local model parameters of the first data holder, the first feature data and the feature label; second, encrypting the first data to be encrypted using the first public key to obtain the first encrypted data. Among them, obtaining the first data to be encrypted according to the first local model parameters of the first data holder, the first feature data and the feature label may include: first, performing a product operation on the first local model parameters of the first data holder and the first feature data; second, performing a difference operation on the product operation result and the feature label to obtain the first data to be encrypted. Among them, the calculation method of the first data to be encrypted can refer to the following formula (1):
[0084]
[0085] Among them, x1 is the first feature data, t1 is the first local model parameter, y is the feature label, and u is the first data to be encrypted. Further, after obtaining the first data to be encrypted, the first data to be encrypted can be encrypted according to the target public key (pub_key) to obtain the first encrypted data [u]. It should be noted here that the first data to be encrypted is obtained according to the second-order Taylor expansion of the loss function of the model to be trained. Of course, the first data to be encrypted can also be expanded to a multi-order Taylor expansion, and this example does not impose special restrictions on this. The specific reasons are as follows: Since in the process of training the model to be trained, it is necessary to adjust the first local model parameters and the second local model parameters included therein according to the loss function, therefore, in order to complete the training of the model to be trained, it is necessary to construct the above-mentioned first data to be encrypted.
[0086] In step S120, the first encrypted data is sent to the second data holder, and a first intermediate variable generated by the second encrypted data sent by the second data holder and obtained by encrypting the second characteristic data based on the first encrypted data and using the target public key is received.
[0087] In this example embodiment, after obtaining the first encrypted data, the first encrypted data can be sent to the second data holder, so that the second data holder generates a first intermediate variable according to the first encrypted data and the second encrypted data. It should be noted here that the first intermediate variable is an expanded term of the loss function of the model to be trained (i.e., the joint logistic regression model).
[0088] In step S130, a first encrypted gradient is generated according to the first intermediate variable and the first characteristic data, the first encrypted gradient is sent to the second data holder, and the first encrypted gradient is decrypted by using the second private key corresponding to the second public key sent by the second data holder to obtain the decrypted first encrypted gradient.
[0089] In this example embodiment, first, a first encrypted gradient can be generated according to the first intermediate variable and the first feature data, and then the first encrypted gradient is sent to the second data holder, so that the second data holder can decrypt the first encrypted gradient according to the second private key, and then obtain the decrypted first encrypted gradient; of course, in order to further improve the security of the feature data, a random vector can also be set in the first encrypted gradient. Specifically, generating the first encrypted gradient according to the first intermediate variable and the first feature data can also include: generating a first random vector, generating the first encrypted gradient according to the first intermediate variable, the first feature data and the first random vector.
[0090] For further reference, Figure 3 As shown, generating the first encrypted gradient according to the first intermediate variable, the first characteristic data and the first random vector may include steps S310 and S330. Among them:
[0091] In step S310, the first random vector is encrypted using the target public key;
[0092] In step S320, an inner product operation is performed on the first intermediate variable and the first characteristic data, and an average value of the inner product operation results is calculated;
[0093] In step S330, a sum operation is performed on the average value and the encrypted first random vector to obtain the first encrypted gradient.
[0094] The following will explain and illustrate steps S310 to S330. Specifically, the calculation method of the first encryption gradient can refer to the following formula (2):
[0095]
[0096] Wherein, [g1] is the first encrypted gradient, mean(·) indicates the average value, [w] indicates the first intermediate variable, and [w] = [u] + [v] ([v] indicates the second encrypted data), It represents the inner product of the first intermediate variable and the first feature data, that is, multiplying the matrix where the first intermediate variable is located and the matrix where the first feature data is located, [z1] represents the encrypted first random vector; wherein, the first random vector is generated by the above-mentioned joint logistic regression model according to the parameters owned by the first data holder, and the scale of the first random vector is the same as the scale of the first intermediate variable.
[0097] It should be noted that, since the first encrypted data and the second encrypted data included in the first intermediate variable are both second-order Taylor expansion terms of the loss function of the model to be trained (i.e., the joint logistic regression model), the data obtained after the operation of the first intermediate variable will also have a gradient, which is the first encrypted gradient mentioned above. At the same time, after obtaining the first encrypted gradient, it is necessary to send the first encrypted gradient to the second data holder so that the second data holder can decrypt the first encrypted gradient.
[0098] At the same time, in order to further reduce the burden of the first data holder and the second data holder, sending the first encrypted gradient to the second data holder and receiving the first encrypted gradient sent by the second data holder after decrypting the first encrypted gradient using the second private key corresponding to the second public key can also be achieved in the following manner: sending the first encrypted gradient to the auxiliary party in the multi-party machine learning, so that the auxiliary party sends the first encrypted gradient to the second data holder; receiving the decrypted first encrypted gradient sent by the auxiliary party; wherein the decrypted first encrypted gradient is obtained by the second data holder using the second private key corresponding to the second public key to decrypt the first encrypted gradient and send it to the auxiliary party. In other words, a third party, that is, an auxiliary party, can also be introduced on the basis of the first data holder and the second data holder; by setting the auxiliary party, when multiple second data holders are involved, the first data holder can directly send the decrypted second encrypted gradient to the auxiliary party, and the auxiliary party will send it to the corresponding second data holders respectively, thereby avoiding the heavy burden caused by the first data holder needing to send multiple decrypted first encrypted gradients to different second data holders respectively, reducing the burden of the first data holder.
[0099] It should be further explained here that, in the above encryption process, another first intermediate variable can also be calculated through the first intermediate variable, that is, [w]' is calculated according to [w], and then [w]' is encrypted using the encrypted first random vector to obtain the first encrypted gradient. This example does not impose any special restrictions on this.
[0100] In step S140, the decrypted first encrypted gradient is decrypted using a first private key corresponding to the first public key to obtain a first plaintext gradient, and the first local model parameter is updated using the first plaintext gradient.
[0101] In this example embodiment, after receiving the decrypted first encrypted gradient, the first data holder can use the first private key held by the holder to decrypt the decrypted first encrypted gradient again to obtain the first plaintext gradient; and then use the first plaintext gradient to update the first local model parameters to complete the training of the joint logistic regression model on the first data holder side. Through this method, since the multi-party machine learning only involves the first data holder and the second data holder, and the first private key and the second private key are only held by the first data holder and the second data holder respectively, it avoids the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure.
[0102] Furthermore, after the first random vector is added to the first encrypted gradient, the specific decryption process can be as follows: the first random vector is used to decrypt the decrypted first encrypted gradient to obtain the first plaintext gradient to be decrypted; the first private key corresponding to the first public key is used to decrypt the first plaintext gradient to be decrypted again to obtain the first plaintext gradient. Specifically, the first decrypted first encrypted gradient can be subtracted from the first random vector to obtain the first plaintext gradient, and then the first private key is used to decrypt the first plaintext gradient to obtain the first plaintext gradient, and then the first local model parameters are updated based on the first plaintext gradient, thereby completing the training of the joint logistic regression model. Through this method, the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure is avoided. The specific reasons are as follows:
[0103] Specifically, since the first data holder encrypts the first data to be encrypted using the target public key, and the first private key and the second private key are both kept by himself, the second data holder cannot decrypt the first data to be encrypted and obtain the first feature data and feature label of the first data holder; at the same time, in the process of the auxiliary party forwarding the decrypted first encrypted gradient, since the auxiliary party does not hold either the first private key or the second private key, it is also impossible to decrypt the decrypted first encrypted gradient and obtain the first feature data.
[0104] Figure 4 A flowchart of another model training method according to an exemplary embodiment of the present invention is schematically shown, wherein the model training method is configured for a second data holder providing second feature data in multi-party machine learning, and is used to train a joint logistic regression model. Figure 4 As shown, the model training method may include steps S410 to S440. Among them:
[0105] In step S410, the second local model parameters of the joint logistic regression model and the second feature data are encrypted using the target public key to obtain second encrypted data; wherein the target public key is calculated based on the first public key held by the first data holder who provides the first feature data and feature labels in multi-party machine learning, and the second public key held by the second data holder.
[0106] Specifically, the calculation method of the second encrypted data can be specifically shown in the following formula (4):
[0107]
[0108] Wherein, v is the second data to be encrypted, x2 is the second feature data, and t2 is the second local model parameter. After the second data to be encrypted is obtained, the target public key can be used to encrypt the second data to be encrypted to obtain the second encrypted data [v]. It should be noted here that the second data to be encrypted is obtained according to the second-order Taylor expansion of the loss function of the model to be trained. Of course, the second data to be encrypted can also be expanded to a multi-order Taylor expansion, and this example does not impose any special restrictions on this. The specific reasons are as follows: In the process of training the model to be trained, it is necessary to adjust the first local model parameters and the second local model parameters included therein according to the loss function. Therefore, in order to complete the training of the model to be trained, it is necessary to construct the above-mentioned second data to be encrypted. At the same time, since the second data holder only provides the second feature data and does not provide the feature label, the second data to be encrypted does not include other items.
[0109] In step S420, first encrypted data sent by the first data holder is received, which is obtained by encrypting the first local model parameter, first feature data and feature label of the joint logistic regression model using the target public key, and a first intermediate variable is generated based on the first encrypted data and the second encrypted data.
[0110] Specifically, the calculation method of the first intermediate variable is:
[0111] [w]=[u]+[v]; wherein [w] represents the first intermediate variable, and [u] represents the first encrypted data.
[0112] In step S430, a second encrypted gradient is generated according to the first intermediate variable and the second characteristic data, the second encrypted gradient is sent to the first data holder, and the second encrypted gradient is decrypted by using the first private key corresponding to the first public key sent by the first data holder to obtain the decrypted second encrypted gradient.
[0113] In this example embodiment, first, a first encrypted gradient can be generated according to the first intermediate variable and the second characteristic data, and then the second encrypted gradient is sent to the first data holder, so that the first data holder can decrypt the second encrypted gradient according to the first private key, and then obtain the decrypted second encrypted gradient; of course, in order to further improve the security of the characteristic data, a random vector can also be set in the second encrypted gradient. Specifically, the second encrypted gradient can also be generated according to the first intermediate variable, the second characteristic data and the second random vector of the second data holder.
[0114] Specifically, the calculation method of the second encryption gradient can be specifically shown in the following formula (5):
[0115]
[0116] Where [g2] is the second encrypted gradient, mean(·) represents the average value, represents the inner product of the first intermediate variable and the second feature data, that is, multiplying the matrix where the first intermediate variable is located and the matrix where the second feature data is located, [z2] represents the encrypted second random vector; wherein, the second random vector is generated by the above-mentioned joint logistic regression model according to the parameters owned by the second data holder, and the second random vector is encrypted using the first public key to obtain the encrypted second random vector, and the scale of the second random vector is the same as that of the first intermediate variable.
[0117] It should be noted here that, since the first intermediate variable is the expanded term of the loss function of the model to be trained (i.e., the joint logistic regression model), after the loss function is derived, there will be a gradient, which is the above-mentioned second encrypted gradient. At the same time, after obtaining the second encrypted gradient, the second encrypted gradient needs to be sent to the auxiliary party so that the auxiliary party can decrypt the second encrypted gradient. At the same time, the calculation method of the first intermediate variable can also be performed on the first data holder side, and this example does not impose any special restrictions on this.
[0118] In step S440, the decrypted second encrypted gradient is decrypted using a second private key corresponding to the second public key to obtain a second plaintext gradient, and the second local model parameter is updated using the second plaintext gradient.
[0119] In this example embodiment, after receiving the decrypted second encrypted gradient, the second data holder can use the second private key held by the holder to decrypt the decrypted second encrypted gradient again to obtain the second plaintext gradient; and then use the second plaintext gradient to update the second local model parameters to complete the training of the joint logistic regression model on the second data holder side. Through this method, since the multi-party machine learning only involves the first data holder and the second data holder, and the first private key and the second private key are only held by the first data holder and the second data holder respectively, it avoids the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure.
[0120] Furthermore, after the second random vector is added to the second encrypted gradient, the specific decryption process can be as follows: the decrypted second encrypted gradient is decrypted using the second random vector to obtain the first plaintext gradient to be decrypted; the second plaintext gradient to be decrypted is decrypted again using the second private key corresponding to the second public key to obtain the second plaintext gradient. Specifically, the second plaintext gradient to be decrypted can be obtained by subtracting the second random vector from the decrypted second encrypted gradient, and then the second plaintext gradient to be decrypted can be decrypted again using the second private key to obtain the second plaintext gradient, and then the second local model parameters are updated based on the second plaintext gradient, thereby completing the training of the joint logistic regression model. Through this method, the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure is avoided. The specific reasons are as follows:
[0121] Specifically, since the second data holder encrypts the second data to be encrypted using the target public key, and both the first private key and the second private key are kept by himself, the first data holder cannot decrypt the second data to be encrypted and obtain the second characteristic data of the second data holder; at the same time, in the process of the auxiliary party forwarding the decrypted second encryption gradient, since the auxiliary party does not hold either the first private key or the second private key, it is also impossible to decrypt the decrypted second encryption gradient and obtain the second characteristic data.
[0122] Figure 5 A flowchart of a data prediction method according to an exemplary embodiment of the present invention is schematically shown, wherein the data prediction method is configured for a first data holder who provides first data to be predicted in multi-party machine learning, and is used to perform data prediction based on a data prediction model obtained by training a joint logistic regression model. Figure 5 As shown, the data prediction method may include steps S510 to S530. Among them:
[0123] In step S510, third data to be encrypted is obtained according to the first data to be predicted and the first local model parameter of the data prediction model, and the third data to be encrypted is encrypted according to the target public key to obtain third encrypted data; wherein the data prediction model is obtained by training the joint logistic regression model according to the aforementioned model training method; the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in the multi-party machine learning;
[0124] Specifically, the calculation method of the third data to be encrypted can be shown in the following formula (3):
[0125] u1=x1·t1; Formula (3)
[0126] Among them, u1 is the third data to be encrypted, x1 is the first data to be predicted (the first data to be predicted here can be the same as the aforementioned first feature data, or it can be a different feature sample, and this example does not impose special restrictions on this), and t1 is the first local model parameter (the first local model parameter is the first local model parameter after training). After the third data to be encrypted is obtained, it can be encrypted using the target public key to obtain the third encrypted data. Among them, the target public key is calculated based on the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in multi-party machine learning. The first public key is generated by the first data holder itself through an encryption algorithm. The encryption algorithm can be an asymmetric encryption algorithm or other encryption algorithms. This example does not impose special restrictions on this. It should be supplemented here that in the process of using the model to predict data, it is necessary to use the trained parameters in the model to predict the input data. Therefore, the third data to be encrypted includes the data to be predicted and the trained first local model parameters.
[0127] In step S520, the third encrypted data is sent to the second data holder, and the target data to be predicted obtained based on the third encrypted data and the fourth encrypted data sent by the second data holder is received; wherein the fourth encrypted data is obtained by the second data holder encrypting the second data to be predicted using the target public key.
[0128] Specifically, after the second data holder splices the third encrypted data and the fourth encrypted data, the second private key held by the second data holder is used to decrypt the spliced data to be predicted, thereby obtaining the target data to be predicted, and then sending the target data to be predicted to the first data holder. Through this method, since the multi-party machine learning data prediction method only involves the first data holder and the second data holder, and the first private key and the second private key are only held by the first data holder and the second data holder respectively, it avoids the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure.
[0129] Furthermore, in order to reduce the burden on the first data holder and the second data holder, the third encrypted data is sent to the second data holder who provides the second data to be predicted in the multi-party machine learning, and the target data to be predicted obtained by the second data holder from the third encrypted data and the fourth encrypted data can also be achieved in the following way: the third encrypted data is sent to the auxiliary party in the multi-party machine learning, so that the auxiliary party splices the third encrypted data and the fourth encrypted data sent by the second data holder to obtain the target data to be predicted; and the target data to be predicted sent by the auxiliary party is received. In other words, a third party, that is, an auxiliary party, can be introduced on the basis of the first data holder and the second data holder; by setting up an auxiliary party, when multiple second data holders are involved, the problem of splicing confusion caused by not knowing which second data holder to splice the data can be avoided, and the burden on the second data holder can also be reduced.
[0130] Of course, this method can also avoid the problem that the A-type role and the C-type role collude to obtain the feature data of the B-type role, thereby making the feature data of the B-type role less secure, or the B-type role and the C-type role collude to obtain the feature data of the A-type role, thereby making the feature data of the A-type role less secure. The specific reasons are as follows:
[0131] Specifically, since the first data holder and the second data holder encrypt the third data to be encrypted and the fourth data to be encrypted using the first private key and the second private key, and the first private key and the second private key are both kept by themselves, the first data holder cannot decrypt the fourth encrypted data to obtain the fourth data to be predicted of the second data holder, and the second data holder cannot decrypt the third encrypted data to obtain the third data to be predicted of the first data holder; at the same time, in the process of the auxiliary party splicing and sending the third encrypted data and the fourth encrypted data, since the auxiliary party does not hold either the first private key or the second private key, it is also impossible to decrypt the third encrypted data and the fourth encrypted data to obtain the first data to be predicted and the second data to be predicted.
[0132] In step S530, the target data to be predicted is decrypted using the first private key corresponding to the first public key, and the decrypted target data to be predicted is predicted using the data prediction model to obtain a prediction result.
[0133] Specifically, the data to be predicted may include the user's data to be scored, user data corresponding to credit assessment, medical diagnosis data to be assessed, etc., or other data, and this example does not impose any special restrictions on this. At the same time, the data prediction model can be used in all scenarios involving logistic regression, which is broadly speaking, binary classification security joint modeling, such as jointly establishing a scoring card model, credit assessment, medical diagnosis, etc. under privacy protection.
[0134] The following, combined Figure 6 The model training method of the exemplary embodiment of the present invention is further explained and illustrated. Figure 6 As shown, the model training method may include the following steps:
[0135] Step S610: The first data holder generates a first public key and a first private key, and sends the first public key to the second data holder; the second data holder generates a second public key and a second private key, and sends the second public key to the first data holder;
[0136] Step S620: The first data holder randomly initializes the first local model parameter t1, generates a target public key according to the first public key and the second public key, generates first encrypted data, and then sends the first encrypted data to the second data holder;
[0137] Step S630: The second data holder randomly initializes a second local model parameter t2, generates a target public key according to the first public key and the second public key, and generates second encrypted data;
[0138] Step S640: the second data holder generates a first intermediate variable according to the first encrypted data and the second encrypted data, and sends the first intermediate variable to the first data holder;
[0139] Step S650, the first data holder generates a first encrypted gradient according to the first intermediate variable, and sends the first encrypted gradient to the auxiliary party;
[0140] Step S660, the second data holder generates a second encrypted gradient according to the first intermediate variable, and sends the second encrypted gradient to the auxiliary party;
[0141] Step S670: the assistant sends the first encrypted gradient and the second encrypted gradient to the second data holder and the first data holder respectively, and sends the decrypted first encrypted gradient and the decrypted second encrypted gradient sent by the second data holder and the first data holder to the first data holder and the second data holder respectively;
[0142] Step S680: the first data holder decrypts the decrypted first encrypted gradient to obtain a first plaintext gradient, and updates the first local model parameter according to the first plaintext gradient;
[0143] In step S690, the second data holder decrypts the decrypted second encrypted gradient to obtain a second plaintext gradient, and updates the second local model parameters according to the second plaintext gradient.
[0144] The following, combined Figure 7 The data prediction method of the exemplary embodiment of the present invention is explained and illustrated. Figure 7 As shown, the data prediction method may include the following steps:
[0145] Step S710: The first data holder generates a first public key and a first private key, and sends the first public key to the second data holder; the second data holder generates a second public key and a second private key, and sends the second public key to the first data holder;
[0146] Step S720: the first data holder generates a target public key according to the first public key and the second public key, generates third encrypted data according to the target public key and the first data to be predicted, and sends the third encrypted data to the auxiliary party;
[0147] Step S730, the second data holder generates a target public key using the first public key and the second public key, generates fourth encrypted data according to the target public key and the second data to be predicted, and sends the fourth encrypted data to the auxiliary party;
[0148] Step S740: the auxiliary party superimposes (sum operation) the third encrypted data and the fourth encrypted data to obtain the spliced data to be predicted; and sends the spliced data to be predicted to the second data holder, so that the second data holder decrypts the spliced data to be predicted according to the second private key to obtain the target data to be predicted, and receives the target data to be predicted sent by the second data holder;
[0149] In step S750, the first data holder receives the target data to be predicted sent by the auxiliary party, and uses the second private key to decrypt the encrypted data to be predicted, obtains the intermediate variables of the cross-feature logistic regression model in plain text, and then obtains the prediction result through the sigmoid function.
[0150] Figure 6 The model training method shown and Figure 7 The data prediction method shown is robust to the three malicious collusion scenarios described above. Specifically:
[0151] In the training part, for the first two cases of malicious collusion, since the auxiliary party only has the model gradient and does not hold the model parameters, that is, during the modeling process, the auxiliary party sends the first plaintext gradient and the second plaintext gradient to the first data holder and the second data holder. In the case where the auxiliary party participates in the collusion with any party, only the average gradient information in the mini-batch of the other party can be obtained. Since the initial model parameters of each party are generated independently and are not exposed during the transmission process, the attacker cannot obtain the model parameters of other parties, and therefore cannot infer the input data of the party; in addition, due to the introduction of the first random vector and the second random vector, the input data of the party cannot be inferred by accumulating the first intermediate variable and the first plaintext gradient or the second plaintext gradient.
[0152] Furthermore, for the third case of malicious collusion, since the first data holder and the second data holder intelligently obtain the first intermediate variable of the ciphertext and their own plaintext gradient, they cannot infer the local data of other role organizations even if they collude.
[0153] Furthermore, for reasons similar to those mentioned above, there will be no data leakage during the data prediction process.
[0154] The present disclosure also provides a model training device, configured to provide a first data holder of first feature data and feature labels in multi-party machine learning. Figure 8 As shown, the model training device may include a first encryption module 810, a first receiving module 820, a first encrypted gradient generation module 830, and a first parameter updating module 840. Among them:
[0155] The first encryption module 810 can be used to encrypt the first local model parameter, the first feature data and the feature label of the joint logistic regression model according to the target public key to obtain the first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning;
[0156] The first receiving module 820 may be used to send the first encrypted data to the second data holder, and receive a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data using the target public key according to the first encrypted data and obtaining the second encrypted data;
[0157] The first encrypted gradient generating module 830 may be configured to generate a first encrypted gradient according to the first intermediate variable and the first feature data, send the first encrypted gradient to the second data holder, and receive a decrypted first encrypted gradient obtained by decrypting the first encrypted gradient using a second private key corresponding to the second public key sent by the second data holder;
[0158] The first parameter updating module 840 may be configured to decrypt the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient, and update the first local model parameter using the first plaintext gradient.
[0159] In an exemplary embodiment of the present disclosure, generating a first encrypted gradient according to the first intermediate variable and the first characteristic data includes:
[0160] Generate a first random vector;
[0161] The first encrypted gradient is generated according to the first intermediate variable, the first characteristic data and the first random vector.
[0162] In an exemplary embodiment of the present disclosure, decrypting the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient includes:
[0163] Decrypting the decrypted first encrypted gradient using the first random vector to obtain a first plaintext gradient to be decrypted;
[0164] The first plaintext gradient to be decrypted is decrypted again using a first private key corresponding to the first public key to obtain the first plaintext gradient.
[0165] In an exemplary embodiment of the present disclosure, the first encrypted gradient is sent to the second data holder, and the first encrypted gradient is decrypted using the second private key corresponding to the second public key sent by the second data holder, and the decrypted first encrypted gradient obtained includes:
[0166] Sending the first encrypted gradient to an auxiliary party in the multi-party machine learning, so that the auxiliary party sends the first encrypted gradient to the second data holder;
[0167] Receive the decrypted first encrypted gradient sent by the auxiliary party; wherein the decrypted first encrypted gradient is obtained by the second data holder using the second private key corresponding to the second public key to decrypt the first encrypted gradient, and sent to the auxiliary party.
[0168] The present disclosure also provides another model training device, which is configured in a second data holder providing second feature data in multi-party machine learning, and is used to train a joint logistic regression model. Fig. 9 As shown, the model training device includes a second encryption module 910, a first intermediate variable generation module 920, a second encrypted gradient generation module 930 and a second model parameter update module 940. Wherein:
[0169] The second encryption module 910 can be used to encrypt the second local model parameter of the joint logistic regression model and the second feature data using a target public key to obtain second encrypted data; wherein the target public key is calculated based on the first public key held by the first data holder who provides the first feature data and feature labels in multi-party machine learning, and the second public key held by the second data holder;
[0170] The first intermediate variable generating module 920 may be configured to receive first encrypted data sent by the first data holder, obtained by encrypting the first local model parameter, the first feature data and the feature label of the joint logistic regression model using the target public key, and generate a first intermediate variable according to the first encrypted data and the second encrypted data;
[0171] The second encrypted gradient generating module 930 may be used to generate a second encrypted gradient according to the first intermediate variable and the second characteristic data, send the second encrypted gradient to the first data holder, and receive a second encrypted gradient sent by the first data holder, which is decrypted by using the first private key corresponding to the first public key to decrypt the second encrypted gradient;
[0172] The second model parameter updating module 940 can be used to decrypt the decrypted second encrypted gradient using the second private key corresponding to the second public key to obtain a second plaintext gradient, and update the second local model parameter using the second plaintext gradient.
[0173] The present disclosure also provides a data prediction device, which is configured for a first data holder who provides first data to be predicted in multi-party machine learning, and is used to perform data prediction based on a data prediction model obtained by training a joint logistic regression model. Fig.10 As shown, the data prediction device may include a third encryption module 1010, a second receiving module 1020 and a data prediction module 1030. Among them:
[0174] The third encryption module 1010 can be used to obtain third data to be encrypted according to the first data to be predicted and the first local model parameter of the data prediction model, and encrypt the third data to be encrypted according to the target public key to obtain third encrypted data; wherein the data prediction model is obtained by training the joint logistic regression model according to any one of the model training methods; the target public key is calculated based on the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in the multi-party machine learning;
[0175] The second receiving module 1020 may be configured to send the third encrypted data to the second data holder, and receive the target data to be predicted sent by the second data holder and obtained based on the third encrypted data and the fourth encrypted data; wherein the fourth encrypted data is obtained by the second data holder encrypting the second data to be predicted using the target public key;
[0176] The data prediction module 1030 can be used to decrypt the target data to be predicted using the first private key corresponding to the first public key, and predict the decrypted target data to be predicted using the data prediction model to obtain a prediction result.
[0177] In an exemplary embodiment of the present disclosure, sending the third encrypted data to a second data holder who provides second data to be predicted in the multi-party machine learning, and receiving target data to be predicted obtained by the second data holder according to the third encrypted data and the fourth encrypted data, includes:
[0178] Sending the third encrypted data to an auxiliary party in the multi-party machine learning, so that the auxiliary party concatenates the third encrypted data and the fourth encrypted data sent by the second data holder to obtain the target data to be predicted;
[0179] Receive the target data to be predicted sent by the auxiliary party.
[0180] The specific details of each module in the above-mentioned model training device and data prediction device have been described in detail in the corresponding model training method and data prediction method, so they will not be repeated here.
[0181] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0182] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0183] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
[0184] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0185] Refer to the following Fig.11 The electronic device 1100 according to this embodiment of the present invention is described. Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0186] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include, but are not limited to: the at least one processing unit 1110, the at least one storage unit 1120, a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110), and a display unit 1140.
[0187] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1110 can perform the following steps: Figure 1Step S110 shown in: encrypt the first local model parameter, first feature data and feature label of the joint logistic regression model according to the target public key to obtain the first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning; Step S120: send the first encrypted data to the second data holder, and receive the first intermediate variable generated by the second data holder according to the first encrypted data and the second encrypted data obtained by encrypting the second feature data with the target public key; Step S110: generate a first encrypted gradient according to the first intermediate variable and the first feature data, send the first encrypted gradient to the second data holder, and receive the first encrypted gradient sent by the second data holder by decrypting the first encrypted gradient with the second private key corresponding to the second public key to obtain the decrypted first encrypted gradient; Step S140: decrypt the decrypted first encrypted gradient with the first private key corresponding to the first public key to obtain the first plaintext gradient, and update the first local model parameter with the first plaintext gradient.
[0188] For another example, the processing unit 1110 may execute the following Figure 4 Step S410 shown in: encrypt the second local model parameters of the joint logistic regression model and the second feature data using the target public key to obtain second encrypted data; wherein the target public key is calculated based on the first public key held by the first data holder who provides the first feature data and feature labels in multi-party machine learning, and the second public key held by the second data holder; Step S420: receive the first encrypted data sent by the first data holder, which is obtained by encrypting the first local model parameters, the first feature data and the feature labels of the joint logistic regression model using the target public key, and generate a first intermediate variable based on the first encrypted data and the second encrypted data; Step S430: generate a second encrypted gradient based on the first intermediate variable and the second feature data, send the second encrypted gradient to the first data holder, and receive the second encrypted gradient sent by the first data holder by decrypting the second encrypted gradient using the first private key corresponding to the first public key to obtain the decrypted second encrypted gradient; Step S440: decrypt the decrypted second encrypted gradient using the second private key corresponding to the second public key to obtain a second plaintext gradient, and update the second local model parameter using the second plaintext gradient.
[0189] For another example, the processing unit 1110 may execute the following Figure 5Step S610 shown in: obtaining third data to be encrypted according to the first data to be predicted and the first local model parameter of the data prediction model, and encrypting the third data to be encrypted according to the target public key to obtain third encrypted data; wherein the data prediction model is obtained by training the joint logistic regression model according to any one of the model training methods; the target public key is calculated based on the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in the multi-party machine learning; step S520: sending the third encrypted data to the second data holder, and receiving the target data to be predicted obtained according to the third encrypted data and the fourth encrypted data sent by the second data holder; wherein the fourth encrypted data is obtained by the second data holder encrypting the second data to be predicted using the target public key; step S530: decrypting the target data to be predicted using the first private key corresponding to the first public key, and predicting the decrypted target data to be predicted using the data prediction model to obtain a prediction result.
[0190] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0191] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0192] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0193] The electronic device 1100 may also communicate with one or more external devices 1200 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0194] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0195] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0196] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0197] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0198] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0199] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0200] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0201] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0202] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A model training method, It is characterized in that A first data holder configured to provide first feature data and feature labels in multi-party machine learning, wherein the first feature data includes user data and / or medical diagnosis data, and is used to train a joint logistic regression model, wherein the model training method includes: Encrypting the first local model parameter, the first feature data, and the feature label of the joint logistic regression model according to the target public key to obtain first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning; Sending the first encrypted data to the second data holder, and receiving a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data according to the first encrypted data and using the target public key to obtain the second encrypted data; Generate a first encrypted gradient according to the first intermediate variable and the first feature data, send the first encrypted gradient to the second data holder, and receive a decrypted first encrypted gradient sent by the second data holder by decrypting the first encrypted gradient using a second private key corresponding to the second public key; The decrypted first encrypted gradient is decrypted using the first private key corresponding to the first public key to obtain a first plaintext gradient, and the first local model parameter is updated using the first plaintext gradient; wherein the data prediction model obtained by training the joint logistic regression model is used for a binary classification security joint modeling scenario, and the security joint modeling scenario includes at least one of a scoring card model scenario, a credit assessment model, and a medical diagnosis scenario under privacy protection.
2. The model training method according to claim 1, It is characterized in that Generating a first encrypted gradient according to the first intermediate variable and the first characteristic data includes: Generate a first random vector; The first encrypted gradient is generated according to the first intermediate variable, the first characteristic data and the first random vector.
3. The model training method according to claim 2, It is characterized in that Decrypting the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient includes: Decrypting the decrypted first encrypted gradient using the first random vector to obtain a first plaintext gradient to be decrypted; The first plaintext gradient to be decrypted is decrypted again using a first private key corresponding to the first public key to obtain the first plaintext gradient.
4. The model training method according to claim 1, It is characterized in that The first encrypted gradient is sent to the second data holder, and the first encrypted gradient is decrypted using the second private key corresponding to the second public key, and the decrypted first encrypted gradient obtained by the second data holder includes: Sending the first encrypted gradient to an auxiliary party in the multi-party machine learning, so that the auxiliary party sends the first encrypted gradient to the second data holder; Receive the decrypted first encrypted gradient sent by the auxiliary party; wherein the decrypted first encrypted gradient is obtained by the second data holder using the second private key corresponding to the second public key to decrypt the first encrypted gradient, and sent to the auxiliary party.
5. A model training method, It is characterized in that A second data holder configured to provide second feature data in multi-party machine learning, wherein the second feature data includes user data and / or medical diagnosis data, and is used to train a joint logistic regression model, wherein the model training method includes: The second local model parameter of the joint logistic regression model and the second feature data are encrypted using a target public key to obtain second encrypted data; wherein the target public key is calculated based on a first public key held by a first data holder who provides first feature data and feature labels in multi-party machine learning, and a second public key held by the second data holder; Receive first encrypted data sent by the first data holder, obtained by encrypting the first local model parameter, the first feature data, and the feature label of the joint logistic regression model using the target public key, and generate a first intermediate variable according to the first encrypted data and the second encrypted data; Generate a second encrypted gradient according to the first intermediate variable and the second feature data, send the second encrypted gradient to the first data holder, and receive a decrypted second encrypted gradient sent by the first data holder by decrypting the second encrypted gradient using a first private key corresponding to the first public key; The decrypted second encrypted gradient is decrypted using a second private key corresponding to the second public key to obtain a second plaintext gradient, and the second plaintext gradient is used to update the second local model parameters; wherein the data prediction model obtained by training the joint logistic regression model is used for a binary classification security joint modeling scenario, and the security joint modeling scenario includes at least one of a scoring card model scenario, a credit assessment model, and a medical diagnosis scenario under privacy protection.
6. A data prediction method, It is characterized in that A first data holder configured to provide first data to be predicted in multi-party machine learning, wherein the first data to be predicted includes user data and / or medical diagnosis data, and is used to perform data prediction according to a data prediction model obtained by training a joint logistic regression model, wherein the data prediction method includes: The third data to be encrypted is obtained according to the first data to be predicted and the first local model parameter of the data prediction model, and the third data to be encrypted is encrypted according to the target public key to obtain the third encrypted data; wherein the data prediction model is obtained by training the joint logistic regression model according to the model training method according to any one of claims 1 to 5; the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second data to be predicted in the multi-party machine learning; the data prediction model is used in a secure joint modeling scenario for binary classification, and the secure joint modeling scenario includes at least one of a scoring card model scenario, a credit assessment model and a medical diagnosis scenario under privacy protection; Sending the third encrypted data to the second data holder, and receiving the target data to be predicted sent by the second data holder, which is obtained based on the third encrypted data and the fourth encrypted data; wherein the fourth encrypted data is obtained by the second data holder encrypting the second data to be predicted using the target public key; The target data to be predicted is decrypted using a first private key corresponding to the first public key, and the decrypted target data to be predicted is predicted using the data prediction model to obtain a prediction result.
7. The data prediction method according to claim 6, It is characterized in that Sending the third encrypted data to the second data holder, and receiving target data to be predicted obtained according to the third encrypted data and the fourth encrypted data sent by the second data holder, comprising: Sending the third encrypted data to an auxiliary party in the multi-party machine learning, so that the auxiliary party concatenates the third encrypted data and the fourth encrypted data sent by the second data holder to obtain the target data to be predicted; Receive the target data to be predicted sent by the auxiliary party.
8. A model training device, It is characterized in that A first data holder configured to provide first feature data and feature labels in multi-party machine learning, wherein the first feature data includes user data and / or medical diagnosis data for training a joint logistic regression model, and the model training device includes: A first encryption module, used to encrypt the first local model parameter, the first feature data and the feature label of the joint logistic regression model according to a target public key to obtain first encrypted data; wherein the target public key is calculated according to the first public key held by the first data holder and the second public key held by the second data holder who provides the second feature data in the multi-party machine learning; a first receiving module, configured to send the first encrypted data to the second data holder, and receive a first intermediate variable sent by the second data holder that is generated by encrypting the second characteristic data according to the first encrypted data and the second encrypted data using the target public key; a first encrypted gradient generating module, configured to generate a first encrypted gradient according to the first intermediate variable and the first characteristic data, send the first encrypted gradient to the second data holder, and receive a first encrypted gradient decrypted by the second data holder using a second private key corresponding to the second public key; A first parameter updating module is used to decrypt the decrypted first encrypted gradient using a first private key corresponding to the first public key to obtain a first plaintext gradient, and to update the first local model parameter using the first plaintext gradient; wherein the data prediction model obtained by training the joint logistic regression model is used for a binary classification security joint modeling scenario, and the security joint modeling scenario includes at least one of a scoring card model scenario, a credit assessment model, and a medical diagnosis scenario under privacy protection.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, it implements the model training method described in any one of claims 1-5 and the data prediction method described in any one of claims 6-7.
10. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the model training method described in any one of claims 1-5 and the data prediction method described in any one of claims 6-7 by executing the executable instructions.
