A model joint optimization method based on federated learning
By using the Federated Semi-Supervised Mutual Learning (FedSML) algorithm, local models are trained on edge devices using a server-trained assistive model for knowledge distillation. This solves the problem of utilizing unlabeled data on edge devices and achieves efficient model training and accuracy improvement.
Patent Information
- Application Number
- CN202410739117.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing technologies struggle to effectively utilize unlabeled data on edge devices for distributed semi-supervised learning, especially in edge computing environments with limited computing resources and heterogeneous data. Existing methods cannot fully leverage unlabeled data to improve model performance.
The Federated Semi-Supervised Mutual Learning (FedSML) algorithm is adopted. A large number of parameters are trained on the server, and the edge devices use this model to train local models through knowledge distillation and perform semi-supervised training on unlabeled data. The server performs mutual learning on labeled data to improve the generalization ability of the global model and the mutual learning model.
Edge devices can directly train local models using unlabeled datasets, which reduces the cost of labeled data, improves training accuracy, reduces the computational overhead of edge devices, and enhances the generalization ability of global and co-models.
Smart Images

Figure CN118586522B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, specifically a model joint optimization method based on federated learning. Background Technology
[0002] Research on distributed machine learning in edge computing is increasing, enabling edge devices to collaboratively learn deep models without exchanging private data. Existing distributed learning methods assume that the private data possessed by edge devices is labeled. However, in real-world scenarios, a large amount of usable private data is unlabeled, making it difficult for existing methods to utilize this type of data. To overcome this limitation, this paper proposes a federated semi-supervised learning algorithm, FedSML, which aims to solve the federated semi-supervised learning problem in a challenging environment: all labeled data resides on the server, the client only has unlabeled data, and the client's computing power is limited. FedSML fully utilizes the server's computing resources to train a large-parameter assistant model on the labeled dataset. The client uses this assistant model to train a local model through unsupervised knowledge distillation and consistency regularization. After the server aggregates the received local models to obtain the global model, it trains both the assistant model and the global model on the labeled dataset through mutual learning. This allows the assistant model to learn knowledge from the unlabeled dataset, while the global model learns the inter-class relationships from the labeled dataset, thereby improving the generalization ability of both models.
[0003] Today, machine learning applications are deployed on numerous edge devices, such as smartphones or IoT devices, to provide users with artificial intelligence services. Because vast amounts of data are generated at the edge, machine learning applications can leverage this private data to collaboratively learn models. However, labeling data is a time-consuming and specialized task, so data generated on edge devices typically has only a small amount of labeling. Therefore, researching how to utilize datasets on edge devices to enhance distributed model learning in edge computing is quite important.
[0004] In centralized computing environments, models can be trained using semi-supervised learning algorithms to improve performance with large-scale unlabeled data. Recently, researchers proposed consistency regularization (Zhang B, Wang Y, Hou W, et al. FlexMatch: Boosting Semi-Supervised Learning with Curriculum PseudoLabeling[C]. In: Advances in Neural Information Processing Systems, Curran Associates, Inc., 2021. 34: 18408–18419.) to utilize unlabeled data for semi-supervised learning. This class of algorithms optimizes the model by training the consistency of its outputs on different perturbation versions of the same unlabeled sample. Self-training (Lee DH et al. Pseudo-Label: The Simple and Efficient Semi-Supervised Learning Method for Deep Neural Networks[J]. Workshop on challenges in representation learning, ICML, 3(2): 896, 2013) is another commonly used semi-supervised learning algorithm that uses the model's own output on unlabeled data (also known as pseudo-labels) to optimize the model. These methods have achieved great success in centralized computing environments, but in distributed computing environments, the accuracy of models trained by these methods drops sharply due to the small number of samples on each node. Due to privacy and other issues, data on the device cannot be transferred to the server for training, so it is necessary to explore how to achieve distributed semi-supervised learning without transferring datasets across the network.
[0005] To maintain privacy and reduce transmission overhead, researchers have proposed several distributed machine learning methods, such as Federated Learning, Distributed SGD, and Gossip Learning. These methods use on-device data to train a local model for each device, then transmit the model over the network and aggregate it with other models. Private data is stored on each device without being transmitted over the network, and the model is optimized using global data information. However, these methods assume that the data generated on edge devices is labeled, which is impractical in edge computing. To leverage unlabeled data to train models on edge devices, researchers have proposed various distributed semi-supervised training methods, considering the scenario where shared unlabeled datasets exist among edge devices. These methods reduce communication overhead by transmitting only soft labels and use knowledge distillation to transfer knowledge between models. However, devices cannot apply these methods to learn models on private unlabeled datasets. To utilize this private data, researchers have proposed Federated Semi-Supervised Learning (FSSL), which uses this unlabeled data on each device to train a local model through self-training or consistency regularization, and then aggregates it to obtain a global model. Some existing technologies combine federated learning and semi-supervised learning algorithms, where each node trains its model using a semi-supervised learning algorithm and then uses federated learning for model exchange and aggregation. However, this method uses only the same global model to predict pseudo-labels for unlabeled samples, which reduces the accuracy of pseudo-labels generated in heterogeneous data environments. To address this issue, some existing technologies propose using an aggregation server to select these assistive models for each client, which generate pseudo-labels for unlabeled data. However, since the aggregation server lacks information about the dataset distribution on each node, it is difficult to select a suitable assistive model for each client to generate high-accuracy pseudo-labels.
[0006] Self-training is a simple and effective semi-supervised learning algorithm that trains the model using pseudo-labels on unlabeled data generated by the model itself. Clearly, the accuracy of the pseudo-labels has a significant impact on the convergence of semi-supervised training and the performance of the model. Therefore, self-training is often integrated with other semi-supervised learning algorithms, such as consistency regularization and entropy minimization, to reduce the generation of erroneous pseudo-labels. Consistency regularization assumes that small perturbations to the data do not affect the class semantics of the data. Generally, consistency regularization algorithms in image recognition (Laine S. and Aila T. Temporal Ensembling for Semi-Supervised Learning[A]. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017.) train the model by reducing the difference in model output between different data-augmented versions of the same image. ReMixMatch (Berthelot D., Carlini N., Cubuk ED, et al. ReMixMatch: Semi-Supervised Learning with DistributionMatching and Augmentation Anchoring[A]. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020.) applies weak data augmentation to unlabeled samples to generate pseudo-labels, while applying strong data augmentation to force the model to output consistent values for both versions of the samples. FixMatch simplifies previously complex semi-supervised learning algorithms by filtering pseudo-labels using a fixed high threshold. To improve upon FixMatch, Dash utilizes more unlabeled data by using a threshold that increases during training, while FlexMatch uses a curriculum pseudo-labeling algorithm to set a dynamic threshold for each class. Entropy minimization is another popular component of semi-supervised learning, working by forcing the model to reduce the information entropy of its output on unlabeled data. However, these methods all require large amounts of unlabeled data to achieve optimal accuracy, which is impractical for devices in edge scenarios. Furthermore, these methods do not take into account the heterogeneity of data on the device, thus failing to achieve the original performance of these methods. Summary of the Invention
[0007] To address this issue, this invention proposes a Federated Semi-Supervised Mutual Learning (FedSML) algorithm to improve model performance in this scenario using unlabeled samples. In FedSML, instead of matching a helper model to each client, the server leverages its computing power to train a large-parameter model on a labeled dataset as a helper model. The client uses this helper model to transfer knowledge from a smaller-parameter local model through knowledge distillation. Simultaneously, the local model undergoes semi-supervised training on unlabeled samples, acquiring knowledge from the unlabeled dataset. After local training, the local model is uploaded back to the server for model aggregation to obtain the global model. The server trains the global model on the labeled dataset, enabling it to learn knowledge from labeled samples and, through knowledge distillation, transfers the knowledge from the client's unlabeled dataset held by the global model to the helper model.
[0008] The present invention is achieved by at least one of the following technical solutions.
[0009] A federated learning-based method for joint optimization of models includes the following steps:
[0010] Step 1: Each edge device uses an acquisition device to acquire images, forming an unlabeled dataset; the server uses an acquisition device to acquire images, classifies the images, and forms a labeled dataset.
[0011] Step 2: The server randomly selects an edge device and sends the global model and the assisting model to the edge device;
[0012] Step 3: The edge device uses the global model as a local model and trains the local model using unlabeled samples;
[0013] Step 4: The edge device uploads the updated local model to the server;
[0014] Step 5: The server aggregates all received local models to obtain a new global model;
[0015] Step 6: The server uses the labeled dataset to perform mutual learning between the global model and the helper models;
[0016] Step 7: The server transmits the global model to the edge device, and the edge device uses the distributed global model for classification.
[0017] Furthermore, each edge device c uses a camera to capture images, forming an unlabeled dataset. in It is the i-th unlabeled sample on edge device c. The set of all possible input images. This represents the total number of unlabeled samples on edge device c.
[0018] Furthermore, server S captures images via a camera, and then manually categorizes the images into C classes, forming a labeled dataset. in It is the i-th image in the dataset. Given the set of all possible input images, y i ∈{1, ..., C} is the image x i The corresponding marker, N s This represents the total number of labeled samples on the server.
[0019] Furthermore, there are labeled datasets. The total number of samples is much smaller than that of the unlabeled dataset. Right now Where N is the total number of edge devices participating in the joint optimization, and the data on different edge devices are not independent and identically distributed.
[0020] Furthermore, the same C classification model structure is used for the server and all edge devices.
[0021] Furthermore, the model on the edge device is Where L c It is a local model on edge device c, and the parameters are N represents the total number of edge devices participating in the joint optimization.
[0022] The global model on the server is denoted as G. S Its parameters are denoted as The assist model is denoted as G. H Its parameters are denoted as
[0023] Furthermore, the server randomly selects a subset from the edge devices {1, ..., M} participating in federated learning. Where M is the total number of edge devices participating in the joint optimization, and the global model G... S and the assisting model G H Send to these edge devices; edge devices k∈K use G S Parameter initialization of local model L k Update the local model on the unlabeled dataset:
[0024]
[0025] in It is an unsupervised loss. For the local model L kThe parameters, The unlabeled dataset held by edge device k;
[0026] After the local model is updated, the edge device uploads the local model parameters to the server. The server then aggregates all received local models to obtain a new global model.
[0027]
[0028] in The number of unlabeled samples held by edge device k. For the global model G S The parameters.
[0029] Furthermore, the server trains a global model G using a labeled dataset. S and the assisting model G H :
[0030]
[0031] in, These are the parameters of the global model. To assist in the model's parameters, For the labeled dataset on the server, With supervised loss, after obtaining the new global model parameters and the assisting model, repeat steps two through six until the global model converges.
[0032] Furthermore, the global model G is trained on the server. S and the assisting model G H During the process, they learn from each other, and the global model G S and the assisting model G H The loss functions are as follows:
[0033]
[0034] in, These are the parameters of the global model. To assist in the model's parameters, For the labeled dataset on the server, For the global model G S In labeled datasets Enhanced cross-entropy loss on To assist model G H In labeled datasets Enhanced cross-entropy loss on For the global model G S For the collaborative model G H Knowledge distillation loss, To assist model G HFor the global model G S Knowledge distillation loss; mutual learning learns from each other through two models, learning the category information of the samples while also learning the similarity information between categories.
[0035] Furthermore, after the global model converges, the server will... S The global model G is distributed to each edge device, and the edge devices use the distributed global model G. S As a classification model, it is used for subsequent image classification on edge devices.
[0036] Compared with existing technologies, the beneficial effects of the present invention are as follows:
[0037] Edge devices directly train local models using unlabeled datasets, greatly reducing the cost of labeling unlabeled datasets; edge devices use co-models to generate pseudo-labels for unlabeled datasets, improving the classification accuracy of trained local models; edge devices only train local models and do not need to train co-models, reducing the computational overhead of edge devices; the server performs mutual learning between the global model and co-models on labeled datasets, improving the generalization ability of the global model and co-models. Attached Figure Description
[0038] Figure 1 A flowchart illustrating a federated learning-based model joint optimization method is provided as an example.
[0039] Figure 2 A flowchart illustrating the training of a local model for an edge device in this embodiment;
[0040] Figure 3 The flowchart for the server aggregating all local models received in this embodiment is shown. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0042] like Figures 1-3 The method for joint optimization of models based on federated learning, as shown, includes the following steps:
[0043] Step 1: Each edge device uses an acquisition device to acquire images, forming an unlabeled dataset; the server uses an acquisition device to acquire images, classifies the images, and forms a labeled dataset.
[0044] This embodiment considers a surveillance scenario with one server S and N edge devices. Server S captures images through cameras, and then manually categorizes the images into C classes (e.g., by the people appearing in the images), thus forming a labeled dataset. Where x i It is a labeled sample, y i ∈{1, ..., C} is a sample x i The corresponding unique hot tag, N S represents the total number of labeled samples on the server. Each edge device c uses a camera to capture images, forming an unlabeled dataset. in It is the i-th unlabeled sample on edge device k. Let be the total number of unlabeled samples on edge device k.
[0045] Generally speaking, the total number of samples in a labeled dataset is much smaller than that in an unlabeled dataset, i.e. Moreover, data on different edge devices are usually not independent and identically distributed.
[0046] As one example, in federated learning, the server and all edge devices use the same C-class classification model architecture (such as LeNet5). Let the models on the edge devices be denoted as... Where L k It is a local model on edge device k, and the parameters are The global model on the server is denoted as G. S Its parameters are denoted as In addition, the server uses a parameter count relative to the global model G. S Larger model G H As an assistive model, its parameters are denoted as
[0047] Step 2: The server randomly selects an edge device and sends the global model and the assisting model to the edge device;
[0048] The server randomly selects a subset from the edge devices {1, ..., M} participating in federated learning. Where M is the total number of edge devices participating in the joint optimization, and the global model G... S and the assisting model G H Send to these edge devices.
[0049] Step 3: The edge device uses the global model as a local model and trains the local model using unlabeled samples, such as... Figure 2 As shown;
[0050] For all edge devices k∈K, use G S Parameter initialization of local model Lk ,Right now
[0051]
[0052] in For the local model L k The parameters, For the global model G S The parameters.
[0053] Update local model parameters on an unlabeled dataset:
[0054]
[0055] in It is an unsupervised loss. This is the unlabeled dataset held by edge device k.
[0056] To calculate the local model L k In unlabeled datasets Unsupervised loss
[0057] Step 1: For the unlabeled dataset Each unlabeled sample in A weak data augmentation is denoted as α(·), and a strong data augmentation is denoted as α(·). The corresponding enhanced sample α(u) and
[0058] As an example, weak data augmentation includes random flipping and random translation, while strong data augmentation includes RandAugment and CTAugment.
[0059] Step 2: Using the local model L k Predict α(u) and The probability of belonging to each category is denoted as p(α(u)); L k )∈(0,1) C and The client uses p(α(u); L k Generate pseudo-labels for sample u, i.e.
[0060]
[0061] Where p i (α(u;L) k ) for model L k Predict the probability that α(u) belongs to the i-th class. The third step is to use the received assist model G. H Predict the probability p(α(u)) that α(u) belongs to each category; G H)∈(0,1) C Therefore, unsupervised loss is defined as follows:
[0062]
[0063] The loss consists of two parts, the first item For the local model L k In unlabeled datasets The consistency regularization loss on the surface is:
[0064]
[0065] in,
[0066]
[0067] For indicator functions, For unlabeled datasets The sample size, τ is a preset threshold. for For pseudo-tags The cross-entropy. The second term is the local model L. k On a weakly augmented, unlabeled dataset, the cooperative model G was tested. H The knowledge distillation loss, namely:
[0068]
[0069] Where p i (α(u;G) H ) is model G H Predict the probability that α(u) belongs to the i-th class.
[0070] Calculate the local model L k In unlabeled datasets Unsupervised loss Then, the edge device uses this loss to adjust the local model parameters. Perform gradient descent in round E:
[0071]
[0072] Where η is the learning rate.
[0073] Step 4: The edge device uploads the updated local model to the server;
[0074] For edge devices k∈K, in step 3, they are in the unlabeled dataset Its local model L was trained on it. k Next, the local model L k Uploaded back to server S.
[0075] Step 5: The server aggregates all received local models to obtain a new global model;
[0076] Server S receives all uploaded local models {L} k} k∈K Aggregate the parameters of these local models For the new global model parameters
[0077]
[0078] in The number of unlabeled samples held by edge device k.
[0079] Step 6: The server uses the labeled dataset to perform mutual learning between the global model and the helper models;
[0080] Server S has a labeled dataset Training the global model G S and the assisting model G H ,Right now:
[0081]
[0082] in Losses due to lack of oversight.
[0083] To calculate the global model G S and the assisting model G H In the dataset The above has supervised losses The first step is for server S to process the labeled dataset. Each sample in Perform a weak data augmentation (such as random flipping, random shifting, etc., denoted as α(·)) to obtain the corresponding augmented sample (α(x), y). The second step is to apply the global model G to each sample. S and the assisting model G H Predict the probability that α(x) belongs to each category, denoted as p(α(x)); G S )∈(0,1) C and p(α(x); G H )∈(0,1) C Therefore, the global model G S and the assisting model G H The supervised losses are defined as follows:
[0084]
[0085] The loss consists of two parts, the first item and The global model G is respectivelyS and the assisting model G H In labeled datasets The enhanced cross-entropy loss on the above, i.e.:
[0086]
[0087]
[0088] Where N S For labeled datasets The total number of samples included, (x, y) belongs to the dataset The tuple consisting of sample x and its corresponding unique label y, l CE (y, p(α(x);G) S )) and l CE (y, p(α(x);G) H )) respectively represent p(α(x); G S ) and p(α(x); G H The cross-entropy with respect to label y. The second term. For the global model G S For the collaborative model G H Knowledge distillation loss, To assist model G H For the global model G S The knowledge distillation loss, namely:
[0089]
[0090] Where p i (α(x); G) H ) is model G H Predict the probability that α(x) belongs to class f, p i (α(x); G) S ) is model G S Predict the probability that α(x) belongs to the i-th class.
[0091] Calculate the global model G S and the assisting model G H In labeled datasets The above has supervised losses Then, the server uses this loss to apply it to the global model parameters. and assist model parameters Perform gradient descent in round E:
[0092]
[0093] Where η is the learning rate. After obtaining the new global model parameters and co-model parameters, repeat steps two through six until the global model converges.
[0094] Step 7: The server transmits the global model to the edge device, and the edge device uses the distributed global model for classification.
[0095] After the global model converges, the server will convert the global model G... S The global model G is distributed to each edge device, and the edge devices use the distributed global model G. S As a classification model, it is used for subsequent image classification on edge devices. This reduces the classification cost of the training dataset while simultaneously improving the performance of the global model G. S The training enabled G S Images in the above C categories can be classified on various edge devices.
[0096] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, enabling those skilled in the art to better understand and utilize the invention.
Claims
1. A joint optimization method for models based on federated learning, characterized in that, Includes the following steps: Step 1: Each edge device uses an acquisition device to acquire images, forming an unlabeled dataset; the server uses an acquisition device to acquire images, classifies the images, and forms a labeled dataset. Step 2: The server randomly selects an edge device and sends the global model and the assisting model to the edge device; Step 3: The edge device uses the global model as a local model and trains the local model using unlabeled samples; Step 4: The edge device uploads the updated local model to the server; Step 5: The server aggregates all received local models to obtain a new global model; Step 6: The server uses the labeled dataset to perform mutual learning between the global model and the helper models; The server uses a labeled dataset to train a global model. and assisted model : in, These are the parameters of the global model. To assist in the model's parameters, For the labeled dataset on the server, With supervised loss, after obtaining new global model parameters and assistant models, repeat steps two through six until the global model converges. Training a global model on the server and assisted model Mutual learning occurs during the process, and a global model is developed. and assisted model The loss functions are as follows: in, These are the parameters of the global model. To assist in the model's parameters, For the labeled dataset on the server, For global model In labeled datasets Enhanced cross-entropy loss on To assist the model In labeled datasets Enhanced cross-entropy loss on For global model For the collaborative model Knowledge distillation loss, To assist the model For the global model Knowledge distillation loss; mutual learning learns from each other through two models, learning the category information of samples while also learning the similarity information between categories; Step 7: The server transmits the global model to the edge device, and the edge device uses the distributed global model for classification.
2. The model joint optimization method based on federated learning according to claim 1, characterized in that, Each edge device Images are captured using a camera to create an unlabeled dataset. ,in It is an edge device The first One unlabeled sample, The set of all possible input images. For edge devices The total number of unlabeled samples.
3. The model joint optimization method based on federated learning according to claim 1, characterized in that, server Images are captured by a camera, and then manually categorized. Each category forms a labeled dataset. ,in It is the first in the dataset Image, The set of all possible input images. It is an image The corresponding marker, This represents the total number of labeled samples on the server.
4. The model joint optimization method based on federated learning according to claim 1, characterized in that, Labeled datasets The total number of samples is much smaller than that of the unlabeled dataset. ,Right now ,in The total number of edge devices participating in joint optimization, and the data on different edge devices are not independent and identically distributed.
5. The model joint optimization method based on federated learning according to claim 1, characterized in that, The server and all edge devices use the same Classification model structure.
6. The federated learning-based model joint optimization method according to claim 5, characterized in that, Models on edge devices ,in It is an edge device The local model on the top, the parameters are ; The total number of edge devices participating in joint optimization; The global model on the server is denoted as Its parameters are denoted as ; the assist model is denoted as Its parameters are denoted as .
7. The model joint optimization method based on federated learning according to claim 6, characterized in that, The server originates from the edge device participating in federated learning. A subset is randomly selected from the data. ,in To determine the total number of edge devices participating in joint optimization, the global model will be used. and assisted model Send to these edge devices; edge devices use Parameter initialization of local model Update the local model on the unlabeled dataset: in It is an unsupervised loss. For local models The parameters, For edge devices The unlabeled dataset held; After the local model is updated, the edge device uploads the local model parameters to the server. The server then aggregates all received local models to obtain a new global model. in For edge devices The number of unlabeled samples held For global model The parameters.
8. The model joint optimization method based on federated learning according to claim 1, characterized in that, After the global model converges, the server will... The global model is distributed to each edge device, and the edge devices use the distributed global model. As a classification model, it is used for subsequent image classification on edge devices.
