A training method, device, equipment and storage medium for a federated model
By controlling the computing nodes to determine intermediate features and reverse gradients during the federated model training process, and performing encrypted gradient updates, it solves the problem of inaccurate credit score judgments for new users and large-scale data training problems, and improves the training of bank federated credit score models. Accuracy.
Patent Information
- Application Number
- CN202410962148.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-07-18
AI Technical Summary
In the bank's federal risk control model, the lack of data for new users leads to inaccurate credit score judgments, and it is difficult to train the model on a single machine with large-scale data, so distributed training of the vertical federal credit score model is required.
During the federated model training process, the computing nodes are controlled to determine the intermediate features based on the training data and model parameters, calculate the reverse gradient, and update the parameters. The encrypted reverse gradient is sent to the data provider for gradient update to realize distributed training.
The training accuracy of the federated model is improved, and it is suitable for large-scale data, especially the amount of data in the billions level in banks.
Smart Images

Figure CN118504715B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated learning technology, and in particular to a training method, apparatus, device and storage medium for a federated model. Background Art
[0002] In the bank's federal risk control model, the credit score model is a commonly used model. This model is used to calculate the user's credit score and the user's credit rating based on the credit score (the bank can define the credit card limit based on the credit rating). Banks generally only have basic information about users (such as age, gender, and address, etc.) and transaction information in the bank (monthly consumption, monthly deposits, and half-year deposits, etc.). When this user is a new user, there will be inaccurate judgments due to lack of data judgment, but federated learning can solve this problem. Federated learning can combine data from two or more banks to train a federated model and obtain a federal credit score.
[0003] The data of banks, especially large banks, is often in the billions. A single machine cannot train the model, so distributed model training is required. Therefore, how to train the distributed vertical federal credit score model is particularly important. Summary of the invention
[0004] The present invention provides a method, apparatus, device and storage medium for training a federated model to achieve the performance of a vertical federated credit score model.
[0005] According to one aspect of the present invention, a method for training a federated model is provided, which is applied to a first control node of a data application party, wherein the data application party further includes at least one first computing node, and the method includes:
[0006] During the training of the federated model, controlling the first computing node to determine a first intermediate feature of the federated model in a current training round according to first training data and a first model parameter of a current training round;
[0007] Determine a reverse gradient of the federated model in a current training round according to the first intermediate feature, the data label, and a second feature obtained from a data provider;
[0008] Determine a first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter;
[0009] Encrypting the reverse gradient to obtain a target gradient ciphertext, and sending the target gradient ciphertext to a data provider, so that the data provider obtains a second gradient update ciphertext according to the target gradient ciphertext and second training data;
[0010] Receive and decrypt the second gradient update ciphertext sent by the data provider to obtain the first gradient update plaintext, and send the first gradient update plaintext to the data provider, so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext.
[0011] According to another aspect of the present invention, a method for training a federated model is provided, which is applied to a second control node of a data provider, wherein the data provider further includes at least one second computing node, and the method includes:
[0012] During the training of the federated model, controlling the second computing node to use the second training data and the second model parameter of the current training round, determining the second intermediate feature of the federated model in the current training round, and integrating at least one second intermediate feature to obtain the second feature;
[0013] receiving a target gradient ciphertext sent by a data application party, and splitting the target gradient ciphertext based on a second data set partitioning method to obtain a second gradient ciphertext corresponding to the second computing node;
[0014] Controlling the second computing node to obtain a second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data;
[0015] Integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext;
[0016] Receive a first gradient update plaintext sent by the data application party, and update the second model parameter according to the first gradient update plaintext.
[0017] According to another aspect of the present invention, a training device for a federated model is provided, which is configured at a first control node of a data application party, and the data application party also includes at least one first computing node, and the device includes:
[0018] a first intermediate feature determination module, configured to control the first computing node to determine a first intermediate feature of the federated model in a current training round according to first training data and a first model parameter of a current training round during training of the federated model;
[0019] A reverse gradient determination module, configured to determine a reverse gradient of the federated model in a current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider;
[0020] a first parameter updating module, configured to determine a first update gradient according to the reverse gradient and the first intermediate feature, and to update the first model parameter using the first update gradient;
[0021] A second gradient update ciphertext determination module is used to encrypt the reverse gradient to obtain a target gradient ciphertext, and send the target gradient ciphertext to a data provider, so that the data provider obtains a second gradient update ciphertext according to the target gradient ciphertext and second training data;
[0022] The first gradient update plaintext determination module is used to receive and decrypt the second gradient update ciphertext sent by the data provider to obtain the first gradient update plaintext, and send the first gradient update plaintext to the data provider so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext.
[0023] According to another aspect of the present invention, a training device for a federated model is provided, which is configured at a second control node of a data provider, wherein the data provider further includes at least one second computing node, and the device includes:
[0024] a second feature determination module, used to control the second computing node to use the second training data and the second model parameters of the current training round to determine the second intermediate feature of the federated model in the current training round during the training of the federated model, and to integrate at least one second intermediate feature to obtain the second feature;
[0025] A second gradient ciphertext determination module is used to receive a target gradient ciphertext sent by a data application party, and split the target gradient ciphertext based on a second data set partitioning method to obtain a second gradient ciphertext corresponding to the second computing node;
[0026] A second intermediate gradient update ciphertext determination module, used for controlling the second computing node to obtain a second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data;
[0027] A first gradient update plaintext determination module is used to integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext;
[0028] The second parameter updating module is used to receive the first gradient update plaintext sent by the data application party, and update the second model parameter according to the first gradient update plaintext.
[0029] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0030] at least one processor; and
[0031] a memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the federated model described in any embodiment of the present invention.
[0033] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the training method of the federated model described in any embodiment of the present invention when executed.
[0034] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program, and the computer program, when executed by a processor, implements the method for training a federated model according to any embodiment of the present invention.
[0035] The technical solution of the embodiment of the present invention is to control the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round during the training of the federated model, and then determine the reverse gradient of the federated model in the current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider, and then determine the first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter; at the same time, encrypt the reverse gradient to obtain the target gradient ciphertext, and send the target gradient ciphertext to the data provider, so that the data provider obtains the second gradient update ciphertext according to the target gradient ciphertext and the second training data, receives and decrypts the second gradient update ciphertext sent by the data provider, obtains the first gradient update plaintext, and sends the first gradient update plaintext to the data provider, so that the data provider performs the gradient update of the federated model according to the first gradient update plaintext. The above technical solution can improve the training accuracy of the federated model for large-scale training data, especially the order of billions involved in banks, by distributing the federated model through the data application party and the data provider.
[0036] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0038] Figure 1 is a flowchart of a method for training a federated model according to Embodiment 1 of the present invention;
[0039] Figure 2 is a flowchart of a method for training a federated model according to Embodiment 2 of the present invention;
[0040] Figure 3 This is a schematic diagram of data interaction during the training process of a federated model provided in Embodiment 3 of the present invention;
[0041] Figure 4 is a structural schematic diagram of a training device for a federated model provided according to Embodiment 4 of the present invention;
[0042] Figure 5 is a structural schematic diagram of a training device for a federated model provided according to Embodiment 5 of the present invention;
[0043] Figure 6 It is a schematic diagram of the structure of an electronic device for implementing the training method of the federated model of an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0045] It should be noted that the terms "first" and "second" and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0046] In addition, it should be noted that in the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of the training data of the federated model and related gradient parameters involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0047] Embodiment 1
[0048] Figure 1 It is a flow chart of a method for training a federated model provided according to the first embodiment of the present invention. This embodiment can be applicable to the situation of how to train a federated model, especially a vertical federated model, especially the situation of performing distributed training on a federal risk control model such as a vertical federal credit score model in a banking scenario. The method can be executed by a training device for the federal model, which can be implemented in the form of hardware and / or software, and can be integrated into an electronic device that carries the training function of the federal model, such as a first control node of a data application party, wherein the first control node can be a server; further, the data application party also includes at least one first computing node, wherein the first computing node can also be a server. As Figure 1 As shown, the method includes:
[0049] S110. During the training of the federated model, control the first computing node to determine a first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round.
[0050] In this embodiment, the federal model may be a federal risk control model of a bank, specifically a credit score model. Furthermore, the federal model may be a vertical federal credit score model. Specifically, the equation of the vertical federal credit score model may be: ; The gradient descent method is used to iterate the model parameters. The specific gradient iteration method is as follows: ; where x represents the training data and y is the data label. are model parameters, is the learning rate.
[0051] The so-called data application party refers to the party that owns the data label and initiates the vertical federated model training process; optionally, the data application party includes a first control node and at least one first computing node; wherein the first control node refers to the main process node used to control the computing node of the data application party, that is, the header; the first computing node refers to the node used for data calculation, which is controlled by the first control node. It should be noted that in addition to controlling each first computing node and interacting with the data provider, the first control node itself also participates in the training of the federated model, that is, it participates in the calculation of the first training data and the first model parameters like the first computing node; it can also be understood that the first control node is also a first computing node. For example, the data application party has 4 machines such as servers, and randomly selects one machine as the first control node, and the remaining machines are first computing nodes.
[0052] The so-called first training data refers to the training data of the first computing node used for federated model training, such as the basic information and transaction information of bank customers, where the basic information includes the customer's age and gender; transaction information includes bank flow information, such as the monthly consumption amount, monthly deposit amount and number of defaults; it should be noted that the collection, storage, use, processing, transmission, provision and disclosure of basic information and transaction information are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0053] The so-called first model parameter refers to the model parameter of the current training round of the federated model in the data application side during the training process. The so-called first intermediate feature refers to the intermediate feature generated during the model training process determined based on the first training data and the first model parameter; it can be represented in the form of a matrix or a vector.
[0054] Specifically, during the iterative training of the federated model, the first control node sends a control instruction to each first computing node, and accordingly, each first computing node obtains the first intermediate feature based on its local first training data and the first model parameter of the current training round. At the same time, the first control node also obtains the first intermediate feature based on its local first training data and the first model parameter of the current training round. For example, the first model parameter is , the first training data is , where i represents the machine of the i-th data application party (including the first control node and the first computing node); A represents the data application party; the first intermediate feature is .
[0055] S120. Determine a reverse gradient of the federated model in a current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider.
[0056] An optional method includes receiving a second feature sent by a data provider, splitting the second feature based on the first data set division method, and obtaining a third intermediate feature corresponding to the first computing node; determining a target feature based on the first intermediate feature and the third intermediate feature; obtaining a target prediction result based on the target feature; and determining a reverse gradient of the federated model in the current training round based on the target prediction result and the data label.
[0057] Among them, the second feature refers to the feature determined by the data provider based on its local training data and the second model parameters; it can be expressed in the form of a matrix or a vector. The so-called third intermediate feature refers to the feature in the second feature corresponding to the first computing node and the first control node respectively, which can be expressed in the form of a matrix or a vector. The so-called target feature refers to all the features corresponding to each distributed node, that is, each first computing node and the first control node respectively during the training process of the federated model, which can be expressed in the form of a matrix or a vector. The so-called target prediction result refers to the result predicted based on the target feature based on the federated model, such as the credit score probability value predicted by the credit score model. The so-called data label refers to the true value corresponding to the training data, such as the real credit score. The so-called reverse gradient refers to the difference between the target prediction result and the data label.
[0058] Specifically, the first control node receives the second feature sent by the data provider ,in, Represents the training data owned by the data provider, The second model parameter is the model parameter of the federated model when the data provider trains the federated model. Afterwards, the first control node splits the second feature based on the first data set partitioning method to obtain the third intermediate features corresponding to the first control node and each first computing node. ,in, Indicates the feature in the second feature corresponding to the i-th machine of the data application party. Then, the first control node and each first computing node respectively add the first intermediate feature and the third intermediate feature corresponding to each other to obtain the target feature, that is, ,in, represents the target feature corresponding to the i-th machine of the data application party. Then, the first control node and each first computing node respectively obtain the corresponding target prediction result based on the federated model prediction according to their corresponding target features, that is, ,in, represents the target prediction result corresponding to the i-th machine of the data application. Finally, the difference between the target prediction result and the data label is used as the reverse gradient of the federated model in the current training round, that is, ,in, Represents the reverse gradient corresponding to the i-th machine of the data application side.
[0059] S130. Determine a first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter.
[0060] In this embodiment, the first updated gradient refers to the result obtained by multiplying the reverse gradient by the first intermediate feature.
[0061] Specifically, the first control node and each first computing node use the product of the reverse gradient and the first intermediate feature as the first update gradient, that is, ; After that, each first computing node sends its corresponding first update gradient to the first control node respectively; accordingly, the first control node accumulates the collected first update gradient and the first update gradient calculated locally to obtain the target update gradient , then, based on the gradient iteration method, the difference between the first model parameter of the current training round and the product of the target update gradient and the learning rate is used as the updated first model parameter, that is, the first model parameter of the next training round, to achieve the update of the first model parameter, that is, , where k represents the kth training round.
[0062] S140, encrypting the reverse gradient to obtain a target gradient ciphertext, and sending the target gradient ciphertext to a data provider, so that the data provider obtains a second gradient update ciphertext according to the target gradient ciphertext and the second training data.
[0063] In this embodiment, the second training data refers to the training data of the second computing node in the data provider for the federated model training. It should be noted that the second training data and the first training data can be data of the same type or data of different types. The so-called second gradient update ciphertext refers to the data obtained after the data provider uses the second training data to encrypt the target gradient ciphertext.
[0064] In an optional manner, at least one first computing node is controlled to use a public key to encrypt the reverse gradient to obtain at least one first gradient ciphertext; and at least one first gradient ciphertext is integrated to obtain a target gradient ciphertext.
[0065] The target gradient ciphertext refers to the encrypted data of the gradient corresponding to the gradient descent update of the model parameter corresponding to the data application party. The so-called first gradient ciphertext refers to the encrypted data of the reverse gradient corresponding to each machine of the data application party.
[0066] Specifically, the first control node sends a gradient encryption instruction to at least one first computing node respectively; accordingly, each first computing node uses a public key to encrypt the reverse gradient corresponding to the first computing node to obtain a first gradient ciphertext, which is recorded as , and sends the first gradient ciphertext to the first control node; it should be noted that the first control node also participates in the calculation of the first gradient ciphertext, that is, the first control node uses the public key to encrypt the reverse gradient corresponding to the first control node to obtain the first gradient ciphertext corresponding to the first control node. Afterwards, the first control node merges the first gradient ciphertext sent by each first computing node and the first gradient ciphertext calculated locally by the first control node to obtain the target gradient ciphertext, which is recorded as Furthermore, the first control node sends the target gradient ciphertext to the data provider, and accordingly, the data provider can obtain the second gradient update ciphertext according to the target gradient ciphertext and the second training data.
[0067] S150, receiving and decrypting the second gradient update ciphertext sent by the data provider, obtaining the first gradient update plaintext, and sending the first gradient update plaintext to the data provider, so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext.
[0068] The first gradient updated plaintext refers to data obtained after the data application party decrypts the second gradient updated ciphertext.
[0069] An optional method includes receiving a second gradient update ciphertext sent by a data provider; splitting the second gradient update ciphertext based on the first data set division method to obtain a first intermediate gradient update ciphertext corresponding to the first computing node; controlling the first computing node to use a private key to decrypt the first intermediate gradient update ciphertext to obtain a first intermediate gradient update plaintext; and integrating at least one first intermediate gradient update plaintext to obtain a first gradient update plaintext.
[0070] The first intermediate gradient update ciphertext refers to a part of the ciphertext in the second gradient update ciphertext corresponding to each machine of the data application party. The so-called first intermediate gradient update plaintext refers to the data obtained after decrypting the first intermediate gradient update ciphertext.
[0071] Specifically, the first control node receives the second gradient update ciphertext sent by the data provider, which is recorded as , then based on the first data set partitioning method, the second gradient update ciphertext is split to obtain the first intermediate gradient update ciphertext corresponding to the first control node and each first computing node, recorded as , and sends the first intermediate gradient update ciphertext corresponding to each first computing node to the corresponding first computing node. Correspondingly, each first computing node receives the corresponding first intermediate gradient update ciphertext, decrypts the first intermediate gradient update ciphertext using the private key, and obtains the first intermediate gradient update plaintext, which is recorded as , and sends the first intermediate gradient update plaintexts corresponding to each of them to the first control node; at the same time, the first control node also uses the private key to decrypt the first intermediate gradient update ciphertext corresponding to it, and obtains the first intermediate gradient update plaintext corresponding to the first control node. Then, the first control node accumulates the first intermediate gradient update plaintexts sent by each first computing node and the first intermediate gradient update plaintexts calculated locally, and obtains the first gradient update plaintext, which is recorded as ; and send the first gradient update plaintext to the data provider, so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext.
[0072] The technical solution of the embodiment of the present invention is to control the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round during the training of the federated model, and then determine the reverse gradient of the federated model in the current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider, and then determine the first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter; at the same time, encrypt the reverse gradient to obtain the target gradient ciphertext, and send the target gradient ciphertext to the data provider, so that the data provider obtains the second gradient update ciphertext according to the target gradient ciphertext and the second training data, receives and decrypts the second gradient update ciphertext sent by the data provider, obtains the first gradient update plaintext, and sends the first gradient update plaintext to the data provider, so that the data provider performs the gradient update of the federated model according to the first gradient update plaintext. The above technical solution can improve the training accuracy of the federated model for large-scale training data, especially the order of billions involved in banks, by distributing the federated model through the data application party and the data provider.
[0073] On the basis of the above embodiments, as an optional method of the present invention, during the training of the federated model, before determining the first intermediate feature of the federated model in the current training round according to the first model parameter of the current training round of the first training data, it also includes: dividing the local training data based on the first data set division method to obtain at least one first training data, and sending the first training data to the first computing node; generating a private key and a public key, sharing the public key and the private key with at least one first computing node respectively, and sending the public key to the data provider.
[0074] Among them, local training data refers to the training data owned by the data application party. The so-called public key and private key are used to encrypt and decrypt the data in the subsequent federated learning process. The so-called first data set division method is to use the hash algorithm for division, for example ; Wherein, ID represents the ID of the local training data of the data application party, and n represents the number of machines owned by the data application party, that is, the first number of machines.
[0075] Specifically, the first control node divides the local training data of the data application party based on the first data set division method. For example, it can be to determine the number of first machines owned by the data application party, and then evenly divide the local training data into the first number of machines. Each piece of local training data is recorded as first training data. Thereafter, based on the intranet of the data application party, the first training data is sent to each first computing node respectively, that is, the first control node retains a copy of the first training data locally at the first control node for distributed training of the federated model, and sends the other copies of the first training data to each first computing node respectively.
[0076] Afterwards, the first control node generates a public key and a private key, and shares the public key and the private key with each first computing node based on the intranet of the data application party; at the same time, the public key is sent to the second control node of the data provider.
[0077] It can be understood that the data transmission efficiency can be improved by performing main process control and data distribution to the data application party through the first control node.
[0078] Embodiment 2
[0079] Figure 2 It is a flow chart of a method for training a federated model provided according to the second embodiment of the present invention. This embodiment can be applicable to the situation of how to train a federated model, especially a vertical federated model, especially the situation of performing distributed training on a federal risk control model such as a vertical federal credit score model in a banking scenario. The method can be executed by a training device for the federal model, which can be implemented in the form of hardware and / or software, and can be integrated into an electronic device that carries the training function of the federal model, such as a second control node of a data provider, wherein the second control node can be a server; further, the data provider also includes at least one second computing node, wherein the second computing node can also be a server. As Figure 2 As shown, the method includes:
[0080] S210. During the training process of the federated model, control the second computing node to use the second training data and the second model parameters of the current training round, determine the second intermediate feature of the federated model in the current training round, and integrate at least one second intermediate feature to obtain the second feature.
[0081] In this embodiment, the so-called data provider refers to the party that provides relevant data for federated model training; optionally, the data provider may include a second control node and at least one second computing node; wherein the second control node refers to the main process node used to control the computing node of the data provider, that is, the header; the so-called second computing node refers to the node used for data calculation, which is controlled by the second control node. It should be noted that in addition to controlling each second computing node and interacting with the data application party, the second control node itself also participates in the training of the federated model, that is, it participates in the calculation of the second training data and the second model parameters like the second computing node, and it can also be understood that the second control node is also a second computing node. For example, the data provider has 3 machines, such as a server, and randomly selects one machine as the second control node, and the remaining machines are second computing nodes.
[0082] The so-called second training data refers to the training data of the second computing node used for federated model training, that is, the training data owned by each machine of the data provider, such as the basic information and transaction information of the customers in the bank, among which the basic information includes the age and gender of the customers; the transaction information includes bank flow information, such as the monthly consumption amount, the monthly deposit amount and the number of defaults; it should be noted that the collection, storage, use, processing, transmission, provision and disclosure of basic information and transaction information shall comply with the relevant laws and regulations and shall not violate public order and good morals.
[0083] The so-called second model parameters refer to the model parameters of the current training round in the federated model training process of the data provider. The so-called second intermediate features refer to the intermediate features generated in the model training process determined by each machine of the data provider based on the second training data and the second model parameters, which can be expressed in the form of a matrix or a vector. The so-called second features refer to the intermediate features generated in the model training process obtained based on the local training data and the second model parameters of the data provider, which can be expressed in the form of a matrix or a vector.
[0084] Specifically, during the iterative training of the federated model, the second control node sends computing instructions to each second computing node. Correspondingly, each second computing node uses its local second training data and the second model parameters of the current training round to calculate the second intermediate features of the federated model corresponding to each second computing node in the current training round, and sends the corresponding second intermediate features to the second control node. At the same time, the second control node also calculates the second intermediate features based on its local second training data and the second model parameters of the current training round. Afterwards, the second control node accumulates the second intermediate features received from each second computing node and the second intermediate features calculated locally by the second control node to obtain the second features. For example. The second model parameter is , the second training data is , where j represents the machine of the jth data provider (including the second control node and the second computing node); B represents the data provider; the second intermediate feature is , the second feature is .
[0085] S220, receiving the target gradient ciphertext sent by the data application party, and splitting the target gradient ciphertext based on the second data set partitioning method to obtain a second gradient ciphertext corresponding to the second computing node.
[0086] In this embodiment, the target gradient ciphertext refers to the data obtained by encrypting the gradient corresponding to the gradient descent update of the model parameter corresponding to the data application party. The so-called second gradient ciphertext refers to the part of the target gradient ciphertext corresponding to each machine of the data provider party.
[0087] Specifically, the second control node receives the target gradient ciphertext sent by the data application party , then based on the second data set partitioning method, the target gradient ciphertext is split to obtain the second gradient ciphertext corresponding to the second control node and each second computing node, recorded as ; and send the second gradient ciphertext to the corresponding second computing node.
[0088] S230 , controlling the second computing node to obtain a second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data.
[0089] In an optional manner, the second computing node is controlled to obtain a candidate gradient update ciphertext according to the second gradient ciphertext and the second training data; the second computing node is controlled to generate a mask ciphertext, and a second intermediate gradient update ciphertext is obtained according to the candidate gradient update ciphertext and the mask ciphertext.
[0090] The candidate gradient update ciphertext refers to the gradient ciphertext calculated based on the second gradient ciphertext and the second training data. The so-called second intermediate gradient update ciphertext refers to the gradient ciphertext that further encrypts the candidate gradient update ciphertext. The so-called mask ciphertext refers to the data obtained by encrypting the mask, which is used to encrypt the candidate gradient update ciphertext.
[0091] Specifically, the second control node sends a gradient ciphertext update instruction to each second computing node; accordingly, each second computing node multiplies its corresponding second gradient ciphertext by the second training data to obtain a corresponding candidate gradient update ciphertext, which is recorded as , and randomly generate a mask ciphertext with the same dimension as the candidate gradient update ciphertext, denoted as , and then add the candidate gradient update ciphertext and the mask ciphertext to obtain the corresponding second intermediate gradient update ciphertext, recorded as , and finally send the corresponding second intermediate gradient update ciphertext to the second control node. It should be noted that the second control node also performs data processing corresponding to the second computing node locally, that is, obtains the candidate gradient update ciphertext according to the second gradient ciphertext and the second training data of the second control node, and generates the mask ciphertext, and obtains the second intermediate gradient update ciphertext from the candidate gradient update ciphertext and the mask ciphertext.
[0092] It can be understood that masking and re-encrypting the candidate gradient update ciphertext can prevent data leakage between the data application party and the data provider during the data transmission process.
[0093] S240. Integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to a data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext.
[0094] In this embodiment, the second gradient update ciphertext refers to the gradient ciphertext obtained by integrating the second intermediate gradient update ciphertext, that is, the data obtained by the data provider using the second training data to encrypt the target gradient ciphertext. The so-called first gradient update plaintext refers to the data obtained by the data application party after decrypting the second gradient update ciphertext.
[0095] Specifically, the second control node accumulates the second intermediate gradient update ciphertexts received from the second computing nodes and the second intermediate gradient update ciphertexts calculated locally by the second control node to obtain the second gradient update ciphertext ; and send the second gradient update ciphertext to the data application party, and correspondingly, the data application party decrypts the second gradient update ciphertext to obtain the first gradient update plaintext .
[0096] S250: Receive a first gradient update plaintext sent by a data application party, and update the second model parameters according to the first gradient update plaintext.
[0097] An optional method is to split the first gradient update plaintext based on the second data set division method to obtain the second intermediate gradient update plaintext corresponding to the second computing node; control the second computing node to obtain the second intermediate update gradient according to the second intermediate gradient update plaintext and the mask plaintext; integrate at least one second intermediate update gradient to obtain the second update gradient, and use the second update gradient to update the second model parameters.
[0098] The second intermediate gradient update plaintext refers to part of the second gradient plaintext corresponding to each machine of the data provider. The so-called second intermediate update gradient refers to the data obtained after removing the mask from the second intermediate gradient update plaintext. The so-called second update gradient refers to the result obtained by multiplying the reverse gradient with the second intermediate feature.
[0099] Specifically, the second control node receives the first gradient update plaintext sent by the data application party, and then splits the first gradient update plaintext based on the second data set division method to obtain the second intermediate gradient update plaintext corresponding to the second control node and each second computing node, which is recorded as , and sends the second intermediate gradient update plaintext to the corresponding second computing node. Then the second control node sends a gradient plaintext update operation to each second computing node. Correspondingly, each second computing node removes the mask plaintext from the corresponding second intermediate gradient update plaintext to obtain the second intermediate update gradient, which is recorded as , and sends the second intermediate update gradient to the second control node. At the same time, the second control node also removes the mask plaintext of its local second intermediate gradient update plaintext to obtain the second intermediate update gradient corresponding to the second control node. Then, the second control node accumulates the second intermediate update gradient sent by each second computing node and the second intermediate update gradient calculated locally by the second control node to obtain the second update gradient, which is recorded as ; Finally, based on the gradient iteration method, the difference between the second model parameter corresponding to the current training round and the product of the second updated gradient and the learning rate is used as the updated second model parameter, that is, the second model parameter of the next training round, to achieve the update of the second model parameter, that is , where k represents the kth training round.
[0100] The technical solution provided by the embodiment of the present invention is to control the second computing node to adopt the second training data and the second model parameters of the current training round during the training of the federated model, determine the second intermediate feature of the federated model in the current training round, integrate at least one second intermediate feature to obtain the second feature, then receive the target gradient ciphertext sent by the data application party, and split the target gradient ciphertext based on the second data set partitioning method to obtain the second gradient ciphertext corresponding to the second computing node, and control the second computing node to obtain the second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data, and then integrate at least one second intermediate gradient ciphertext to obtain the second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain the first gradient update plaintext, and finally receives the first gradient update plaintext sent by the data application party, and updates the second model parameters according to the first gradient update plaintext. The above technical solution can improve the training accuracy of the federated model for large-scale training data, especially the order of billions involved in banks, by performing distributed training on the federated model by the data application party and the data provider.
[0101] On the basis of the above embodiments, as an optional method of the present invention, during the training process of the federated model, the second computing node is controlled to adopt the second training data and the second model parameters of the current training round, determine the second intermediate feature of the federated model in the current training round, and integrate at least one second intermediate feature to obtain the second feature, and also includes: based on the second data set division method, the local training data is divided to obtain at least one second training data, and the second training data is sent to the second computing node; the public key sent by the data application party is received, and the public key is shared with at least one second computing node respectively.
[0102] The local training data refers to the training data owned by the data provider. The second data partitioning method is to use the hash algorithm for partitioning, for example ; Wherein, ID represents the ID of the local training data of the data provider, and n represents the number of machines owned by the data provider, that is, the number of second machines.
[0103] Specifically, the second control node divides the local training data of the data provider based on the second data set division method. For example, the number of second machines owned by the data provider is determined, and then the local training data is divided into the second number of machines. Each copy of the local training data is recorded as the second training data. After that, based on the intranet of the data provider, the second training data is sent to each second computing node respectively, that is, the second control node itself retains a copy of the second training data locally for distributed training of the federated model, and sends the other copies of the second training data to each second computing node respectively.
[0104] Furthermore, the second control node may receive the public key sent by the data application party, and share the public key with each second computing node based on the intranet provided by the data.
[0105] It can be understood that the data transmission efficiency can be improved by performing main process control and data distribution to the data provider through the second control node.
[0106] Embodiment 3
[0107] Figure 3 1 is a schematic diagram of data interaction during the training process of a federated model provided according to the third embodiment of the present invention. Based on the above embodiment, this embodiment specifically describes the training process of the federated model in which the data application party and the data provider cooperate, that is, the gradient update process. Optionally, the data application party includes its local training data. , data label Y, first model parameter The data application party guest includes a first control node header1 m0 and at least one first computing node, such as m1, m2 and m3. The data provider host includes its local training data , the second model parameter The data provider includes a second control node header2 n0 and at least one second computing node, such as n1 and n2. The first control node of the data application party and the second control node of the data provider exchange data through the external network. The first control node and at least one first computing node exchange data through the intranet of the data application party. The second control node and at least one second computing node exchange data through the intranet of the data provider, such as Figure 3 shown.
[0108] Specifically, the training process of the federated model can be:
[0109] First, the data preparation stage:
[0110] The first control node header1 m0 of the data application party guest divides the local training data based on the first data set division method to obtain at least one first training data, and sends the first training data to the first computing node; at the same time, the first control node sends the first model parameter Generate a private key and a public key, share the public key en and the private key de with at least one first computing node respectively, and send the public key en to the second control node header2 n0 of the data provider.
[0111] The second control node header2 n0 of the data provider host divides the local training data based on the second data set division method to obtain at least one second training data, and sends the second training data to the second computing node; at the same time, the second control node sends the second model parameter Share with each second computing node. Receive the public key en sent by the data application party, and share the public key en with at least one second computing node.
[0112] Then, the federated model training phase, that is, the model parameter update process:
[0113] First, the determination of the first intermediate feature and the second intermediate feature. Specifically, each first computing node and the first control node of the data application party respectively calculates the first intermediate feature according to the first training data and the first model parameter of the current training round. The second computing nodes and the second control nodes of the data provider respectively calculate the second intermediate features according to the second training data and the second model parameters of the current training round: .
[0114] Second, the data provider and data user aggregate and split the second feature.
[0115] Specifically, the second computing nodes of the data provider send their respective second intermediate features to the second control node; correspondingly, the second control node accumulates the second intermediate features received from each second computing node and the second intermediate features calculated locally by the second control node to obtain the second feature , and the second feature The first control node sent to the data application guest.
[0116] After receiving the second feature, the first control node splits the second feature to obtain the third intermediate features corresponding to the first control node and each first computing node. At the same time, the first control node sends the third intermediate feature to the corresponding first computing node.
[0117] Third, the data application party obtains the target gradient ciphertext and sends it to the data provider.
[0118] Specifically, the first control node and each first computing node of the data application party guest respectively add the first intermediate feature and the third intermediate feature corresponding to each other to obtain the target feature, that is, ; According to the corresponding target features, the corresponding target prediction results are obtained based on the federated model prediction, that is, ; The difference between the target prediction result and the data label is used as the reverse gradient of the federated model in the current training round, that is, ; Use the public key to encrypt the reverse gradient corresponding to the first computing node to obtain the first gradient ciphertext, recorded as .
[0119] Afterwards, each first computing node sends the first gradient ciphertext to the first control node; accordingly, the first control node merges the first gradient ciphertext sent by each first computing node and the first gradient ciphertext calculated locally by the first control node to obtain the target gradient ciphertext, which is recorded as Then, the first control node encrypts the target gradient Sent to the second control node of the data provider.
[0120] Fourth, the data provider obtains the second gradient updated ciphertext and sends it to the data user.
[0121] Specifically, the second control node header2 n0 receives the target gradient ciphertext sent by the data application party , then based on the second data set partitioning method, the target gradient ciphertext is split to obtain the second gradient ciphertext corresponding to the second control node and each second computing node, recorded as ; and send the second gradient ciphertext to the corresponding second computing node.
[0122] Afterwards, each second computing node multiplies its corresponding second gradient ciphertext by the second training data to obtain the corresponding candidate gradient update ciphertext, which is recorded as , and randomly generate a mask ciphertext with the same dimension as the candidate gradient update ciphertext, denoted as , and then add the candidate gradient update ciphertext and the mask ciphertext to obtain the corresponding second intermediate gradient update ciphertext, recorded as , and finally send the corresponding second intermediate gradient update ciphertext to the second control node.
[0123] Then, the second control node accumulates the second intermediate gradient update ciphertexts received from the second computing nodes and the second intermediate gradient update ciphertexts calculated locally by the second control node to obtain the second gradient update ciphertext .
[0124] Fifth, the data application party determines the first gradient update plaintext and sends it to the data provider, as well as the update of the first model parameters.
[0125] Specifically, the first control node header1 m0 updates the ciphertext of the second gradient based on the first data set division method. Split it to obtain the first intermediate gradient update ciphertext corresponding to the first control node and each first computing node, recorded as , and sends the first intermediate gradient update ciphertext corresponding to each first computing node to the corresponding first computing node. Correspondingly, each first computing node receives the corresponding first intermediate gradient update ciphertext, decrypts the first intermediate gradient update ciphertext using the private key, and obtains the first intermediate gradient update plaintext, which is recorded as At the same time, the first control node also uses the private key to decrypt the local first intermediate gradient update ciphertext to obtain the first intermediate gradient update plaintext corresponding to the first control node.
[0126] Each first computing node sends its corresponding first intermediate gradient update plaintext to the first control node; the first control node accumulates the received first intermediate gradient update plaintext sent by each first computing node and the first intermediate gradient update plaintext obtained by local calculation to obtain the first gradient update plaintext, which is recorded as ; and send the first gradient update plaintext to the second control node of the data provider.
[0127] Furthermore, the first control node and each first computing node use the product of the reverse gradient and the first intermediate feature as the first update gradient, that is, ; After that, each first computing node sends its corresponding first update gradient to the first control node respectively; accordingly, the first control node accumulates the collected first update gradient and the first update gradient calculated locally to obtain the target update gradient After that, based on the gradient iteration method, the difference between the first model parameter of the current training round and the product of the target update gradient and the learning rate is used as the updated first model parameter, that is, the first model parameter of the next training round, and the updated first model parameter is analyzed to each first computing node to realize the update of the first model parameter.
[0128] Sixth, the processing of the first gradient update plaintext and the update of the second model parameters.
[0129] The second control node splits the first gradient update plaintext based on the second data set partitioning method to obtain the second intermediate gradient update plaintext corresponding to the second control node and each second computing node, which is recorded as , sending the second intermediate gradient update plaintext to the corresponding second computing node.
[0130] Afterwards, each second computing node removes the mask plaintext from the corresponding second intermediate gradient update plaintext to obtain the second intermediate update gradient, which is recorded as , and sends the second intermediate updated gradient to the second control node. At the same time, the second control node also removes the masked plaintext from its local second intermediate gradient updated plaintext to obtain the second intermediate updated gradient corresponding to the second control node.
[0131] Furthermore, the second control node accumulates the second intermediate update gradient sent by each second computing node and the second intermediate update gradient calculated locally by the second control node to obtain a second update gradient, which is recorded as ; Finally, based on the gradient iteration method, the difference between the second model parameter corresponding to the current training round and the product of the second updated gradient and the learning rate is used as the updated second model parameter, i.e., the second model parameter of the next training round, and the updated second model parameter is shared with each second computing node to realize the update of the second model parameter.
[0132] It should be noted that in the present invention, encryption and decryption are performed in the computing nodes of the data application party and the data provider party, and data distribution and transmission are processed by the first control node of the data application party and distributed to the first computing nodes, and the second control node of the data provider party is processed and distributed to the second computing nodes, so that data can be quickly transmitted in the intranet. The data encryption and decryption process is cumbersome, so the ciphertext or plaintext is first split and then processed by the respective computing nodes, thereby improving the efficiency of model training.
[0133] In addition, it should be noted that the initialization of the first model parameter and the second model parameter are randomly generated by the corresponding first control node and the second control node.
[0134] Embodiment 4
[0135] Figure 4 It is a structural diagram of a federal model training device provided according to the fourth embodiment of the present invention. This embodiment can be applicable to the situation of how to train a federal model, especially a vertical federal model, especially the situation of performing distributed training on a federal risk control model such as a vertical federal credit score model in a banking scenario. The method can be executed by a federal model training device, which can be implemented in the form of hardware and / or software, and can be integrated into an electronic device that carries the training function of the federal model, such as a first control node of a data application party, wherein the first control node can be a server; further, the data application party also includes at least one first computing node, wherein the first computing node can also be a server. As Figure 4 As shown, the device comprises:
[0136] A first intermediate feature determination module 410 is used to control the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round during the training process of the federated model;
[0137] A reverse gradient determination module 420, configured to determine a reverse gradient of the federated model in a current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider;
[0138] A first parameter updating module 430, configured to determine a first update gradient according to the reverse gradient and the first intermediate feature, and to update the first model parameter using the first update gradient;
[0139] A second gradient update ciphertext determination module 440 is used to encrypt the reverse gradient to obtain a target gradient ciphertext, and send the target gradient ciphertext to a data provider, so that the data provider obtains a second gradient update ciphertext according to the target gradient ciphertext and the second training data;
[0140] The first gradient update plaintext determination module 450 is used to receive and decrypt the second gradient update ciphertext sent by the data provider, obtain the first gradient update plaintext, and send the first gradient update plaintext to the data provider so that the data provider can perform a gradient update of the federated model according to the first gradient update plaintext.
[0141] The technical solution of the embodiment of the present invention is to control the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round during the training of the federated model, and then determine the reverse gradient of the federated model in the current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider, and then determine the first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter; at the same time, encrypt the reverse gradient to obtain the target gradient ciphertext, and send the target gradient ciphertext to the data provider, so that the data provider obtains the second gradient update ciphertext according to the target gradient ciphertext and the second training data, receives and decrypts the second gradient update ciphertext sent by the data provider, obtains the first gradient update plaintext, and sends the first gradient update plaintext to the data provider, so that the data provider performs the gradient update of the federated model according to the first gradient update plaintext. The above technical solution can improve the training accuracy of the federated model for large-scale training data, especially the order of billions involved in banks, by distributing the federated model through the data application party and the data provider.
[0142] Optionally, the device further includes a data distribution module, which is used to:
[0143] In the training process of the federated model, according to the first model parameter of the current training round of the first training data, before determining the first intermediate feature of the federated model in the current training round, the local training data is divided based on the first data set division method to obtain at least one first training data, and the first training data is sent to the first computing node;
[0144] Generate a private key and a public key, share the public key and the private key with at least one first computing node respectively, and send the public key to the data provider.
[0145] Optionally, the reverse gradient determination module 420 is specifically used for:
[0146] Receive the second feature sent by the data provider, split the second feature based on the first data set division method, and obtain a third intermediate feature corresponding to the first computing node;
[0147] Determining a target feature according to the first intermediate feature and the third intermediate feature;
[0148] Obtain target prediction results based on target features;
[0149] Determine the reverse gradient of the federated model in the current training round based on the target prediction results and data labels.
[0150] Optionally, the second gradient updated ciphertext determining module 440 is specifically used for:
[0151] Controlling at least one first computing node to encrypt the reverse gradient using a public key to obtain at least one first gradient ciphertext;
[0152] At least one first gradient ciphertext is integrated to obtain a target gradient ciphertext.
[0153] Optionally, the first gradient updated plaintext determining module 450 is specifically used for:
[0154] Receiving a second gradient update ciphertext sent by a data provider;
[0155] Based on the first data set division method, split the second gradient update ciphertext to obtain a first intermediate gradient update ciphertext corresponding to the first computing node;
[0156] Controlling the first computing node to decrypt the first intermediate gradient update ciphertext using the private key to obtain the first intermediate gradient update plaintext;
[0157] At least one first intermediate gradient update plaintext is integrated to obtain a first gradient update plaintext.
[0158] The training device for the federated model provided in the embodiment of the present invention can execute the training method for the federated model provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.
[0159] Embodiment 5
[0160] Figure 5It is a structural diagram of a training device for a federated model provided according to the fifth embodiment of the present invention. This embodiment can be applicable to the situation of how to train a federated model, especially a vertical federated model, especially the situation of performing distributed training on a federal risk control model such as a vertical federal credit score model in a banking scenario. The method can be executed by a training device for a federated model, which can be implemented in the form of hardware and / or software, and can be integrated into an electronic device that carries the training function of the federated model, such as a second control node of a data provider, wherein the second control node can be a server; further, the data provider also includes at least one second computing node, wherein the second computing node can also be a server. As Figure 5 As shown, the device comprises:
[0161] A second feature determination module 510 is used to control the second computing node to use the second training data and the second model parameters of the current training round to determine the second intermediate feature of the federated model in the current training round during the training of the federated model, and integrate at least one second intermediate feature to obtain the second feature;
[0162] The second gradient ciphertext determination module 520 is used to receive the target gradient ciphertext sent by the data application party, and split the target gradient ciphertext based on the second data set partitioning method to obtain the second gradient ciphertext corresponding to the second computing node;
[0163] A second intermediate gradient updated ciphertext determining module 530 is used to control the second computing node to obtain a second intermediate gradient updated ciphertext according to the second gradient ciphertext and the second training data;
[0164] A first gradient update plaintext determination module 540 is configured to integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to a data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext;
[0165] The second parameter updating module 550 is used to receive the first gradient update plaintext sent by the data application party, and update the second model parameters according to the first gradient update plaintext.
[0166] The technical solution provided by the embodiment of the present invention is to control the second computing node to adopt the second training data and the second model parameters of the current training round during the training of the federated model, determine the second intermediate feature of the federated model in the current training round, integrate at least one second intermediate feature to obtain the second feature, then receive the target gradient ciphertext sent by the data application party, and split the target gradient ciphertext based on the second data set partitioning method to obtain the second gradient ciphertext corresponding to the second computing node, and control the second computing node to obtain the second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data, and then integrate at least one second intermediate gradient ciphertext to obtain the second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain the first gradient update plaintext, and finally receives the first gradient update plaintext sent by the data application party, and updates the second model parameters according to the first gradient update plaintext. The above technical solution can improve the training accuracy of the federated model for large-scale training data, especially the order of billions involved in banks, by performing distributed training on the federated model by the data application party and the data provider.
[0167] Optionally, the device further includes a data distribution module, which is used to:
[0168] In the process of training the federated model, the second computing node is controlled to use the second training data and the second model parameter of the current training round to determine the second intermediate feature of the federated model in the current training round, and before integrating at least one second intermediate feature to obtain the second feature, the local training data is divided based on the second data set division method to obtain at least one second training data, and the second training data is sent to the second computing node;
[0169] Receive the public key sent by the data application party, and share the public key with at least one second computing node.
[0170] Optionally, the second intermediate gradient updated ciphertext determining module 530 is specifically used for:
[0171] Control the second computing node to obtain a candidate gradient update ciphertext according to the second gradient ciphertext and the second training data;
[0172] The second computing node is controlled to generate a masked ciphertext, and a second intermediate gradient update ciphertext is obtained according to the candidate gradient update ciphertext and the masked ciphertext.
[0173] Optionally, the second parameter updating module 550 is specifically used for:
[0174] Based on the second data set partitioning method, split the first gradient update plaintext to obtain a second intermediate gradient update plaintext corresponding to the second computing node;
[0175] Controlling the second computing node to update the plaintext and the masked plaintext according to the second intermediate gradient to obtain a second intermediate updated gradient;
[0176] The at least one second intermediate update gradient is integrated to obtain a second update gradient, and the second model parameter is updated using the second update gradient.
[0177] The training device for the federated model provided in the embodiment of the present invention can execute the training method for the federated model provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.
[0178] Embodiment 6
[0179] Figure 6 It is a structural schematic diagram of an electronic device for implementing the training method of the federated model of an embodiment of the present invention; Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0180] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0181] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0182] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the training method of the federated model.
[0183] In some embodiments, the training method of the federated model may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the training method of the federated model described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the training method of the federated model in any other appropriate manner (e.g., by means of firmware).
[0184] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0185] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0186] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.
[0187] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0188] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0189] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0190] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0191] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for training a federated model, characterized in that: A first control node applied to a data application party, the data application party further comprising at least one first computing node, the first computing node being controlled by the first control node, the first control node participating in the training of the federated model, the method comprising: Based on the first data set division method, divide the local training data to obtain at least one first training data, and send the first training data to the first computing node; In the process of training the federated model, controlling the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round includes: controlling the first computing node to use the product of the first training data and the first model parameter of the current training round as the first intermediate feature of the federated model in the current training round; wherein the federated model is a bank vertical federated credit score model; the first training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customer; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; Determine the reverse gradient of the federated model in the current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider; wherein the data label is a real credit score; Determine a first update gradient according to the reverse gradient and the first intermediate feature, and use the first update gradient to update the first model parameter, including: the first control node and each first computing node use the product of the reverse gradient and the first intermediate feature as the first update gradient; each first computing node sends its corresponding first update gradient to the first control node respectively; the first control node accumulates the collected first update gradient and the first update gradient calculated locally to obtain a target update gradient; based on the gradient iteration method, use the difference between the first model parameter and the product of the target update gradient and the learning rate as the updated first model parameter; The reverse gradient is encrypted to obtain a target gradient ciphertext, and the target gradient ciphertext is sent to a data provider, so that the data provider obtains a second gradient update ciphertext according to the target gradient ciphertext and second training data; wherein the second training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customers; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; Receiving and decrypting the second gradient update ciphertext sent by the data provider to obtain the first gradient update plaintext, and sending the first gradient update plaintext to the data provider, so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext; The determining of the reverse gradient of the federated model in the current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider includes: receiving a second feature sent by the data provider, and splitting the second feature based on the first data set division method to obtain a third intermediate feature corresponding to the first control node and each first computing node; Determining a target feature according to the first intermediate feature and the third intermediate feature includes: the first control node and each first computing node respectively add the first intermediate feature and the third intermediate feature corresponding to each other to obtain the target feature; Obtaining a target prediction result according to the target feature, including: the first control node and each first computing node respectively obtain corresponding target prediction results based on the federated model prediction according to their corresponding target features; Determining the reverse gradient of the federated model in the current training round according to the target prediction result and the data label includes: taking the difference between the target prediction result and the data label as the reverse gradient of the federated model in the current training round.
2. The method according to claim 1, characterized in that In the training process of the federated model, controlling the first computing node to determine, according to the first training data and the first model parameter of the current training round, the first intermediate feature of the federated model before the current training round, further comprising: Generate a private key and a public key, share the public key and the private key with at least one first computing node respectively, and send the public key to the data provider.
3. The method according to claim 2, characterized in that The reverse gradient is encrypted to obtain a target gradient ciphertext, including: respectively controlling at least one first computing node to encrypt the reverse gradient using the public key to obtain at least one first gradient ciphertext; The at least one first gradient ciphertext is integrated to obtain a target gradient ciphertext.
4. The method according to claim 2, characterized in that: Receiving and decrypting the second gradient update ciphertext sent by the data provider to obtain the first gradient update plaintext, including: Receiving a second gradient update ciphertext sent by the data provider; Based on the first data set division method, split the second gradient update ciphertext to obtain a first intermediate gradient update ciphertext corresponding to the first computing node; Controlling the first computing node to decrypt the first intermediate gradient update ciphertext using the private key to obtain a first intermediate gradient update plaintext; At least one first intermediate gradient update plaintext is integrated to obtain a first gradient update plaintext.
5. A method for training a federated model, characterized in that: A second control node applied to a data provider, the data provider further comprising at least one second computing node, the second computing node being controlled by the second control node, the second control node participating in the training of the federated model, the method comprising: Based on the second data set partitioning method, the local training data is partitioned to obtain at least one second training data, and the second training data is sent to the second computing node; In the process of training the federated model, the second computing node is controlled to use the second training data and the second model parameters of the current training round, determine the second intermediate feature of the federated model in the current training round, and integrate at least one second intermediate feature to obtain the second feature; wherein the federated model is a bank vertical federated credit score model; the second training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customer; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; receiving a target gradient ciphertext sent by a data application party, and splitting the target gradient ciphertext based on a second data set partitioning method to obtain a second gradient ciphertext corresponding to the second computing node; Controlling the second computing node to obtain a second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data; Integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext; receiving a first gradient update plaintext sent by the data application party, and updating the second model parameter according to the first gradient update plaintext; The updating of the second model parameter according to the first gradient plaintext includes: Based on the second data set division method, split the first gradient update plaintext to obtain a second intermediate gradient update plaintext corresponding to the second computing node; Controlling the second computing node to update the plaintext and the masked plaintext according to the second intermediate gradient to obtain a second intermediate updated gradient; At least one second intermediate update gradient is integrated to obtain a second update gradient, and the second model parameter is updated using the second update gradient.
6. The method according to claim 5, characterized in that In the process of training the federated model, before controlling the second computing node to use the second training data and the second model parameter of the current training round, determining the second intermediate feature of the federated model in the current training round, and integrating at least one second intermediate feature to obtain the second feature, the method further includes: Receive the public key sent by the data application party, and share the public key with at least one second computing node.
7. The method according to claim 5, characterized in that The controlling the second computing node to obtain a second intermediate gradient updated ciphertext according to the second gradient ciphertext and the second training data includes: Control the second computing node to obtain a candidate gradient update ciphertext according to the second gradient ciphertext and the second training data; The second computing node is controlled to generate a masked ciphertext, and a second intermediate gradient update ciphertext is obtained according to the candidate gradient update ciphertext and the masked ciphertext.
8. A training device for a federated model, characterized in that: A first control node configured at a data application party, the data application party further comprising at least one first computing node, the first computing node being controlled by the first control node, the first control node participating in the training of the federated model, the device comprising: A data distribution module, configured to divide the local training data based on the first data set division method to obtain at least one first training data, and send the first training data to the first computing node; The first intermediate feature determination module is used to control the first computing node to determine the first intermediate feature of the federated model in the current training round according to the first training data and the first model parameter of the current training round during the training process of the federated model, including: controlling the first computing node to use the product of the first training data and the first model parameter of the current training round as the first intermediate feature of the federated model in the current training round; wherein the federated model is a bank vertical federal credit score model; the first training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customer; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; A reverse gradient determination module, configured to determine a reverse gradient of the federated model in a current training round according to the first intermediate feature, the data label, and the second feature obtained from the data provider; wherein the data label is a real credit score; A first parameter updating module, used to determine a first update gradient according to the reverse gradient and the first intermediate feature, and to update the first model parameter using the first update gradient, including: the first control node and each first computing node use the product of the reverse gradient and the first intermediate feature as the first update gradient; each first computing node sends its corresponding first update gradient to the first control node respectively; the first control node accumulates the collected first update gradient and the first update gradient calculated locally to obtain a target update gradient; based on a gradient iteration method, uses the difference between the first model parameter and the product of the target update gradient and the learning rate as the updated first model parameter; A second gradient update ciphertext determination module is used to encrypt the reverse gradient to obtain a target gradient ciphertext, and send the target gradient ciphertext to a data provider, so that the data provider can obtain a second gradient update ciphertext based on the target gradient ciphertext and second training data; wherein the second training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customer; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; A first gradient update plaintext determination module is used to receive and decrypt the second gradient update ciphertext sent by the data provider to obtain a first gradient update plaintext, and send the first gradient update plaintext to the data provider, so that the data provider performs a gradient update of the federated model according to the first gradient update plaintext; Wherein, the reverse gradient determination module is specifically used for: receiving a second feature sent by the data provider, and splitting the second feature based on the first data set division method to obtain a third intermediate feature corresponding to the first control node and each first computing node; Determining a target feature according to the first intermediate feature and the third intermediate feature includes: the first control node and each first computing node respectively add the first intermediate feature and the third intermediate feature corresponding to each other to obtain the target feature; Obtaining a target prediction result according to the target feature, including: the first control node and each first computing node respectively obtain corresponding target prediction results based on the federated model prediction according to their corresponding target features; Determining the reverse gradient of the federated model in the current training round according to the target prediction result and the data label includes: taking the difference between the target prediction result and the data label as the reverse gradient of the federated model in the current training round.
9. A training device for a federated model, characterized in that: A second control node configured at a data provider, the data provider further comprising at least one second computing node, the second computing node being controlled by the second control node, the second control node participating in the training of the federated model, the device comprising: A data distribution module, configured to divide the local training data based on the second data set division method to obtain at least one second training data, and send the second training data to the second computing node; A second feature determination module is used to control the second computing node to use the second training data and the second model parameters of the current training round to determine the second intermediate feature of the federated model in the current training round during the training of the federated model, and integrate at least one second intermediate feature to obtain the second feature; wherein the federated model is a bank vertical federated credit score model; the second training data is basic information and transaction information of customers in the bank; the basic information includes the age and gender of the customer; the transaction information includes bank flow information; the bank flow information includes the monthly consumption amount, the monthly deposit amount and the number of defaults; A second gradient ciphertext determination module is used to receive a target gradient ciphertext sent by a data application party, and split the target gradient ciphertext based on a second data set partitioning method to obtain a second gradient ciphertext corresponding to the second computing node; A second intermediate gradient update ciphertext determination module, used for controlling the second computing node to obtain a second intermediate gradient update ciphertext according to the second gradient ciphertext and the second training data; A first gradient update plaintext determination module is used to integrate at least one second intermediate gradient ciphertext to obtain a second gradient update ciphertext, and send the second gradient update ciphertext to the data application party, so that the data application party decrypts the second gradient update ciphertext to obtain a first gradient update plaintext; A second parameter updating module, configured to receive a first gradient update plaintext sent by the data application party, and update the second model parameter according to the first gradient update plaintext; Wherein, the second parameter updating module is specifically used for: Based on the second data set division method, split the first gradient update plaintext to obtain a second intermediate gradient update plaintext corresponding to the second computing node; Controlling the second computing node to update the plaintext and the masked plaintext according to the second intermediate gradient to obtain a second intermediate updated gradient; At least one second intermediate update gradient is integrated to obtain a second update gradient, and the second model parameter is updated using the second update gradient.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the federated model described in any one of claims 1-4 or claims 5-7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the training method of the federated model described in any one of claims 1-4 or claims 5-7 when executed by a processor.
12. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements a method for training a federated model according to any one of claims 1-4 or claims 5-7.
Citation Information
Patent Citations
Longitudinal federal feature derivation method and device based on privacy calculation, and medium
CN114881247A
Federal multi-target classification method and system
CN117131443A
Longitudinal federal tree model training method and device, equipment and storage medium
CN117972793A
Federated learning platform and methods for using same
US20240054405A1
Method and system for protecting privacy in federated learning prediction stage
WO2024138854A1
