Auxiliary few-sample federated learning method and system based on generative model, and medium
By building basic classifiers in federated learning, generating pseudo-labels and synthetic data, using generative models to bridge the data distribution differences, the problems of data distribution mismatch and label scarcity in federated learning are solved, and high-performance learning in complex environments is achieved , reduce resource consumption.
Patent Information
- Application Number
- CN202411293542.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-27
AI Technical Summary
Federated learning faces the problems of non-independent homogeneous distribution of client data distribution and scarcity of tags. The existing methods have failed to effectively solve the mismatch between the distribution of labeled data on the distributed client and the global labeled data distribution, and the resource consumption of pre-trained generation model Large and unused client unlabeled data.
The basic classifier is built on the client through an edge server, using unlabeled data to generate pseudo-labels, combining the labeled data for generation model training, generating synthetic data, bridging the differences in local and global data distribution, and conducting final classifier training, using residuals Network and conditional diffusion models to reduce resource costs.
Effectively utilize client data resources, improve the performance of federated learning in complex data environments, overcome the negative impact of low samples and imbalance in data distribution, and reduce resource costs.
Smart Images

Figure CN119204170A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a generative model-based auxiliary few-sample federated learning method, system and medium. Background Art
[0002] Federated learning, as a method for learning from distributed heterogeneous data, has attracted widespread attention. However, federated learning faces multiple challenges, of which two are the main ones: (1) the client data distribution is non-independent and identically distributed (Non-iid); (2) the client data labels are scarce due to the high cost of obtaining accurately labeled data. These factors may lead to the degradation of federated learning performance and difficulties in training convergence. Existing research has addressed these challenges through various methods, such as alleviating client drift, optimizing server-side model aggregation, using auxiliary public datasets for data augmentation, and conducting federated semi-supervised learning. Although these methods have achieved certain results, they have not fundamentally solved the problem of degraded federated learning performance, that is, there is a mismatch between the distribution of labeled data on distributed clients and the global distribution of labeled data.
[0003] Generative models represented by diffusion models have demonstrated the ability to generate high-quality, controllable data samples, providing new possibilities for alleviating the difference between client data distribution and global data distribution. Most existing studies use pre-trained generative models to generate data samples to combat the impact of non-iid data distribution. However, this approach has two major limitations: first, training pre-trained generative models for specific scenarios requires a lot of resources; second, this approach fails to fully utilize the unlabeled data on the client.
[0004] Prior art document CN116229172A discloses a training method, classification method and device for a federated few-sample image classification model based on contrastive learning, which includes: constructing a training set and a query set, adding a true label to the training set; obtaining an initial model, which includes an embedding network and a relational network; inputting the training set samples and the query set samples into the embedding network in pairs, extracting and splicing the training set sample feature graph and the query set sample feature graph, and generating a spliced feature graph; inputting the spliced feature graph into the relational network to calculate a similarity score to obtain the category of the training set samples; training the initial model using a local data set, and constructing a mean square error loss to obtain an initial image classification model; constructing a shared model based on the model parameters of each client, and updating the initial image classification model using an exponential moving average according to the shared model parameters to obtain a final image classification model. This prior art document uses contrastive learning, and has deficiencies in processing non-independent and identically distributed (Non-iid) data.
[0005] Therefore, how to more effectively utilize the data resources on decentralized clients while overcoming the impact of data non-iid and label scarcity remains a challenging problem. There is an urgent need to study an auxiliary few-sample federated learning system and method based on a generative model. Summary of the invention
[0006] In view of the defects in the prior art, the present invention aims to provide an assisted few-sample federated learning method, system and medium based on a generative model to improve the performance of federated learning in complex data environments.
[0007] According to the present invention, an auxiliary few-sample federated learning method based on a generative model includes the following steps:
[0008] Step S1, the edge server uses the annotated data distributed on each client to perform federated training and build a basic classifier;
[0009] Step S2, each client uses the basic classifier to predict the unlabeled data to obtain the category probability distribution of each unlabeled data, and assigns pseudo labels to the unlabeled data according to the predicted probability distribution to obtain data with pseudo labels;
[0010] Step S3, merging the labeled data and the data with pseudo labels, performing federated training of the generative model, and obtaining a trained generative model;
[0011] Step S4: The client uploads the local annotated data distribution information to the edge server. The edge server integrates the distribution information of all clients, obtains the global annotated data distribution, and feeds it back to each client.
[0012] Step S5, each client generates synthetic data for each category using the trained generation model according to the global annotated data distribution;
[0013] Step S6: merge the labeled data and the synthetic data and jointly train the final classifier.
[0014] Preferably, in step S1, each client trains the basic classifier locally. In each round, the client uploads the basic classifier parameters to the edge server. The edge server uses a specific parameter aggregation algorithm to obtain the global model parameters. The edge server then sends the global model parameters to each client. After receiving the global model parameters, the client continues local training and repeats the above process until convergence.
[0015] Preferably, in step S1, the basic classifier adopts a residual network.
[0016] Preferably, the edge server uses a federated averaging algorithm to obtain global model parameters.
[0017] Preferably, in step S3, the generation model adopts a conditional diffusion model.
[0018] The present invention also provides an auxiliary few-sample federated learning system based on a generative model, including: constructing a basic classifier module, the edge server uses the annotated data distributed on each client to perform federated training and construct a basic classifier;
[0019] Pseudo-label generation module: each client uses the basic classifier to assign pseudo-labels to unlabeled data to obtain data with pseudo-labels;
[0020] The generative model training module combines the labeled data and the data with pseudo labels to perform federated training of the generative model and obtain a trained generative model.
[0021] In the distribution information exchange module, the client uploads the local labeled data distribution information to the edge server. The edge server integrates the distribution information of all clients, obtains the global labeled data distribution, and feeds it back to each client.
[0022] Synthetic data generation module: each client generates synthetic data for each category using the trained generation model based on the global annotated data distribution;
[0023] The final classifier training module combines the labeled data and the synthetic data to jointly train the final classifier.
[0024] Preferably, the system includes an edge server and multiple clients, each client is provided with a classifier model and a generation model, and each client contains labeled data and unlabeled data.
[0025] Preferably, the classifier model adopts a residual network.
[0026] Preferably, the generation model adopts a conditional diffusion model, and the conditional diffusion model controls the generated data category according to the set label.
[0027] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-mentioned auxiliary few-sample federated learning method based on a generative model.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The present invention is based on machine learning, fully utilizes the data resources on decentralized clients, and uses generative models to bridge the gap between local data distribution and global distribution. Even in complex data distribution scenarios, the method still has good performance, overcoming the negative effects of few samples and unbalanced data distribution, while reducing the resource costs caused by data labeling and pre-training models in existing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0031] Figure 1 Flow chart of a method for auxiliary few-sample federated learning based on a generative model in an embodiment of the present invention;
[0032] Figure 2 It is an auxiliary few-sample federated learning system framework based on a generative model in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0034] The embodiments of the present invention provide a system and method for auxiliary federated learning based on a generative model, but are not limited to a specific federated aggregation algorithm or generative model instance. In fact, any generative model-assisted few-shot federated learning framework that adopts the core idea of this study can be regarded as a specific implementation of this method.
[0035] Below, we will describe the implementation of this method in detail from the aspects of experimental setup, data preprocessing, model architecture, training process, and evaluation metrics. Through these examples, we aim to demonstrate the applicability and effectiveness of this method in different scenarios, while providing a reproducible benchmark for future research.
[0036] Embodiment 1:
[0037] Figure 1 This is a flow chart of an auxiliary few-sample federated learning method based on a generative model in an embodiment of the present invention.
[0038] like Figure 1 As shown, this embodiment provides an auxiliary few-sample federated learning method based on a generative model, comprising the following steps:
[0039] Step S1: construct a basic classifier. Specifically, the edge server uses limited labeled data distributed on each client to perform federated training and construct a basic classifier.
[0040] To be more specific, each client trains the basic classifier locally. In each round, the client uploads the basic classifier parameters to the edge server. The edge server uses a specific parameter aggregation algorithm to obtain the global model parameters. The edge server then sends the global model parameters to each client. After receiving the global model parameters, the client continues local training and repeats the above process until convergence. There is no restriction on the parameter aggregation method used here.
[0041] In this embodiment, the basic classifier adopts a residual network, and the edge server adopts a federated average algorithm to obtain global model parameters.
[0042] Step S2, pseudo label generation. Specifically, each client uses a basic classifier to predict the unlabeled data, obtains the category probability distribution of each unlabeled data, assigns pseudo labels to the unlabeled data according to the predicted probability distribution, and assigns the category with the highest probability as the pseudo label to obtain data with pseudo labels.
[0043] In this embodiment, a probability threshold of 0.9 is set. When the highest probability of a sample exceeds the set probability threshold of 0.9, a pseudo label is assigned to the sample to improve the reliability of the pseudo label.
[0044] Since the basic classifier is not completely accurate, the pseudo-labeled data obtained may not be consistent with the true label. The purpose of this step is to generate enough data for training the diffusion model.
[0045] Step S3, training the generative model. Specifically, the labeled data and the data with pseudo labels are merged to perform federated training of the generative model to obtain a trained generative model.
[0046] In this embodiment, the generation model adopts the conditional diffusion model. The method of federated training is the same as that in step S1.
[0047] Step S4: Distribution information exchange: Specifically, the client uploads the local annotated data distribution information to the edge server, and the edge server integrates the distribution information of all clients to obtain the global annotated data distribution and feeds it back to each client.
[0048] Step S5, synthetic data generation. Specifically, each client generates a corresponding amount of synthetic data for each category using a trained generation model based on the global annotated data distribution to bridge the gap between local data distribution and global distribution.
[0049] Step S6: final classifier training. Specifically, the limited labeled data and the synthetic data are combined to jointly train the final classifier.
[0050] Embodiment 2:
[0051] Figure 2 It is an auxiliary few-sample federated learning system framework based on a generative model in an embodiment of the present invention.
[0052] like Figure 2 As shown in the figure, an edge server and multiple clients are included. Each client is equipped with a classifier model and a generation model locally, and each client contains a small amount of labeled data and a large amount of unlabeled data.
[0053] The system goal of this embodiment is to allow multiple clients to jointly train a classifier model through federated training, and use the classification accuracy of the classifier model as a measurement indicator of system performance.
[0054] In this embodiment, two aspects of data distribution are considered to be non-iid: first, the distribution of labeled data between clients is unbalanced; second, the distribution of labeled data and unlabeled data within the same client is unbalanced. The above settings can simulate extremely complex data imbalance scenarios. Among them, the classifier model uses a residual network. The generation model uses a conditional diffusion model, which controls the generated data category according to the set label.
[0055] Specifically, this embodiment provides an auxiliary few-sample federated learning system based on a generative model, including:
[0056] Build a basic classifier module. The edge server uses the labeled data distributed on each client to perform federated training and build a basic classifier.
[0057] Pseudo-label generation module: each client uses the basic classifier to assign pseudo-labels to unlabeled data to obtain data with pseudo-labels;
[0058] The generative model training module combines the labeled data and the data with pseudo labels to perform federated training of the generative model and obtain a trained generative model.
[0059] In the distribution information exchange module, the client uploads the local labeled data distribution information to the edge server. The edge server integrates the distribution information of all clients, obtains the global labeled data distribution, and feeds it back to each client.
[0060] Synthetic data generation module: each client generates synthetic data for each category using the trained generation model based on the global annotated data distribution;
[0061] The final classifier training module combines the labeled data and the synthetic data to jointly train the final classifier.
[0062] Embodiment 3:
[0063] This embodiment provides 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 above-mentioned auxiliary few-sample federated learning method based on a generative model are implemented.
[0064] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.
[0065] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. An auxiliary few-shot federated learning method based on a generative model, characterized in that: The steps include: Step S1, the edge server uses the annotated data distributed on each client to perform federated training and build a basic classifier; Step S2, each client uses the basic classifier to predict the unlabeled data to obtain the category probability distribution of each unlabeled data, and assigns pseudo labels to the unlabeled data according to the predicted probability distribution to obtain data with pseudo labels; Step S3, merging the labeled data and the data with pseudo labels, performing federated training of the generative model, and obtaining a trained generative model; Step S4: The client uploads the local annotated data distribution information to the edge server. The edge server integrates the distribution information of all clients, obtains the global annotated data distribution, and feeds it back to each client. Step S5, each client generates synthetic data for each category using the trained generation model according to the global annotated data distribution; Step S6, merging the labeled data and the synthetic data, and federally training a final classifier.
2. The generative model-based auxiliary few-sample federated learning method according to claim 1, characterized in that: In step S1, each client trains the basic classifier locally. In each round, the client uploads the basic classifier parameters to the edge server. The edge server uses a specific parameter aggregation algorithm to obtain the global model parameters. Then the edge server sends the global model parameters to each client. After receiving the global model parameters, the client continues local training and repeats the above process until convergence.
3. The generative model-based auxiliary few-sample federated learning method according to claim 1, characterized in that: In the step S1, the basic classifier adopts a residual network.
4. The generative model-based auxiliary few-sample federated learning method according to claim 2, characterized in that: The edge server uses a federated averaging algorithm to obtain global model parameters.
5. The generative model-based auxiliary few-sample federated learning method according to claim 1, characterized in that: In step S3, the generation model adopts a conditional diffusion model.
6. An auxiliary few-shot federated learning system based on a generative model, characterized in that: include: Build a basic classifier module. The edge server uses the labeled data distributed on each client to perform federated training and build a basic classifier. A pseudo-label generation module, in which each client uses the basic classifier to assign pseudo-labels to unlabeled data to obtain data with pseudo-labels; A generative model training module is used to combine the labeled data and the pseudo-labeled data to perform federated training of the generative model to obtain a trained generative model; In the distribution information exchange module, the client uploads the local labeled data distribution information to the edge server. The edge server integrates the distribution information of all clients, obtains the global labeled data distribution, and feeds it back to each client. A synthetic data generation module, in which each client generates synthetic data for each category using the trained generation model according to the global annotated data distribution; The final classifier training module combines the labeled data and the synthetic data to federally train the final classifier.
7. The generative model-based auxiliary few-sample federated learning system according to claim 6, characterized in that: The system includes an edge server and multiple clients, each client is provided with a classifier model and a generation model, and each client contains labeled data and unlabeled data.
8. The generative model-based auxiliary few-sample federated learning system according to claim 7, characterized in that: The classifier model adopts a residual network.
9. The generative model-based auxiliary few-sample federated learning system according to claim 7, characterized in that: The generation model adopts a conditional diffusion model, and the conditional diffusion model controls the generated data category according to the set label.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of an auxiliary few-sample federated learning method based on a generative model as described in any one of claims 1 to 5 are implemented.
