Federated learning Byzantine node detection method, device and computer-readable storage medium based on generative adversarial network

Through generative adversarial networks and principal component analysis technology, Byzantine nodes in federated learning are detected and excluded, which solves the problem of reduced verification effect in the case of multiple attackers in the existing technology, achieves higher detection accuracy and defense capabilities, and ensures improve the stability and performance of the global model.

CN118468041BActive Publication Date: 2024-10-01QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410924362.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-01
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

When existing technology faces Byzantine attacks from multiple attackers, the effectiveness of the verification method will be reduced, and the server may crash due to a large amount of overhead, resulting in low detection accuracy and defense performance.

Method used

The federated learning Byzantine node detection method based on generative adversarial networks and principal component analysis is adopted. By expanding the benchmark data set, calculating the Euclidean distance, establishing a reward and punishment array, excluding the model parameters of the Byzantine client, and assigning weights according to the distance to adjust the model parameters. Ensure the stability and defense capabilities of the global model.

Benefits of technology

It significantly improves the detection accuracy and defense capabilities in the case of high proportion of Byzantine clients, ensures the stability and convergence of the model, and enhances the robustness and overall defense performance of the federated learning system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118468041B_ABST
    Figure CN118468041B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of federated learning data security, and more specifically, to a method, device and computer-readable storage medium for detecting Byzantine nodes in federated learning based on a generative adversarial network. It includes the client and the server completing the allocation of data sets and initializing the models of the client and the server; the client updates the local model parameters according to the global model parameters and performs training, and after the training is completed, the updated local model parameters are sent to the server; the server performs Byzantine node detection and excludes the local model parameters corresponding to the Byzantine nodes, aggregates the remaining client local model parameters, obtains new global model parameters, and sends them to the client; repeats the above steps to the training round threshold to obtain optimized global federated learning model parameters. The present invention solves the problem that Byzantine attackers can make the global model performance unstable by modifying the local parameters and sending them to the aggregation server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of federated learning data security, and more specifically, to a method, device and computer-readable storage medium for detecting Byzantine nodes in federated learning based on a generative adversarial network. Background Art

[0002] Machine learning technology has made significant progress in data mining, natural language processing, computer vision, and recommendation systems by integrating technologies and methods such as probability theory, convex optimization, and complexity analysis. Rapid breakthroughs in machine learning technology cannot be achieved by relying solely on the data held by a certain institution. At the same time, due to geographical restrictions, privacy concerns, and other issues, data sharing and exchange between multiple institutions are difficult to achieve. The emergence of federated learning technology has solved the above problems well. It sends the model parameters between different participants to the model parameter aggregation server to update the model parameters and share the aggregated model parameters with each participant to achieve performance iteration of the machine learning model.

[0003] Chinese invention patent CN114492828A discloses a method and application for detecting and reinforcing Byzantine nodes in vertical federated learning based on blockchain technology, including: participants in vertical federated learning establish smart contracts based on blockchain; participants conduct vertical federated learning with active participants who initiate vertical federated learning; active computing nodes corresponding to active participants use the central server model to perform reasoning verification on the intermediate calculation results of each participant, and calculate the cumulative contribution of each participant based on the reasoning verification results; establish a verification agency, the verification agency generates adversarial sample data based on the intermediate calculation results with high cumulative contribution, and constructs a sample detection model, and uses the sample detection model to perform Byzantine node detection on the participants; the active computing nodes combine the adversarial sample data generated by the verification agency to train the central server model to reinforce the central server model to defend against adversarial attacks.

[0004] In summary, the detection-based method relies on monitoring anomalies in system behavior to identify possible attack behaviors, but it cannot cope with the situation where there are multiple attackers, especially when the attacker's attack vector is concealed. The verification-based method is a method for defending against Byzantine attacks in federated learning. It identifies attackers by verifying each submitted local model parameter one by one. This method is especially effective when the number of attackers continues to increase. The server may crash due to a large amount of overhead. Only parameter exchange makes it impossible for the server to judge the authenticity of the parameters when aggregating model parameters. Therefore, Byzantine attackers can modify local parameters and send them to the aggregation server to make the global model performance unstable, resulting in low detection accuracy and overall defense performance. 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 Byzantine node detection method based on a generative adversarial network to solve the problems in the prior art that when the number of attackers continues to increase, the effectiveness of the verification method will decrease, and the server may crash due to a large amount of overhead.

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

[0007] The present invention provides a method for detecting Byzantine nodes in federated learning based on a generative adversarial network. The method uses a generative adversarial network and principal component analysis technology to detect Byzantine nodes in federated learning. First, the benchmark data set is expanded by a generative adversarial network, and then the model parameters are extracted and restored using principal component analysis, the Euclidean distance is calculated, a reward and punishment array is established, the model parameters of the Byzantine client are excluded, and the model parameters are adjusted according to the weights of the obtained distance allocation, and finally the model parameters of each client are aggregated to obtain new global model parameters. Under the premise of ensuring successful resistance to Byzantine attacks, the effect of the global model is optimized. The specific steps include:

[0008] S1. The client and the server complete the data distribution and initialize the models of the client and the server;

[0009] S2. The client updates the local model parameters according to the global model parameters and trains the local model parameters using the local data set. After each round of training, the updated local model parameters are sent to the server.

[0010] S3. After the server detects Byzantine nodes and excludes the local model parameters corresponding to the Byzantine nodes, it aggregates the remaining client local model parameters to obtain new global model parameters and sends them to the client.

[0011] The Byzantine node detection is performed by calculating the distance between the benchmark model parameters and each local model parameter, and setting a distance threshold to distinguish the model parameters corresponding to the Byzantine node and the model parameters corresponding to the normal client:

[0012] S4. Repeat S2~S3 until the training round threshold is reached to obtain the optimized global federated learning model parameters.

[0013] Furthermore, with regard to the distribution of data sets, 10% of the data is first taken out as a benchmark data set for training global model parameters; the remaining data is shuffled and evenly distributed to each client as its local data set for training local model parameters. The data samples of the data set are data for image classification tasks, such as the CIFAR-10 data set.

[0014] Furthermore, the initialization of the client and server models includes but is not limited to initialization of learning rate, model optimizer, loss function and model parameters.

[0015] Furthermore, the present invention uses a generative adversarial network model to generate more diverse training samples to expand the benchmark data set. The purpose of expanding the benchmark data set is to improve the performance of the global model in federated learning by generating more diverse training samples, especially in the face of Byzantine attacks, to improve the accuracy of detecting Byzantine gradients and the robustness of the model. This method significantly enhances the defense capability of the global model in the face of a high proportion of Byzantine clients, ensuring the stability and convergence of the model.

[0016] The generative adversarial network model of the present invention adds an authenticator to the original generative adversarial network and changes the constraints to increase the ability of the generative adversarial network model to output sample diversity. The detailed design is as follows:

[0017] The class label is used as additional information, and new training samples are synthesized by applying random noise vectors and additional information condition constraints to specify sample generation and prevent the generation of a large amount of data with the same additional information. The constraint formula is as follows:

[0018] (1);

[0019] In formula (1), Represents real data, Represents the input to the generator network The noise, Representation Generator Network The data generated, (*) indicates the discriminator network The probability of judging whether the input data is true or not, represents the distribution of real data, Represents the distribution of generated random noise, y represents the class label, which is used to generate conditional constraints for the adversarial network GAN to generate more diverse training samples. represents the expected value of the real data x, represents the expected value of the random noise vector z.

[0020] Furthermore, an authenticator is introduced to supervise the data augmentation process in the generative adversarial network. The authenticator predicts each synthetic sample, calculates the loss with the true class label of each synthetic sample, adds the loss to the loss of the generator and the discriminator, and performs back propagation to achieve the purpose of increasing diversity.

[0021] The improved generator and discriminator loss functions are as follows:

[0022] = (2);

[0023] = (3);

[0024] In formulas (2)~(3), is the generator loss, Discriminator loss, is the authenticator loss, To add the loss function of the generator after the authenticator, is the loss function of the discriminator after adding the authenticator.

[0025] Furthermore, the training of local model parameters using the local data set specifically includes:

[0026] In the tth round, each client updates the local model parameters according to the global model parameters and trains the local model parameters using the local gradient descent algorithm. The formula is expressed as:

[0027] (4);

[0028] In formula (4), It is represented as the model parameters of the i-th client after the t+1th iteration. Represented as the model parameters of the i-th client in the t-th iteration, Denoted as the learning rate, It is represented as the gradient calculated by the i-th client in the t-th iteration.

[0029] Furthermore, after the server performs Byzantine node detection and excludes Byzantine model parameters, the remaining model parameters are aggregated to obtain new global model parameters, which specifically include:

[0030] A Byzantine node detection method based on generative adversarial networks is proposed to improve the robustness of the federated learning system and its ability to resist Byzantine attacks, including model parameter storage, principal component analysis, distance calculation and parameter sorting, as well as reward and punishment mechanisms:

[0031] S31, model parameter storage;

[0032] The client uses the local data set to train the local model parameters, and the server uses the expanded benchmark data set to train the global model parameters of the previous round. After the local training is completed, the client uploads the trained local model parameters to the server. The local model parameters uploaded by the client will be stored in the sum_grad list, waiting for the server to check and aggregate.

[0033] S32, principal component analysis;

[0034] After all client local model parameters are uploaded, the server first performs principal component analysis (PCA) on all model parameters to extract the main features. Then, the extracted principal components are restored. The server obtains a model parameter set that removes noise and highlights the difference between Byzantine model parameters and benign parameters. After denoising and feature extraction of the model parameters, the obtained model parameter set is mainly used to accurately detect Byzantine nodes. Through denoising and feature extraction, the server can more accurately identify Byzantine nodes and reduce the possibility of misjudgment.

[0035] This step ensures that the subsequent judgment process is less affected by noise as possible, improving the accuracy of detection. Next, it is necessary to further use these processed model parameters for distance calculation and sorting to more accurately identify the Byzantine model parameters.

[0036] S33, distance calculation and parameter sorting;

[0037] The server uses the expanded benchmark data set to train the global model parameters of the previous round to obtain the benchmark model parameters, and calculates the distance between the benchmark model parameters and each client model parameter in the model parameter set;

[0038] The server holds the local model parameters of all clients in round t and the global model parameters in round t-1, which are the baseline model parameters obtained after training with the benchmark dataset in round t. Based on these model parameters, the server can calculate the model parameter distance of each client with the baseline model parameters as a guide.

[0039] Let the model parameters of the initial state of the global model be expressed as , the model parameters of the global model in round t are expressed as , the local model parameters of the jth client in round t are And the baseline model parameters of the server in round t are ,by As a benchmark, the Euclidean distance formula is used to calculate the distance between the benchmark model parameters and each client model parameter in the model parameter set:

[0040] (5) ;

[0041] In formula (5), represents the model parameters of the j-th client in the t-th iteration, m represents the number of dimensions of the model parameters, j represents the j-th client, The larger the value, the farther away from the benchmark model parameters;

[0042] Complete the distance calculation and sorting of each client model parameter in the model parameter set, and set a distance threshold to distinguish the model parameters corresponding to the Byzantine node and the model parameters corresponding to the normal client;

[0043] The possible Byzantine model parameters are preliminarily identified. In order to further ensure the accuracy and stability of the detection, it is necessary to introduce a reward and punishment mechanism to conduct more detailed analysis and processing of these model parameters.

[0044] Among them, the model parameters obtained by the server using the expanded benchmark data set to train the global model parameters of the previous round are referred to as benchmark model parameters in the present invention. The benchmark model parameters refer to the reference model parameters obtained by the server at the end of the previous round of training by fine-tuning the global model parameters of the previous round through the benchmark data set, which are used to calculate the Euclidean distance of the model parameters uploaded by the client in the current training round to detect and exclude the Byzantine model parameters sent by the Byzantine nodes, ensuring the robustness and stability of the federated learning system. If t=1, since the server does not have the global model parameters of the previous round, the server will use the initialized global model parameters for training.

[0045] S34. Add a reward and punishment mechanism. The reward and punishment array values ​​are used to record and accumulate the performance of each client in multiple rounds of training, so as to further determine whether it is a Byzantine client.

[0046] Each client will initialize a reward and punishment array value from the first round of training, with an initial value of 0. After the server calculates the distance of each client model parameter, it sorts each distance from small to large. The model parameters corresponding to the top 40% of clients in each round are defined as normal model parameters. If the corresponding reward and punishment array value is greater than 0, it is reduced by 1. The reward and punishment array values ​​corresponding to the remaining model parameters are increased by 1, and the remaining model parameters are determined to be Byzantine model parameters and removed.

[0047] Furthermore, a reward and punishment threshold is set, and the normal model parameters are further judged through the updated reward and punishment array to determine whether the total value of the reward and punishment array corresponding to the normal model parameters in this round is greater than the reward and punishment threshold. If it is less than the reward and punishment threshold, it is judged as a normal model parameter and allowed to participate in aggregation; if the parameter is greater than the reward and punishment threshold, it means that it has been judged as a Byzantine model parameter many times in the past round of federated learning. Therefore, such parameters are not allowed to participate in the aggregation process, and continuous iterations are performed until the corresponding reward and punishment array value is less than the reward and punishment threshold and then allowed to participate in aggregation again.

[0048] Through the above steps, the Byzantine model parameters sent by the Byzantine nodes are detected. After the Byzantine nodes are detected, these normal model parameters need to be aggregated to form new global model parameters. This step not only helps to further improve the robustness and performance of the model, but also lays a solid foundation for the next round of federated learning training.

[0049] S35, the server aggregates and removes the local model parameters of the Byzantine nodes to obtain new global model parameters:

[0050] After the server eliminates the Byzantine model parameters based on the update distance verification results, it aggregates the remaining model parameters to obtain new global model parameters and conducts the next round of federated learning. The federated server uses an aggregation algorithm to aggregate the local model parameters uploaded by each client to update the global model parameters. .

[0051] Furthermore, the S35 also includes score calculation and normalization of local model parameters. After selecting the normal model parameters, a score is assigned to each client model parameter according to the distance ranking of the normal model parameters. The larger the score, the greater the proportion of the model parameter in the final aggregation process. This is a measure to prevent the omission of Byzantine model parameters. The proportion adjustment process adopts the following formula:

[0052] (6);

[0053] In formula (6), represents the number of model parameters that are considered normal, represents the score of the i-th client model parameter, represents the distance between the i-th client model parameter and the global model parameter after fine-tuning. It represents the distance between the jth client model parameter identified as normal and the benchmark model parameter. The smaller the distance between the client model parameter and the benchmark model parameter, the greater the possibility of being considered as a normal model parameter, and the higher the assigned score.

[0054] Each score is then normalized and the client model parameters are adjusted. The normalization and adjustment process uses the following formula:

[0055] (7);

[0056] In formula (7), represents the score of the j-th client model parameter, represents the global model parameters after the tth round of aggregation, represents the score of the i-th client model parameter, represents the model parameters of the i-th client in the t-th iteration.

[0057] The benefit of this approach in practical applications is that by ranking and assigning scores to each client's model parameters based on the distance to the normal model parameters, it can more effectively prevent the omission of Byzantine model parameters. Specifically, the higher the score, the greater the proportion of the client's model parameters in the final aggregation process, which helps to increase the importance of benign model parameters and reduce the impact of Byzantine model parameters. Normalizing and adjusting client model parameters through assigned scores further ensures fairness and accuracy of different clients participating in training.

[0058] After the above score calculation and normalization adjustment, the server obtains the new global model parameters that have been verified and weighted. At this point, the server ensures that the Byzantine model parameters are effectively excluded, while optimizing and weighting the normal model parameters to improve the overall performance and robustness of the model. After completing these steps, the server generates new global model parameters and is ready for the next round of federated learning.

[0059] In another aspect of the present invention, a federated learning Byzantine node detection device based on a generative adversarial network is provided, characterized in that the device comprises:

[0060] processor;

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

[0062] Among them, when the computer program is executed by the processor, the steps of the federated learning Byzantine node detection method based on generative adversarial network are implemented.

[0063] A computer-readable storage medium, characterized in that: a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the steps of a federated learning Byzantine node detection method based on a generative adversarial network are implemented.

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

[0065] (1) The present invention proposes a method, device and computer-readable storage medium for detecting Byzantine nodes in federated learning based on a generative adversarial network. By using a generative adversarial network to expand the benchmark data set, more diverse training samples can be generated, thereby improving the performance of the global model in federated learning, especially in the face of Byzantine attacks, improving the accuracy of Byzantine model parameter detection and the robustness of the model. This method significantly enhances the defense capability of the global model when facing a high proportion of Byzantine clients, ensuring the stability and convergence of the model.

[0066] (2) The present invention proposes a federated learning Byzantine node detection method, device and computer-readable storage medium based on a generative adversarial network. The main features are extracted through principal component analysis (PCA), and the model parameters uploaded by the client are extracted and restored to remove noise and highlight the differences between the Byzantine model parameters and the benign model parameters. Through this process, the interference to the subsequent judgment process is reduced, thereby improving the accuracy of detection and the overall defense performance of the model.

[0067] (3) The present invention proposes a method, device and computer-readable storage medium for detecting Byzantine nodes in federated learning based on a generative adversarial network. The Euclidean distance between the model parameters of each client and the benchmark model parameters is calculated through the benchmark model parameters after training with the benchmark data set, thereby identifying the Byzantine model parameters. By accurately calculating and sorting the distance, the server can effectively detect the model parameters sent by the Byzantine client to ensure the effective convergence of the global model; at the same time, a reward and punishment array is introduced to judge and filter the Byzantine model parameters, and the model parameters of each client are sorted and scored to ensure that benign model parameters occupy a higher proportion in the aggregation process and reduce the impact of the Byzantine model parameters. Through this mechanism, the aggregation process of the model parameters can be dynamically adjusted and optimized, further improving the robustness and fairness of the model, ensuring that the federated learning system can still maintain efficient training and stable convergence in the face of various Byzantine attacks, and improving the overall defense capability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 Flowchart of the Byzantine node detection method for federated learning based on generative adversarial networks.

[0069] Figure 2 Schematic diagram of Byzantine gradient detection using Euclidean distance.

[0070] Figure 3 Schematic diagram of the Byzantine robustness aggregation experiment under mislead attack.

[0071] Figure 4 Schematic diagram of the Byzantine robustness aggregation experiment under scale attack. DETAILED DESCRIPTION

[0072] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.

[0073] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present disclosure. 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 disclosure belongs.

[0074] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present disclosure. 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.

[0075] In the absence of conflict, the embodiments in the present disclosure and the features in the embodiments may be combined with each other.

[0076] Example 1

[0077] Ginseng Figure 1 This embodiment provides a method for detecting Byzantine nodes in federated learning based on a generative adversarial network, the method comprising:

[0078] S1, data set allocation and model initialization;

[0079] The client and the server complete the allocation of data sets and initialize the models of the client and the server; the client and the server complete the allocation of data including:

[0080] First, 10% of the data is taken as the benchmark data set, and the rest of the data is shuffled and evenly distributed to each client as a local data set. The data samples are data for image classification tasks, such as the CIFAR-10 data set.

[0081] Initialize the client and server models, including learning rate, model optimizer, loss function, and model parameters.

[0082] Preferably, this embodiment uses a benchmark data set to train a generative adversarial network (GAN) model, and generates more diverse training samples through GAN to expand the benchmark data set. The purpose of expanding the benchmark data set is to improve the performance of the global model in federated learning by generating more diverse training samples, especially in the face of Byzantine attacks, to improve the accuracy of detecting Byzantine parameters and the robustness of the model. The benchmark data set is used to train a generative adversarial network (GAN) model, and the benchmark data set is expanded by generating more diverse training samples through GAN;

[0083] This embodiment adds an authenticator to the original generative adversarial network and changes the constraints to increase the ability of the generative adversarial network model to output sample diversity. The detailed design is as follows:

[0084] The generative adversarial network described in this embodiment uses additional information, preferably, the additional information is a class label, and synthesizes new training samples by applying a random noise vector and a class label condition constraint, so as to specify the sample for generation and prevent a large amount of data with the same label from being generated. The constraint condition formula is as follows:

[0085] (1);

[0086] In formula (1), represents the expected value of the real data x, represents the expected value of the random noise vector z, Represents real data, Represents the input to the generator network The noise, Representation Generator Network The data generated, (*) indicates the discriminator network The probability of judging whether the input data is true or not, represents the distribution of real data, Represents the distribution of generated random noise, y represents the class labels, and the class labels are used as additional information to generate conditional constraints for the adversarial network GAN to generate more diverse training samples.

[0087] Preferably, an authenticator is introduced to supervise the data augmentation process in the generative adversarial network. The authenticator predicts each synthetic sample, then calculates the loss with the true class label of each synthetic sample, adds the loss to the loss of the generator and the discriminator, and performs back propagation, so as to achieve the purpose of increasing diversity;

[0088] The improved generator and discriminator loss functions are as follows:

[0089] = (3);

[0090] In formulas (2)~(3), is the generator loss, Discriminator loss, is the authenticator loss, To add the loss function of the generator after the authenticator, is the loss function of the discriminator after adding the authenticator.

[0091] S2, the client performs local training;

[0092] The client updates the local model parameters according to the global model parameters, and trains the local model parameters using the local data set. After each round of training, the updated local model parameters are sent to the server.

[0093] The training of the local model parameters using the local data set specifically includes:

[0094] In the tth round, each client initializes the local model parameters according to the global model parameters issued, and uses the local gradient descent algorithm to train the local model parameters. The formula is expressed as:

[0095] The model parameters are trained using the local gradient descent algorithm, and the formula is:

[0096] (4);

[0097] In formula (4), It is represented as the model parameters of the i-th client after the t+1th iteration. Represented as the model parameters of the i-th client in the t-th iteration, Denoted as the learning rate, It is represented as the gradient calculated by the i-th client in the t-th iteration.

[0098] The client will update the model parameters Push to the federated learning server.

[0099] S3, detect and exclude Byzantine model parameters and aggregate;

[0100] After the server detects Byzantine nodes and eliminates Byzantine model parameters, it aggregates the remaining model parameters to obtain new global model parameters and sends them to the client.

[0101] The Byzantine node detection is performed by calculating the distance between the global model parameters and each local model parameter, and setting a distance threshold to distinguish the model parameters corresponding to the Byzantine node and the model parameters corresponding to the normal client:

[0102] Preferably, this embodiment proposes a Byzantine node detection method based on a generative adversarial network (GAN) to improve the robustness of the federated learning system and its ability to resist Byzantine attacks, including model parameter storage, principal component analysis (PCA), distance calculation and parameter sorting, and a reward and punishment mechanism:

[0103] S31, model parameter storage;

[0104] In this embodiment, taking the tth round as an example, the client uses the local data set to train the local model parameters, and the server uses the expanded benchmark data set to train the global model parameters of the previous round. After the tth round of training is completed, the client uploads the trained local model parameters to the server. The local model parameters uploaded by the client will be stored in the sum_grad list, waiting for the server to check and aggregate.

[0105] S32, principal component analysis (PCA), after all client model parameters are uploaded, the server first performs principal component analysis (PCA) on all model parameters to extract main features, and then restores the extracted principal components;

[0106] After completing the principal component analysis (PCA) and restoring the model parameters uploaded by all clients, the server obtains a set of model parameters that removes noise and highlights the differences between Byzantine model parameters and benign parameters. This step ensures that the subsequent judgment process is interfered with by noise as little as possible, improving the accuracy of detection. Next, it is necessary to further use these processed model parameters for distance calculation and sorting to more accurately identify Byzantine model parameters.

[0107] S33, distance calculation and parameter sorting, the server uses the expanded benchmark data set to train the global model parameters of the previous round to obtain benchmark model parameters, and calculates the distance between the benchmark model parameters and each client model parameter in the model parameter set, preferably, the distance is Euclidean distance;

[0108] In this round, the server uses the expanded benchmark data set to train the model parameters obtained by the global model parameters of the previous round. The present invention refers to the benchmark model parameters. The benchmark model parameters refer to the reference model parameters obtained by the server at the end of the previous round of training by fine-tuning the global model parameters of the previous round through the benchmark data set. They are used to calculate the Euclidean distance of the model parameters uploaded by the client in the current training round to detect and exclude the Byzantine model parameters sent by the Byzantine nodes, ensuring the robustness and stability of the federated learning system. If t=1, since the server does not have the global model parameters of the previous round, the server will use the initialized global model parameters for training.

[0109] For the server, taking round t as an example, the server holds the local model parameters of all clients in round t and the benchmark model parameters obtained after training the global model parameters in round t-1 using the benchmark dataset in round t. Based on these model parameters, the server can calculate the local model parameter distance of each client with the benchmark model parameters as a guide.

[0110] Assume that the model parameters of the initial state of the global model are expressed as , the model parameters of the global model in round t are expressed as , the model parameters of the jth client in the tth round are And the baseline model parameters of the server in round t are ,by As a benchmark, the distance to each client model parameter can be calculated using the Euclidean distance formula:

[0111] (5);

[0112] In formula (5), represents the model parameters of the j-th client in the t-th iteration, m represents the number of dimensions of the model parameters, j represents the j-th client, The larger the value, the farther away from the baseline model parameters are, and the more likely it is to represent the Byzantine model parameters.

[0113] Specifically, Figure 2 As shown, a schematic diagram of the directions of Byzantine model parameters, normal model parameters and benchmark model parameters under federated learning provided by the embodiment, L1 and L2 are the distances between the Byzantine model parameters and the benchmark model parameters, and L3 and L4 are the distances between the normal model parameters and the benchmark model parameters.

[0114] Since the attack goal of the Byzantine client is to prevent the convergence of the global model, the farther the Byzantine model parameters of the Byzantine client are from the baseline model parameters, the better the effect of preventing the convergence of the global model will be. The goal of the normal client update is to make the global model converge, so the normal model parameters will be closer to the baseline model parameters. Therefore, the Euclidean distance of the model parameters of the Byzantine client will be larger than the Euclidean distance of the normal model parameters, so that the model parameters of the Byzantine client can be detected. After completing the distance calculation and sorting of the model parameters of each client in the model parameter set, a distance threshold is set to distinguish the model parameters corresponding to the Byzantine node and the model parameters corresponding to the normal client;

[0115] Preferably, the sorting is to sort the distances from small to large, and a distance threshold of 40% is set. The first 40% of the model parameters are preliminarily determined to be normal model parameters, and the last 60% of the model parameters are preliminarily determined to be Byzantine model parameters, so that possible Byzantine model parameters can be preliminarily identified.

[0116] In order to further ensure the accuracy and stability of detection, it is necessary to introduce a reward and punishment mechanism to conduct more detailed analysis and processing of these model parameters. This step will strengthen the judgment of the Byzantine model parameters by updating the reward and punishment array, and ultimately determine which model parameters can participate in the aggregation of global model parameters.

[0117] S34. Add a reward and punishment mechanism. The reward and punishment array value is to record and accumulate the performance of each client in multiple rounds of training, so as to further determine whether it is a Byzantine client. Each client will initialize a reward and punishment array value from the first round of training, with an initial value of 0. After the server calculates the distance of each client model parameter, it sorts each distance from small to large. The model parameters corresponding to the first 40% of clients are temporarily set as normal model parameters. At this time, if the corresponding reward and punishment array value is greater than 0, it is reduced by 1, and the reward and punishment array values ​​corresponding to the remaining model parameters are increased by 1, and the remaining model parameters are determined to be Byzantine model parameters and removed.

[0118] Set the reward and punishment threshold, preferably, the reward and punishment threshold is set to 10; further judge the tentative normal model parameters through the updated reward and punishment array to determine whether the value of the reward and punishment array corresponding to the normal model parameter is greater than 10. If it is less than 10, it is determined to be a normal model parameter and allowed to participate in aggregation; if the parameter is greater than 10, it means that it has been judged as a Byzantine model parameter many times in the recent rounds of federated learning, so such parameters are not allowed to participate in the aggregation process until the corresponding reward and punishment array value is less than 10 and then allowed to participate in aggregation again.

[0119] Through the above steps, the Byzantine model parameters sent by the Byzantine nodes are detected. After the Byzantine nodes are detected, these normal model parameters need to be aggregated to form new global model parameters. This step not only helps to further improve the robustness and performance of the model, but also lays a solid foundation for the next round of federated learning training.

[0120] S35, the server aggregates and removes the local model parameters of the Byzantine nodes to obtain new global model parameters:

[0121] After the server excludes the parameters of the Byzantine local model based on the update distance verification result, it aggregates the remaining local model parameters to obtain new global model parameters and conducts the next round of federated learning. The federated server uses the aggregation algorithm to aggregate the local model parameters uploaded by each client to update the global model parameters. .

[0122] In addition, step S35 includes the score calculation and normalization of the model parameters. After selecting the normal model parameters, a score is assigned to each client model parameter according to the distance ranking of the normal model parameters. The larger the score, the greater the proportion of the model parameter in the final aggregation process. This is a measure to prevent the omission of Byzantine model parameters. The weight adjustment process uses the following formula:

[0123] (6);

[0124] in, represents the number of model parameters that are considered normal, represents the score of the i-th client model parameter, Represents the Euclidean distance between the i-th client model parameter and the global model parameter after fine-tuning. The smaller the distance between the client model parameter and the baseline model parameter, the greater the possibility of being considered a normal model parameter, and the higher the score assigned.

[0125] Each score is then normalized and the client model parameters are adjusted. The normalization and adjustment process uses the following formula:

[0126] (7);

[0127] in, represents the global model parameters after the tth round of aggregation, represents the score of the i-th client model parameter.

[0128] The benefit of this approach in practical applications is that by ranking and assigning scores to each client's model parameters based on the distance to the normal model parameters, it can more effectively prevent the omission of Byzantine model parameters. Specifically, the higher the score, the greater the proportion of the client's model parameters in the final aggregation process, which helps to increase the importance of benign model parameters and reduce the impact of Byzantine model parameters. Normalizing and adjusting client model parameters through assigned scores further ensures fairness and accuracy of different clients participating in training.

[0129] After the above score calculation and normalization adjustment, the server obtains the new global model parameters that have been verified and weighted. At this point, the server ensures that the Byzantine model parameters are effectively excluded, while optimizing and weighting the normal model parameters to improve the overall performance and robustness of the model. After completing these steps, the server generates new global model parameters and is ready for the next round of federated learning.

[0130] S4. Repeat training to obtain optimized model parameters: Repeat S2~S3 until the training round threshold is reached to obtain the optimized global federated learning model parameters.

[0131] For experimental comparison, here are some basic settings for the experiment:

[0132] In the experiment, the data set used cifar-10, the number of clients was 50, the ratio of Byzantine clients was 0.6, and 100 rounds of experiments were conducted. The attacker started attacking in the 50th round, and the model adopted the most basic fully connected model.

[0133] In the case of 60% Byzantine clients, the present invention is compared with two Byzantine robustness aggregation methods, FLTrust and median.

[0134] FLTrust is a state-of-the-art trust-based Byzantine robust aggregator that removes Byzantine gradients by using a cosine similarity detection mechanism; the Median method sorts the updates of the parameter uploaded from all devices or data centers, and then selects the value in the middle as the final aggregation result.

[0135] The attacker used two attack methods: mislead and scale. The former is a non-target attack, and the latter is a targeted attack.

[0136] Mislead considers strong attacks that apply label flipping and gradient operations at the same time, and combines L-flip and label flipping by summarizing the Byzantine updates of label flipping and gradient operations; scale (scaling attack), the attacker first selects a specific target class, uses a data augmentation scheme to add triggers to its normal local training samples, and marks them as the target class. Due to the limited influence of a single Byzantine participant, the attacker amplifies the poisonous local gradient by a factor greater than 1.

[0137] The experimental results are as follows Figure 3 , Figure 4 As shown, Figure 3 This is a Byzantine robustness aggregation experiment under mislead attacks. Figure 4 This is an experiment on Byzantine robustness aggregation under scale attack.

[0138] From the experiment, we can see that under non-target and non-attack conditions, such as Figure 3 As shown in the figure, the accuracy of identifying cifar-10 under Byzantine attack shows that the defense effect of the present invention is better than that of FLTrust, while median cannot resist the attack under 60% of Byzantine clients. Under target attack, only the present invention can successfully resist the attack of Byzantine clients, while FLTrust and median cannot resist the attack of Byzantine clients.

[0139] Example 2

[0140] This embodiment provides a federated learning Byzantine node detection device based on a generative adversarial network, characterized in that the device includes:

[0141] processor;

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

[0143] Among them, when the computer program is executed by the processor, the steps of the federated learning Byzantine node detection method based on generative adversarial network are implemented.

[0144] In this embodiment, a federated learning Byzantine node detection device based on a generative adversarial network includes but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronic devices, etc.

[0145] A computer-readable storage medium, characterized in that: a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the steps of a federated learning Byzantine node detection method based on a generative adversarial network are implemented.

[0146] Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can read and execute instructions stored in the readable storage medium.

[0147] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute part of this specification.

[0148] 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. Optionally, the program code may be downloaded from a server computer or a cloud via a communication network.

[0149] Obviously, the above embodiments of the present invention are only examples for clearly explaining 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 present invention specification shall be included in the protection scope of the present invention specification.

Claims

1. A federated learning Byzantine node detection method based on generative adversarial networks, characterized in that: The method comprises: S1, the client and the server complete the allocation of data sets and initialize the models of the client and the server; S2. The client updates the local model parameters according to the global model parameters and trains the local model parameters using the local data set. After each round of training, the updated local model parameters are sent to the server. S3. After the server detects Byzantine nodes and excludes the local model parameters corresponding to the Byzantine nodes, it aggregates the remaining client local model parameters to obtain new global model parameters and sends them to the client. The Byzantine node detection is performed by calculating the distance between the benchmark model parameters and each local model parameter, and setting a distance threshold to distinguish the model parameters corresponding to the Byzantine node and the model parameters corresponding to the normal client; S4, repeat S2-S3 until the training round threshold is reached to obtain the optimized global federated learning model parameters; The benchmark dataset is expanded by using a generative adversarial network model to generate more diverse training samples. The generative adversarial network model adds an authenticator to the original generative adversarial network and changes the constraints to increase the diversity of the output samples of the generative adversarial network model, as follows: The class label is used as additional information to synthesize new training samples by applying random noise vectors and additional information condition constraints. The constraint formula is as follows: (1); In formula (1), Represents real data, Represents the input to the generator network A random noise vector, Representation Generator Network The data generated, (*) indicates the discriminator network The probability of judging whether the input data is true or not, represents the distribution of real data, Represents the distribution of generated random noise, y represents the class label, which is used to generate conditional constraints for the adversarial network GAN. represents the expected value of the real data x, represents the expected value of the random noise vector z; At the same time, an authenticator is introduced to supervise the data enhancement process in the generative adversarial network. The authenticator predicts each synthetic sample, then calculates the loss with the true class label of each synthetic sample, adds the loss to the loss of the generator and the discriminator, and performs back propagation. The improved generator and discriminator loss functions are as follows: = (2); = (3); In formula (2)-(3), is the generator loss, Discriminator loss, is the authenticator loss, To add the loss function of the generator after the authenticator, is the loss function of the discriminator after adding the authenticator.

2. According to the method for detecting Byzantine nodes in federated learning based on generative adversarial networks in claim 1, it is characterized in that: The training of the local model parameters using the local data set specifically includes: For data set allocation, 10% of the data is first taken out as the benchmark data set, and the remaining data is shuffled and evenly distributed to each client as its local data set; In the tth round, each client updates the local model parameters according to the global model parameters and trains the local model parameters using the local gradient descent algorithm. The formula is expressed as: (4); In formula (4), It is represented as the model parameters of the i-th client after the t+1th iteration. Represented as the model parameters of the i-th client in the t-th iteration, Denoted as the learning rate, It is represented as the gradient calculated by the i-th client in the t-th iteration.

3. According to claim 2, the method for detecting Byzantine nodes in federated learning based on generative adversarial networks is characterized in that: After the server performs Byzantine node detection and excludes Byzantine model parameters, it aggregates the remaining model parameters to obtain new global model parameters, which specifically include: S31, model parameter storage; The client uses the local data set to train the local model parameters, while the server uses the expanded benchmark data set to train the global model parameters of the previous round. After the local training is completed, the client uploads the trained local model parameters to the server. The local model parameters uploaded by the client will be stored in the sum_grad list, waiting for the server to check and aggregate; S32, principal component analysis; After all client local model parameters are uploaded, the server performs principal component analysis on all client local model parameters to extract the main features, and then restores the extracted principal components. The server obtains a model parameter set that removes noise and highlights the differences between Byzantine model parameters and benign parameters. S33, distance calculation and parameter sorting; The server uses the expanded benchmark data set to train the global model parameters of the previous round to obtain the benchmark model parameters, and calculates the distance between the benchmark model parameters and each client model parameter in the model parameter set; The model parameters of the global model in round t are expressed as , the local model parameters of the jth client in round t are And the baseline model parameters of the server in round t are ,by As a benchmark, the Euclidean distance formula is used to calculate the distance between the benchmark model parameters and each client model parameter in the model parameter set: (5); In formula (5), represents the model parameters of the j-th client in the t-th iteration, m represents the number of dimensions of the model parameters, j represents the j-th client, The larger the value, the farther away from the benchmark model parameters; Complete the distance calculation and sorting of each client model parameter in the model parameter set, set a distance threshold, and the model parameters greater than the distance threshold are the model parameters corresponding to the Byzantine node, i.e., the Byzantine model parameters, and those less than or equal to the distance threshold are normal model parameters; S34. Add reward and punishment mechanism; Each client initializes a reward and penalty array value from the beginning of the first round of training, with an initial value of 0. After the server calculates the distance of each client model parameter in the model parameter set, it sorts each distance from small to large. The model parameters corresponding to the top 40% of clients in each round are defined as normal model parameters. If the corresponding reward and penalty array value is greater than 0, it is reduced by 1. The reward and penalty array values ​​corresponding to the remaining model parameters are increased by 1, and the remaining model parameters are determined to be Byzantine model parameters and removed. S35, the server aggregates and removes the local model parameters of the Byzantine nodes to obtain new global model parameters: After the server verifies the results based on the updated distance and eliminates the Byzantine model parameters, it aggregates the remaining model parameters to obtain new global model parameters and conducts the next round of federated learning.

4. According to claim 3, the method for detecting Byzantine nodes in federated learning based on generative adversarial networks is characterized in that: The adding of the reward and punishment mechanism also includes: setting reward and punishment thresholds, and re-judging the normal model parameters through the updated reward and punishment array: Determine whether the total value of the reward and punishment array corresponding to the total round of normal model parameters in this round is greater than the reward and punishment threshold. If it is less than the reward and punishment threshold, it is determined to be a normal model parameter and is allowed to participate in aggregation; if the total value of the reward and punishment array is greater than the normal model parameter corresponding to the reward and punishment threshold, it means that it has been judged as a Byzantine model parameter many times in the federated learning process of the past total rounds. For such parameters, they are not allowed to participate in the aggregation process in this round until the corresponding reward and punishment array value is less than the reward and punishment threshold, and then they are allowed to participate in aggregation again.

5. The method for detecting Byzantine nodes in federated learning based on generative adversarial networks according to claim 3 or 4, characterized in that: The S35 also includes score calculation and normalization of local model parameters. After selecting the normal model parameters, a score is assigned to each client model parameter according to the distance ranking of the normal model parameters. The larger the score, the greater the proportion of the model parameter in the final aggregation process. The proportion adjustment process adopts the following formula: (6); In formula (6), represents the number of model parameters that are considered normal, represents the score of the i-th client model parameter, represents the distance between the model parameters of the i-th client identified as normal and the benchmark model parameters, represents the distance between the model parameters of the jth client identified as normal and the benchmark model parameters; Each score is then normalized and the client model parameters are adjusted. The normalization and adjustment process uses the following formula: (7); In formula (7), represents the score of the j-th client model parameter, represents the global model parameters after the tth round of aggregation, represents the score of the i-th client model parameter, represents the model parameters of the i-th client in the t-th iteration.

6. According to claim 1, the method for detecting Byzantine nodes in federated learning based on generative adversarial networks is characterized in that: The initialization of the client and server models includes but is not limited to initialization of learning rate, model optimizer, loss function and model parameters.

7. A device for detecting Byzantine nodes in federated learning based on generative adversarial networks, 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 the method for detecting Byzantine nodes in federated learning based on a generative adversarial network as described in any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium storing a computer program, 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 6 are implemented.