A federated learning method, device and computer-readable storage medium for resisting poisoning attacks under differential privacy protection constraints

By defining differential privacy on the client and detecting malicious clients, the impact of differential privacy protection on malicious model detection in the existing technology is solved, effective poisoning attack defense under differential privacy protection is achieved, and the security and safety of the global model are ensured. accuracy.

CN118378255BActive Publication Date: 2024-09-10SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410825770.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-10
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing differential privacy protection technology has a negative impact on the detection of malicious local models, and malicious clients cannot be effectively detected under differential privacy protection, resulting in the failure of poisoning attack defense solutions.

Method used

Define differential privacy on the client, update the local model and add noise through the stochastic gradient descent method, detect and filter out malicious clients, assign weights and aggregate models to improve the accuracy of identifying malicious clients.

Benefits of technology

Effectively detect and defend against poisoning attacks by malicious clients, ensuring the security and accuracy of the global model, while improving system performance and model accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378255B
    Figure CN118378255B
Patent Text Reader

Abstract

The present invention belongs to the field of data security technology, and more specifically, it relates to a federated learning method, device and computer-readable storage medium that resist poisoning attacks under differential privacy protection constraints. It includes defining differential privacy on the client; after the client obtains the global model of the server, it uses its own training data set to update the local model, calculates the differential privacy noise and adds it to the local model of each client; the local model with the differential privacy noise added is sent to the server, and malicious clients are selected; the server assigns weights to each client, and then aggregates the local models of each client to obtain a trained global model and sends it to each client; each client obtains the trained global model, completes an iteration, and after reaching the set training round, outputs the final global model and ends the training. The present invention solves the problem that the poisoning attack defense solution in the prior art cannot effectively detect malicious clients under differential privacy protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data security technology, and more specifically, relates to a federated learning method, device and computer-readable storage medium that are resistant to poisoning attacks under differential privacy protection constraints. Background Art

[0002] Deep learning has the advantages of high flexibility, automatic feature learning ability and end-to-end learning, and is applicable to a variety of complex tasks. Traditionally, training neural networks involves collecting large data sets from clients, which may bring significant privacy risks. To mitigate these problems, federated learning has been proposed as a solution. In federated learning, establishing a trusted federated learning environment requires solving two main problems: ensuring that the server cannot infer the user's original data through the local model, and effectively defending against poisoning attacks. Existing technologies for protecting user privacy security usually rely on three basic technologies: differential privacy (DP), secure multi-party computation (SMC), and homomorphic encryption (HE). Secure multi-party computation and homomorphic encryption usually require high computational and communication costs, especially when dealing with large-scale datasets and complex computing tasks. In contrast, the computational overhead of the DP method is much lower than the other two. Therefore, we choose a DP-based solution to protect client privacy.

[0003] Chinese invention patent CN117349672A discloses a model training method, apparatus and device based on differential privacy federated learning. The method includes: adopting a biased client sampling strategy, selecting a target client from a client candidate set according to the privacy budget and sample distribution of each client, and distributing the latest global model to the target client; obtaining the original model gradient by using the local data set for local iteration by the target client, and using a differential privacy mechanism to generate random noise according to the privacy consumption of each round of iteration to disturb the original model gradient, and obtain a noisy model gradient; receiving the noisy model gradient uploaded by the target client and aggregating it to update the global model.

[0004] In summary, using differential privacy to protect user privacy may have an adverse effect on detecting malicious clients. Differential privacy protects data by introducing noise, which causes slight random changes in the local model, thereby increasing the difficulty of identifying malicious local models. Therefore, most attack detection mechanisms have difficulty effectively detecting malicious local models when faced with local models with differential privacy noise added. Current differential privacy protection technology will have a certain degree of impact on the detection of malicious local models, and the existing poisoning attack defense scheme cannot effectively detect malicious clients under differential privacy protection. Summary of the invention

[0005] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide a federated learning method that is resistant to poisoning attacks under the constraints of differential privacy protection, so as to solve the problems that the differential privacy protection technology in the prior art will have a certain degree of impact on the detection of malicious local models, and the existing poisoning attack defense scheme cannot effectively detect malicious clients under differential privacy protection.

[0006] The detailed technical scheme of the present invention is as follows:

[0007] S1. Define differential privacy on the client side.

[0008] S2. After obtaining the global model from the server, the client uses its own training data set to update the local model through the stochastic gradient descent method, calculates the differential privacy noise and adds it to the local model of each client;

[0009] S3, sending the local model with differential privacy noise to the server to detect attacks against poisoning attacks and select malicious clients;

[0010] S4. After selecting malicious clients through S3, the server assigns weights to each client, then aggregates the local models of each client to obtain a trained global model and sends it to each client;

[0011] S5. Each client obtains the trained global model, completes one iteration, and repeats S2-S4. After reaching the set training rounds, the final global model is output and the training ends.

[0012] Furthermore, the differential privacy is defined as follows:

[0013] (13);

[0014] In formula (13), It is the privacy budget, which determines the degree of privacy protection; Represents probability; any two adjacent data sets ; () represents a random mechanism that satisfies the requirements of differential privacy; express () Outputs a collection of events; represents the relaxation term of differential privacy.

[0015] Furthermore, federated learning involves multiple local client devices that train models on local data and send them to the server, which aggregates these local models to improve the global model without transmitting the original data; any client , including the training data set ,in, , a total of N clients;

[0016] Federated learning training involves multiple rounds of communication between the client and the server. Communication, the S2 specifically includes the following steps:

[0017] S21. The client downloads the latest global model from the server , t is the tth round of training, in the first round of training, that is At the beginning, the server initializes the global model as ;

[0018] S22, the client uses its own training data set to transform the global model through stochastic gradient descent Updated to , i is any client i, ;

[0019] S23, the client then crops to obtain a local model :

[0020] (1);

[0021] In formula 2, Indicates the clipping value, which can be set independently according to the actual situation;

[0022] S24. Calculation sensitivity :

[0023] (2);

[0024] S25. Calculate the variance of differential privacy noise :

[0025] (3);

[0026] S26. Add differential privacy noise to the local model and sent to the server:

[0027] (4);

[0028] In formula (4) represents the local model with differential privacy noise added, represents the standard Gaussian distribution, represents the identity matrix;

[0029] S27. Calculate the loss difference before and after gradient descent Send to the server:

[0030] (5);

[0031] In formula (5), Represents the client A sample of the dataset, represents the loss value of client i after gradient descent in the tth round, represents the loss value of client i before gradient descent in round t;

[0032] The loss difference is used to determine whether the iteration round is a critical round.

[0033] Furthermore, the S3 specifically includes:

[0034] S31, sending the local model with differential privacy noise added to the server for detection;

[0035] S32. Calculate the difference between the two local models with differential privacy noise added Norm:

[0036] (6);

[0037] In formula (6) Represents two random local models with differential privacy noise added and Between norm;

[0038] S33, find the local models Norm The minimum value is , summarize this set of data as the density of each client's local model;

[0039] (7);

[0040] In formula (7), represents the density of the local model of the i-th client in round t; m represents the number of malicious clients; is a hyperparameter that adjusts the size based on the number of clients;

[0041] S34. Find the local model Minimum density, identify Clients represented by the minimum density It represents the malicious clients selected in this round. The design of screening malicious clients by density is based on the principle that the probability of entering and exiting the local area is equal in the DP protection model update. This design can greatly improve the accuracy of the server in detecting malicious clients;

[0042] Furthermore, the S4 specifically includes:

[0043] S41, submitting the loss difference between the local model with differential privacy noise added and the local model before and after gradient descent to the server;

[0044] S42, the server aggregates local models from all clients;

[0045] S43, determining whether the client is a benign client or a malicious client and calculating a weight parameter;

[0046] If the client is a benign client, then:

[0047] (8);

[0048] In formula (8), Represents a benign client In the The weight parameter of the round;

[0049] If the client is malicious, then:

[0050] (9);

[0051] In formula (9), Represents a malicious client In the The weight parameter of the round;

[0052] S44, judging whether the current round is a critical round:

[0053] (10);

[0054] In formula (10), Represents the sum of the losses of each client before and after gradient descent in the tth round; Represents the loss difference before and after gradient descent of client i in round t;

[0055] if This means that the current round is in a critical round, and the weight of the client is: ;

[0056] represents the hyperparameters used to determine the critical rounds;

[0057] if This means that the current round is not a critical round, and the weight of the client is:

[0058] (11);

[0059] In formula (11), is the weight of the i-th client in round t;

[0060] S45: Aggregate the local models of each client to obtain a trained global model , the aggregation rule is a federated averaging mechanism:

[0061] (12);

[0062] This article also includes a federated learning device that resists poisoning attacks under differential privacy protection constraints, characterized in that the device includes:

[0063] processor;

[0064] a memory having stored thereon a computer program executable on the processor;

[0065] Among them, when the computer program is executed by the processor, the steps of the federated learning method for resisting poisoning attacks under the constraint of differential privacy protection are implemented.

[0066] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of a federated learning method that resists poisoning attacks under differential privacy protection constraints.

[0067] Compared with the prior art, the present invention has the following beneficial effects:

[0068] 1. The present invention proposes a federated learning method, device and computer-readable storage medium that are resistant to poisoning attacks under differential privacy protection constraints. By integrating differential privacy technology into federated learning, it can protect user data privacy while effectively detecting and defending against poisoning attacks by malicious clients, thereby ensuring the security and accuracy of the global model.

[0069] 2. The present invention proposes a federated learning method, device and computer-readable storage medium that are resistant to poisoning attacks under the constraints of differential privacy protection. Malicious clients are detected and their weights are reduced or directly deleted before aggregating local models, thereby improving the overall performance of the system and the accuracy of the global model. In addition, a small part of clean data sets is not required to train and verify the model, and it is also applicable to various types of models and data sets without prior knowledge. The method is simple to implement and can be quickly deployed and used. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 It is a flow chart of the federated learning method for resisting poisoning attacks under the differential privacy protection constraint described in the present invention.

[0071] Figure 2 It is a schematic diagram of the federated learning architecture described in Example 1 of the present invention.

[0072] Figure 3These are test accuracy graphs of the Lie attack on the global model protected by the defense algorithm of the present invention under Cifar data.

[0073] Figure 4 These are test accuracy graphs of the Fang attack on the global model protected by the defense algorithm of the present invention under Cifar data.

[0074] Figure 5 These are test accuracy graphs of the global model protected by the defense algorithm of the present invention under the MinMax attack on the Cifar data. DETAILED DESCRIPTION

[0075] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0076] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0077] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0078] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0079] Example 1

[0080] This embodiment provides a federated learning method that resists poisoning attacks under differential privacy protection constraints. Figure 1 As shown, including:

[0081] S1. Define differential privacy on the client. The differential privacy is defined as follows:

[0082] (13);

[0083] In formula (13), It is the privacy budget, which determines the degree of privacy protection; Represents probability; any two adjacent data sets ; () represents a random mechanism that satisfies the requirements of differential privacy; express () Outputs a collection of events; represents the relaxation term of differential privacy.

[0084] S2, update the local model and add differential privacy noise;

[0085] After the client obtains the global model from the server, it uses its own training data set to update the local model through the stochastic gradient descent method, calculates the differential privacy noise and adds it to the local model of each client.

[0086] The S2 specifically includes:

[0087] Federated learning involves multiple local client devices that train models on local data and send updates to the server, which aggregates these updates to improve the global model without transmitting the original data; any client , including the training data set ,in, , the client includes a benign client and a malicious client, and the federated learning architecture is as follows Figure 2 shown.

[0088] Federated learning training involves multiple rounds of communication between the client and the server, with client i in each round Communication, perform the following steps in sequence:

[0089] S21. Client Download the latest global model from the server , in the first round of training, i.e. At the beginning, the server initializes the global model as .

[0090] S22, Client Using its own training data set, the global model is transformed by stochastic gradient descent. Updated to .

[0091] S23. Each client cuts the local model to obtain a local model :

[0092] (1);

[0093] In formula 2 Represents the clipping value.

[0094] S24. Calculation sensitivity :

[0095] (2).

[0096] S25. Calculate the variance of differential privacy noise :

[0097] (3).

[0098] S26. Add differential privacy noise to the local model and sent to the server:

[0099] (4).

[0100] In formula (4) represents the local model with differential privacy noise added; represents the standard Gaussian distribution; Represents the identity matrix.

[0101] S27. Calculate the loss difference before and after gradient descent Send to the server:

[0102] (5);

[0103] In formula (5), Represents the client A sample of the dataset, represents the loss value of client i after gradient descent in the tth round, represents the loss value of client i before gradient descent in round t;

[0104] The loss difference is used to determine whether the iteration round is a critical round.

[0105] S3. Filter malicious clients through attack detection mechanism: Send the local model with differential privacy noise to the server to detect attacks against poisoning attacks and select malicious clients;

[0106] The client calculates at S2 and After that, it is sent to the server, and the server performs attack detection in step S3.

[0107] The S3 specifically includes:

[0108] S31. Add the local model with differential privacy noise Submit to the server, the server detects the local model with differential privacy noise added from all clients , .

[0109] S32. Calculate the difference between the two local models with differential privacy noise added Norm:

[0110] (6).

[0111] In formula (6), Represents two random local models with differential privacy noise added and Between norm;

[0112] S33, find the local models Norm Minimum values: , summarize this set of data as the density of each client's local model;

[0113] (7);

[0114] In formula (7), represents the density of the local model of the i-th client in round t; m represents the number of malicious clients and is an initial known parameter; is a hyperparameter that adjusts in size based on the number of clients.

[0115] S34. Find the local model Minimum density, identify The minimum density of clients is represented by , Represents the malicious client selected in this round.

[0116] S4, weights are assigned to the local models of each client and aggregated;

[0117] After selecting malicious clients through S3, the server assigns weights to each client, then aggregates the local models of each client to obtain a trained global model and sends it to each client.

[0118] S4 specifically includes:

[0119] S41. Add the local model with differential privacy noise The difference in loss before and after gradient descent with the local model Submit to the server.

[0120] S42. The server aggregates local models from all clients , .

[0121] S43, determining whether the client is a benign client or a malicious client and calculating a weight parameter;

[0122] If the client is a benign client, then:

[0123] (8);

[0124] In formula (8), Represents a benign client In the The weight parameter of the round;

[0125] If the client is malicious, then:

[0126] (9);

[0127] In formula (9), Represents a malicious client In the The weight parameter of the round.

[0128] S44, judging whether the current round is a critical round:

[0129] (10);

[0130] In formula (10), Represents the sum of the losses of each client before and after gradient descent in the tth round; Represents the loss difference before and after gradient descent of client i in round t;

[0131] if This means that the current round is in a critical round, and the weight of the client is: ;

[0132] represents the hyperparameters used to determine the critical round;

[0133] if This means that the current round is not a critical round, and the weight of the client is:

[0134] (11);

[0135] In formula (11), is the weight of the i-th client in the t-th round.

[0136] S45. Aggregate the local models of each client, and the aggregation rule is a federated average mechanism:

[0137] (12);

[0138] S5, iteratively set the training rounds to obtain the final model;

[0139] Each client obtains the trained global model, completes one iteration, repeats S2-S4, and outputs the final global model after reaching the set training rounds. And end the training.

[0140] The present invention considers the following poisoning attack methods:

[0141] Lie: The attacker calculates the mean and standard deviation of the benign gradients he has, and then determines a coefficient based on the total number of benign and malicious clients to generate malicious updates.

[0142] Fang: The attacker computes the mean of the benign gradients he has, and then generates malicious updates by computing the gradient in the opposite direction and solving a global coefficient.

[0143] MinMax: The min-max attack computes malicious gradients to constrain their distance from other gradients to be within the maximum distance between the two farthest benign gradients, thereby confining malicious gradients to a smaller range.

[0144] The present invention also considers the following defense methods:

[0145] median: The principle is to select the median gradient of each client from each round and then aggregate these median gradients.

[0146] mkrum: mkrum operates by selecting from the input gradient set the gradients that are closest to their nm-2 neighbors in squared Euclidean distance space. These selected gradients are added to a selection set while being removed from the remaining set. This process is iterated multiple times, producing a selection set. Finally, mkrum sums up the gradients in the selection set.

[0147] bulyan: bulyan uses a selective method that initially selects a portion of the gradients in the manner of mkrum. Subsequently, the selected gradients are pruned by removing the maximum and minimum values, and finally the pruned gradients are aggregated.

[0148] The sample data of the dataset described in this embodiment is image data, such as cifar10, minst dataset and ImageNet dataset. Preferably, the cifar10 dataset is used as the processing data, and three situations of Lie attack, Fang attack and MinMax attack are used. Figure 3-Figure 5 The test results of the Cifar data set are as follows:

[0149] Figure 3It is a test accuracy diagram of the global model protected by the defense algorithm of the present invention, the bulban defense algorithm, the median defense algorithm, and the mkrum defense algorithm under the Cifar data. As the test accuracy gradually stabilizes, it can be obviously concluded that the test accuracy of the present invention is more than 20% higher than that of the bulban defense algorithm, the median defense algorithm, and the mkrum defense algorithm.

[0150] Figure 4 It is a test accuracy diagram of the global model protected by the defense algorithm of the present invention, the bulban defense algorithm, the median defense algorithm, and the mkrum defense algorithm under the Cifar data. As the test accuracy gradually stabilizes, it can be obviously concluded that the test accuracy of the present invention is more than 25% higher than that of the median defense algorithm, and more than 40% higher than that of the bulban defense algorithm and the mkrum defense algorithm.

[0151] Figure 5 It is a test accuracy diagram of the global model protected by the defense algorithm of the present invention, the bulban defense algorithm, the median defense algorithm, and the mkrum defense algorithm under the Cifar data. As the test accuracy gradually stabilizes, it can be obviously concluded that the test accuracy of the present invention is more than 40% higher than that of the median defense algorithm, and more than 50% higher than that of the bulban defense algorithm and the mkrum defense algorithm.

[0152] From the experimental results, the defense algorithm of the method described in this embodiment has achieved higher accuracy than other defense algorithms, especially under MinMax and MinSum attacks, the method described in the present invention is the only defense method that can maintain high accuracy of the global model.

[0153] Example 2

[0154] This embodiment also includes a federated learning device that resists poisoning attacks under differential privacy protection constraints, characterized in that the device includes:

[0155] processor;

[0156] a memory having stored thereon a computer program executable on the processor;

[0157] Among them, when the computer program is executed by the processor, the steps of the federated learning method for resisting poisoning attacks under the constraint of differential privacy protection are implemented.

[0158] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of a federated learning method that resists poisoning attacks under differential privacy protection constraints.

[0159] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A federated learning method that resists poisoning attacks under differential privacy protection constraints. It is characterized in that include: S1. Define differential privacy on the client side. S2. After obtaining the global model of the server, the client uses its own training data set to update the local model through the stochastic gradient descent method, calculates the differential privacy noise and adds it to the local model of each client, where the sample data of the data set is image data; S3, sending the local model with differential privacy noise to the server to detect attacks against poisoning attacks and select malicious clients; S4. After selecting malicious clients through S3, the server assigns weights to each client, then aggregates the local models of each client to obtain a trained global model and sends it to each client; S5. Each client obtains the trained global model, completes one iteration, and repeats S2-S4. After reaching the set training round, the final global model is output and the training ends. The S2 specifically includes the following steps: S21. The client downloads the latest global model from the server , t is the tth round of training, in the first round of training, that is At the beginning, the server initializes the global model as ; S22, the client uses its own training data set to transform the global model through stochastic gradient descent Updated to , i is any client i, , a total of N clients; S23, the client then crops to obtain a local model : (1); In formula 2, Indicates the clipping value, which can be set independently according to the actual situation; S24. Calculation of sensitivity : (2); S25. Calculate the variance of differential privacy noise : (3); In formula (3), It’s the privacy budget; S26. Add differential privacy noise to the local model and sent to the server: (4); In formula (4) represents the local model with differential privacy noise added, represents the standard Gaussian distribution, represents the identity matrix; S27. Calculate the loss difference before and after gradient descent Send to the server: (5); In formula (5), Represents the client A sample of the dataset, represents the loss value of client i after gradient descent in the tth round, represents the loss value of client i before gradient descent in round t; The S3 specifically includes: S31, sending the local model with differential privacy noise added to the server for detection; S32. Calculate the difference between the two local models with differential privacy noise added Norm: (6); In formula (6) Represents two random local models with differential privacy noise added and Between norm; S33, find the local models Norm The minimum value is , summarize this set of data as the density of each client's local model; (7); In formula (7), represents the density of the local model of the i-th client in round t; m represents the number of malicious clients; is a hyperparameter that adjusts the size based on the number of clients; S34. Find the local model Minimum density, identify Clients represented by the minimum density Indicates the malicious client selected in this round; The S4 specifically includes: S41, submitting the loss difference between the local model with differential privacy noise added and the local model before and after gradient descent to the server; S42, the server aggregates local models from all clients; S43, determining whether the client is a benign client or a malicious client and calculating a weight parameter; If the client is a benign client, then: (8); In formula (8), Represents a benign client In the The weight parameter of the round; If the client is malicious, then: (9); In formula (9), Represents a malicious client In the The weight parameter of the round; S44, judging whether the current round is a critical round: (10); In formula (10), Represents the sum of the losses of each client before and after gradient descent in the tth round; represents the loss difference before and after gradient descent of client i in round t, and N is the total number of clients; if This means that the current round is in a critical round, and the weight of the client is: ; represents the hyperparameters used to determine the critical round; if This means that the current round is not a critical round, and the weight of the client is: (11); In formula (11), is the weight of the i-th client in round t; S45: Aggregate the local models of each client to obtain a trained global model , the aggregation method is the federated averaging mechanism: (12)。 2. According to claim 1, a federated learning method for resisting poisoning attacks under differential privacy protection constraints, It is characterized in that The differential privacy is defined as follows: (13); In formula (13), It’s the privacy budget; Represents probability; any two adjacent data sets ; () represents a random mechanism that satisfies the requirements of differential privacy; express () Outputs a collection of events; represents the relaxation term of differential privacy.

3. A federated learning device that resists poisoning attacks under differential privacy protection constraints. It is characterized in that The device comprises: processor; a memory having stored thereon a computer program executable on the processor; Wherein, when the computer program is executed by the processor, the steps of a federated learning method for resisting poisoning attacks under differential privacy protection constraints as described in any one of claims 1 to 2 are implemented.

4. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.

Citation Information

Cited By

  • Decentralized federated learning-based poisoning attack dynamic defense method

    CN120602123A