Defense method for federal learning depth gradient leakage attack
By adopting chain principle and Paillier homomorphic encryption technology in federated learning, and replacing the original gradient upload by gradient difference value, the problem of privacy protection vulnerability in the existing technology is solved, achieving high precision and efficient privacy Protected, suitable for time-sensitive scenarios.
Patent Information
- Application Number
- CN202411204624.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-22
AI Technical Summary
The existing privacy protection methods rely on uploading the original gradient in federated learning, and are vulnerable to gradient inversion attacks and tag recovery attacks. The introduction of noise affects the training accuracy, has high computational complexity, and are not suitable for time-sensitive scenarios.
Adopt data pre-encryption method based on chain principle, use Paillier homomorphic encryption technology to hide the gradient, and replace the original gradient upload through gradient difference, combine historical gradients for iterative updates, design a new joint transformation framework, and support floating-point integer component encryption , enhance privacy protection and training accuracy.
It effectively reduces the possibility of attackers obtaining private information through analysis and uploading gradients, maintains high-precision federated learning, and improves the effectiveness and computing efficiency of privacy protection, overcoming the limitations of Paillier encryption on non-integer data.
Smart Images

Figure CN119004537A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data security technology, and in particular to a method for defending against deep gradient leakage attacks in federated learning. Background Art
[0002] Federated learning (FL) has attracted the attention of researchers and engineers because of its ability to enhance the privacy protection capabilities of traditional machine learning methods. Google proposed a FL solution using a distributed machine learning framework. It mainly focuses on combining multiple client training models to solve the local privacy leakage problem and solve the distributed data island problem without sharing local data.
[0003] In addition, some methods propose to upload only model parameters or gradients for collaborative learning, which requires uploading original data. Therefore, there is a growing interest in using FL to protect privacy. Although FL enhances privacy protection by avoiding direct exchange of local data, the feature information gradients extracted from the original data are still vulnerable to attacks. Attackers can use these gradients to recover sensitive information, such as users' personal photos or medical history.
[0004] The latest technique of gradient inversion attack involves computing the minimum distance between the original gradient and the virtual gradient using the Euler function. The training data can be reconstructed from the swapped model weights or gradients. This vulnerability is particularly worrisome for deep learning architectures that utilize fully connected layers, as they can be analyzed and reconstructed, exposing the privacy of the data owner to gradient inversion attacks. The introduction of noise accumulates during the iteration process, negatively affecting the training accuracy, while the high computational complexity of encryption and decryption makes it impractical for time-sensitive FL scenarios. Summary of the invention
[0005] The purpose of the present invention is to provide a method for defending against deep gradient leakage attacks in federated learning, aiming to solve the technical problem that existing privacy protection methods mainly rely on uploading original gradients and are vulnerable to the threats of gradient reversal attacks and label recovery attacks.
[0006] To achieve the above object, the present invention provides a method for defending against a deep gradient leakage attack in federated learning, comprising the following steps:
[0007] Step 1: The central server selects the client;
[0008] Step 2: Implement data pre-encryption based on the chain principle;
[0009] Step 3: Client gradient upload;
[0010] Step 4: Server aggregation, summarizing the model parameters of all clients;
[0011] Step 5: Model update, using the historical gradient loop for iterative updates until the loss function converges.
[0012] Optionally, during the execution of step 1, the central server selects m clients that meet the requirements, m≤K, K represents the maximum number of clients supported by the central server; specifically, the server selects clients with stable communication and no disconnection based on the client operation status and network status.
[0013] Optionally, the execution process of step 2 includes broadcasting and local training. During the broadcasting process, a homomorphic encryption framework is established, and each participant generates a pair of encryption keys in the federated system, namely a public key and a private key. In local training, each client updates the local computing model with local data and runs the gradient descent algorithm to optimize the machine learning model.
[0014] Optionally, during local training, extract the features of local data and calculate the corresponding gradients. The expression is as follows:
[0015]
[0016] in, is the model parameter of the jth client in the tth round, represents the gradient of the jth client in the tth round, is the true label, Represented as the input data features and model parameters W t To make predictions.
[0017] Optionally, during the execution of step 3, the gradient is hidden using Paillier homomorphic encryption in epoch = 1 Starting from epoch=2, the gradient difference between this round of training and the previous round of training is used To replace the gradient upload.
[0018] Optionally, in step 4, if the client is not selected, the client model at the end of the current communication is still the original model obtained from the server at the beginning of the previous round of communication.
[0019] Optionally, in step 5, the server allows to select K clients or selected clients to participate in the aggregation, so there are two cases: the first is to aggregate only some of the selected clients, and the other is to aggregate all the clients.
[0020] When partially selecting clients for aggregation: the server transmits the current new parameters to the selected clients each time, and only aggregates the model parameters of the selected clients. Assume that the current global model is W t, the client set selected in the tth iteration is V, the server selects m clients belonging to the set V, and then sends W only to these m clients t After m clients are updated locally, the server's aggregation formula for selecting clients in the tth round is as follows:
[0021]
[0022] where n k Indicates the number of client samples, represents the model parameters of client j in round t.
[0023] When the server returns the weighted average result to the corresponding client, the client can use the previously stored gradient to restore
[0024] When all clients are aggregated: The server sends a new brand new model to all clients in each round and aggregates the model parameters of all clients. If no client is selected, the client model at the end of the current communication is still the original model obtained from the server at the beginning of the previous communication round. If the current global model is set to W t , the server selects m clients from the set V. After the m clients are updated locally, the aggregation formula on the server side is as follows:
[0025]
[0026] Finally, the loop is iterated until the loss function converges. The global loss function is as follows:
[0027]
[0028] Where W is the global model parameter, is the loss function of client j on its local data.
[0029] The present invention provides a method for defending against deep gradient leakage attacks in federated learning, focusing on gradient vectors, and designs a new joint transformation framework that can maintain high precision in federated learning while protecting privacy without loss; at the same time, through the gradient transformation method, privacy protection, training accuracy and computational efficiency are taken into account. Specifically, by utilizing the correlation between the gradient and the data, the gradient difference of two consecutive iterations is used to mask the original gradient, thereby effectively reducing the possibility of attackers obtaining private information by analyzing the uploaded gradient. In addition, in view of the limitation that homomorphic encryption technology can only be applied to integer calculations, the encryption scheme is improved to support integer components of floating-point numbers, thereby effectively overcoming the limitations of the Paillier encryption scheme when processing non-integer data. The present invention improves the effectiveness of privacy protection while maintaining the high training accuracy and efficiency of the federated system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, 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 paying creative work.
[0031] Figure 1 It is a system principle flow chart of a method for defending against deep gradient leakage attacks of federated learning of the present invention.
[0032] Figure 2 It is a schematic diagram of the framework of a method for defending against deep gradient leakage attacks in federated learning according to a specific embodiment of the present invention.
[0033] Figure 3 It is a timing diagram of a method for defending against deep gradient leakage attacks in federated learning according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0034] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0035] See also Figure 1 The present invention provides a method for defending against a deep gradient leakage attack in federated learning, comprising the following steps:
[0036] S1: The central server selects the client;
[0037] S2: Data pre-encryption based on the chain principle;
[0038] S3: client gradient upload;
[0039] S4: server aggregation, summarizing model parameters of all clients;
[0040] S5: Model update, using the historical gradient loop for iterative updates until the loss function converges.
[0041] The following is further described in conjunction with specific embodiments and execution steps:
[0042] like Figure 2 The model architecture diagram of the embodiment is shown, and the specific implementation steps of the method for defending against the deep gradient leakage attack of federated learning are as follows:
[0043] 1) Step S1 is the client selection process: the central server selects m clients that meet the requirements from a group of clients. Specifically, m≤K, K value is theoretically greater than 1 and within the server support range. In this process, the central server selects sample users based on the client operation status and network status. The selection criteria are stable communication without disconnection.
[0044] 2) The data pre-encryption in step S2 includes the following two parts:
[0045] broadcast;
[0046] Local training.
[0047] During the broadcast process, a secure homomorphic encryption framework is established, and each participant generates a pair of encryption keys in the FL system: a public key and a private key. These keys are essential to the encryption process. Subsequently, each client randomly specifies another client, called client j, and uses the public key of the selected client to encrypt its own private key, thereby facilitating the secure transmission of the first round of gradients. This encrypted private key, as well as the model of the central server, is distributed to all participating clients. This method ensures that the encryption key is kept confidential and can only be accessed by the designated recipient. This strengthens the security of the entire federated learning process.
[0048] In local training, each client updates the local computing model with local data and runs the gradient descent algorithm to optimize the machine learning model. During the model training process, each client's data is stored locally. Each participant needs to train based on local data to extract the features of the local data and calculate the corresponding gradient, as shown in Formula 1:
[0049]
[0050] In the formula, is the model parameter of the jth client in the tth round, represents the gradient of the jth client in the tth round, is the true label, Represented as the input data features and model parameters W t To make predictions. Because there is no gradient from the previous round in the first round of iterations, there is no gradient difference, and the algorithm idea of the present invention is the chain principle, which needs to ensure that the gradient of the first round of training is not stolen by attackers. The Paillier scheme meets the standard security definition of encryption schemes. Intuitively speaking, the ciphertext will not leak any information in the plaintext.
[0051] 3) Step S3 is the client gradient upload process:
[0052] During epoch=1, Paillier homomorphic encryption is used to hide the gradient The encrypted gradient is transmitted to the server for weighted averaging. Starting from epoch=2, the present invention uses the difference between the gradient of this round of training and the gradient of the previous round of training. Instead of uploading the gradient, the gradient difference can effectively confuse the original gradient. After receiving the gradient difference uploaded by each client, the server performs weighted averaging, i.e. where n k represents the number sample of the kth client. Finally, the calculated average value is returned to each client. Since each client, i.e., client j, saves the gradient of the previous round, it can be used to restore the gradient of the current round, i.e., the gradient of the tth round as shown in Formula 2:
[0053]
[0054] Where K represents the total number of clients, r represents a client, and n k Indicates the number of client samples, represents the model parameters of client j in round t.
[0055] But the gradient obtained by the server in round t is as follows:
[0056]
[0057] The values of these two gradients are completely different, so privacy leakage can be effectively protected. If the server wants to get the normal gradient of this epoch, it must know the gradient of the previous epoch. Therefore, in order to protect the privacy security of the gradient, the present invention uses Paillier homomorphic encryption technology to hide the gradient in epoch 1. During the model training process, the data of each client is stored locally.
[0058] 4) Step S4 is the server aggregation process. The server transmits the current new parameters to the selected client each time and only aggregates the model parameters of the selected client. Assume that the current global model is W t , the client set selected in the tth iteration is V, the server selects m clients belonging to the set V, and then sends W only to these m clients t After m clients are updated locally, the server's aggregation formula for selecting clients in the tth round is as follows:
[0059]
[0060] where n k Indicates the number of client samples, represents the model parameters of client j in round t.
[0061] When the server returns the weighted average result to the corresponding client, the client can use the previously stored gradient to restore
[0062] When all clients are aggregated: The server sends a new brand new model to all clients in each round and aggregates the model parameters of all clients. If no client is selected, the client model at the end of the current communication is still the original model obtained from the server at the beginning of the previous communication round. If the current global model is set to W t , the server selects m clients from the set V. After the m clients are updated locally, the aggregation formula on the server side is as follows:
[0063]
[0064] 5) During the model update process in step S5, the cumulative update of the participating clients in the current time period is the summary result of the gradient differences of all clients. Based on this update, the server will update and share the global model and publish it to the selected clients in the next training round. The above process is repeated until the loss function converges. The global loss function is as follows:
[0065]
[0066] Where W is the global model parameter, is the loss function of client j on its local data. Figure 3 FIG. 1 is a timing diagram of an embodiment, and the specific implementation steps of the method for defending against a deep gradient leakage attack of federated learning are as follows:
[0067] In S1, the server performs client selection. At the beginning of federated learning, the central server first selects k clients that meet the conditions from a group of clients to participate in this round of training. The selection criteria may be based on the client's computing power, network conditions, and the diversity of data distribution. This step ensures that the clients participating in the training can be stable during the communication and computing process, thereby improving the training efficiency.
[0068] In S2, data pre-encryption is implemented based on the chain principle. After the client completes the selection, the central server distributes the initial model F(·) and parameter W to the client. After receiving this information, each client starts training the local model. To protect the privacy of local data and gradients, the client uses the Paillier homomorphic encryption method to encrypt the gradients. Encryption is performed, and the formula is as follows:
[0069]
[0070] Among them, l is the loss function, is the model prediction function, and are the input features and corresponding labels, W t is the current model parameter. The encrypted gradient Paillier (W) is uploaded to the server.
[0071] In S3, the client uploads the gradient. After the first round of training is completed, the client uploads the encrypted gradient Paillier (W) to the server. After receiving the encrypted gradients from each client, the server performs weighted average to generate a new global gradient. In this process, the server does not directly decrypt the gradient, but aggregates the encrypted gradient. The formula is as follows:
[0072]
[0073] This formula means that the server averages the encrypted gradients uploaded by each client to maintain the security of the gradients in an encrypted state.
[0074] In S4, the server performs a weighted average of the encrypted gradients uploaded by all clients to generate aggregated global model parameters. These parameters are encrypted again and transmitted back to the client. After receiving the encrypted aggregated gradient, the client decrypts and restores it to the plaintext gradient. At this point, the client combines the previously stored historical gradients with the gradients updated in this round to update the model. The client's gradient difference is calculated as follows:
[0075]
[0076] The gradient difference is used to replace the original gradient and upload it to the server, further confusing the decryption attempt of potential attackers. After receiving the gradient difference, the server performs a weighted average as follows:
[0077]
[0078] In S5, the model is updated and iteratively updated using the historical gradient loop until the loss function converges. The client uses the received aggregated gradient to update the model and stores the gradient of the current round as the historical gradient. This update method gradually optimizes the model parameters and improves the robustness of the model by combining the historical gradient and the current gradient. The whole process will continue to cycle until the global loss function converges. Until convergence:
[0079]
[0080] Where W is the global model parameter, is the local loss function of client j.
[0081] What is disclosed above is only a preferred embodiment of the present invention, and it certainly cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.
Claims
1. A method for defending against deep gradient leakage attacks in federated learning, characterized in that: The following steps are involved: Step 1: The central server selects the client; Step 2: Implement data pre-encryption based on the chain principle; Step 3: Client gradient upload; Step 4: Server aggregation, summarizing the model parameters of all clients; Step 5: Model update, using the historical gradient loop for iterative updates until the loss function converges.
2. The method for defending against a deep gradient leakage attack in federated learning according to claim 1, wherein: During the execution of step 1, the central server selects m clients that meet the requirements, m≤K, K represents the maximum number of clients supported by the central server; specifically, according to the client operation status and network status, the server selects clients with stable communication and no disconnection.
3. The method for defending against a federated learning deep gradient leakage attack as claimed in claim 2, characterized in that: The execution process of step 2 includes broadcasting and local training. During the broadcasting process, a homomorphic encryption framework is established, and each participant generates a pair of encryption keys in the federated system, namely a public key and a private key. In local training, each client updates the local computing model with local data and runs the gradient descent algorithm to optimize the machine learning model.
4. The method for defending against a federated learning deep gradient leakage attack as claimed in claim 3, characterized in that: During local training, the features of local data are extracted and the corresponding gradients are calculated. The expressions are as follows: in, is the model parameter of the jth client in the tth round, represents the gradient of the jth client in the tth round, is the true label, Represented as the input data features and model parameters W t To make predictions.
5. The method for defending against a deep gradient leakage attack in federated learning as claimed in claim 4, characterized in that: During the execution of step 3, Paillier homomorphic encryption is used to hide the gradient in epoch = 1. Starting from epoch=2, the gradient difference between this round of training and the previous round of training is used To replace the gradient upload.
6. The method for defending against a federated learning deep gradient leakage attack as claimed in claim 5, characterized in that: In step 4, if the client is not selected, the client model at the end of the current communication is still the original model obtained from the server at the beginning of the previous round of communication.
7. The method for defending against a federated learning deep gradient leakage attack as claimed in claim 6, characterized in that: In step 5, the server allows K clients or selected clients to participate in the aggregation, including two cases: the first is to aggregate only some of the selected clients, and the other is to aggregate all clients; When partially selecting clients, the server transmits the current new parameters to the selected clients each time, and only aggregates the model parameters of the selected clients; assuming that the current global model is W t , the client set selected in the tth iteration is V, the server selects m clients belonging to the set V, and then sends W only to these m clients t ; After m clients update locally, the server's aggregation formula for selecting clients in the tth round is as follows: Where n k Indicates the number of client samples, represents the model parameters of client j in round t; When the server returns the weighted average result to the corresponding client, the client can use the previously stored gradient to restore When all clients are aggregated: the server sends a new brand new model to all clients in each round and aggregates the model parameters of all clients; if no client is selected, the client model at the end of the current communication is still the original model obtained from the server at the beginning of the previous round of communication; if the current global model is set to W t , the server selects m clients from the set V. After the m clients are updated locally, the aggregation formula on the server side is as follows: Where n k Indicates the number of client samples, represents the model parameters of client j in the tth round; finally, iterate in a loop until the loss function converges; the global loss function is as follows: Where W is the global model parameter, is the loss function of client j on its local data.
Citation Information
Cited By
Method and system for defending gradient attacks in federal learning process of power system
CN119989412A
Model training method for defending gradient leakage attack
CN120582890A
Gradient inversion attack method and system in federated learning and medium
CN121303263A
Gradient inversion attack method, system and medium in federated learning
CN121303263B
