Layered federal learning method and device for resisting poisoning gradient attack
By deploying maliciousness detection and gradient processing mechanisms in the hierarchical structure of the federated learning system, the problem of poisoning gradient attacks is solved, the security and privacy protection of the federated learning system is achieved, and the training bandwidth is reduced.
Patent Information
- Application Number
- CN202410576459.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2024-09-06
AI Technical Summary
There is a poisoned gradient attack in the federated learning system. The attacker damages the performance and reliability of the global model by uploading malicious gradient information. The existing technology lacks effective defense methods.
The hierarchical federated learning method is used to divide the system into the Client layer, Edge layer and Server layer, and deploy defense measures at each layer: the Client layer uses a maliciousness detection mechanism, and the Edge layer and Server layer use Euclidean distance and K-means clustering Abnormal gradients are eliminated and the mean method is used for gradient processing to reduce bandwidth and improve security.
It can effectively resist poisoning gradient attacks, reduce training bandwidth, increase privacy security to a certain extent, and protect the privacy of user data.
Smart Images

Figure CN118607659A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine learning, relates to multiple fields of machine learning, and in particular to a hierarchical federated learning method for resisting poisoned gradient attacks Background Art
[0002] Federated Learning is a machine learning method that aims to achieve global improvement of models by training them on distributed devices or nodes without storing the original dataset in a central location. In short, it allows local models of multiple devices or clients to be merged to create a global model without sharing sensitive data.
[0003] The concept of federated learning was first proposed by Google in 2017. Google first described the framework and methods of federated learning in a paper titled "Communication-Efficient Learning of Deep Networks from Decentralized Data".
[0004] This paper emphasizes the concept of federated learning, which is to improve the global model by training the model locally on the terminal device and then uploading the local model parameters to the central server for model aggregation, while protecting the privacy of users. Google's proposal aims to solve the privacy and communication problems in distributed machine learning while reducing the communication burden between the central server and the client.
[0005] Since then, federated learning has become an active research field and has been widely explored and applied in various applications, including healthcare, financial services, IoT, natural language processing, computer vision, smart transportation, etc. Different research teams and institutions have made important progress in the field of federated learning, making it an important tool for solving distributed machine learning and privacy protection problems.
[0006] A gradient poisoning attack is a privacy and security attack on a federated learning system, where the attacker attempts to damage the global model of federated learning by uploading local model updates with malicious gradient information. The goal of this attack is to contaminate or put the global model into a bad state, thereby affecting its performance and reliability.
[0007] The principle of poisoned gradient attack is that the attacker introduces malicious gradients on the local model and then uploads these malicious gradients to the central server for model aggregation. These malicious gradients may cause the global model to be compromised, causing its performance to degrade or produce wrong predictions. Summary of the invention
[0008] In view of the shortcomings of the prior art, the present invention provides a hierarchical federated learning method and device for resisting poisoned gradient attacks. By improving the hierarchical federated learning system, it can effectively avoid most of the attack methods of federated poisoning attacks, reduce the training bandwidth of federated learning, and increase the privacy security to a certain extent.
[0009] This solution is proposed mainly to defend against gradient attacks on hierarchical federated learning. This defense method combines defense methods with hierarchical communication and integrates them into federated learning, making federated learning more resistant to poisoned gradient attacks while retaining the advantages of hierarchical federated learning.
[0010] According to one aspect of an embodiment of the present specification, a hierarchical federated learning method for resisting poisoned gradient attacks is divided into two parts: the implementation of hierarchical federated learning and the layout of the defense method.
[0011] The implementation of hierarchical federated learning is specifically divided into the Client layer, Edge layer, and Server layer:
[0012] The Client layer: This layer is the user layer, which mainly includes terminal devices, mobile devices, servers or other computing resources used by users. In this method, they are collectively referred to as Clients. These Clients are complex and diverse. In the process of participating in hierarchical federated learning, considering the need to maintain user privacy, the data stored by each Client is not allowed to leave the Client's storage unit. In this method, each Client in this layer will use the same training model for self-training. After the training, the Client will upload the training data to the Edge layer. These data are called grads, which are gradients in deep learning. Grads generally have multiple dimensions and are positively correlated with the size of the selected model.
[0013] The Edge layer is responsible for aggregating the grads provided by the Client layer, returning the aggregation results to the Client layer as updated content, and uploading the results to the Server layer after a certain number of iterations. The number of iterations is determined according to the actual application of the hierarchical federated learning method.
[0014] The server layer is responsible for updating and storing the global model (the structure is consistent with all training models deployed on the client), aggregating the grads uploaded by the edge layer, and updating it to the global model, and finally propagating the updated global model to the edge layer, which is then propagated to each client. This layer also needs to pay attention to security and privacy protection measures.
[0015] For defense layout, this method deploys from the above three layered perspectives:
[0016] For the Client layer: a maliciousness detection mechanism is arranged at the Client layer. The data participating in the training process between different Clients are similar but not the same. The grads provided to the Edge by the attacked Clients will be quite different from those of the majority of unattacked Clients. The Euclidean distance between all grads is calculated, and the K-means clustering method is used for all distances. All distances are divided into two groups. The Clients corresponding to the group with the longer distance are the Clients that may be attacked. These Clients that may be attacked are eliminated in this round of training and marked. If these Clients are marked as likely to be attacked multiple times in the subsequent training process, these Clients are eliminated from the entire training process. While reducing the possibility of being attacked, the bandwidth of training is reduced. This method calls the maliciousness detection mechanism detector.
[0017] For the Edge layer: After the Edge layer obtains the grads provided by the Client, the Edge layer needs to aggregate these grads and process the provided grads to deal with the deficiencies in the defense measures of the Client layer. This method divides the grads uploaded by the Client by dimension at the Edge layer, calculates the Euclidean distance between each Client in each dimension, uses K-means clustering to divide the distance into two groups, removes the part corresponding to the group with the larger distance, and weights the remaining part according to the amount of data participating in the training of different Clients to calculate the average. After calculating the average value in all dimensions, these grads are spliced into the same format as the data uploaded by the Client according to the divided dimensions. This method of processing grads is called the mean method. Finally, the grads processed by the mean method are uniformly transmitted back to each Client to update the model and proceed to the next step of training. In a specific round, the processed grads also need to be uploaded to the Server layer to update the global model, and the model parameters propagated by the Server layer are propagated to the Client layer.
[0018] For the server layer: After receiving the grads uploaded by the edge, the server layer processes the grads in the same way as the edge layer, using the mean method to divide the grads by dimension, and removes the content that may be attacked and then calculates the weighted average. Finally, after calculating the average value of all dimensions, these grads are spliced into the same format as the data uploaded by the edge according to the divided dimensions. The spliced grads are then used to update the global model at the server layer, and the updated global model is propagated to the edge layer.
[0019] According to another aspect of an embodiment of this specification, a hierarchical federated learning device for resisting poisoned gradient attacks is provided, comprising: at least one processor, a memory coupled to the at least one processor, and a computer program stored in the memory, wherein the at least one processor executes the computer program to implement the hierarchical federated learning method for resisting poisoned gradient attacks as described above.
[0020] According to another aspect of an embodiment of the present specification, a computer-readable storage medium is provided, which stores executable instructions, and when the instructions are executed, the processor executes the hierarchical federated learning method for resisting poisoned gradient attacks as described above.
[0021] According to another aspect of an embodiment of the present specification, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to implement the hierarchical federated learning method for resisting poisoned gradient attacks as described above.
[0022] The beneficial effects of the present invention are as follows:
[0023] In the field of multi-level federated learning, there is currently no defense method against poisoning attacks, nor has a multi-level federated learning model for poisoning attacks been proposed. This method can effectively defend against poisoning attacks, can well protect user privacy issues, and can also reduce training bandwidth under certain circumstances. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a multi-level defense layout diagram of an embodiment of the present invention;
[0025] Figure 2 The figure shows the experimental comparison results between the present invention and the existing federated learning defense method. DETAILED DESCRIPTION
[0026] The present invention will be described in detail below with reference to the accompanying drawings, and the purpose and effects of the present invention will become more apparent.
[0027] Example
[0028] In the case of applying this method to the medical field, medical institutions have a large amount of patient data, including medical records, diagnoses, treatment plans, etc. Through this method, different hospitals or research institutions can cooperate to train models to improve disease diagnosis and treatment plans while complying with privacy regulations. Considering that a medical institution will have different departments that provide different data, we divide them by department, each department provides a device as a client, and then deploy an Edge server in each medical institution, which can ensure that the data provided by the clients participating in the training will not leave the scope of the corresponding medical structure to ensure that data privacy will not be leaked. The server is deployed in the cloud and maintains communication with the Edge servers of various medical institutions. For the convenience of description, the following text uniformly refers to various servers as Client, Edge, and Server.
[0029] The present invention proposes a hierarchical federated learning method to resist poisoned gradient attacks. The overall network layout is as follows: Figure 1 In the figure, hierarchical federated learning is divided into three levels, namely the Client layer, the Edge layer, and the Server layer. Corresponding defense measures are arranged for each of the three layers. Assuming that according to the situation in the figure, a total of one Server controls four Edges (two of which are not shown in the figure). Figure 1 In the case of , each Edge controls five Clients, among which the darker Clients represent the Clients that have been successfully attacked.
[0030] The specific implementation process of this method is as follows:
[0031] Step 1: Each client initially obtains the same training model, which is a global model. At the same time, the server also obtains the same model and stores it in the server.
[0032] Step 2: The client uses its own sample S to perform self-training using the global model to generate grads. The client layer performs the detector strategy to calculate the Euclidean distance between the grads of each client. By comparison, the client farthest from other clients is marked as the client that has been successfully attacked. It is removed from this training process, and the grads provided by the remaining clients are uploaded to the Edge. Figure 1 The grads provided by the Client layer have a total of four dimensions. The parts with higher grayscale values are some situations that may affect the model update during the Client self-training process or malicious grads provided by the attacked Client that have not yet been discovered by the detector mechanism.
[0033] Step 3: After the Edge receives the grads provided by the Client, it divides the grads provided by the four Clients by dimension, divides them by different dimensions, and then calculates the Euclidean distance of the grads provided by each Client by dimension. If the distance between the grads provided by a Client in a certain dimension and other Clients is obviously not similar to other grads after using K-means clustering, the grads of this dimension are eliminated.
[0034] Step 4: Perform weighted averaging on the data processed in step 3 by dimension. The weighting principle is determined by the sample size of different clients participating in the training. The formula is as follows:
[0035]
[0036] Where mean A is the weighted mean on dimension A, S1 is the number of samples that Client1 participates in the training process, grads1 A The component of grads provided to Client1 in dimension A.
[0037] Step 5: After obtaining the mean of each dimension, Edge reassembles them into a complete grads, and then backpropagates this grads to the Client to update the Client's training model.
[0038] Step 6: Repeat steps 2 to 4 above until the number of communications between Edge and Client set in advance is met. Edge uploads the grads calculated last time to the Server.
[0039] Step 7: The server processes the received grads using the mean method (the specific process is the same as steps 3 to 5). The server then uses the final grads to update the global model stored in the server, and then back-propagates the updated global model to the Edge layer, and then propagates it to the Client layer through each Edge.
[0040] In some embodiments, a hierarchical federated learning device for resisting poisoned gradient attacks is provided, comprising: at least one processor, a memory coupled to the at least one processor, and a computer program stored in the memory, wherein the at least one processor executes the computer program to implement the hierarchical federated learning method for resisting poisoned gradient attacks as described above.
[0041] In some embodiments, a computer-readable storage medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1 Specifically, a system or device equipped with a readable storage medium may be provided, on which a software program code implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system or device reads and executes the instructions stored in the readable storage medium.
[0042] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above-mentioned embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute a part of the present invention.
[0043] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or a cloud via a communication network.
[0044] According to one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the processor performs the above combination of the various embodiments of this specification. Figure 1 Describes the various operations and functions.
[0045] like Figure 2 As shown, the method of the present invention and some existing federated learning defense methods are experimented with different numbers of Client-Edges. When facing the same attack, it can be found that the method is superior to other methods.
[0046] The above contents are further detailed descriptions of the present invention in combination with specific / preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, they can also make several substitutions or modifications to these described embodiments without departing from the concept of the present invention, and these substitutions or modifications should be regarded as belonging to the protection scope of the present invention.
[0047] Parts of the present invention that are not described in detail belong to the well-known technologies of those skilled in the art.
Claims
1. A hierarchical federated learning method for resisting poisoned gradient attacks, characterized in that: It is divided into two parts: the implementation of hierarchical federated learning and the layout of defense methods; The implementation of hierarchical federated learning is specifically divided into the Client layer, Edge layer, and Server layer: The Client layer: This layer is the user layer, which mainly includes terminal devices, mobile devices, servers or other computing resources used by users, collectively referred to as Clients. These Clients are complex and diverse. In the process of participating in hierarchical federated learning, considering the need to maintain user privacy, the data stored by each Client is not allowed to leave the Client's storage unit; each Client in this layer will use the same training model for self-training. After the training, the Client will upload the training data to the Edge layer. These data are called grads, which is the gradient in deep learning; The Edge layer is responsible for aggregating the grads provided by the Client layer, returning the aggregation results to the Client layer as updated content, and uploading the results to the Server layer after a certain number of iterations. The number of iterations is determined according to the actual application of the hierarchical federated learning method. The Server layer is responsible for updating and storing the global model. The structure of the global model is consistent with all training models deployed on the Client. It aggregates the grads uploaded by the Edge layer and updates them to the global model. Finally, it propagates the updated global model to the Edge layer, and then propagates it to each Client. For defense layout, deploy from the above three layered perspectives: For the Client layer: a maliciousness detection mechanism is arranged at the Client layer. The data participating in the training process between different Clients are similar but not the same. The grads provided to the Edge by the attacked Clients will be quite different from those of the majority of unattacked Clients. The Euclidean distance between all grads is calculated, and the K-means clustering method is used for all distances to divide all distances into two groups. The Clients corresponding to the group with the longer distance are the Clients that may be attacked. These Clients that may be attacked are eliminated in this round of training and marked. If these Clients are marked as likely to be attacked multiple times in the subsequent training process, these Clients are eliminated from the entire training process. While reducing the possibility of being attacked, the training bandwidth is reduced. This method calls the maliciousness detection mechanism detector. For the Edge layer: At the Edge layer, the grads uploaded by the client are divided by dimension, and the Euclidean distance between each client is calculated in each dimension. The distance is clustered using K-means and divided into two groups. The part corresponding to the group with the larger distance is eliminated, and the remaining part is weighted and averaged according to the amount of data participating in the training of different clients. After the average value is calculated in all dimensions, these grads are spliced into the same format as the data uploaded by the client according to the divided dimensions. This method of processing grads is called the mean method. Finally, the grads processed by the mean method are uniformly transmitted back to each client to update the model and proceed to the next step of training. In a specific round, the processed grads also need to be uploaded to the Server layer to update the global model, and the model parameters propagated by the Server layer are propagated to the Client layer. For the Server layer: After receiving the grads uploaded by the Edge, the Server layer processes the grads in the same way as the Edge layer. It uses the mean method to divide the grads by dimension, removes the content that may be attacked, and then takes the weighted average. Finally, after all dimensions are averaged, these grads are spliced into the same format as the Edge uploaded data according to the divided dimensions; the spliced grads are then used to update the global model at the Server layer, and the updated global model is propagated to the Edge layer.
2. A hierarchical federated learning device for resisting poisoned gradient attacks, characterized in that: include: At least one processor, a memory coupled to the at least one processor, and a computer program stored in the memory, wherein the at least one processor executes the computer program to implement the hierarchical federated learning method for resisting poisoned gradient attacks as claimed in claim 1.
3. A computer-readable storage medium, characterized in that: It stores executable instructions, which, when executed, enable the processor to perform the hierarchical federated learning method for resisting poisoned gradient attacks as claimed in claim 1.
4. A computer program product, characterized in that It includes a computer program, which is executed by a processor to implement the hierarchical federated learning method for resisting poisoned gradient attacks as claimed in claim 1.
Citation Information
Cited By
Federal learning backdoor attack defense method based on multi-layer cooperative defense strategy
CN120434054A
Poison model recovery method and device based on forgetting decoupling and accelerated optimization
CN121119052A
