A method for heterogeneous federated learning and malicious client defense based on weighted distillation

By using weighted distillation techniques and KL divergence calculation, the client weights are dynamically adjusted, solving the problems of poor robustness and low efficiency in heterogeneous federated learning. This achieves high accuracy and efficient model training, adapts to different client structures, and resists malicious attacks.

CN117454413BActive Publication Date: 2026-11-24BEIJING INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311232818.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2026-11-24
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

Existing heterogeneous federated learning systems suffer from poor robustness, poor applicability, and low efficiency. In particular, they struggle to effectively train highly accurate global models when faced with large differences in data distribution and malicious client attacks.

Method used

We employ a weighted distillation-based approach, which calculates client weights on the server side and performs weighted KL divergence calculation to dynamically adjust client weights, reduce the impact of malicious clients, and facilitate mutual learning within the local model.

Benefits of technology

It improves the accuracy and robustness of heterogeneous federated learning, is highly adaptable, and has high training efficiency. It can effectively resist attacks from malicious clients and reduce training time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117454413B_ABST
    Figure CN117454413B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of heterogeneous federal learning and malicious client defense method based on weighted distillation, belong to artificial intelligence and network security technical field.First, client selects local model with different neural network structure according to actual demand, and pre-trains model using local private data.Different clients share knowledge based on the public dataset possessed by server, and the server obtains the optimal solution of the linear combination of client output by training, so that the result is close to the real label distribution.Then, heterogeneous model is updated locally based on KL divergence, and mutual learning is performed according to the obtained weight.Finally, local learning is performed using private dataset to prevent forgetting of local knowledge.The above process is repeated until the model accuracy no longer improves or the preset iteration number is reached.Compared with the prior art, the present method effectively improves the accuracy of local model, has good robustness, adaptability and higher efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a heterogeneous federated learning and malicious client defense method based on weighted distillation, belonging to the fields of artificial intelligence and network security technology. Background Technology

[0002] Federated learning is a popular distributed machine learning paradigm that enables multiple parties to collaboratively train a global model without sharing their local private data. Standard federated learning uses a client-server architecture. At the start of each training round, a central server sends the global model to all participating clients. Clients train their models using their local data and return the updated model parameters to the server. The server collects all the local updates from the clients and updates the global model by aggregating these parameters.

[0003] However, this federated learning approach brings three serious problems: First, in real-world scenarios, the distribution of data among different participants is highly non-independent and identically distributed. This data heterogeneity makes it difficult to train a single model applicable to all clients. Second, when a client has limited or low-quality local data, it can obtain a good local model through collaborative training. However, it is uncertain whether clients with abundant data can benefit from federated learning. Third, as the number of clients and the size of the model increase, the communication overhead between the server and the client also increases rapidly.

[0004] Heterogeneous federated learning considers more practical application scenarios where clients' local data distributions and models differ, using model knowledge as interactive information. This heterogeneous scenario presents challenges such as difficulty in aggregating model parameters, slow convergence speed, and difficulty in distinguishing malicious model updates. The goal of federated learning is to improve the accuracy of individual client-side local models through joint training without directly sharing data. To achieve this goal, in heterogeneous scenarios, a reasonable global model needs to be established to enhance the ability of clients to learn from each other, while also considering the negative impact of poor quality local data or malicious behavior on client sides. Therefore, to meet the requirements of federated learning under heterogeneous model and data conditions and to effectively resist malicious client attacks, an efficient training method for heterogeneous federated learning must be designed.

[0005] To address this situation, the following approaches can typically be used to train heterogeneous federated learning systems:

[0006] Option 1: Heterogeneous Federated Learning Training Method Based on Knowledge Distillation. In this method, the model owned by the central server is considered the teacher model, and the local models owned by each client are considered student models. Student models can learn the similarities and differences between classes in the teacher model's output, thereby increasing their local model knowledge. After the client completes training using local data, the federated learning process generally consists of three steps: First, the client calculates the logits corresponding to the public dataset, which is constructed by each private dataset providing a portion of its data. Second, the server aggregates the received client logits, averages them based on the number of clients participating in the training, and returns the average to the client. Third, the client uses the received logits to distill its local private model. In this scheme, the logits obtained by the client on the public dataset contain the distribution information of its local private data, thus enabling mutual learning without privacy leakage through distillation.

[0007] Option 2: Heterogeneous Federated Learning Training Method Based on the Same Neural Network Layer. In this method, the client model is designed with a "base layer + personalization layer." The personalization layer is client-private and used to complete local personalization tasks, while the base layer is shared with the server using the same structure and is used to learn general features. First, the client trains its local model using private data, including both the base and personalization layers. Second, after local training, the client only sends the parameters of the base layer back to the server. Third, the server aggregates the model parameters using traditional federated learning methods and returns them to the client for the next round of training.

[0008] Option 3: Malicious Client Identification Method Based on Spectral Anomaly Detection. First, a detection model is trained using a centrally trained unbiased model. Then, malicious and benign model updates are input into the encoder to obtain their latent vectors. Second, client updates via the decoder generate reconstruction errors. A detection threshold is set; model updates with reconstruction errors exceeding the threshold are considered malicious updates and will not enter the aggregation process. In this approach, due to heterogeneity, benign client model updates are biased towards their local training data. However, compared to the differences between malicious client updates, this impact is small. Biased model updates from benign clients can trigger lower reconstruction errors, thus ensuring that malicious model updates are identified.

[0009] However, the first approach has the following technical drawbacks:

[0010] Poor robustness. The averaged logits directly affect the model's accuracy. In scenarios with large differences in data distribution or the presence of malicious clients launching targeted attacks, the accuracy of this approach will decrease significantly.

[0011] The second approach has the following technical drawbacks:

[0012] Poor adaptability. The basic structure of the model directly affects the applicability of the solution. When models are highly differentiated and do not have the same layer structure, this solution cannot dynamically meet the training requirements.

[0013] The third option has the following technical drawbacks:

[0014] The approach suffers from low efficiency and security. When the number of clients or samples involved in training is large, the scheme requires extensive preprocessing, leading to low training efficiency. Furthermore, the anomaly detection model requires centralized unbiased model updates for training, which introduces security risks. Summary of the Invention

[0015] The purpose of this invention is to address the technical shortcomings of existing heterogeneous federated learning systems, such as poor robustness, poor applicability, and low efficiency, and to creatively propose a heterogeneous federated learning and malicious client defense method based on weighted distillation.

[0016] To achieve the above objectives, the present invention adopts the following technical solution.

[0017] First, the relevant concepts and contents involved in this invention will be explained.

[0018] Federated learning refers to a distributed machine learning method that enables multiple participants to collaboratively train data using distributed data while protecting data privacy.

[0019] Data heterogeneity: refers to the fact that different participants in federated learning have local data of different types, distributions, sizes, and qualities.

[0020] Model heterogeneity: refers to the fact that participating clients in federated learning have different types of data, or that due to computing and communication limitations, different clients use local models of different types and structures for training.

[0021] KL divergence: a method used to measure the degree of difference or similarity between two probability distributions;

[0022] A heterogeneous federated learning and malicious client defense method based on weighted distillation includes the following steps:

[0023] Step 1: The client selects a local model with a different neural network structure according to the actual needs and pre-trains the model using local private data.

[0024] Step 2: Different clients share knowledge based on the public dataset owned by the server. The server obtains the optimal solution of the linear combination of client outputs through training, so that the result is close to the true label distribution.

[0025] Step 2.1: The client performs predictions on a public dataset using the pre-trained local model to obtain the client's probability distribution set, and then sends it to the server;

[0026] Step 2.2: The server-side model is trained to generate client-side weights using the collected probability distribution set and the original samples as input;

[0027] The closer a client's prediction is to the true label, the greater its weight. If a malicious client transmits predictions that deviate significantly from the true label, its weight calculation will approach zero, reducing its negative impact.

[0028] Through steps 2.1 to 2.2, the training of the server-side model reduces the impact of malicious clients on federated learning during the training process, thereby increasing its effectiveness.

[0029] Step 3: The heterogeneous models perform local updates based on KL divergence and learn from each other based on the obtained weights.

[0030] Step 3.1: The server calculates the weighted KL divergence of the client based on the client weights obtained during training, and returns it to the corresponding client;

[0031] Step 3.2: The client updates its local model through backpropagation based on the received weighted KL divergence.

[0032] Step 4: Use a private dataset for local learning to prevent forgetting local knowledge.

[0033] Repeat steps 2 through 4 until the model accuracy no longer improves or the preset number of iterations is reached.

[0034] Beneficial effects

[0035] The method of the present invention has the following advantages compared with the prior art:

[0036] 1. This method demonstrates good effectiveness. In heterogeneous federated learning scenarios, by passing on knowledge distribution and calculating weights, clients can learn more beneficial knowledge from each other, thereby effectively improving the accuracy of local models.

[0037] 2. This method exhibits good robustness. Compared to Scheme 1, this method, based on weighted distillation, can dynamically adjust the client's weights during training, enabling the client to learn better knowledge during the distillation phase and thus resisting attacks from malicious clients.

[0038] 3. This method has good adaptability. Compared with Scheme 2, the server-side model in this method is a model for client filtering and weighting, rather than a classifier after aggregation. It does not have strong assumptions or requirements regarding the basic structure of the client model.

[0039] 4. This method is highly efficient. Compared to Scheme 3, this method does not require additional data collection and preprocessing, can identify and reduce the impact of malicious clients during collaborative training, shortens the training time per round, and is more efficient. Attached Figure Description

[0040] Figure 1 This is a flowchart illustrating the method of the present invention. Detailed Implementation

[0041] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] like Figure 1 As shown, a heterogeneous federated learning and malicious client defense method based on weighted distillation is presented. This embodiment details the training and defense method using the method described in this invention in a heterogeneous federated learning scenario with malicious clients, including the following process:

[0043] Step 1: Let the clients be c1, c2, ..., c k Using their respective local private data D1, D2, ..., D k and for the local model θ1, θ2, ..., θ k Conduct pre-training.

[0044] Step 2: The server trains based on the collected client predictions and public datasets to calculate the weight combination that is closest to the true label.

[0045] Step 2.1: In the t-th iteration, client c k (k = 1, 2, ..., K) Perform predictions on the public dataset D0 using the pre-trained local model to obtain a set of probability distributions. And send it to the server;

[0046] Step 2.2: The server-side model is trained to generate client weights using the collected probability distribution set and the original samples as input; the closer the client's prediction is to the true label, the greater the weight. Malicious clients will be assigned smaller weight values ​​to reduce their negative impact.

[0047] Specifically, this method is based on training on samples from the public dataset D0 and the client's prediction set, using the weights of the model output to measure the quality of the client's predictions. The loss function of the server-side model is... The goal is to minimize the cross-entropy loss through multiple rounds of iterative training. Where N0 represents the total number of samples in the public dataset, Represents a sample x on a public dataset i The true label, This indicates that the server obtains the weights of the k-th client during training. Indicates client c j In sample x i The probability distribution obtained from the above prediction.

[0048] When the loss is minimized, it means that the combination of probability distributions predicted by the current model most closely approximates the true label of the sample. The server-side model output is a personalized weight combination of different probability distributions. For example, suppose there are three clients c1, c2, and c3, whose weight values ​​obtained by training the server-side model are 0.861, 0.116, and 0.023, respectively. This means that c1's prediction is closest to the true label and is given a larger weight, while c3's prediction is furthest from the true label.

[0049] Step 2.2 distinguishes between benign and malicious clients during training without requiring additional steps, thus improving training efficiency compared to Scheme 3. Image features are extracted using convolutional layers of a neural network, and client weights are jointly calculated using linear layers and probability distributions. Through multiple iterations, the weight values ​​in each batch can be dynamically adjusted. Furthermore, this weight allocation method reduces the weight of malicious clients on the server side, thus minimizing their global impact on federated training and meeting the requirements for resisting various attack methods.

[0050] Furthermore, in step 2.2, the method used by the server to calculate the client weight is as follows:

[0051] The input includes: K, D0, η;

[0052] The output is:

[0053] The first step is to randomly initialize the weights and biases of the server-side model ServerNet, and denote the initial model as θ0;

[0054] The second step is to train the server-side model. For each iteration i, the client-side weights are initialized using the public dataset, i.e. Then calculate the server-side model loss. Then update the server-side model parameters. Repeat the above process until the specified number of iterations is reached.

[0055] The third step is to generate client weights using the trained model. For each batch of data, the client weights are calculated using a common dataset. Repeat the above process to complete the traversal of the public dataset.

[0056] The fourth step is to return the optimal client weight.

[0057] Among them, input K, D0, η refers to the number of clients, the public dataset, the set of probability distributions, and the learning rate, respectively. This represents the gradient of the cross-entropy loss function of the server-side model.

[0058] In the iterative training phase of the server-side model, the original samples of the public dataset first pass through the convolutional layer to extract features, and then are jointly trained with the collected probability distribution in the linear layer to obtain client weights. The difference between the linear combination and the true label is calculated by the loss function to update the model parameters in reverse. When the training is completed, the optimal weight combination calculated by the server is used as the judgment factor for the prediction accuracy of the client model in the subsequent mutual learning.

[0059] In this method, the server-side model is a model for client filtering and weighting, rather than a classifier after aggregation. It does not require the client-side model to have the same basic layer structure, which shows that the method has good scalability.

[0060] Step 3: The heterogeneous model performs local updates based on KL divergence and performs mutual distillation learning based on the obtained weights.

[0061] Step 3.1: The server calculates the weighted KL divergence of the client based on the client weights obtained during training, and returns it to the corresponding client;

[0062] Specifically, this method achieves mutual learning between different client models based on weighted KL divergence. The KL divergence expression is: Used to measure two probability distributions and Minimize the distance between them It is considered from The learning process; the server calculates c based on the client weights obtained from the t-th iteration of training, using a weighted average. k The KL divergence between the client and other clients, for one batch, is calculated as follows: K represents the total number of clients participating in federated learning; the server returns the resulting set of divergences to the corresponding clients.

[0063] Step 3.2: The client updates its local model through backpropagation based on the received weighted KL divergence, expressed as: η is the learning rate; This indicates that in the (t-1)th iteration, the server calculates client c. k The weighted set of KL divergences between the client and other clients.

[0064] Step 3 demonstrates better robustness compared to Scheme 1. Based on weighted distillation technology, the weights of clients in each batch of the heterogeneous federated learning system can be dynamically adjusted. The linear combination of probability distributions more closely approximates the true labels. Malicious clients are assigned smaller weight values, enabling them to learn more correct knowledge during the distillation phase and move towards the correct update direction, thereby resisting the influence of malicious clients.

[0065] Step 4: Use a private dataset for local learning to prevent forgetting local knowledge.

[0066] To balance local knowledge with knowledge learned from other clients, this method sets up a local learning phase after mutual learning, where the client updates the local model with its own private dataset to prevent the forgetting of local knowledge.

[0067] Repeat steps 2 through 4 until the preset number of iterations T is reached.

[0068] The characters designed by the method in this embodiment are shown in Table 1:

[0069] Table 1. Character descriptions related to the method in this embodiment.

[0070]

[0071]

[0072] Experimental verification

[0073] To demonstrate the effectiveness and applicability of this invention, this embodiment was validated on the CIFAR10 dataset, where θ0, θ1, and θ2 are heterogeneous client-side local models. The results are shown in Table 2.

[0074] Table 2 shows the accuracy of this embodiment on the CIFAR10 dataset.

[0075]

[0076] To demonstrate the robustness and efficiency of this scheme in the presence of malicious clients, this embodiment introduces 25% and 50% malicious clients respectively, which influence the training of federated learning by sending incorrect prediction results, as shown in Table 3:

[0077] Table 3 shows the model accuracy and overhead in this embodiment after introducing malicious clients under the Non-IID data distribution.

[0078]

[0079] The above description is merely a preferred embodiment of the present invention, and the present invention should not be limited to the content disclosed in this embodiment and the accompanying drawings. Any equivalent or modified embodiments made without departing from the spirit of the present invention fall within the scope of protection of the present invention.

Claims

1. A method for weighted distillation based heterogeneous federated learning and malicious client defense, comprising: Includes the following steps: Step 1: The client selects a local model with a different neural network structure according to the actual needs and pre-trains the model using local private data; Step 2: Different clients share knowledge based on the public dataset owned by the server. The server obtains the optimal solution for the linear combination of client outputs through training, making the result approximate the true label distribution. The server uses the following method to calculate client weights: The first step is to randomly initialize the server-side model. The weights and biases of the initial model are denoted as . ; Second step, training server side model; for each round of iteration , initialize client weights using public dataset, that is , then calculate server side model loss , then update server side model parameters ; loop the above process until the specified number of iterations is reached; Thirdly, generate the client weight through the trained model; for each batch of data, calculate the client weight using the public data set, that is ; execute the above process in a loop to complete the public data set traversal; Step 4, return the best client weights ; wherein the input respectively refer to the number of clients, the public dataset, the set of probability distributions, and the learning rate; denotes the gradient of the server-side model cross-entropy loss function; Step 2.1: The client performs predictions on a public dataset using the pre-trained local model to obtain the client's probability distribution set, and then sends it to the server; Step 2.2: The server-side model is trained to generate client-side weights using the collected probability distribution set and the original samples as input; The closer the client's prediction is to the true label, the greater its weight; if a malicious client transmits predictions that deviate from the true label, its weight calculation result will be close to zero, reducing the negative impact. Step 3: The heterogeneous models perform local updates based on KL divergence and learn from each other based on the obtained weights; Step 3.1: The server calculates the weighted KL divergence of the client based on the client weights obtained during training, and returns it to the corresponding client; Step 3.2: The client updates its local model through backpropagation based on the received weighted KL divergence; Step 4: Use a private dataset for local learning to prevent forgetting local knowledge; Repeat steps 2 through 4 until the model accuracy no longer improves or the preset number of iterations is reached.

2. The method of claim 1, wherein the method is based on weighted distillation for heterogeneous federated learning and malicious client defense. In step 2, based on the samples in the public dataset and the prediction set of the clients, the quality of the prediction of the clients is measured by the weight size of the model output; wherein the loss function of the server-side model is , and the goal is to minimize the cross-entropy loss through multiple rounds of iterative training; wherein represents the total number of samples in the public dataset, represents the true label of the sample in the public dataset, represents the weight of the th client obtained through server training, represents the probability distribution predicted by the client on the sample . When the loss reaches the minimum, it indicates that the combination of the probability distributions predicted by the current model is closest to the true labels of the samples, and the server-side model outputs the personalized weight combination of different probability distributions ; In the iterative training phase of the server-side model, the original samples of the public dataset first pass through convolutional layers to extract features, and then are jointly trained with the collected probability distribution in linear layers to obtain client weights. The difference between the linear combination and the true label is calculated using a loss function to update the model parameters in reverse. After training, the optimal weight combination calculated by the server is used as a criterion for judging the prediction accuracy of the client model in subsequent mutual learning.

3. The method of claim 1, wherein the method is based on weighted distillation for heterogeneous federated learning and malicious client defense. In step 3.1, mutual learning between different client models is achieved based on weighted KL divergence; the KL divergence expression is: Used to measure two probability distributions and Minimize the distance between them yes from The learning process; the server learns from the training data... Client weights in round iterations, weighted calculation The KL divergence between the client and other clients, for one batch, is calculated as follows: K represents the total number of clients participating in federated learning; the server returns the obtained set of divergences to the corresponding client. Step 3.2: The client updates the local model according to the received weighted KL divergence, expressed as ; is the learning rate; represents the th iteration, the server computes the set of weighted KL divergences between the client and other clients.

Citation Information

Patent Citations

  • Self-adaptive personalized federal learning method supporting heterogeneous model

    CN115271099A

  • Federated learning model training method and apparatus, and electronic device

    WO2022144000A1