Collaborative model training method and device
By using the One-vs-All method and the Federated Averaging algorithm in federated learning, the multi-class classification task is decomposed into a binary classification task, which solves the problem of model training in non-IID data environments and improves the performance and convergence speed of federated learning. , achieving efficient privacy protection and accuracy in large-scale user scenarios.
Patent Information
- Application Number
- CN202110719669.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Non-IID data heterogeneity in federated learning leads to limited global model optimization and convergence speed. Existing model update aggregation algorithms rely on independent and identically distributed data samples, making it difficult to effectively train deep learning models in actual non-IID data environments. .
Propose a collaborative model training method that decomposes multi-class classification tasks into binary classification tasks through the One-vs-All method. Combined with the Federated Averaging algorithm, the Federated One-vs-All (FedOVA) algorithm is designed, using servers and Collaborative communication between clients broadcasts and aggregates classification model parameters to form a global multi-classification model.
It improves the performance, accuracy and convergence speed of the federated learning framework, reduces the negative impact of data on model convergence, provides complete privacy protection, is suitable for large-scale user scenarios, has smaller accuracy fluctuations, and does not require sharing any data or based on specific model.
Smart Images

Figure CN113537509B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a collaborative model training method and device. Background Art
[0002] Federated learning (FL) is a privacy-oriented framework that allows distributed edge devices to jointly train a shared global model without transmitting their sensitive data to a centralized server. The goal of federated learning is to balance the conflict between obtaining large amounts of data and protecting sensitive information. However, the data stored locally on each edge device is usually not independent and identically distributed (non-IID). This data heterogeneity poses serious challenges to the optimization and convergence of the global model.
[0003] At present, in order to solve the communication-related challenges in the federated learning framework, an efficient model update aggregation algorithm, namely Federated Averaging (FedAvg), has been introduced. However, federated learning still faces statistical challenges. On the one hand, the variant aggregation algorithm based on FedAvg relies on distributed stochastic gradient descent (D-SGD), which is widely used to iteratively train deep learning models under the independent and identically distributed (IID) sampling setting of training data. The purpose of learning from training samples using IID sampling methods is to ensure that the stochastic gradient is an unbiased estimate of the full gradient. In practice, it is unrealistic to ensure that the local data of each edge customer is always IID; on the other hand, studies have shown that the heterogeneity of data, namely non-IID distribution, may reduce the convergence speed, which is not conducive to obtaining a robust shared model. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the embodiment of the present invention proposes a method that can improve the performance, accuracy and convergence speed of the federated learning framework, does not need to share any data, does not need to be based on a specific model, and provides complete privacy protection, has smaller accuracy fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0005] The embodiment of the present invention also proposes another collaborative model training method.
[0006] The embodiment of the present invention also proposes another collaborative model training method.
[0007] The embodiment of the present invention also provides a collaborative model training device.
[0008] The embodiment of the present invention also provides another collaborative model training device.
[0009] The collaborative model training method according to the first aspect of the present invention includes:
[0010] Selecting a shared data set from client sets corresponding to multiple clients;
[0011] Participate in federated learning training according to the shared data set and the preset score to obtain classification model parameters;
[0012] broadcasting the classification model parameters to the plurality of clients;
[0013] Obtaining updated model parameters returned by the multiple clients=;
[0014] According to the updating model parameters, aggregation is performed to obtain multiple global binary classification models;
[0015] The multiple global binary classification models are integrated into a global multi-classification model.
[0016] The collaborative model training method according to the embodiment of the first aspect of the present invention has at least the following beneficial effects: first, by selecting a shared data set from a client set corresponding to multiple clients, and then participating in federated learning training based on the shared data set and a preset score, classification model parameters are obtained, and then the classification model parameters are broadcast to multiple clients, and then the updated model parameters and updated binary classification models returned by the multiple clients are obtained, and then aggregating according to the updated model parameters to obtain multiple global binary classification models, and finally integrating the multiple global binary classification models into a global multi-classification model, which can improve the performance, accuracy and convergence speed of the federated learning framework, does not require sharing any data, does not need to be based on a specific model, and provides complete privacy protection, with smaller accuracy fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0017] According to some embodiments of the present invention, selecting a shared data set from a client set corresponding to a plurality of clients includes: acquiring client tags corresponding to the plurality of clients; and selecting the shared data set from the plurality of client sets according to the client tags.
[0018] According to some embodiments of the present invention, aggregating according to the updated model parameters to obtain multiple global binary classification models includes: obtaining an updated binary classification model corresponding to the updated model parameters; grouping the updated model parameters according to the updated binary classification model to obtain multiple classification groups to be aggregated; respectively extracting parameters to be aggregated for each of the classification groups to be aggregated; and aggregating according to the parameters to be aggregated and the updated binary classification model to obtain the multiple global binary classification models.
[0019] The collaborative model training method according to the second aspect of the present invention includes:
[0020] Get the classification model parameters broadcast by the server;
[0021] Obtain local data labels corresponding to multiple local binary classification models;
[0022] Initialize a plurality of local binary classification models according to the local data labels;
[0023] Optimize the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models;
[0024] The updated model parameters are sent back to the server.
[0025] According to the collaborative model training method of the second aspect of the embodiment of the present invention, there are at least the following beneficial effects: first, the classification model parameters broadcast by the server are obtained, and the local data labels corresponding to the multiple local binary classification models are obtained, and then the multiple local binary classification models are initialized according to the local data labels, and then the initialized multiple local binary classification models are optimized according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models, and finally the updated model parameters are sent back to the server, which can greatly reduce the additional computing burden, improve the accuracy of the data, do not need to share any data, and provide complete privacy protection, thereby improving the performance and convergence of the federated learning framework.
[0026] According to some embodiments of the present invention, the multiple local binary classification models initialized by optimizing the local data set to obtain multiple updated model parameters and multiple updated binary classification models include: obtaining the objective function corresponding to the local binary classification model; performing stochastic gradient descent according to the local data set and the objective function to optimize the local binary classification model to obtain the updated model parameters and the updated binary classification model.
[0027] The collaborative model training method according to the third aspect of the present invention is used for a server and a client, and the server and the client are connected in communication, including:
[0028] The server executes the collaborative model training method as described in the embodiment of the first aspect of the present invention, and the client executes the collaborative model training method as described in the embodiment of the second aspect of the present invention.
[0029] The collaborative model training method according to the third aspect of the present invention has at least the following beneficial effects: the collaborative model training method of the first aspect of the present invention is executed by the server, and the collaborative model training method of the second aspect of the present invention is executed by the client, which can improve the performance, accuracy and convergence of the federated learning framework, and reduce the accuracy fluctuation, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0030] A collaborative model training device according to an embodiment of the fourth aspect of the present invention includes:
[0031] A selection module, used for selecting a shared data set from a client set corresponding to a plurality of clients;
[0032] A training module, used to participate in federated learning training according to the shared data set and the preset score to obtain classification model parameters;
[0033] A broadcast module, used for broadcasting the classification model parameters to the multiple clients;
[0034] A first acquisition module, used to acquire the update model parameters returned by the multiple clients;
[0035] An aggregation module, used for performing aggregation according to the updated model parameters to obtain multiple global binary classification models;
[0036] An integration module is used to integrate the multiple global binary classification models into a global multi-classification model.
[0037] The collaborative model training device according to the fourth aspect of the embodiment of the present invention has at least the following beneficial effects: by executing the collaborative model training method of the first aspect of the present invention, the performance, accuracy and convergence speed of the federated learning framework can be improved, without the need to share any data, without the need to be based on a specific model, and providing complete privacy protection, with smaller accuracy fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0038] A collaborative model training device according to an embodiment of a fifth aspect of the present invention includes:
[0039] A second acquisition module is used to acquire the classification model parameters broadcast by the server;
[0040] A third acquisition module is used to obtain local data labels corresponding to multiple local binary classification models;
[0041] An initialization module, used for initializing a plurality of local binary classification models according to the local data labels;
[0042] An optimization module, used for optimizing the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models;
[0043] The return module is used to send the updated model parameters back to the server.
[0044] The collaborative model training device according to the fifth aspect of the present invention has at least the following beneficial effects: by executing the collaborative model training method of the second aspect of the present invention, the additional computational burden can be greatly reduced, the accuracy of the data can be improved, no data needs to be shared, and complete privacy protection is provided, thereby improving the performance and convergence of the federated learning framework.
[0045] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0047] Figure 1 A schematic diagram of a process flow of a collaborative model training method according to an embodiment of the present invention;
[0048] Figure 2 Schematic diagram of the FedOVA algorithm according to an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of a flow chart of a collaborative model training method according to another embodiment of the present invention;
[0050] Figure 4 A schematic diagram of the structure of a collaborative model training device according to an embodiment of the present invention;
[0051] Figure 5 It is a schematic structural diagram of a collaborative model training device according to another embodiment of the present invention.
[0052] Reference numerals:
[0053] Selection module 400, training module 410, broadcasting module 420, first acquisition module 430, aggregation module 440, integration module 450, second acquisition module 500, third acquisition module 510, initialization module 520, optimization module 530, return module 540. DETAILED DESCRIPTION
[0054] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0055] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0056] The embodiment of the present invention focuses on solving the non-IID distribution problem caused by the missing of some categories. Under the limitation of the non-IID data of the customer, the non-IID problem in federated learning means that each customer cannot obtain enough multi-class labels to train a high-precision multi-class classification model through data sharing, which limits the scalability of the federated learning framework, and therefore a multi-class model cannot be trained directly on the client. To this end, the joint multi-class classification task on non-IID data can be decomposed into multiple binary classification tasks of the client by using the One-vs-All method. Therefore, in the embodiment, the One-vs-All method (one-to-many algorithm, that is, using multiple classifiers, assuming that each class is a positive class, and then using a binary classification discriminant algorithm to obtain the classification of each class respectively) and FedAvg (federal average algorithm, the essence of the FedAvg idea is to integrate the weights trained by each user for averaging, that is, according to the different number of samples owned, the proportion in the averaging process is also different) training scheme idea, design Federated One-vs-All (FedOVA) algorithm. This algorithm can effectively handle non-IID data in federated learning by decomposing multi-classification tasks into multiple binary classification tasks. For an overview of the FedOVA algorithm, please refer to Figure 2 The FedOVA algorithm first decomposes the multi-class classification problem into a more direct binary classification problem, and then combines their respective outputs using an ensemble learning method.
[0057] Reference Figure 1 , according to the collaborative model training method of the first embodiment of the present invention, comprising:
[0058] Step S100: selecting a shared data set from a client set corresponding to a plurality of clients.
[0059] There can be multiple clients; the client set can be the data set of each client; a part of the client sets can be selected as the client shared data set к. Optionally, each client has a local data set D k, k∈{1,2,...,K}, the total number of classes is n. We can select a part of the clients from all the clients, and then obtain the data of these clients (i.e., the D k ) as a shared dataset. Specifically, for multiple clients, different client labels can be set. For each round of training, the server randomly selects part of the client set as a shared dataset к to participate in the federated learning training according to the label.
[0060] Step S110, participating in federated learning training according to the shared data set and the preset score to obtain classification model parameters.
[0061] The classification model parameters can be binary classifier model parameters obtained by the server after performing federated learning training based on the shared data set and the preset score. Optionally, the preset score can be set as required. Let the preset score be C, and the shared data set к obtained by random selection can be used to participate in federated learning training with the preset score C, which can speed up the convergence of the training speed. The binary classifier model parameters obtained through federated learning training That is, the classification model parameters are obtained Where i represents the classifier ID, i∈{1,2,...,n}.
[0062] Step S120, broadcasting the classification model parameters to multiple clients.
[0063] Optionally, the server can pass the classification model parameters Broadcast to multiple clients so that multiple clients receive the classification model parameters Afterwards, local training can be performed to obtain updated results.
[0064] Step S130, obtaining updated model parameters returned by multiple clients.
[0065] The updated model parameters may be the binary classifier parameters obtained by optimizing the classifier through local training. Optionally, when the client performs local training, it is necessary to train a classification model for each label, that is, to train multiple models. Each client uses the local dataset D k Perform stochastic gradient descent to optimize the classifier, and then return the updated model parameters to the server.
[0066] Step S140, performing aggregation according to the updated model parameters to obtain multiple global binary classification models.
[0067] The global binary classification model can be a global binary classifier model, and there can be multiple global binary classification models. Optionally, since each client only trains part of the classifiers, the parameters of all classifiers are not returned, and each classifier is independent, asynchronous updates can be performed to reduce the computational burden. Specifically, the server groups the returned updated model parameters according to the corresponding binary classifier model, and then summarizes each group G i The parameters of the local binary classification model are aggregated to obtain the corresponding global binary classification model. For each local client with multiple local binary classification models, after returning the updated model parameters to the server, the server aggregates the local binary classification models of each category into multiple global binary classification models, that is, multiple global binary classification models are obtained.
[0068] Step S150, integrating multiple global binary classification models into a global multi-classification model.
[0069] Optionally, the above aggregation step S140 is repeated, and multiple global binary classification models can be integrated into a global multi-classification model until the final integrated classifier reaches convergence and obtains a global multi-classification model. There is no redundancy between the component binary classifiers in FedOVA, and the training of each classifier does not affect other classifiers. Therefore, during the federated learning training process, the component binary classifier can be updated independently once the training is completed, thereby improving the communication efficiency between the client and the server without bringing additional operations to the federated learning framework.
[0070] The above-mentioned collaborative model training method first selects a shared data set from the client sets corresponding to multiple clients, then participates in federated learning training based on the shared data set and the preset score to obtain the classification model parameters, and then broadcasts the classification model parameters to multiple clients, and then obtains the updated model parameters and updated binary classification models returned by multiple clients, and aggregates them according to the updated model parameters to obtain multiple global binary classification models, and finally integrates multiple global binary classification models into a global multi-classification model, which can improve the performance, accuracy and convergence speed of the federated learning framework, does not require sharing any data, does not need to be based on a specific model, and provides complete privacy protection, with smaller accuracy fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0071] In some embodiments of the present invention, selecting a shared data set from a client set corresponding to a plurality of clients includes:
[0072] Get customer tags corresponding to multiple clients. The customer tag can be a unique tag corresponding to the client. Optionally, for non-IID configuration, the parameter 1≤l≤10 can be used to represent the number of unique tags held by the client. For example, non-IID-2 means that each client has two different tags. This is achieved by grouping the training data by tag and dividing each group into (l×K) / n partitions. Finally, the partition with different tags is assigned to each client, and the tag of the partition is obtained to obtain the customer tag corresponding to each client.
[0073] A shared data set is selected from multiple clients based on the client label. Optionally, assuming that the number of clients K = 100, 20% of the clients can be randomly selected for training in each round of training (i.e., the preset score C = 0.2) according to the client labels corresponding to different clients, and the data of these 20% of clients can be obtained to obtain a shared data set. By randomly selecting clients participating in training based on client labels to obtain a shared data set, not all sample categories are required, and the best accuracy can be obtained on each task, while providing complete privacy protection.
[0074] In some embodiments of the present invention, aggregation is performed according to the updated model parameters to obtain multiple global binary classification models, including:
[0075] Get the updated binary classification model corresponding to the updated model parameters. The updated binary classification model may be an updated local binary classification model. Optionally, since the client needs to train a classification model for each label when performing local training, that is, train multiple models, the updated model parameters of each category correspond to an updated local binary classification model, that is, the updated binary classification model.
[0076] The updated model parameters are grouped according to the updated binary classification model to obtain multiple classification groups to be aggregated. Optionally, since each client only trains part of the classifiers, the parameters of all classifiers are not returned, and each classifier is independent, asynchronous updates can be performed to reduce the computational burden. The server groups the returned parameters according to the corresponding binary classifier model to obtain multiple classification groups to be aggregated.
[0077] The parameters to be aggregated of each to-be-aggregated classification group are extracted respectively. Optionally, for each group of to-be-aggregated classification groups, each group G i Parameters to be aggregated are obtained.
[0078] Aggregate the parameters to be aggregated and the updated binary classification model to obtain multiple global binary classification models. Optionally, for the updated binary classification model f i , the polymerization process can be expressed as the following formula①:
[0079]
[0080] In formula ①, is the parameter to be aggregated, is the classification group to be aggregated, To update the model parameters, k∈{1,2,...,K}. Through the above formula ①, the updated binary classification model of each category is aggregated into multiple global binary classification models, that is, multiple global binary classification models are obtained. The multi-class classification problem is decomposed into a more direct binary classification problem, and then the outputs of each are combined using the ensemble learning method. Since there is no redundancy between the component binary classifiers in FedOVA, the training of each classifier does not affect other classifiers. Through asynchronous updates, during the federated learning training process, the component binary classifiers can be updated independently once the training is completed, which improves the communication efficiency between the client and the server.
[0081] Reference Figure 3 , according to the collaborative model training method of the second aspect of the present invention, comprising:
[0082] Step S300, obtaining the classification model parameters broadcast by the server.
[0083] Optionally, the client can receive classification model parameters broadcast by the server Each client receives the classification model parameters Afterwards, local training can be performed to obtain updated results.
[0084] Step S310, obtaining local data labels corresponding to multiple local binary classification models.
[0085] Among them, the local data label can be the local data set D k Corresponding labels. Optionally, assuming that the local dataset of the client is the F-MNIST dataset, for the F-MNIST dataset, if the client only has label "1" and label "2", the local data labels "1" and "2" corresponding to the local binary classification models f1 and f2 can be obtained.
[0086] Step S320, initializing multiple local binary classification models according to local data labels.
[0087] Optional, see Figure 2 In the FedOVA algorithm shown in Figure 2, the client receives the classification model parameters ω i t After that, the client will initialize some OVA component classifier models according to its local data label distribution, that is, the classification model parameters For example, if the client only has labels "1" and "2", the client will initialize the parameters of local binary classification models f1 and f2. Unlike multi-class classifier ensembles, each classifier in FedOVA is dedicated to distinguishing a specific category. This design ensures low error correlation between different classifiers, thereby enhancing the diversity between classifiers and improving the overall classification accuracy.
[0088] Step S330 , optimizing the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models.
[0089] Optionally, during the federated learning training process, FedOVA aims to train an expert binary classifier for each category, thus solving the problem of difficulty in converging when training multi-classifier models with non-IID data. For each binary classifier, each client uses a local dataset D k Perform stochastic gradient descent to optimize the classifier and obtain the updated results, including the updated binary classification model and its corresponding updated model parameters. Since each component classifier in FedOVA assigns samples that do not belong to the current category to other categories, omitting the negative sample category does not have a significant impact on the performance of the classifier. In addition, when new label categories appear, FedOVA only needs to create a new classifier for each newly appearing label, which allows adaptation to new environments without drastic changes during federated learning training.
[0090] Step S340: sending the updated model parameters back to the server.
[0091] Optionally, the update result may be returned to the server, so that the server may aggregate the local binary classification models of each category into multiple global binary classification models according to the returned updated model parameters, and finally integrate these global binary classification models into a global multi-classification model.
[0092] The above-mentioned collaborative model training method first obtains the classification model parameters broadcast by the server, obtains the local data labels corresponding to multiple local binary classification models, and then initializes the multiple local binary classification models according to the local data labels, and then optimizes the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models, and finally sends the updated model parameters back to the server, which can greatly reduce the additional computing burden, improve the accuracy of the data, does not need to share any data, and provides complete privacy protection, thereby improving the performance and convergence of the federated learning framework.
[0093] In some embodiments of the present invention, optimizing the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters includes:
[0094] Get the objective function corresponding to the local binary classification model. Optionally, assume that for each binary classifier, its goal is to minimize the following objective function:
[0095]
[0096] In formula ②, D k Indicates that the training sample (x i ,y i ), ω is the parameter of the binary classifier, is a loss function, namely:
[0097] According to the local data set and the objective function, stochastic gradient descent is performed to optimize the local binary classification model and obtain the updated model parameters. Figure 2 The FedOVA algorithm shown in Figure 1 trains multiple binary classifiers and selects the output of the most confident classifier as the prediction result. k , and the binary classifier parameter ω are substituted into the above formula ② to obtain the updated result, including the updated binary classification model and its corresponding updated model parameters, which can significantly improve the performance of federated learning in non-IID data scenarios with higher accuracy and faster convergence.
[0098] The collaborative model training method according to the third aspect of the present invention is applied to a server and a client, and the server and the client are connected in communication, including:
[0099] The server executes the collaborative model training method as in the first embodiment of the present invention, and the client executes the collaborative model training method as in the second embodiment of the present invention.
[0100] The above-mentioned collaborative model training method, which executes the collaborative model training method of the first embodiment of the present invention through the server side and executes the collaborative model training method of the second embodiment of the present invention through the client side, can improve the performance, accuracy and convergence of the federated learning framework, with smaller precision fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0101] The process of the collaborative model training method of the embodiment of the present invention is described in detail below with a specific embodiment. It should be understood that the following description is only an exemplary description and is not a specific limitation of the present invention.
[0102] The collaborative model training method performs the following steps:
[0103] The embodiment of the present invention is based on Figure 2 The FedOVA algorithm shown in Figure 1 performs collaborative model training. The training process of FedOVA is to repeat the following steps for communication rounds 1 to T:
[0104] The first step is to initialize the binary classifier model parameters.
[0105] Assume there is a server responsible for coordination and a set of clients in federated learning Each client has a local dataset D k , k∈{1,2,...,K}, the total number of classes is n. For each round of training, the server randomly selects the client set A subset of Participate in federated learning training with score C (participating in federated learning training with score C can speed up the training speed and the convergence speed of the global model). Then, the server will Broadcast to these clients, where i represents the classifier ID, i∈{1,2,...,n}.
[0106] In the second step, the client performs local training.
[0107] After the client receives the binary classifier model parameters, it will initialize some OVA component classifier models according to its local data label distribution, that is, For example, for the F-MNIST dataset, if the client only has the label "1" and the label "2", this client will initialize the parameters of the classifiers and. For each binary classifier, its goal is to minimize the objective function shown in the above formula ②. Each client optimizes the classifier by performing stochastic gradient descent using the local dataset and then sends the updated results back to the server.
[0108] In the third step, the server aggregates the local binary classification models of each category and integrates them to obtain a global multi-classification model.
[0109] Since each client only trains part of the classifiers and does not return the parameters of all classifiers, and each classifier is independent, asynchronous updates are performed to reduce the computational burden. The server groups the returned parameters according to the corresponding binary classifier model and then summarizes each group G i Parameters of the model. i, the aggregation process can be expressed as the above formula ①, thus aggregating the local binary classification models of each category to obtain multiple global binary classification models, the above steps are repeated until the final integrated classifier reaches convergence, and finally these global binary classification models are integrated into a global multi-classification model. Since the purpose of FedOVA is to train an expert-level binary classifier for each category, it solves the problem of difficulty in convergence when training multi-classifier models with non-IID data.
[0110] In some specific embodiments, a simulation experiment may be performed on the collaborative model training method in the embodiments of the present invention:
[0111] Explanation of the experimental hardware environment: All simulation experiments were developed using Python 3.7 and PyTorch1.7, and used an Nvidia GeForce RTX2080 Ti GPU and Silver CPU runs, and all experiments are executed sequentially to simulate distributed training.
[0112] First, the performance of FedOVA and FedAvg is evaluated with non-IID data. Simulation experiments can be performed on three representative public datasets. For the non-IID configuration, a parameter can be used to represent the number of unique labels held by the client. For example, non-IID-2 means that each client has two different labels. This is achieved by grouping the training data by label and dividing each group into partitions, and finally assigning the partitions with different labels to each client. For the consistency of the experiment, the same data distribution method can be used for each dataset, and the training data is sent to 100 clients according to the non-IID-2 configuration. The training samples are distributed to K = 100 clients according to the non-IID configuration, and 10 convolutional neural networks (CNNs) are trained as binary classifiers. By default, 20% of the clients are selected for training in each round of training, that is, the fraction C = 0.2. Each client is trained on its local dataset for 5 epochs with a batch size of 15 (that is, E = 5 and B = 15).
[0113] In order to better study the performance of FedOVA under non-IID data distribution, a series of simulations can be performed for different non-IID configurations, for example, testing non-IID-l and l∈{2,3,5}. Whether using FedOVA or FedAvg algorithm, the accuracy will increase as the number of label categories in the customer's local dataset increases. However, there are still two points worth noting: Table 1 compares the accuracy under different non-IID configurations, and the accuracy is reported in percentage (%).
[0114]
[0115] Table 1
[0116] As shown in Table 1, first, different non-IID configurations have a huge impact on the performance of FedAvg, but have no obvious impact on FedOVA; second, in each non-IID scenario, FedOVA can also achieve excellent performance compared with FedAvg. These two observations fully demonstrate the robustness of the FedOVA algorithm to non-IID situations.
[0117] Secondly, the performance of the large-scale client and small-scale data is tested. Keep the total number of training samples unchanged and significantly increase the number of clients (i.e., K increases from 100 to 1000 in F-MNIST and CIFAR-10; since the amount of data in KWS is too limited, K=500 is set), so the amount of local data for each client will be reduced accordingly. For each round of training, C=0.2 is set, and K×C clients are selected to participate. The average of the last 20 rounds is taken as the final accuracy. The experimental results are shown in Table 5, which is a comparison of the accuracy under different numbers of clients, and the accuracy is reported in percentage (%).
[0118]
[0119] Table 2
[0120] As shown in Table 2, as the number of customers increases, the accuracy of FedAvg decreases significantly; however, this is not the case with FedOVA. The reason is that the FedOVA algorithm uses the idea of OVA to train some binary classifiers, and the increase in the number of customers also increases the robustness of the binary classifiers to different environments. In this way, it is still possible to achieve competitive results with less data.
[0121] The above experiments prove that the OVA-based federated learning training algorithm (FedOVA algorithm) can significantly improve the performance of federated learning in non-IID data scenarios. In extensive experiments on established computer vision and speech recognition datasets, the FedOVA algorithm consistently outperforms FedAvg under various non-IID configurations. The experimental results also show that FedOVA converges faster and has smaller accuracy fluctuations, thereby reducing the negative impact of non-IID data on model convergence. Finally, the experimental results show that FedOVA can be applied to large-scale user scenarios, especially when a large number of customers (up to 1,000 customers) each have a small amount of data.
[0122] Reference Figure 4 , according to the collaborative model training device of the fourth aspect of the present invention, comprising:
[0123] A selection module 400 is used to select a shared data set from a client set corresponding to a plurality of clients;
[0124] A training module 410 is used to participate in federated learning training according to a shared data set and a preset score to obtain classification model parameters;
[0125] A broadcast module 420, for broadcasting the classification model parameters to multiple clients;
[0126] A first acquisition module 430 is used to acquire updated model parameters returned by multiple clients and update the binary classification model;
[0127] Aggregation module 440, used for performing aggregation according to the updated model parameters to obtain multiple global binary classification models;
[0128] The integration module 450 is used to integrate multiple global binary classification models into a global multi-classification model.
[0129] The above-mentioned collaborative model training device, by executing the collaborative model training method of the first aspect of the present invention, can improve the performance, accuracy and convergence speed of the federated learning framework. It does not require sharing any data, does not need to be based on a specific model, and provides complete privacy protection. It has smaller accuracy fluctuations, thereby reducing the negative impact of data on model convergence, and is suitable for large-scale user scenarios.
[0130] Reference Figure 5 , according to a collaborative model training device of an embodiment of the fifth aspect of the present invention, comprising:
[0131] The second acquisition module 500 is used to acquire the classification model parameters broadcast by the server;
[0132] A third acquisition module 510 is used to acquire local data labels corresponding to multiple local binary classification models;
[0133] An initialization module 520, used to initialize multiple local binary classification models according to local data labels;
[0134] An optimization module 530 is used to optimize the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models;
[0135] The return module 540 is used to send the updated model parameters back to the server.
[0136] The above-mentioned collaborative model training device, by executing the collaborative model training method of the second aspect of the embodiment of the present invention, can greatly reduce the additional computing burden, improve the accuracy of the data, does not require sharing any data, and provides complete privacy protection, thereby improving the performance and convergence of the federated learning framework.
[0137] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.
[0138] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0139] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0140] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A collaborative model training method, characterized in that: include: Selecting a shared data set from client sets corresponding to multiple clients; Participate in federated learning training according to the shared data set and the preset score to obtain classification model parameters; broadcasting the classification model parameters to the plurality of clients; Obtaining updated model parameters returned by the multiple clients; the updated model parameters refer to binary classifier parameters obtained by the client after optimizing the classifier through local training; Obtaining an updated binary classification model corresponding to the updated model parameters; Grouping the updated model parameters according to the updated binary classification model to obtain a plurality of classification groups to be aggregated; Extracting parameters to be aggregated from each of the classification groups to be aggregated respectively; performing aggregation according to the parameters to be aggregated and the updated binary classification model to obtain multiple global binary classification models; wherein the generation process of the updated model parameters and the updated binary classification model specifically includes: initializing multiple local binary classification models according to local data labels corresponding to multiple local binary classification models, optimizing the initialized multiple local binary classification models according to the local data set, and obtaining multiple updated model parameters and multiple updated binary classification models; the local data set is an image data set; Integrating the multiple global binary classification models into a global multi-classification model; Among them, for the updated binary classification model , the aggregation process of performing aggregation according to the parameters to be aggregated and the updated binary classification model is specifically expressed as shown in the following formula: in, is the parameter to be aggregated, is the classification group to be aggregated, is the updated model parameter, .
2. The method according to claim 1, characterized in that The step of selecting a shared data set from a client set corresponding to the plurality of clients includes: Obtaining client tags corresponding to the multiple clients; The shared data set is selected from the plurality of client sets according to the client tag.
3. A collaborative model training method, characterized in that: include: Get the classification model parameters broadcast by the server; Obtain local data labels corresponding to multiple local binary classification models; Initialize a plurality of local binary classification models according to the local data labels; Optimize the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models; The updated model parameters are binary classifier parameters obtained by optimizing the classifier through local training; wherein the local data set is an image data set; the optimizing the multiple local binary classification models initialized according to the local data set to obtain multiple updated model parameters includes: obtaining the objective function corresponding to the local binary classification model; performing stochastic gradient descent according to the local data set and the objective function to optimize the local binary classification model to obtain the updated model parameters; sending the updated model parameters back to the server; Wherein, in the obtaining of the objective function corresponding to the local binary classification model, it is assumed that for each binary classifier, its goal is to minimize the following objective function: In the above formula, Indicates that it contains training samples The local dataset, are the parameters of the binary classifier, is a loss function, and .
4. A collaborative model training method, for a server and a client, wherein the server is in communication connection with the client, characterized in that: The method comprises: The server executes the collaborative model training method as described in any one of claims 1 to 2, and the client executes the collaborative model training method as described in claim 3.
5. A collaborative model training device, characterized in that: include: A selection module, used for selecting a shared data set from a client set corresponding to a plurality of clients; A training module, used to participate in federated learning training according to the shared data set and the preset score to obtain classification model parameters; A broadcast module, used for broadcasting the classification model parameters to the multiple clients; A first acquisition module is used to acquire the updated model parameters returned by the multiple clients; the updated model parameters refer to the binary classifier parameters obtained by the client after optimizing the classifier through local training; an aggregation module, used for obtaining an updated binary classification model corresponding to the updated model parameters; The updated model parameters are grouped according to the updated binary classification model to obtain a plurality of classification groups to be aggregated; the parameters to be aggregated of each of the classification groups to be aggregated are extracted respectively; the parameters to be aggregated and the updated binary classification model are aggregated to obtain a plurality of global binary classification models; wherein the generation process of the updated model parameters and the updated binary classification model specifically includes: initializing a plurality of the local binary classification models according to the local data labels corresponding to the plurality of local binary classification models, optimizing the initialized plurality of the local binary classification models according to the local data set, and obtaining a plurality of updated model parameters and a plurality of updated binary classification models; the local data set is an image data set; wherein, for the updated binary classification model , the aggregation process of performing aggregation according to the parameters to be aggregated and the updated binary classification model is specifically expressed as shown in the following formula: in, is the parameter to be aggregated, is the classification group to be aggregated, is the updated model parameter, ; An integration module is used to integrate the multiple global binary classification models into a global multi-classification model.
6. A collaborative model training device, characterized in that: include: A second acquisition module is used to acquire the classification model parameters broadcast by the server; A third acquisition module is used to obtain local data labels corresponding to multiple local binary classification models; An initialization module, used for initializing a plurality of local binary classification models according to the local data labels; An optimization module, used for optimizing the initialized multiple local binary classification models according to the local data set to obtain multiple updated model parameters and multiple updated binary classification models; The updated model parameters are binary classifier parameters obtained by optimizing the classifier through local training; wherein the local data set is an image data set; the optimizing the multiple local binary classification models initialized according to the local data set to obtain multiple updated model parameters includes: obtaining the objective function corresponding to the local binary classification model; performing stochastic gradient descent according to the local data set and the objective function to optimize the local binary classification model to obtain the updated model parameters; wherein, in the obtaining the objective function corresponding to the local binary classification model, it is assumed that for each binary classifier, its goal is to minimize the following objective function: In the above formula, Indicates that it contains training samples The local dataset, are the parameters of the binary classifier, is a loss function, and ; A return module is used to send the updated model parameters back to the server.
