Graph federation training method and device, equipment, storage medium and product
By using homomorphic encryption algorithms and ring network architecture in graph federated training, the risk of data leakage during model parameter transmission is solved, and data security and computing efficiency are improved.
Patent Information
- Application Number
- CN202410959973.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-07-17
AI Technical Summary
During the graph federated training process, when the number of model parameters is large, the attacker can invert the sample data through the model parameters, resulting in the risk of data leakage.
Homomorphic encryption algorithm is used to enable participants to generate gradient values for public keys to encrypt model parameters, form encrypted global gradient values, and transmit and update model parameters in the ring network architecture to avoid plaintext transmission and ensure data security.
The calculation and transmission of model parameters in the ciphertext state is realized, which avoids the risk of data leakage, improves data security, and reduces the amount of calculations of participants.
Smart Images

Figure CN119046955A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of graph federation technology, and in particular to a graph federation training method, device, equipment, storage medium and product. Background Art
[0002] Federated Graph Learning (FGL) is the application of federated learning on graph data. It solves the problem of graph data privacy protection by training graph neural networks in a federated manner. However, during the current graph federation training process, model parameters will be released from the library. This means that when the number of model parameters is large, attackers can infer sample data based on the model parameters, posing the risk of data leakage. Summary of the invention
[0003] The present application provides a graph federation training method, apparatus, device, storage medium and product to solve the problem in the prior art that when there are a large number of model parameters, attackers can reversely infer sample data based on the model parameters, posing a risk of data leakage.
[0004] To achieve the above-mentioned purpose, an embodiment of the present application provides a graph federation training method, which is applied to any participant among K participants participating in graph federation training, and the participant at least has a public key generated by each of the K participants based on a homomorphic encryption algorithm. The graph federation training method includes:
[0005] In this iteration, the current model parameters of each K participant are obtained, and the local data is trained to obtain the gradient value of each current model parameter; wherein, the current model parameters of each K participant determine the current global model;
[0006] Using the public key of the ath participant, the gradient values of the current model parameters that the ath participant is responsible for are encrypted to obtain the encrypted gradient values of each current model parameter; obtaining the encrypted global gradient value of the current model parameter that the participant is responsible for; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameters that the participant is responsible for obtained by training and encrypting K participants, a=1, 2, ..., K;
[0007] The current model parameters for which the participant is responsible are updated according to the encrypted global gradient value to obtain updated model parameters; the updated model parameters are encrypted using the public key of the participant to obtain updated encrypted model parameters;
[0008] The updated encrypted model parameters of the K participants are obtained and decrypted to obtain the updated model parameters.
[0009] As an improvement of the above solution, K participants are connected end to end to form a ring network architecture.
[0010] As an improvement of the above solution, the participant is the kth participant, and the public key of the ith participant is used to encrypt the gradient values of the current model parameters that the ith participant is responsible for, to obtain the encrypted gradient values of each current model parameter; obtaining the encrypted global gradient value of the current model parameter that the participant is responsible for includes:
[0011] In the first encrypted gradient transmission process, the kth participant uses the public key of the k-1th participant to encrypt the gradient value of the current model parameter that the k-1th participant is responsible for, obtains the encrypted gradient value, and transmits it to the k+1th participant as the transmission value of the first encrypted gradient transmission process;
[0012] In the bth encrypted gradient transmission process, the kth participant uses the public key of the kbth participant to encrypt the gradient value of the current model parameter that the kbth participant is responsible for, obtains the encrypted gradient value, and adds it to the transmission value obtained in the b-1th encrypted gradient transmission process of the k-1th participant to obtain the transmission value of the bth encrypted gradient transmission process, and transmits it to the k+1th participant; where b=2,3,...,K-1;
[0013] During the K-th encrypted gradient transmission process, the k-th participant uses the public key of the k-th participant to encrypt the gradient value of the current model parameter that the k-th participant is responsible for, obtains the encrypted gradient value and adds it to the transmission value obtained by the K-1-th encrypted gradient transmission process of the k-1-th participant to obtain the encrypted global gradient value of the current model parameter that the k-th participant is responsible for.
[0014] As an improvement of the above solution, after obtaining the updated encrypted model parameters of the K participants and decrypting them to obtain the updated model parameters, the graph federation training method further includes:
[0015] When a preset iteration stop condition is met, the iteration is stopped, and the global model is updated according to the latest model parameters;
[0016] The iteration stop condition includes any of the following:
[0017] The current number of iterations is greater than the preset number of iterations threshold;
[0018] The total change value between the objective function of each local model of this iteration and the objective function of each local model of the previous iteration is less than the preset change value; wherein each local model is trained by each participant using its own local data.
[0019] As an improvement of the above solution, the current model parameters for which the participant is responsible are updated according to the encrypted global gradient value to obtain updated model parameters, including:
[0020] Calculate a first encrypted change value of the current model parameter for which the participant is responsible based on the learning rate, the total number of samples and the encrypted global gradient value;
[0021] decrypting the first encrypted change value to obtain a first change value;
[0022] According to the first change value, the current model parameters for which the participant is responsible are updated to obtain updated model parameters.
[0023] As an improvement of the above solution, if it is the first iteration, the initial model parameters for which the participant is responsible are used as the current model parameters for which the participant is responsible;
[0024] If it is not the first iteration, the model parameters for which the participant is responsible obtained after the last iteration update are used as the current model parameters for which the participant is responsible.
[0025] To achieve the above-mentioned purpose, the embodiment of the present application further provides a graph federation training device, which is applied to any participant among K participants participating in graph federation training, and the participant at least has a public key generated by each of the K participants based on a homomorphic encryption algorithm, and the graph federation training device includes:
[0026] The training module is used to obtain the current model parameters of each of the K participants in this iteration, train the local data, and obtain the gradient values of each current model parameter; wherein the current model parameters of each of the K participants determine the current global model;
[0027] An encryption transmission module is used to encrypt the gradient value of the current model parameter responsible for the a-th participant using the public key of the a-th participant to obtain the encrypted gradient value of each current model parameter; obtain the encrypted global gradient value of the current model parameter responsible for the participant; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameter responsible for the participant obtained by training and encrypting K participants, a=1, 2, ..., K;
[0028] An updating module, configured to update the current model parameters for which the participant is responsible according to the encrypted global gradient value to obtain updated model parameters; and encrypt the updated model parameters using the public key of the participant to obtain updated encrypted model parameters;
[0029] The decryption module is used to obtain the updated encrypted model parameters of the K participants and decrypt them to obtain the updated model parameters.
[0030] To achieve the above-mentioned objectives, an embodiment of the present application also provides a graph federation training device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the graph federation training method as described above when executing the computer program.
[0031] To achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the graph federation training method as described above.
[0032] To achieve the above objectives, an embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the graph federation training method as described above.
[0033] Compared with the prior art, the embodiment of the present application provides a graph federation training method, device, equipment, storage medium and product. The participant obtains the public key generated by each of the K participants based on the homomorphic encryption algorithm, and uses the public key of the ath participant to encrypt the gradient value of the current model parameter that the ath participant is responsible for, thereby obtaining the encrypted global gradient value of the current model parameter that the participant is responsible for, and after using the encrypted global gradient value to update the current model parameter that the participant is responsible for, the updated model parameter is encrypted, thereby obtaining the updated encrypted model parameters of the K participants, and then decrypting to obtain the updated model parameters, so that during the entire graph federation training process, the model parameters will not be released from the library in plain text, avoiding the phenomenon that when the number of model parameters is large, the attacker can reverse the sample data based on the model parameters, thereby avoiding the risk of data leakage, achieving data availability but invisible, and improving data security. In addition, the participant only updates the model parameters that he is responsible for, and the amount of calculation is small. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a flowchart of a graph federation training method provided in an embodiment of the present application;
[0035] Figure 2 It is a network structure diagram of each participant provided in an embodiment of the present application;
[0036] Figure 3 It is a structural block diagram of a graph federation training device provided in an embodiment of the present application;
[0037] Figure 4 This is a structural block diagram of a graph federation training device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] It is worth noting that the embodiments of this application mainly focus on the horizontal modeling scenario in node-level federated graph neural networks. The subgraphs saved by each participant are parts of the potential complete graph that are horizontally segmented. These subgraphs constitute the potential complete graph, and the connections between them are lost due to data isolation storage. Here, it is assumed that there are a total of K participants in the scenario, and each participant has its own data set D (k) =(G (k) ,Y (k) ), where G (k) =(V (k) ,E (k) ) is the graph dataset of the kth participant; V (k) is the node set of the kth participant, including node feature data m represents a node; E (k) is the edge set of the kth participant, including edge feature data m and n are the two nodes of the edge respectively; Y (k) is a subgraph G (k) The label set, N k Represents subgraph G (k) Each participant has a localized Graph Neural Network (GNN) model (hereinafter referred to as the local model, which is trained by the participant using its own local data) to learn graph representation and make predictions. Each participant trains its own local model through model parameter training and updating to complete graph federation training.
[0040] See also Figure 1 , Figure 1 : is a flowchart of a graph federation training method provided in an embodiment of the present application. The graph federation training method is applied to any participant among K participants participating in graph federation training, and the participant has at least a public key generated by each of the K participants based on a homomorphic encryption algorithm. The graph federation training method includes:
[0041] S1. In this iteration, the current model parameters of each K participant are obtained, and the local data is trained to obtain the gradient value of each current model parameter; wherein the current model parameters of each K participant determine the current global model;
[0042] It can be understood that each participant transmits / encrypts the model parameters for which they are responsible, so that each participant directly obtains or decrypts the model parameters for which all participants (ie, K participants) are responsible.
[0043] Optionally, if it is the first iteration, the initial model parameters for which the participant is responsible are used as the current model parameters for which the participant is responsible;
[0044] If it is not the first iteration, the model parameters for which the participant is responsible obtained after the last iteration update are used as the current model parameters for which the participant is responsible.
[0045] It can be understood that in the first iteration, each participant is responsible for initializing the model parameters for which he is responsible, and obtains the initial model parameters, that is, the kth participant initializes the model parameters W (k) , including but not limited to message functions The parameters θ in the update function Then send the initialized model parameters that it is responsible for to other participants, so that each participant has the initial model parameters that all participants are responsible for. Each participant receives the initial model parameters that all participants are responsible for, and completes the initialization of the local model. The initial model parameters here do not contain data information, so there is no need to encrypt transmission. Only the updated model parameters obtained later need to be encrypted and transmitted.
[0046] During the t-th iteration, for the k-th participant, the updated model parameters obtained in the t-1-th iteration are used as the current model parameters that the K participants of the t-th iteration are responsible for, that is, the model parameters obtained in step S4 during the t-1-th iteration are used as the current model parameters that the K participants in step S1 during the t-th iteration are responsible for.
[0047] It should be noted that in one iteration, for any participant, the process of training its own local data based on the current model parameters includes: forward calculation phase and back propagation phase;
[0048] Here, the message passing neural network (MPNN) framework is used to unify the local model into this framework, so the forward calculation stage includes the message passing stage and the readout stage.
[0049] The message passing phase consists of two steps: (1) the model collects and transforms messages from neighbors; (2) the model uses the aggregated gated messages to update the hidden state of the node. Mathematically, for the kth participant and layer index l=0,...,L-1, the L-layer MPNN is formalized as follows:
[0050]
[0051] in, is the hidden vector of the i-th node of the k-th participant at the l-th layer, is the node feature of the kth participant, l is the layer id of the local model, AGG is the aggregation function, such as the sum function in the GCN model, N i is the set of adjacent nodes of node i, is a message function. According to the message function parameter θ, based on the hidden layer state and the current node update, the message transmission result is obtained. is the update function, and φ is the update function parameter.
[0052] Readout stage: After propagating through L layers of MPNN, the readout stage calculates the feature vector according to the hidden state of the last MPNN layer through formula (2) for downstream prediction tasks.
[0053]
[0054] In the node classification task, S represents a node. represents the set of nodes associated with node S in the kth participant, R δ represents the readout function, δ is the readout function parameter, It represents the probability that a node in the kth participant belongs to the positive class.
[0055] Back propagation stage: For convenience of representation, define W = {W θ ,U φ ,R δ} are all learnable model parameters in the kth participant, so the modeling process of the local model is formulated as a distributed optimization problem:
[0056]
[0057] f (k) (W) is the objective function value of the kth participant on the local data, N k is the number of samples of the kth participant, N is the total number of samples of all participants, N (k) is the number of samples of the kth participant, is the weighted average of the objective functions of each participant, that is, the global objective function. The global objective function is minimized by optimizing the parameter W. L is the loss function, which is based on calculate, is the node feature data of the i-th sample of the k-th participant, is the edge feature data of the i-th sample of the k-th participant, is the label data of the i-th sample of the k-th participant.
[0058] Through the back propagation algorithm, calculate the objective function f (k) (ω) The gradient value relative to the model parameter ω. Since different participants have different sample data, the calculated gradient values are also different:
[0059]
[0060] That is to say, for the kth participant, in this iteration, the current model parameters that the K participants are responsible for are obtained, and the local data is trained to obtain the gradient values of the current model parameters, including:
[0061] In the message passing phase, the last hidden layer vector of each node is calculated according to formula (1):
[0062] In the readout stage, the prediction probability of each stage is calculated according to formula (2);
[0063] According to formula (3), the result f of the objective function on the local data is calculated (k) (W);
[0064] Through the back propagation algorithm, based on formula (4), the gradient value of the objective function relative to each current model parameter is calculated in, It represents the gradient value of the current model parameter ω obtained by the kth participant based on the local data (i.e., its own data).
[0065] S2. Use the public key of the ath participant to encrypt the gradient values of the current model parameters that the ath participant is responsible for, and obtain the encrypted gradient values of each current model parameter; obtain the encrypted global gradient value of the current model parameter that the participant is responsible for; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameters that the participant is responsible for obtained by training and encrypting K participants, a=1, 2, ..., K;
[0066] In one example, among the kth participant, the public key of the first participant is used to encrypt the gradient value of the current model parameter that the first participant is responsible for, and the public key of the second participant is used to encrypt the gradient value of the current model parameter that the second participant is responsible for, and so on, until the public key of the Kth participant is used to encrypt the gradient value of the current model parameter that the Kth participant is responsible for, so that the kth participant has the gradient values of the current model parameters that K participants are responsible for, that is, the encrypted gradient values of each current model parameter are obtained.
[0067] It can be understood that the encrypted global gradient value of the current model parameter that the kth participant obtains is expressed as in, It represents the encrypted gradient value of the current model parameter ω of the kth participant obtained by the ath participant based on local data training, and the encrypted gradient value is encrypted by the public key of the kth participant.
[0068] That is to say, after each participant obtains the encrypted gradient value of each current model parameter, it transmits it directly or indirectly to the participant responsible for the current model parameter based on the network structure formed by K participants (that is, which participant is responsible for the current model parameter, then the encrypted gradient value of the current model parameter is finally aggregated to the responsible participant), so that each participant receives the encrypted gradient values of the model parameter that it is responsible for calculated by other participants. For example, the encrypted gradient values of the model parameter that the kth participant is responsible for and calculated by other participants are respectively expressed as in, Not equal to k, these values are transmitted directly or indirectly to the kth participant through other participants.
[0069] S3. updating the current model parameters for which the participant is responsible according to the encrypted global gradient value to obtain updated model parameters; encrypting the updated model parameters using the public key of the participant to obtain updated encrypted model parameters;
[0070] It is understandable that in the current model parameter update process, each participant is only responsible for a part of The update of the current model parameters, that is, only the current model parameters that are responsible for themselves are updated, using W (k) Indicates the current model parameters that the kth participant is responsible for updating, all W (k) Forms a complete
[0071] S4. Obtain the updated encrypted model parameters of the K participants, and decrypt them to obtain the updated model parameters.
[0072] In the embodiment of the present application, after each participant updates the current model parameters for which it is responsible, it obtains its own updated model parameters, and transmits them to other participants through encrypted transmission, so that each participant obtains the updated encrypted model parameters of all participants, and then each participant uses its own private key to decrypt; for example, after the kth participant obtains the updated encrypted model parameters of the K participants, it uses its own Prvkey generated based on the homomorphic encryption algorithm k , decrypt these encrypted model parameters to obtain updated model parameters.
[0073] It can be understood that each of the K participants participating in the graph federation training can implement the graph federation training method provided in the embodiment of the present application. Steps S1-S4 describe one of the iteration processes of any participant. Each iteration can obtain updated model parameters, and then the updated model parameters are aggregated to complete the update of the global model. At this time, the local model is reset with the updated global model, and the latest local model is confirmed until the iteration ends and the latest local model is obtained.
[0074] Each participant has K public keys generated by each participant based on the homomorphic encryption algorithm; specifically, for any participant k, the participant k has its own public key Pubkey generated based on the homomorphic encryption algorithm k And your own private key Prvkey k , and then use your public key Pubkey k Send to other participants; each participant does this, so that each participant not only has the private key PrvKey generated by itself k , and also has the public keys generated by all participants; the homomorphic encryption algorithm here meets the requirements of additive homomorphism and multiplication homomorphism, such as the Paillier algorithm (additive homomorphic encryption algorithm).
[0075] It can be seen that the embodiment of the present application adopts a homomorphic encryption method in the process of model parameter training and updating, adheres to the principle of no plaintext out of the warehouse, realizes the ciphertext calculation and transmission of the whole process, and finally achieves that the calculation result in the ciphertext state is consistent with the plaintext calculation result, and is more secure and reliable.
[0076] Optionally, the K participants are connected end to end to form a ring network architecture.
[0077] It is understandable that the embodiment of the present application does not have a central server, but transmits data between various participants, which can avoid the risk of data leakage.
[0078] In an optional embodiment, the participant is the kth participant, and the step of encrypting the gradient values of the current model parameters for which the i-th participant is responsible by using the public key of the i-th participant to obtain the encrypted gradient values of the current model parameters; and obtaining the encrypted global gradient values of the current model parameters for which the participant is responsible includes:
[0079] In the first encrypted gradient transmission process, the kth participant uses the public key of the k-1th participant to encrypt the gradient value of the current model parameter that the k-1th participant is responsible for, obtains the encrypted gradient value, and transmits it to the k+1th participant as the transmission value of the first encrypted gradient transmission process;
[0080] In the bth encrypted gradient transmission process, the kth participant uses the public key of the kbth participant to encrypt the gradient value of the current model parameter that the kbth participant is responsible for, obtains the encrypted gradient value, and adds it to the transmission value obtained in the b-1th encrypted gradient transmission process of the k-1th participant to obtain the transmission value of the bth encrypted gradient transmission process, and transmits it to the k+1th participant; where b=2,3,...,K-1;
[0081] During the K-th encrypted gradient transmission process, the k-th participant uses the public key of the k-th participant to encrypt the gradient value of the current model parameter that the k-th participant is responsible for, obtains the encrypted gradient value and adds it to the transmission value obtained by the K-1-th encrypted gradient transmission process of the k-1-th participant to obtain the encrypted global gradient value of the current model parameter that the k-th participant is responsible for.
[0082] In an embodiment of the present application, in a ring network architecture composed of K participants, each participant only sends data to the next participant, and the kth participant sends a transmission value to the k+1th participant. After one cycle, each participant obtains the encrypted global gradient value of the current model parameter for which it is responsible, completes the update of the current model parameter for which it is responsible, and then another cycle is performed to distribute the updated model parameters to all participants, so that each participant obtains the updated model parameters and completes the update of the global model.
[0083] Assume that the model parameter set W that the kth participant is responsible for is (k) , which contains multiple parameters ω∈W (k) , take any ω∈W (k) In order to better understand the embodiment of the present application, the process of obtaining the encrypted global gradient value is described by taking the model parameter ω that the kth participant is responsible for as an example:
[0084] First, the calculation starts from the next(k)th participant, using the public key of the kth participant Encrypted Here next(k)=mod(k+1,K) represents the next participant of the kth participant, using [[ ]] k Indicates the use of public key PubKey k The result of homomorphic encryption. Then the next(k)th participant will Sent to the mod(k+2,K)th participant.
[0085] The mod(k+2,K)th participant first performs similar Encrypted Then compare it with the received The sum is Then it is sent to the mod(k+3,K)th participant.
[0086] And so on, repeat the above steps K-1 times, and finally come to the kth participant. The kth participant sends the The encrypted gradient value calculated by the participant for the model parameter that he is responsible for Sum the model parameters ω
[0087] For ease of understanding, assume that there are four participants. For example, if the model parameter ω1 that the first participant is responsible for is to be updated, then the second participant first encrypts the first participant's public key get And send it to the third party, the third party 3 calculates and sends it to the fourth party, who calculates And send it to the first participant, who finally calculates in, It indicates the encrypted gradient value of the model parameter of the first participant obtained by the second participant based on its own data training. The remaining parameters and The meanings are similar and will not be elaborated here.
[0088] The above is just a parameter matrix update process. In actual calculations, all model parameters are updated according to the following method: First, any participant k uses the k-1th public key to encrypt the gradient values of all model parameters that the previous participant k-1 is responsible for, and transmits it to the k+1th participant; then each participant k uses the k-2th key to encrypt the gradient values of all model parameters that the previous participant k-2 is responsible for, and then sums them with the encrypted gradient values sent by the previous participant k-1, and then transmits the summed result to the k+1th participant, and so on, repeating K-1 times, until the participant k encrypts the gradient values of all model parameters that it is responsible for using the kth key, and then sums them with the encrypted gradient values sent by the previous participant k-1, and finally obtains Finally, all model parameters are updated according to formula (5) and formula (6).
[0089] For ease of understanding, assume that there are four participants. The fourth participant first calculates the model parameter ω3 that the third participant is responsible for. And send it to the first participant, and then the fourth participant takes the model parameter ω2 of the second participant and combines it with the model parameter sent by the third participant. Calculated Send it to the first participant; then combine the model parameter ω1 sent by the third participant with the model parameter ω2 of the first participant. Calculated and sent to the first participant; finally, the fourth participant takes the model parameter ω4 that he is responsible for, combined with the one sent by the third participant Calculated
[0090] That is to say, for any participant, K encrypted gradient transmission processes are required:
[0091] In the first encrypted gradient transmission process, the kth participant uses the public key of the k-1th participant to encrypt the gradient value of the current model parameter that the k-1th participant is responsible for, obtains the encrypted gradient value, and transmits it to the k+1th participant as the transmission value of the first encrypted gradient transmission process;
[0092] In the bth encrypted gradient transmission process, the kth participant uses the public key of the kbth participant to encrypt the gradient value of the current model parameter that the kbth participant is responsible for, obtains the encrypted gradient value, and adds it to the transmission value obtained in the b-1th encrypted gradient transmission process of the k-1th participant to obtain the transmission value of the bth encrypted gradient transmission process, and transmits it to the k+1th participant; where b=2,3,...,K-1;
[0093] During the K-th encrypted gradient transmission process, the k-th participant uses the public key of the k-th participant to encrypt the gradient value of the current model parameter that the k-th participant is responsible for, obtains the encrypted gradient value and adds it to the transmission value obtained by the K-1-th encrypted gradient transmission process of the k-1-th participant to obtain the encrypted global gradient value of the current model parameter that the k-th participant is responsible for.
[0094] That is to say, each participant transmits the ath (a=1, 2, ..., K) transmission value to the next participant, and the transmission value can be used by the next participant. The next participant adds the received transmission value to the corresponding encrypted gradient value during the a+1th encrypted gradient transmission process to obtain the transmission value of the next participant's a+1th process.
[0095] In the above, each participant only updates the current model parameters that they are responsible for according to their own encrypted global gradient values. Subsequently, it is necessary to obtain the updated model parameters of all participants to complete the global synchronous update of all model parameters, i.e., step S4;
[0096] Here, based on the ring network architecture composed of K participants, first, for any participant k, the updated model parameters responsible for participant k are encrypted using the public key of the next participant k+1 to obtain the updated encrypted model parameters [[W (k) ]] k+1 , and then send it to participant k+1, which decrypts it and obtains the updated model parameter W that participant k is responsible for. (k) ;
[0097] By analogy, participant k encrypts again to obtain [[W (k) ]] k+2 , sent to participant k+2, who decrypts it and obtains the updated model parameter W that participant k is responsible for. (k) . Repeat this process K-1 times and finally complete the global update of all model parameters.
[0098] In an optional embodiment, after obtaining the updated encrypted model parameters of the K participants and decrypting them to obtain the updated model parameters, the graph federation training method further includes:
[0099] When a preset iteration stop condition is met, the iteration is stopped, and the global model is updated according to the latest model parameters;
[0100] The iteration stop condition includes any of the following:
[0101] The current number of iterations is greater than the preset number of iterations threshold;
[0102] The total change value between the objective function of each local model of this iteration and the objective function of each local model of the previous iteration is less than the preset change value; wherein each local model is trained by each participant using its own local data.
[0103] It can be understood that steps S1-S4 are repeated until a preset iteration stop condition is met, the iteration is stopped, and the global model is updated according to the latest model parameters obtained after this iteration;
[0104] Optionally, the total change value is obtained by adding the second change values between the objective function of each local model of this iteration and the objective function of the corresponding local model of the previous iteration; wherein the second change value is represented by the difference, for example, the difference, the sum of squared errors, the absolute error and other values related to the difference can all represent the change between the objective function of each local model of this iteration and the objective function of each local model of the previous iteration.
[0105] Specifically, the total change value is calculated as follows:
[0106] Each participant calculates the objective function f of each local model in this iteration according to formula (3): (k,t) (W) and the objective function f of each local model in the previous iteration (k,t-1) (W); where k represents the participant and t represents the current iteration number;
[0107] Each participant calculates the objective function f (k,t) (W) and the objective function f (k,t-1) (W), and encrypt the second change value to obtain a second encrypted change value; for example, the error square sum is used as the second change value, and the second change value calculated by the kth participant is Dist k =||f (k,t) (W)-f (k,t-1) (W)|| 2 ;
[0108] Each participant summarizes the second change values and sums them up to get the sum result The summation result is decrypted to obtain the total change value Dist; or, one of the participants summarizes the second change values and sums them to obtain the summation result, decrypts the summation result to obtain the total change value, and then transmits it to each participant. For example, each participant sends the calculated second change value to the first participant, and the first participant sums and obtains Decrypt to get Dist and send it back to each participant.
[0109] In an optional embodiment, the updating of the current model parameters for which the participant is responsible according to the encrypted global gradient value to obtain updated model parameters includes:
[0110] Calculate a first encrypted change value of the current model parameter for which the participant is responsible based on the learning rate, the total number of samples and the encrypted global gradient value;
[0111] decrypting the first encrypted change value to obtain a first change value;
[0112] According to the first change value, the current model parameters for which the participant is responsible are updated to obtain updated model parameters.
[0113] Exemplarily, each participant calculates the first encrypted change value of the current model parameter for which they are responsible according to formula (5):
[0114]
[0115] In the formula, represents the first encrypted change value, λ is the learning rate, N is the total number of samples, Represents the encrypted global gradient value of the current model parameter ω calculated by the kth participant for which he is responsible.
[0116] Each participant decrypts the first encrypted change value calculated by itself to obtain the first change value
[0117] Each participant updates the current model parameters for which he is responsible according to formula (6):
[0118]
[0119] Thus, the current model parameter ω is updated.
[0120] The embodiments of the present application can be applied to modeling training scenarios based on complex relationship network data when data is not required to be stored, such as anti-fraud modeling scenarios of provincial companies of multiple operators. In terms of data, the data used mainly includes three categories:
[0121] (1) User characteristic data
[0122] User characteristic data mainly refers to operational data and DPI analysis data in mobile services, including user technical portraits, communication information, roaming information, device information, and APP usage information.
[0123] (2) User relationship data
[0124] Relationship data mainly includes user call relationships, user text message relationships, user device relationships, user location relationships, etc.
[0125] (3) User tag data
[0126] User tag data is the user's business performance data, which has different meanings in different business scenarios. For example, in the anti-fraud scenario, 0 represents a normal user and 1 represents a fraudulent user; similarly, in the credit scoring and wool party scenarios, 0-1 can also be used to represent a normal user-abnormal user.
[0127] In summary, the above data form a network diagram, which contains three types of nodes: users, locations, and devices. Each type of node has its own characteristics, of which users have the most characteristics, and the characteristics of locations include longitude and latitude, and the characteristics of devices include device prices, etc. Nodes are connected by relationships, and users have call and text message relationships. The relationship between users and locations indicates whether the user is at a certain location during a certain period of time, and the relationship between users and devices indicates whether the user has used a certain device.
[0128] For each institution, such as a bank, an operator, or a provincial company of an operator, as long as the above data is available, each can perform modeling training to obtain a prediction model for fraudulent users (i.e., a local model). However, due to the insufficient data volume of a single provincial company, it is often difficult to establish a better model. In order to improve the accuracy of the model, it is necessary to combine the data of each provincial company of the operator for modeling. Specifically, each provincial company of the operator is deployed with participants, and the characteristics, relationships, and label data of users in each provincial company are stored in the storage layer of the participants. Through the embodiment of the present application, each participant can obtain the final local model and deploy it online separately.
[0129] See also Figure 3 , Figure 3 1 is a structural block diagram of a graph federation training device 10 provided in an embodiment of the present application. The graph federation training device 10 is applied to any participant among K participants participating in graph federation training. The participant has at least a public key generated by each of the K participants based on a homomorphic encryption algorithm. The graph federation training device 10 includes:
[0130] The training module 11 is used to obtain the current model parameters that each of the K participants is responsible for in this iteration, train the local data, and obtain the gradient value of each current model parameter; wherein the current global model is determined by the current model parameters that each of the K participants is responsible for;
[0131] The encryption transmission module 12 is used to encrypt the gradient value of the current model parameter responsible for the a-th participant using the public key of the a-th participant to obtain the encrypted gradient value of each current model parameter; obtain the encrypted global gradient value of the current model parameter responsible for the participant; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameter responsible for the participant obtained by training and encrypting K participants, a=1, 2, ..., K;
[0132] An updating module 13 is used to update the current model parameters that the participant is responsible for according to the encrypted global gradient value to obtain updated model parameters; and to encrypt the updated model parameters using the public key of the participant to obtain updated encrypted model parameters;
[0133] The decryption module 14 is used to obtain the updated encrypted model parameters of the K participants and decrypt them to obtain the updated model parameters.
[0134] Optionally, the K participants are connected end to end to form a ring network architecture.
[0135] Optionally, the participant is the kth participant, and the encryption transmission module 12 is specifically used for:
[0136] In the first encrypted gradient transmission process, the kth participant uses the public key of the k-1th participant to encrypt the gradient value of the current model parameter that the k-1th participant is responsible for, obtains the encrypted gradient value, and transmits it to the k+1th participant as the transmission value of the first encrypted gradient transmission process;
[0137] In the bth encrypted gradient transmission process, the kth participant uses the public key of the kbth participant to encrypt the gradient value of the current model parameter that the kbth participant is responsible for, obtains the encrypted gradient value, and adds it to the transmission value obtained in the b-1th encrypted gradient transmission process of the k-1th participant to obtain the transmission value of the bth encrypted gradient transmission process, and transmits it to the k+1th participant; where b=2,3,...,K-1;
[0138] During the K-th encrypted gradient transmission process, the k-th participant uses the public key of the k-th participant to encrypt the gradient value of the current model parameter that the k-th participant is responsible for, obtains the encrypted gradient value and adds it to the transmission value obtained by the K-1-th encrypted gradient transmission process of the k-1-th participant to obtain the encrypted global gradient value of the current model parameter that the k-th participant is responsible for.
[0139] Optionally, the graph federation training device 10 further includes:
[0140] An iteration stop module, used to stop iteration when a preset iteration stop condition is met, and update the global model according to the latest model parameters;
[0141] The iteration stop condition includes any of the following:
[0142] The current number of iterations is greater than the preset number of iterations threshold;
[0143] The total change value between the objective function of each local model of this iteration and the objective function of each local model of the previous iteration is less than the preset change value; wherein each local model is trained by each participant using its own local data.
[0144] Optionally, the updating module 13 is specifically used for:
[0145] Calculate a first encrypted change value of the current model parameter for which the participant is responsible based on the learning rate, the total number of samples and the encrypted global gradient value;
[0146] decrypting the first encrypted change value to obtain a first change value;
[0147] According to the first change value, the current model parameters for which the participant is responsible are updated to obtain updated model parameters.
[0148] Optionally, if it is the first iteration, the initial model parameters for which the participant is responsible are used as the current model parameters for which the participant is responsible;
[0149] If it is not the first iteration, the model parameters for which the participant is responsible obtained after the last iteration update are used as the current model parameters for which the participant is responsible.
[0150] It is worth noting that the working process of each module in the graph federation training device 10 described in the embodiment of the present application can refer to the working process of the graph federation training method described in the above embodiment, and will not be repeated here.
[0151] A graph federation training device 10 provided in an embodiment of the present application, in which a participant obtains the public key generated by each of K participants based on a homomorphic encryption algorithm, and uses the public key of the ath participant to encrypt the gradient value of the current model parameter that the ath participant is responsible for, thereby obtaining the encrypted global gradient value of the current model parameter that the participant is responsible for, and after using the encrypted global gradient value to update the current model parameter that the participant is responsible for, the updated model parameter is encrypted, thereby obtaining the updated encrypted model parameters of the K participants, and then decrypting to obtain the updated model parameters, so that during the entire graph federation training process, the model parameters will not be released from the library in plain text, avoiding the phenomenon that when the number of model parameters is large, the attacker can reverse the sample data based on the model parameters, thereby avoiding the risk of data leakage, achieving data availability but invisible, and improving data security. In addition, each participant only updates the model parameters that he is responsible for, and the amount of calculation is small.
[0152] In addition, an embodiment of the present application further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the graph federation training method described in any of the above embodiments.
[0153] In addition, an embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the graph federation training method described in any of the above embodiments.
[0154] See also Figure 4 , Figure 4 : is a structural block diagram of a graph federation training device 20 provided in an embodiment of the present application, and the graph federation training device 20 includes: a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above-mentioned graph federation training method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented.
[0155] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the graph federation training device 20.
[0156] The graph federation training device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of the graph federation training device 20 and does not constitute a limitation on the graph federation training device 20. The graph federation training device 20 may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the graph federation training device 20 may also include input and output devices, network access devices, buses, and the like.
[0157] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the graph federation training device 20, and uses various interfaces and lines to connect various parts of the entire graph federation training device 20.
[0158] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the graph federation training device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0159] Wherein, if the module / unit integrated in the graph federation training device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 21. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0160] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0161] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.
Claims
1. A graph federation training method, characterized in that: Applied to any participant among K participants participating in graph federation training, the participant at least has a public key generated by each of the K participants based on a homomorphic encryption algorithm, the graph federation training method includes: In this iteration, the current model parameters of each K participant are obtained, and the local data is trained to obtain the gradient value of each current model parameter; wherein, the current model parameters of each K participant determine the current global model; Using the public key of the ath participant, the gradient values of the current model parameters that the ath participant is responsible for are encrypted to obtain the encrypted gradient values of each current model parameter; obtaining the encrypted global gradient value of the current model parameter that the participant is responsible for; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameters that the participant is responsible for obtained by training and encrypting K participants, a=1, 2, ..., K; The current model parameters for which the participant is responsible are updated according to the encrypted global gradient value to obtain updated model parameters; the updated model parameters are encrypted using the public key of the participant to obtain updated encrypted model parameters; The updated encrypted model parameters of the K participants are obtained and decrypted to obtain the updated model parameters.
2. The graph federation training method according to claim 1, characterized in that: The K participants are connected end to end to form a ring network architecture.
3. The graph federation training method according to claim 2, characterized in that: The participant is the kth participant, and the gradient values of the current model parameters that the i-th participant is responsible for are encrypted using the public key of the i-th participant to obtain the encrypted gradient values of the current model parameters; Obtaining the encrypted global gradient value of the current model parameter for which the participant is responsible, including: In the first encrypted gradient transmission process, the kth participant uses the public key of the k-1th participant to encrypt the gradient value of the current model parameter that the k-1th participant is responsible for, obtains the encrypted gradient value, and transmits it to the k+1th participant as the transmission value of the first encrypted gradient transmission process; In the bth encrypted gradient transmission process, the kth participant uses the public key of the kbth participant to encrypt the gradient value of the current model parameter that the kbth participant is responsible for, obtains the encrypted gradient value, and adds it to the transmission value obtained in the b-1th encrypted gradient transmission process of the k-1th participant to obtain the transmission value of the bth encrypted gradient transmission process, and transmits it to the k+1th participant; where b=2,3,...,K-1; During the K-th encrypted gradient transmission process, the k-th participant uses the public key of the k-th participant to encrypt the gradient value of the current model parameter that the k-th participant is responsible for, obtains the encrypted gradient value and adds it to the transmission value obtained by the K-1-th encrypted gradient transmission process of the k-1-th participant to obtain the encrypted global gradient value of the current model parameter that the k-th participant is responsible for.
4. The graph federation training method according to claim 1, characterized in that: After obtaining the updated encrypted model parameters of the K participants and decrypting them to obtain updated model parameters, the graph federation training method further includes: When a preset iteration stop condition is met, the iteration is stopped, and the global model is updated according to the latest model parameters; The iteration stop condition includes any of the following: The current number of iterations is greater than the preset number of iterations threshold; The total change value between the objective function of each local model of this iteration and the objective function of each local model of the previous iteration is less than the preset change value; wherein each local model is trained by each participant using its own local data.
5. The graph federation training method according to claim 1, characterized in that: The updating of the current model parameters for which the participant is responsible according to the encrypted global gradient value to obtain updated model parameters includes: Calculate a first encrypted change value of the current model parameter for which the participant is responsible based on the learning rate, the total number of samples and the encrypted global gradient value; decrypting the first encrypted change value to obtain a first change value; According to the first change value, the current model parameters for which the participant is responsible are updated to obtain updated model parameters.
6. The graph federation training method according to claim 1, characterized in that: If it is the first iteration, the initial model parameters for which the participant is responsible are used as the current model parameters for which the participant is responsible; If it is not the first iteration, the model parameters for which the participant is responsible obtained after the last iteration update are used as the current model parameters for which the participant is responsible.
7. A graph federation training device, characterized in that: Applied to any participant among K participants participating in graph federation training, the participant at least has a public key generated by each of the K participants based on a homomorphic encryption algorithm, and the graph federation training device includes: The training module is used to obtain the current model parameters of each of the K participants in this iteration, train the local data, and obtain the gradient values of each current model parameter; wherein the current model parameters of each of the K participants determine the current global model; An encryption transmission module is used to encrypt the gradient value of the current model parameter responsible for the a-th participant using the public key of the a-th participant to obtain the encrypted gradient value of each current model parameter; obtain the encrypted global gradient value of the current model parameter responsible for the participant; wherein the encrypted global gradient value is composed of the encrypted gradient values of the current model parameter responsible for the participant obtained by training and encrypting K participants, a=1, 2, ..., K; An updating module, configured to update the current model parameters for which the participant is responsible according to the encrypted global gradient value to obtain updated model parameters; and encrypt the updated model parameters using the public key of the participant to obtain updated encrypted model parameters; The decryption module is used to obtain the updated encrypted model parameters of the K participants and decrypt them to obtain the updated model parameters.
8. A graph federation training device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the graph federation training method as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is run, it controls the device where the computer-readable storage medium is located to execute the graph federation training method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that It includes a computer program / instruction, which, when executed by a processor, implements the graph federation training method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Federal learning privacy protection method based on homomorphic encryption and secret sharing
CN113037460A
Federal learning method and device based on homomorphic encryption and depth gradient compression
CN115643105A
Federal learning method and system and storage medium
CN116090586A
Federal learning-based model construction method and device, equipment and medium
CN116957109A
Graph model training method, system and equipment based on privacy protection
CN117786753A
Cited By
Power system honey dynamic deployment defense method based on learning perception
CN119254537A
