Efficient heterogeneous federated learning method, system and equipment based on mixed distillation and medium
Through the two-stage learning scheme of the mixed distillation method, client self-distillation and server integrated distillation solve the model training and generalization performance problems of federated learning in heterogeneous data environment, and achieve efficient global model training and attack robustness , avoid privacy leakage.
Patent Information
- Application Number
- CN202410981059.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Existing federated learning methods are difficult to achieve efficient training and generalization performance of global models in heterogeneous data environments, and there are problems of privacy leakage and attack robustness, especially when information exchange and local model aggregation between clients.
Using the mixed distillation method, the two-stage learning scheme of client self-distillation and server integrated distillation can be alleviated to reduce local overfitting, and joint soft prediction and feature distillation are carried out on the server side to avoid client information exchange and privacy leakage, while improving the model Indicates learning and loss of flatness.
Improves model aggregation and generalization performance on heterogeneous and long-tail client data, enhances the accuracy of the global model, avoids privacy leakage, and improves communication efficiency and attack robustness.
Smart Images

Figure CN118966271A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of federated learning, and in particular, relates to an efficient heterogeneous federated learning method, system, device and medium based on mixed distillation. Background Art
[0002] With the improvement of computer computing power, machine learning, as a technology for analyzing and processing massive data, has been widely used in human society. However, there are data barriers between different industries and departments, resulting in the formation of "islands" of data that cannot be safely shared, and the performance of machine learning models trained with independent data from each department cannot achieve global optimization. Federated learning technology was proposed to solve this problem. It effectively protects the privacy of users by transferring the data storage and model training phase of machine learning to local users and only interacting with the central server to update the model. It has been widely used in practice and achieved good results. However, it also brings new challenges, that is, the data distribution of different parties is usually non-independent and identically distributed (non-iid). When the client holds heterogeneous data, the local models often diverge from each other during training, resulting in drift on the client. Therefore, directly aggregating model parameters and updates will lead to a significant decrease in global model performance.
[0003] Since the problem of data heterogeneity was raised, many methods have been proposed to alleviate the various problems caused by data heterogeneity. Most of the existing federated learning work to solve the heterogeneity of data from different clients can be divided into three categories. The first category is data-level methods, which smooth the statistical heterogeneity of client local data through private data processing such as data augmentation and external data. The second category is model-level methods, which aim to learn a local model for each client by operating at the model level, which adapts to its private data distribution and learns global information at the same time, mainly including adding regularization, combining contrastive learning or meta-learning, improving consistency, sharing partial structures, etc. The third category is server-level methods, which require server participation, such as participating in client selection or client clustering.
[0004] Combining federated learning with knowledge distillation, namely federated distillation, can utilize external data sources and knowledge transfer to improve the performance of federated learning in heterogeneous environments. It belongs to data-level and model-level methods. There are currently two main ways to combine, one is client distillation and the other is distillation on the server. In client distillation, each client obtains the average soft prediction from all clients to constrain local updates and prevent falling into local optimality. However, it requires data exchange between clients, which may lead to privacy leakage and is vulnerable to poisoning attacks by malicious clients. In server distillation, the server aggregates the client models and uses the average soft prediction output by the auxiliary dataset to fine-tune the global model. However, the existing server distillation method only uses soft predictions to learn global knowledge. It relies on the set of local predictor outputs for distillation, making it sensitive to misleading and ambiguous knowledge injected by poorly performing local models, and sharing soft predictions will exacerbate this problem. Summary of the invention
[0005] The purpose of the present invention is to provide an efficient heterogeneous federated learning method, system, device and medium based on mixed distillation to solve the problems existing in the above-mentioned prior art.
[0006] To achieve the above objectives, the present invention provides an efficient heterogeneous federated learning method based on hybrid distillation, comprising:
[0007] Step 1: Initialize the global model parameters on the server and set the total number of training rounds and the number of clients participating in each round of training;
[0008] Step 2: In each client, load the corresponding local data set, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server;
[0009] Step 3: After receiving the local model parameters, the server performs server distillation in combination with the preset auxiliary data set to obtain updated global model parameters, and sends the updated global model back to the client;
[0010] Repeat steps 2 and 3 until the model converges.
[0011] Optionally, performing a random transformation on the local data set specifically includes:
[0012] Scaling and rotating the local data set are performed to obtain the client distilled data.
[0013] Optionally, each of the sub-networks has a different network fraction width.
[0014] Optionally, each sub-network is trained on the client distilled data, including:
[0015] Calculate the KL divergence between the softmax output of the sub-network and the original softmax output of the corresponding client local model as the distillation loss, and dynamically assign weights according to the prediction confidence of the sub-network;
[0016] Based on the distillation loss and the traditional cross entropy loss, an optimization algorithm is used to update the local model parameters.
[0017] Optionally, the step three specifically includes:
[0018] The server receives the updated local model parameters of all clients, performs weight aggregation, and obtains the global model;
[0019] The global model is distilled based on the preset auxiliary data set in combination with joint soft prediction distillation and feature distillation to obtain updated global model parameters, and the updated global model is sent back to the client.
[0020] An efficient heterogeneous federated learning system based on hybrid distillation, including:
[0021] The initialization module is used to enable the server to initialize global model parameters and set the total number of training rounds and the number of clients participating in each round of training;
[0022] The client distillation module is used to load the corresponding local data set in each client, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server;
[0023] The server distillation module is used for the server to perform server distillation on the local model parameters after receiving them in combination with a preset auxiliary data set to obtain updated global model parameters, and send the updated global model back to the client; repeat the client distillation and server distillation until the model converges.
[0024] An electronic device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform an efficient heterogeneous federated learning method based on mixed distillation.
[0025] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the efficient heterogeneous federated learning method based on mixed distillation.
[0026] The technical effects of the present invention are:
[0027] The present invention designs a two-stage learning scheme consisting of client self-distillation and server integrated distillation to alleviate local overfitting and improve the model aggregation and generalization performance of federated learning on heterogeneous and long-tail client data. The scheme does not require any information exchange between clients, nor does it require global data distribution for joint optimization, thereby preventing privacy leakage.
[0028] The proposed server distillation method can achieve better representation learning and flatter loss landscape for fine-tuning the aggregate model, both of which help improve the accuracy of the global model under different degrees of data heterogeneity and different numbers of clients.
[0029] The method designed in the present invention not only overcomes the heterogeneity problem of federated learning, but also improves communication efficiency and attack robustness while avoiding privacy leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0032] Figure 1 It is an implementation flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0033] Various exemplary embodiments of the present invention will now be described in detail. This detailed description should not be considered as limiting the present invention, but should be understood as a more detailed description of certain aspects, features, and embodiments of the present invention.
[0034] It should be understood that the terms described in the present invention are only for describing special embodiments and are not intended to limit the present invention. In addition, for the numerical range in the present invention, it should be understood that each intermediate value between the upper and lower limits of the scope is also specifically disclosed. Each smaller range between the intermediate value in any stated value or stated range and any other stated value or intermediate value in the described range is also included in the present invention. The upper and lower limits of these smaller ranges can be independently included or excluded in the scope.
[0035] Unless otherwise indicated, all technical and scientific terms used herein have the same meanings as those of ordinary skill in the art generally understood by the present invention. Although the present invention describes only preferred methods, any method similar or equivalent to that described herein may also be used in the implementation or testing of the present invention. All documents mentioned in this specification are incorporated by reference to disclose and describe the methods related to the documents. In the event of a conflict with any incorporated document, the content of this specification shall prevail.
[0036] It will be apparent to those skilled in the art that various modifications and variations may be made to the specific embodiments of the present invention description without departing from the scope or spirit of the present invention. Other embodiments derived from the present invention description will be apparent to those skilled in the art. The present application description and examples are exemplary only.
[0037] The words “include,” “including,” “have,” “contain,” etc. used in this article are open-ended terms, meaning including but not limited to.
[0038] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0039] Embodiment 1
[0040] like Figure 1 As shown, this embodiment provides an efficient heterogeneous federated learning method based on hybrid distillation, including:
[0041] Step 1: Initialize the global model parameters on the server and set the total number of training rounds and the number of clients participating in each round of training;
[0042] Step 2: In each client, load the corresponding local data set, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server;
[0043] Step 3: After receiving the local model parameters, the server performs server distillation in combination with the preset auxiliary data set to obtain updated global model parameters, and sends the updated global model back to the client;
[0044] Repeat steps 2 and 3 until the model converges.
[0045] This embodiment designs a two-stage learning scheme consisting of client self-distillation and server integrated distillation to alleviate local overfitting and improve the model aggregation and generalization performance of federated learning on heterogeneous and long-tail client data. This scheme does not require any information exchange between clients, nor does it require global data distribution for joint optimization, thereby preventing privacy leakage.
[0046] The server distillation method proposed in this embodiment can achieve better representation learning and a flatter loss landscape to fine-tune the aggregation model, both of which help to improve the accuracy of the global model under different degrees of data heterogeneity and different numbers of clients.
[0047] The method designed in this embodiment not only overcomes the heterogeneity problem of federated learning, but also improves communication efficiency and attack robustness while avoiding privacy leakage.
[0048] This embodiment proposes a heterogeneous federated learning method with a two-stage learning paradigm, namely Federated Hybrid Knowledge Distillation (FedHyb). The two stages mainly perform knowledge distillation on the client and server respectively. Among them, the client distillation limits local updates and alleviates local overfitting by dynamically learning sub-networks, while avoiding information exchange between clients. A server integrated distillation scheme is proposed on the server side, which transfers aggregated client information to the global model more comprehensively at three different levels. The server distillation process is guided by a class-balanced unlabeled dataset. This auxiliary dataset can come from a third party or from a generator that is independent of the client data distribution to supervise the integrated knowledge transfer. In this way, more general feature representations can be learned from model aggregation, while the classifier can be retrained using a set of balanced data, thereby achieving better final test accuracy.
[0049] The specific plan is as follows:
[0050] 1. Traditional Federated Learning (FedAvg): Consider a federated learning system with K clients. For clients k = 1, 2, ..., K, all clients can only access their own local private data D with labels. k :=(x,y), x and y are client local private data and labels respectively. k :=|D k | represents the amount of client data. The participating clients use local training, and the cross entropy (CE) loss is:
[0051]
[0052] After training for a specified number of rounds, send the local client model parameters ω to the server k =ω1,ω2,...,ω K, using , the server then performs a simple model aggregation via weight aggregation to obtain the global model parameters:
[0053]
[0054] where pk = |D k | / |D| is the amount of data of client k relative to the aggregate of all client data The server sends the global model back to the client. This process repeats T rounds until convergence.
[0055] 2. Client distillation process: Most existing works perform local logarithmic distillation, but this requires information exchange between clients. If a malicious client participates, the privacy of other clients may be leaked in the collaborative learning process. To solve this problem, this embodiment designs a client self-distillation scheme that protects privacy. It does not require information exchange or a public dataset shared between clients. In the self-distillation process, first, the local data sample D k Perform random transformations, including scaling and rotation, on the client to obtain the client distilled data R m (x). Secondly, this embodiment also samples M sub-networks with different network fraction widths from the original network, denoted as S m (ω), where ω is the local client model parameter, m = 1, 2, ..., M. Then this embodiment uses the cumulative distillation loss of the M sub-networks to limit local updates and alleviate local overfitting. Specifically, this embodiment introduces the following regularization term on the traditional cross entropy (CE) loss function to regularize the local model update at client k:
[0056]
[0057] Among them, the softmax output of the mth sub-network trained on the corresponding client distillation dataset is denoted as Q k (S m (ω); R m (ω)), the original softmax output of the k-th client local model is Q k (ω; x), are aligned by computing the KL divergence of the two. The proposed client-side distillation involves sampling multiple sub-networks with different network fraction widths, which are fine-tuned using client-side distilled data generated by random transformations of the local dataset, which is used to enrich the learned local semantic information without leaking to other clients.
[0058] 3. Dynamic subnetwork weights: Due to the different fractional widths of the sampling subnetworks and the different simple transformations of the original images, the performance of each subnetwork may deviate. The best case is that the subnetwork with better performance can make a greater contribution to the original network. On this basis, this embodiment designs a mechanism for dynamically weighted subnetwork losses, which dynamically assigns loss weights to subnetworks based on the performance of different subnetworks. Specifically, as training progresses, each subnetwork has different prediction confidence levels for samples, so that the subnetwork dynamically contributes to the training of the original network. It is beneficial to the original network to use an adaptive way to allocate these subnetwork weights. That is, based on the prediction outputs of different subnetworks, in the current training, subnetworks with different confidence levels contribute differently to the original network. The formula is defined as:
[0059]
[0060] in is the cross entropy (CE) loss of the mth subnetwork of client k and calculated on the original labels. In this way, the subnetwork with higher prediction confidence will contribute more to the client self-distillation process. Combined with the above design, the objective function of the local model at client k is:
[0061]
[0062] The first part is the traditional cross entropy (CE) loss, as shown in Equation (1), and the second part is the cumulative knowledge distillation (KD) loss based on soft label prediction, which is a dynamic weighting with adaptive model regularization. The contributions of CE and KD losses are balanced using the hyperparameter σ.
[0063] 4. Server-side distillation: Due to data heterogeneity, there may be large differences between client models. The server model obtained by directly aggregating the client models has poor performance. Therefore, the aggregated server model is further fine-tuned on the server. Specifically, further distillation is performed on the server using an unlabeled class-balanced proxy dataset D S :=x s , the proxy dataset can come from a third party or from a generator that is independent of the client data distribution. Based on the global proxy dataset, the integrated knowledge of the client model is transferred to the server model, alleviating the drift of the server model aggregated from the client model due to data heterogeneity. At the same time, for better knowledge transfer, three levels of aggregation are performed, including weight aggregation, soft prediction aggregation, and feature aggregation. First, weight aggregation is performed, that is, the traditional federated learning aggregation method, to obtain the global model Ω, and then the proxy dataset D is used S Combine soft prediction distillation and feature distillation to fine-tune Ω. The formula for soft prediction knowledge transfer is as follows:
[0064]
[0065] The first term in KL is the aggregated soft prediction output of the uploaded client model, i.e., soft prediction aggregation, and the second is the global model output with the current network parameters Ω before fine-tuning. The knowledge of feature extraction by the K clients is then transferred to the server, i.e., representation knowledge transfer, which is accomplished by minimizing the mean square error (MSE) distance between the data representation output of the server model and the data representation output of the client model. The formula for representation knowledge transfer is as follows:
[0066]
[0067] Where the first term in MSE represents the penultimate feature extracted by the global model Ω, while the second term is the aggregation of the penultimate features obtained from the uploaded client model. By combining these two types of knowledge transfer, the server ensemble distillation loss is:
[0068]
[0069] where η and ν are used to adjust the ratio of soft prediction knowledge and representation knowledge.
[0070] Experiments show that the model trained by the scheme of this embodiment has improved accuracy compared with traditional and latest schemes in heterogeneous and long-tail federated learning environments, and has leading advantages in communication efficiency and attack robustness. The evaluation data sets used in this embodiment are: SVHN and CIFAR-10 with 10 categories, and CIFAR-100 with 100 categories.
[0071] This example tests the accuracy of the server global model and the accuracy of the client model when the number of clients is 10, 20, and 50. The method proposed in this example can achieve the highest accuracy in most cases, especially for the global model on the server side. At the same time, it is not affected by the number of clients and can also obtain the best performance under more clients close to the actual situation. Compared with the traditional FedAvg, this example obtains a gain of 11-24% in server accuracy, and compared with the latest proposed method, this example obtains a gain of 2-19% in server accuracy.
[0072] In terms of heterogeneity, this embodiment uses Dirichlet distribution to change the heterogeneity of client data, and achieves different client heterogeneity by setting heterogeneity factors. The smaller the heterogeneity factor, the more heterogeneous the data. After experiments, the method of this embodiment achieves the best performance compared with traditional solutions and the latest solutions, and obtains a gain of 3-20% under the condition of setting quite heterogeneous conditions.
[0073] In terms of communication efficiency, by comparing the number of communication rounds required to reach the specified test accuracy of this embodiment with other methods, the fewer the communication rounds, the higher the communication efficiency. After experiments, the method of this embodiment requires the least communication rounds for all specified test accuracies, indicating that this embodiment has a leading advantage in communication efficiency.
[0074] For attack robustness, this embodiment uses two attack methods to evaluate the robustness of malicious clients attempting to poison federated learning. One is a random noise (RN) attack, which generates perturbations based on a Gaussian distribution and introduces random noise during training to mislead the training process and degrade model performance. The other is a label flipping (LF) attack, which performs a targeted attack on the global model by modifying the client dataset. The attack involves changing the category of each instance in the dataset to an incorrect classification. By comparing the method of this embodiment with traditional federated learning methods and the latest methods, as the number of malicious clients (attackers) increases, the global accuracy of all methods decreases to varying degrees, but the method of this embodiment has the smallest decrease, indicating that this method significantly improves the robustness of the model under two types of data poisoning attacks.
[0075] An efficient heterogeneous federated learning system based on hybrid distillation, including:
[0076] The initialization module is used to enable the server to initialize global model parameters and set the total number of training rounds and the number of clients participating in each round of training;
[0077] The client distillation module is used to load the corresponding local data set in each client, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server;
[0078] The server distillation module is used for the server to perform server distillation on the local model parameters after receiving them in combination with a preset auxiliary data set to obtain updated global model parameters, and send the updated global model back to the client; repeat the client distillation and server distillation until the model converges.
[0079] An electronic device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform an efficient heterogeneous federated learning method based on mixed distillation.
[0080] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the efficient heterogeneous federated learning method based on mixed distillation.
[0081] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An efficient heterogeneous federated learning method based on hybrid distillation, characterized in that: include: Step 1: Initialize the global model parameters on the server and set the total number of training rounds and the number of clients participating in each round of training; Step 2: In each client, load the corresponding local data set, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server; Step 3: After receiving the local model parameters, the server performs server distillation in combination with the preset auxiliary data set to obtain updated global model parameters, and sends the updated global model back to the client; Repeat steps 2 and 3 until the model converges.
2. According to claim 1, an efficient heterogeneous federated learning method based on mixed distillation is characterized in that: Performing a random transformation on the local data set includes: Scaling and rotating the local data set are performed to obtain the client distilled data.
3. According to claim 1, an efficient heterogeneous federated learning method based on hybrid distillation is characterized in that: Each of the sub-networks has a different network fraction width.
4. The efficient heterogeneous federated learning method based on hybrid distillation according to claim 1, characterized in that: Each sub-network is trained on the client distilled data, including: Calculate the KL divergence between the softmax output of the sub-network and the original softmax output of the corresponding client local model as the distillation loss, and dynamically assign weights according to the prediction confidence of the sub-network; Based on the distillation loss and the traditional cross entropy loss, an optimization algorithm is used to update the local model parameters.
5. The efficient heterogeneous federated learning method based on hybrid distillation according to claim 1, characterized in that: The step three specifically includes: The server receives the updated local model parameters of all clients, performs weight aggregation, and obtains the global model; The global model is distilled based on the preset auxiliary data set in combination with joint soft prediction distillation and feature distillation to obtain updated global model parameters, and the updated global model is sent back to the client.
6. An efficient heterogeneous federated learning system based on hybrid distillation, characterized in that: include: The initialization module is used to enable the server to initialize global model parameters and set the total number of training rounds and the number of clients participating in each round of training; The client distillation module is used to load the corresponding local data set in each client, perform random transformation on the local data set, and generate client distilled data; sample several sub-networks from the original network of each client, train each sub-network on the client distilled data, obtain updated local model parameters after training, and upload the local model parameters to the server; The server distillation module is used for the server to perform server distillation on the local model parameters after receiving them in combination with a preset auxiliary data set to obtain updated global model parameters, and send the updated global model back to the client; repeat the client distillation and server distillation until the model converges.
7. An electronic device, characterized in that: It includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform an efficient heterogeneous federated learning method based on mixed distillation according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements an efficient heterogeneous federated learning method based on mixed distillation as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Federal learning personalization method based on data set distillation
CN115511108A
Block chain enhanced cyclic distillation guide channel decoupling framework for personalized federated learning
CN116701928A
Image classification method based on federal knowledge distillation and ensemble learning
CN117523291A
Medical image classification method for knowledge distillation federal learning under neural architecture search
CN118279639A
Method, system and apparatus for federated learning
WO2022169136A1
Cited By
Personalized federal learning implementation method based on client self-knowledge distillation
CN119578512A
Federal width learning method and system for data isomerism
CN120509460A
A federated width learning method and system for data heterogeneity
CN120509460B
Federal learning model robustness enhancement method, device and system
CN120745754A
Federated learning model robustness enhancement method, device, and system
CN120745754B
