CN111222647A - Federal learning system optimization method, device, equipment and storage medium - Google Patents
Federal learning system optimization method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN111222647A CN111222647A CN202010022561.7A CN202010022561A CN111222647A CN 111222647 A CN111222647 A CN 111222647A CN 202010022561 A CN202010022561 A CN 202010022561A CN 111222647 A CN111222647 A CN 111222647A
- Authority
- CN
- China
- Prior art keywords
- model
- federal
- local
- full
- training
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000003860 storage Methods 0.000 title claims abstract description 14
- 238000005457 optimization Methods 0.000 title claims description 42
- 238000012549 training Methods 0.000 claims abstract description 133
- 230000004927 fusion Effects 0.000 claims abstract description 73
- 238000011056 performance test Methods 0.000 claims abstract description 56
- 238000012360 testing method Methods 0.000 claims description 16
- 239000002699 waste material Substances 0.000 abstract description 4
- 230000009286 beneficial effect Effects 0.000 abstract 1
- 238000010801 machine learning Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 6
- 230000008901 benefit Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 5
- 238000013528 artificial neural network Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 238000009826 distribution Methods 0.000 description 3
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000002776 aggregation Effects 0.000 description 1
- 238000004220 aggregation Methods 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012417 linear regression Methods 0.000 description 1
- 238000007477 logistic regression Methods 0.000 description 1
- 235000012054 meals Nutrition 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/217—Validation; Performance evaluation; Active pattern learning techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Physics & Mathematics (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Medical Informatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method, a device, equipment and a storage medium for optimizing a federated learning system, wherein the method comprises the following steps: participating in the federal learning model training to obtain a federal model; training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model; and performing performance tests on the federal model, the local model and the full model, and selecting a model to be finally used based on a performance test result. The invention realizes the full utilization of the federal model, does not waste the local computing resources of the participated equipment, and because of combining the federal model and the local model, the performance of the obtained full model is probably better than that of the local model, thereby leading most participated equipment to be beneficial from the federal learning and improving the performance of the model.
Description
Technical Field
The invention relates to the technical field of machine learning, in particular to a method, a device, equipment and a storage medium for optimizing a federated learning system.
Background
At present, in order to protect the data privacy and safety of the participants of the joint training model, a federal learning concept is provided. Federated learning refers to a method of machine learning or deep learning by combining different participants to build a shared machine learning model. In the federal study, the participants do not need to expose own data to other participants and coordinators, so that the federal study can well protect the privacy of users and guarantee the data security.
However, in a scenario where federal learning is actually applied, the data feature distributions of training data owned by different participants are generally different. For example, one participant a may often use the sentence "i eat at nine o ' clock night", while another participant B may often use the sentence "i see at nine o ' clock night", while training the next input word prediction model, "i see _______ at nine o ' clock night", the models obtained by participants a and B through model training by federal learning may not have a good prediction effect, clearly distinguishing whether to predict "eat" or "see. If the participant A carries out model training alone, the prediction can be more accurate, and the 'meal' is always predicted. That is, due to the different data feature distributions of the training data owned by participants, the models jointly trained by participants a and B through federal learning do not always perform better than the machine learning models trained by either participant a or B alone. When the performance of the local model obtained by local training of the participant is superior to that of the federal model, the participant chooses to use the local model and abandons the federal model, so that resource waste is caused, and the utilization rate of the local calculation resources of the participant is reduced.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a storage medium for optimizing a federated learning system, and aims to solve the technical problem that when the performance of a local model obtained by local training of a participant is superior to that of a federated model, the participant selects to use the local model and abandons the federated model, so that resource waste is caused, and the utilization rate of local calculation resources of the participant is reduced.
In order to achieve the above object, the present invention provides a federated learning system optimization method, which is applied to a participating device participating in federated learning, and comprises:
participating in the federal learning model training to obtain a federal model;
training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and performing performance tests on the federal model, the local model and the full model, and selecting a model to be finally used based on a performance test result.
Optionally, the step of obtaining the local model and the full model by training with the preset training data set and the federal model includes:
training a local model to be trained by adopting a preset training data set to obtain a local model;
and adopting the data in the preset training data set as the input of the federal model and the local model, adopting the output of the federal model and the local model as the input of the fusion model to be trained, and training the fusion model to be trained to obtain the full model.
Optionally, the step of obtaining the local model and the full model by training with the preset training data set and the federal model includes:
and training the local model to be trained and the fusion model to be trained by adopting the data in the preset training data set as the input of the federal model and the local model to be trained and adopting the output of the federal model and the local model to be trained as the input of the fusion model to be trained to obtain the local model and the full model.
Optionally, after the step of performing performance testing on the federal model, the local model and the full model and selecting a model to be finally used based on a performance testing result, the method further includes:
and when the performance test result shows that the performance of the local model is optimal, stopping participating in federal learning within a preset time period.
Optionally, after the step of performing performance testing on the federal model, the local model and the full model and selecting a model to be finally used based on a performance testing result, the method further includes:
and sending the performance test result to a coordinating device participating in the federal learning, so that the coordinating device stops sending the federal learning invitation to the participating device within a preset time period when the performance test result is that the performance of the local model is optimal.
Optionally, when the performance test result is that the full model has the optimal performance, and the full model is used to classify images, the performance test on the federal model, the local model, and the full model, and the step of selecting the model to be finally used based on the performance test result further includes:
respectively inputting image data of an image to be classified into the federal model and the local model in the full model to obtain a first logarithm of the output of the federal model and a second logarithm of the output of the local model, wherein the first logarithm of the image to be classified represents the probability of the image to be classified belonging to each image category;
and fusing the first logarithm and the second logarithm, and inputting the fused numbers into the fusion model in the full model to obtain the classification result of the image to be classified output by the fusion model.
Optionally, the number of the federal model is at least one, and the number of the local model is at least one.
In addition, to achieve the above object, the present invention further provides a federated learning system optimization apparatus deployed on a participating device participating in federated learning, where the federated learning system optimization apparatus includes:
the federal learning module is used for participating in the federal learning model training to obtain a federal model;
the training module is used for training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and the testing module is used for performing performance testing on the federal model, the local model and the full model and selecting a finally used model based on a performance testing result.
In addition, in order to achieve the above object, the present invention further provides a federal learning system optimization device, which includes a memory, a processor and a federal learning system optimization program stored in the memory and capable of running on the processor, wherein the federal learning system optimization program, when executed by the processor, implements the steps of the federal learning system optimization method as described above.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium, on which a federal learning system optimization program is stored, wherein the federal learning system optimization program, when executed by a processor, implements the steps of the federal learning system optimization method as described above.
In the invention, a participation device participates in the training of a federal learning model to obtain a federal model; training by adopting a preset training data set and the federal model to obtain a local model and a full model comprising the federal model, the local model and a fusion model; and performing performance tests on the federal model, the local model and the full model, and selecting a model to be finally used based on performance test results. The participated equipment trains the full model by combining the federal model and the local model, so that the federal model can be fully utilized, resources are not wasted, and the performance of the obtained full model is probably better than that of the local model due to the combination of the federal model and the local model, so that most participated equipment can benefit from federal learning, and the performance of the model is improved; and the full model can fully learn the data characteristics of the training data of the participating equipment, carry out targeted training on the data owned by the participating equipment, and flexibly select the model structure, so that the application range of the trained model is wider.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a first embodiment of a federated learning system optimization method of the present invention;
FIG. 3 is a schematic structural diagram of a full model according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another full model according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of participating in federal learning of a device according to an embodiment of the present invention;
FIG. 6 is a block diagram of a preferred embodiment of the federal learning system optimization device of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides optimization equipment for a federated learning system, and referring to fig. 1, fig. 1 is a schematic structural diagram of a hardware operating environment according to the scheme of the embodiment of the invention.
It should be noted that fig. 1 is a schematic structural diagram of a hardware operating environment of a device that can be optimized for a federal learning system. The federal learning system optimization device in the embodiment of the invention can be a PC, or a terminal device with a display function, such as a smart phone, a smart television, a tablet personal computer, a portable computer, and the like.
As shown in fig. 1, the federal learning system optimization device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the federal learning system optimization device may further include a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. Those skilled in the art will appreciate that the federated learning system optimization device architecture shown in FIG. 1 does not constitute a limitation to the federated learning system optimization device, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a federal learning system optimization program.
In the federal learning system optimized device shown in fig. 1, the network interface 1004 is mainly used for connecting other participating devices or coordinating devices participating in federal learning and communicating data with other participating devices or coordinating devices; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and processor 1001 may be configured to invoke the federated learning system optimizer stored in memory 1005 and perform the following operations:
participating in the federal learning model training to obtain a federal model;
training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and performing performance tests on the federal model, the local model and the full model, and selecting a model to be finally used based on a performance test result.
Further, the step of obtaining the local model and the full model by training with the preset training data set and the federal model includes:
training a local model to be trained by adopting a preset training data set to obtain a local model;
and adopting the data in the preset training data set as the input of the federal model and the local model, adopting the output of the federal model and the local model as the input of the fusion model to be trained, and training the fusion model to be trained to obtain the full model.
Further, the step of obtaining the local model and the full model by training with the preset training data set and the federal model includes:
and training the local model to be trained and the fusion model to be trained by adopting the data in the preset training data set as the input of the federal model and the local model to be trained and adopting the output of the federal model and the local model to be trained as the input of the fusion model to be trained to obtain the local model and the full model.
Further, after the step of performing the performance test on the federal model, the local model and the full model and selecting the model to be finally used based on the performance test result, the method further includes:
and when the performance test result shows that the performance of the local model is optimal, stopping participating in federal learning within a preset time period.
Further, after the step of performing the performance test on the federal model, the local model and the full model and selecting the model to be finally used based on the performance test result, the method further includes:
and sending the performance test result to a coordinating device participating in the federal learning, so that the coordinating device stops sending the federal learning invitation to the participating device within a preset time period when the performance test result is that the performance of the local model is optimal.
Further, when the performance test result is that the performance of the full model is optimal, and the full model is used for classifying images, the performance test of the federal model, the local model and the full model is performed, and after the step of selecting a model to be finally used based on the performance test result, the method further includes:
respectively inputting image data of an image to be classified into the federal model and the local model in the full model to obtain a first logarithm of the output of the federal model and a second logarithm of the output of the local model, wherein the first logarithm of the image to be classified represents the probability of the image to be classified belonging to each image category;
and fusing the first logarithm and the second logarithm, and inputting the fused numbers into the fusion model in the full model to obtain the classification result of the image to be classified output by the fusion model.
Further, the number of the federal models is at least one, and the number of the local models is at least one.
Based on the hardware structure, the invention provides various embodiments of the federated learning system optimization method.
Referring to fig. 2, a first embodiment of the federated learning system optimization method of the present invention provides a federated learning system optimization method, and it is noted that, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that described herein. The method for optimizing the federal learning system is applied to participating equipment participating in federal learning, and the participating equipment can be terminal equipment such as a PC (personal computer), a smart phone, a smart television, a tablet personal computer and a portable computer. The federal learning system optimization method comprises the following steps:
step S10, participating in the federal learning model training to obtain a federal model;
federated learning refers to a method of machine learning or deep learning by combining different participants to build a shared machine learning model. One global model parameter updating of federal learning is divided into two steps: (a) each participant (also called data owner, or client) trains the machine learning model and obtains model weight update (model weight update) using only its own data, and sends the model parameter update to a coordinator (also called parameter server, or aggregation server). For example, the model parameter update may be model weights (model weights), or gradient information (gradients); (b) the coordinator merges the model parameter updates received from the different participants, for example, by taking a weighted average, and redistributes the model parameter updates obtained after the merging (also referred to as global model parameter updates) to the respective participants. In the federal study, the participants do not need to expose own data to other participants and coordinators, so that the federal study can well protect the privacy of users and guarantee the data security. The core idea of federal learning is that the data is static and the parameters of the machine learning model are dynamic. Federal learning may also be without coordinator involvement.
In this embodiment, the participating device performs federated learning model training with other participating devices based on a learning task or with other participating devices in cooperation with a coordinating device, so as to obtain a federated model. The federal model can be a machine learning model such as a deep neural network or a convolutional neural network, and according to different learning tasks, the trained federal model can complete different tasks, for example, when the learning task is to classify images, the local training data adopted by the participating devices is image data, and the trained federal model is used for classifying the images to be classified.
Step S20, a local model and a full model are obtained by adopting a preset training data set and the federal model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and training the participating equipment to obtain a local model and a full model by adopting a preset training data set and a trained federal model based on a learning task the same as that of the training federal model. The preset training data set is a data set corresponding to the learning task, the data set comprises a plurality of sample data, each sample data comprises characteristic data and a data label, if the learning task is to classify images, each sample data can comprise an image data and a classification label corresponding to the image data, and the classification label is a label of which category the labeled image data belongs to. The pre-set training data set may or may not be the same as the training data set used to train the federal model, but the distribution of the data features should be approximately the same, e.g., the color features in the image data are mostly "green".
The local model is a model obtained by the participatory equipment through independent training by adopting the local preset training data set, namely the local model is different from the model obtained by the training of the federal model which requires the joint training of other participatory equipment, and the local model does not use the training data in other participatory equipment; because the learning task is the same, the local model and the federal model can complete the same task, if all the tasks are used for classifying the images; the local model may also be a machine learning model such as a deep neural network or a convolutional neural network, and the structure of the local model may be the same as or different from that of the federal model, which is not limited herein.
The full model refers to a model at least comprising the three parts of the federal model, the local model and the fusion model, and the output of the federal model and the local model is connected with the input of the fusion model, that is, the fusion model is used for fusing the output data of the federal model and the local model. The fusion model may be any one of a linear regression model (low computational complexity), a logistic regression model, a support vector machine model, and a neural network model. FIG. 3 is a schematic diagram of one of the full models, where M is the federal model and L isAIs a local model, Q, obtained by training with a local training data set AAAdopts a local training data set A to combine M and LATraining the resulting fusion model, NAIs a full model.
The training processes of the local model and the full model can be synchronous or asynchronous, namely, the participating devices can be a fusion model part which is obtained by independently training the local model and then independently train the full model, or a local model and a fusion model part which are trained together.
And step S30, performing performance test on the federal model, the local model and the full model, and selecting a model to be finally used based on the performance test result.
And the participating equipment performs performance test on the joint model, the local model and the full model. Specifically, the participating devices may perform performance tests on the federal model, the local model, and the full model respectively by using a local test data set, the performance tests may be to calculate related model performance indexes, such as accuracy of image classification, and the calculation method of the model performance indexes may be an existing calculation method, which is not described in detail herein. And the participating equipment selects the finally used model according to the performance test results of the three models, for example, the performance test results of the three models can be compared, and the model with the optimal performance is selected as the finally used model. For example, the accuracy of image classification of the three models is compared, and the model with the highest accuracy is used as the finally used model, namely, the model with the highest accuracy is adopted to complete the subsequent image classification task.
Further, the participating device may also combine a federal model with a plurality of local models, that is, the participating device may construct a plurality of local models, then combine with the federal model, and train to obtain a full model, as shown in fig. 4, which is a schematic diagram of a full model structure combining a federal model and a plurality of local models, where M is a federal model and L is a global model structure combining a federal model and a plurality of local modelsA1、LA2、…LAiIs a local model, Q, obtained by training with a local training data set AAEmploys a local training data set A in combination with M, LA1、LA2、…LAiTraining the resulting fusion model, NAIs a full model. Similarly, the participating devices may also obtain the full model by combining K federated models and S local models, where K and S are integers greater than or equal to one.
Compared with the scheme that only the local model and the federal model are trained by the participatory equipment, if the performance of the local model is better than that of the federal model, the local model is selected to be used, the federal model is abandoned, resource waste is caused, and the resource utilization rate of the participatory equipment is reduced. In this embodiment, the full model is constructed by combining the participating devices with the federal model and the local model, the federal model can be fully utilized, resources are not wasted, and due to the combination of the federal model and the local model, the performance of the obtained full model is probably better than that of the local model, so that most of the participating devices can benefit from federal learning, the performance of the model is improved, if the model is used for classifying images, the accuracy of image classification of the model is improved, and meanwhile, the utilization rate of computing resources of the participating devices is also improved.
Further, compared with the method for training the federal model by the participatory device and obtaining the local model by finely adjusting the federal model based on the local training data, the finally obtained local model is limited by the structure of the federal model, and the scheme that the model structure can not be flexibly selected according to the data characteristics of the data set owned by the participatory device is provided.
In the embodiment, a participation device participates in the federal learning model training to obtain a federal model; training by adopting a preset training data set and the federal model to obtain a local model and obtain a full model comprising the federal model, the local model and a fusion model; and performing performance test and comparison on the federal model, the local model and the full model, and selecting a model to be finally used based on the performance test result. The participated equipment trains the full model by combining the federal model and the local model, so that the federal model can be fully utilized, resources are not wasted, and the performance of the obtained full model is probably better than that of the local model due to the combination of the federal model and the local model, so that most participated equipment can benefit from federal learning, and the performance of the model is improved; and the full model can fully learn the data characteristics of the training data of the participating equipment, carry out targeted training on the data owned by the participating equipment, and flexibly select the model structure, so that the application range of the trained model is wider.
Further, based on the first embodiment, a second embodiment of the federal learning system optimization method of the present invention provides a method for optimizing a federated learning system. In this embodiment, the step S20 includes:
step A10, training a local model to be trained by adopting a preset training data set to obtain a local model;
in this embodiment, a method for training a local model and a full model is provided: the participating devices are independently trained to obtain a local model, and then the fusion model part of the full model is independently trained.
Specifically, the participating device performs independent training on the local model to be trained by using a preset training data set to obtain the trained local model. The local model to be trained is a model which is not subjected to parameter optimization, for example, a structure of a neural network is preset, but a weight parameter in the neural network is an initialized parameter; the participating device trains the local model to be trained by adopting a preset training data set, specifically, the parameters of the local model to be trained are iteratively updated, so that the classification or prediction result of the local model to be trained approaches to the real data label, the training is stopped until a certain stopping condition is met, if the error (such as a loss function value) between the classification or prediction result and the real data label is smaller than a certain threshold value, the training can be stopped, the final model parameters are obtained, and the local model after training is obtained. The same applies to the fusion model to be trained mentioned later.
And A20, adopting the data in the preset training data set as the input of the federal model and the local model, adopting the output of the federal model and the local model as the input of the fusion model to be trained, and training the fusion model to be trained to obtain the full model.
After the local model is obtained through training, the participating equipment uses the characteristic data in the preset training data set as the input of the federal model and the local model, uses the output of the federal model and the local model as the input of the fusion model to be trained, trains the fusion model to be trained, and keeps the part of the federal model and the local model unchanged in the training process. Finally, a trained fusion model is obtained, and a full model comprising a federal model, a local model and a fusion model is obtained.
It should be noted that, when the learning task is a classification task, such as classifying images, the output result of the federal model and the local model used alone may be a classification label, i.e., a label that characterizes which category the input data belongs to. When the federal model and the local model are used as part of the full model, the output results of the federal model and the local model can be logarithms, the logarithms output by the two models are fused, and the fusion result is used as the input of the fusion model. Where the logarithms characterize the probability that the input data can be classified into various categories.
Further, the outputs of the federated model and the local model may be fused in a flexible manner, for example, by concatenating the outputs of the federated model and the local model in a vector form, or by weighted averaging, etc.
Further, the step S20 includes:
and step B10, taking the data in the preset training data set as the input of the federal model and the local model to be trained, taking the output of the federal model and the local model to be trained as the input of the fusion model to be trained, and training the local model to be trained and the fusion model to be trained to obtain the local model and the full model.
Further, in an embodiment, another method of training a local model and a full model is proposed: the participating devices train both the local model and the fused model portion.
Specifically, the participating device uses the feature data in the preset training data set as the input of the federal model and the local model to be trained, uses the output of the federal model and the local model to be trained as the input of the fusion model to be trained, and trains the local model to be trained and the fusion model to be trained simultaneously, that is, when each round of parameter update, the model parameters of the local model to be trained and the model parameters of the fusion model to be trained are updated. And after the training is finished, obtaining the trained local model and the fusion model, and further obtaining a full model comprising three parts of the federal model, the local model and the fusion model.
In the embodiment, the participating devices train the full model by combining the federal model and the local model, so that the federal model can be fully utilized, resources are not wasted, and the performance of the obtained full model is probably better than that of the local model due to the combination of the federal model and the local model, so that most of the participating devices can benefit from federal learning, and the performance of the model is improved; and the full model can fully learn the data characteristics of the training data of the participating equipment, carry out targeted training on the data owned by the participating equipment, and flexibly select the model structure, so that the application range of the trained model is wider.
Further, based on the first and second embodiments, a third embodiment of the federal learning system optimization method of the present invention provides a method for optimizing a federated learning system. In this embodiment, after the step S30, the method further includes:
and step S40, when the performance test result is that the performance of the local model is optimal, the participation in the federal learning is stopped within a preset time period.
After the participating device obtains the performance test result, if the performance test result is that the performance of the local model is optimal, the participating device may choose to stop participating in the federal learning within a preset time period. The preset time period may be a time period preset by the participating device. If the performance of the federal model obtained by participating in the federal learning and the performance of the full model trained by combining the federal model and the local model are not good, the performance of the model of participating in the equipment is not improved by the federal learning, and the participating equipment selects to stop participating in the federal learning within a preset time period, so that various local resources including the computing resources of the participating equipment can be saved.
Further, after the step S30, the method further includes:
and step S50, sending the performance test result to a coordinating device participating in federated learning, so that the coordinating device stops sending federated learning invitation to the participating device within a preset time period when the performance test result is that the performance of the local model is optimal.
Further, the participating devices may also send performance test results to the coordinating devices participating in federal learning. When detecting that the performance test result is that the performance of the local model is optimal, the coordination device may stop sending the federal learning invitation to the participating device within a preset time period, so that the participating device does not participate in the federal learning within the preset time period, various local resources including computing resources of the participating device are saved, and the complexity of the federal learning system can be reduced. The federal learning invitation can be a message sent by the coordinating device to the participating device, and is used for informing the participating device to participate in federal learning.
Referring to fig. 5, a schematic flow chart of participating devices in federated learning according to an embodiment is shown, where a participant is a participating device, and a coordinator is a coordinating device.
Further, when the performance test result is that the full model performs optimally, and the full model is used for classifying images, after step S30, the method further includes:
step S60, respectively inputting image data of an image to be classified into the federal model and the local model in the full model to obtain a first logarithm of the output of the federal model and a second logarithm of the output of the local model, wherein the first logarithm of the logarithm and the second logarithm of the second logarithm of the image to be classified represent the probability of the image to be classified belonging to each image category;
when the participating device detects that the performance test result is that the full model performance is optimal, the participating device may choose to use the full model. When the learning task is to classify the images, the trained full model is used for classifying the images. For the images to be classified, the participating equipment respectively inputs image data of the images to be classified into a federal model and a local model in the full model, the federal model outputs a first logarithm score, and the local model outputs a second logarithm score. The first logarithm score and the second logarithm score represent the probability that the image belongs to each image category, and the first logarithm score and the second logarithm score may be different due to the difference between the federal model and the local model.
And step S70, fusing the first logarithm and the second logarithm, and inputting the fused numbers into the fusion model in the full model to obtain the classification result of the image to be classified output by the fusion model.
And the participating equipment fuses the first logarithm and the second logarithm, and the fusion mode is the same as the mode of fusing the outputs of the joint model and the local model during the training of the fusion model. And inputting the fused result into the fusion model of the full model to obtain a result output by the fusion model, namely a classification result of the image to be classified, wherein the classification result can be a class label.
In the embodiment, the full model is obtained by training the participating equipment in combination with the local model and the federal model, and when the performance of the full model is better, the full model is adopted to classify the images to be classified, so that the accuracy of image classification is improved.
In addition, an embodiment of the present invention further provides a federated learning system optimization apparatus, which is deployed in a participating device participating in federated learning, and with reference to fig. 6, the federated learning system optimization apparatus includes:
the federal learning module 10 is used for participating in the federal learning model training to obtain a federal model;
the training module 20 is used for training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and the test module 30 is used for performing performance test and comparison on the federal model, the local model and the full model, and selecting the model with the optimal performance as the model to be finally used.
Further, the training module 20 includes:
the first training unit is used for training a local model to be trained by adopting a preset training data set to obtain a local model;
and the second training unit is used for training the fusion model to be trained to obtain the full model by adopting data in the preset training data set as the input of the federal model and the local model and adopting the output of the federal model and the local model as the input of the fusion model to be trained.
Further, the training module 20 includes:
and the third training unit is used for training the local model to be trained and the fusion model to be trained by adopting data in the preset training data set as the input of the federal model and the local model to be trained and adopting the output of the federal model and the local model to be trained as the input of the fusion model to be trained so as to obtain the local model and the full model.
Further, after the step of performing performance test and comparison on the federal model, the local model and the full model and selecting the model with the optimal performance as the model to be finally used, the method further comprises the following steps:
and when the performance test result shows that the performance of the local model is optimal, stopping participating in federal learning within a preset time period.
Further, the federal learning system optimization device further includes:
and the sending module is used for sending the performance test result to the coordination equipment participating in the federal learning so that the coordination equipment stops sending the federal learning invitation to the participating equipment within a preset time period when the performance test result is that the performance of the local model is optimal.
Further, when the performance test result is that the performance of the full model is optimal, and the full model is used for classifying images, the federal learning system optimization device further includes:
the input module is used for respectively inputting image data of an image to be classified into the federal model and the local model in the full model to obtain a first logarithm of the output of the federal model and a second logarithm of the output of the local model, wherein the first logarithm of the second logarithm of the image to be classified represents the probability of the image to be classified belonging to each image category;
and the classification module is used for fusing the first logarithm and the second logarithm and inputting the fused numbers into the fusion model in the full model to obtain a classification result of the image to be classified output by the fusion model.
Further, the number of the federal models is at least one, and the number of the local models is at least one.
The development content of the specific implementation mode of the federal learning system optimization device is basically the same as that of each embodiment of the federal learning system optimization method, and is not described herein any more.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a federal learning system optimization program is stored on the computer-readable storage medium, and when being executed by a processor, the computer-readable storage medium implements the steps of the federal learning system optimization method described above.
The development content of the specific implementation of the federal learning system optimization device and the computer-readable storage medium of the present invention is basically the same as that of each embodiment of the above-mentioned federal learning system optimization method, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. The optimization method of the federated learning system is characterized by being applied to participating equipment participating in federated learning and comprises the following steps:
participating in the federal learning model training to obtain a federal model;
training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and performing performance tests on the federal model, the local model and the full model, and selecting a model to be finally used based on a performance test result.
2. The federal learning system optimization method of claim 1, wherein the step of training using a preset training data set and the federal model to obtain a local model and a full model comprises:
training a local model to be trained by adopting a preset training data set to obtain a local model;
and adopting the data in the preset training data set as the input of the federal model and the local model, adopting the output of the federal model and the local model as the input of the fusion model to be trained, and training the fusion model to be trained to obtain the full model.
3. The federal learning system optimization method of claim 1, wherein the step of training using a preset training data set and the federal model to obtain a local model and a full model comprises:
and training the local model to be trained and the fusion model to be trained by adopting the data in the preset training data set as the input of the federal model and the local model to be trained and adopting the output of the federal model and the local model to be trained as the input of the fusion model to be trained to obtain the local model and the full model.
4. The federal learning system optimization method of claim 1, wherein the step of performing performance testing on the federal model, the local model, and the full model, and selecting an end-use model based on the results of the performance testing, further comprises:
and when the performance test result shows that the performance of the local model is optimal, stopping participating in federal learning within a preset time period.
5. The federal learning system optimization method of claim 1, wherein the step of performing performance testing on the federal model, the local model, and the full model, and selecting an end-use model based on the results of the performance testing, further comprises:
and sending the performance test result to a coordinating device participating in the federal learning, so that the coordinating device stops sending the federal learning invitation to the participating device within a preset time period when the performance test result is that the performance of the local model is optimal.
6. The federal learning system optimization method of claim 5, wherein the step of performing the performance test on the federal model, the local model, and the global model when the performance test result is that the global model performs optimally, the global model being used for classifying images, and selecting a model to be finally used based on the performance test result further comprises:
respectively inputting an image to be classified into the federal model and the local model in the full model to obtain a first logarithm of the output of the federal model and a second logarithm of the output of the local model, wherein the first logarithm of the second logarithm of the output of the federal model represents the probability of the image to be classified belonging to each image category;
and fusing the first logarithm and the second logarithm, and inputting the fused numbers into the fusion model in the full model to obtain the classification result of the image to be classified output by the fusion model.
7. The federal learning system optimization method of any one of claims 1 to 6, wherein the number of the federal models is at least one, and the number of the local models is at least one.
8. The utility model provides a federal learning system optimizing device which characterized in that deploys in the participation equipment of participating in federal learning, federal learning system optimizing device includes:
the federal learning module is used for participating in the federal learning model training to obtain a federal model;
the training module is used for training by adopting a preset training data set and the federal model to obtain a local model and a full model, wherein the full model at least comprises the federal model, the local model and a fusion model, and the output of the federal model and the output of the local model are connected with the input of the fusion model;
and the testing module is used for performing performance testing on the federal model, the local model and the full model and selecting a finally used model based on a performance testing result.
9. A federated learning system optimization device comprising a memory, a processor, and a federated learning system optimization program stored on the memory and operable on the processor that, when executed by the processor, performs the steps of the federated learning system optimization method of any of claims 1-7.
10. A computer readable storage medium having stored thereon a federal learning system optimization program which, when executed by a processor, performs the steps of the federal learning system optimization method as claimed in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010022561.7A CN111222647A (en) | 2020-01-09 | 2020-01-09 | Federal learning system optimization method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010022561.7A CN111222647A (en) | 2020-01-09 | 2020-01-09 | Federal learning system optimization method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111222647A true CN111222647A (en) | 2020-06-02 |
Family
ID=70828159
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010022561.7A Pending CN111222647A (en) | 2020-01-09 | 2020-01-09 | Federal learning system optimization method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111222647A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111678696A (en) * | 2020-06-17 | 2020-09-18 | 南昌航空大学 | Intelligent mechanical fault diagnosis method based on federal learning |
CN111783630A (en) * | 2020-06-29 | 2020-10-16 | 上海高德威智能交通系统有限公司 | Data processing method, device and equipment |
CN111865826A (en) * | 2020-07-02 | 2020-10-30 | 大连理工大学 | Active content caching method based on federal learning |
CN111859917A (en) * | 2020-07-30 | 2020-10-30 | 深圳前海微众银行股份有限公司 | Topic model construction method and device and computer readable storage medium |
CN112232518A (en) * | 2020-10-15 | 2021-01-15 | 成都数融科技有限公司 | Lightweight distributed federated learning system and method |
CN112989929A (en) * | 2021-02-04 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | Target user identification method and device and electronic equipment |
CN113112026A (en) * | 2021-04-02 | 2021-07-13 | 佳讯飞鸿(北京)智能科技研究院有限公司 | Optimization method and device for federated learning model |
CN113283185A (en) * | 2021-07-23 | 2021-08-20 | 平安科技(深圳)有限公司 | Federal model training and client imaging method, device, equipment and medium |
US11449805B2 (en) * | 2020-10-12 | 2022-09-20 | Alipay (Hangzhou) Information Technology Co., Ltd. | Target data party selection methods and systems for distributed model training |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190138934A1 (en) * | 2018-09-07 | 2019-05-09 | Saurav Prakash | Technologies for distributing gradient descent computation in a heterogeneous multi-access edge computing (mec) networks |
CN110633806A (en) * | 2019-10-21 | 2019-12-31 | 深圳前海微众银行股份有限公司 | Longitudinal federated learning system optimization method, device, equipment and readable storage medium |
-
2020
- 2020-01-09 CN CN202010022561.7A patent/CN111222647A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190138934A1 (en) * | 2018-09-07 | 2019-05-09 | Saurav Prakash | Technologies for distributing gradient descent computation in a heterogeneous multi-access edge computing (mec) networks |
CN110633806A (en) * | 2019-10-21 | 2019-12-31 | 深圳前海微众银行股份有限公司 | Longitudinal federated learning system optimization method, device, equipment and readable storage medium |
Non-Patent Citations (3)
Title |
---|
PAUL PU LIANG ET AL.: "think locally,act globally:federated learning with local and global representations", 《ARXIV》, 6 January 2020 (2020-01-06), pages 1 - 20 * |
刘春旭;张永利;: "基于交互式联邦多模型的多传感器融合算法", 中国电子科学研究院学报, no. 05, 20 October 2013 (2013-10-20), pages 60 - 64 * |
王亚珅;: "面向数据共享交换的联邦学习技术发展综述", 无人系统技术, no. 06, 15 November 2019 (2019-11-15), pages 62 - 66 * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111678696A (en) * | 2020-06-17 | 2020-09-18 | 南昌航空大学 | Intelligent mechanical fault diagnosis method based on federal learning |
CN111783630A (en) * | 2020-06-29 | 2020-10-16 | 上海高德威智能交通系统有限公司 | Data processing method, device and equipment |
CN111783630B (en) * | 2020-06-29 | 2022-07-01 | 上海高德威智能交通系统有限公司 | Data processing method, device and equipment |
WO2022001092A1 (en) * | 2020-06-29 | 2022-01-06 | 上海高德威智能交通系统有限公司 | Data processing method and apparatus, and device |
CN111865826B (en) * | 2020-07-02 | 2022-01-04 | 大连理工大学 | Active content caching method based on federal learning |
CN111865826A (en) * | 2020-07-02 | 2020-10-30 | 大连理工大学 | Active content caching method based on federal learning |
CN111859917A (en) * | 2020-07-30 | 2020-10-30 | 深圳前海微众银行股份有限公司 | Topic model construction method and device and computer readable storage medium |
US11449805B2 (en) * | 2020-10-12 | 2022-09-20 | Alipay (Hangzhou) Information Technology Co., Ltd. | Target data party selection methods and systems for distributed model training |
CN112232518A (en) * | 2020-10-15 | 2021-01-15 | 成都数融科技有限公司 | Lightweight distributed federated learning system and method |
CN112232518B (en) * | 2020-10-15 | 2024-01-09 | 成都数融科技有限公司 | Lightweight distributed federal learning system and method |
CN112989929A (en) * | 2021-02-04 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | Target user identification method and device and electronic equipment |
CN113112026A (en) * | 2021-04-02 | 2021-07-13 | 佳讯飞鸿(北京)智能科技研究院有限公司 | Optimization method and device for federated learning model |
CN113112026B (en) * | 2021-04-02 | 2024-05-28 | 佳讯飞鸿(北京)智能科技研究院有限公司 | Federal learning model optimization method and device |
CN113283185A (en) * | 2021-07-23 | 2021-08-20 | 平安科技(深圳)有限公司 | Federal model training and client imaging method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111222647A (en) | Federal learning system optimization method, device, equipment and storage medium | |
CN109308357B (en) | Method, device and equipment for obtaining answer information | |
US10284705B2 (en) | Method and apparatus for controlling smart device, and computer storage medium | |
WO2020192460A1 (en) | Data processing method, terminal-side device, cloud-side device, and terminal-cloud collaboration system | |
CN108280115B (en) | Method and device for identifying user relationship | |
CN108804567A (en) | Method, equipment, storage medium and device for improving intelligent customer service response rate | |
CN109684047A (en) | Event-handling method, device, equipment and computer storage medium | |
CN110785970B (en) | Techniques to automate robotic creation of web pages | |
CN109961032B (en) | Method and apparatus for generating classification model | |
CN112019820B (en) | Interface generation method and device | |
CN104584513A (en) | Apparatus and method for selection of a device for content sharing operations | |
CN104867065A (en) | Method and equipment for processing orders | |
CN112084959B (en) | Crowd image processing method and device | |
US20230185431A1 (en) | Client application content classification and discovery | |
CN111813910A (en) | Method, system, terminal device and computer storage medium for updating customer service problem | |
US20200202430A1 (en) | Recommending shared products | |
CN112766402A (en) | Algorithm selection method and device and electronic equipment | |
CN114548416A (en) | Data model training method and device | |
CN112052316A (en) | Model evaluation method, model evaluation device, storage medium and electronic equipment | |
CN113052246A (en) | Method and related device for training classification model and image classification | |
CN112418442A (en) | Data processing method, device, equipment and storage medium for federal transfer learning | |
CN116094907B (en) | Complaint information processing method, complaint information processing device and storage medium | |
CN112070162A (en) | Multi-class processing task training sample construction method, device and medium | |
CN111178846A (en) | Workflow file generation method, device, equipment and storage medium | |
US20210168195A1 (en) | Server and method for controlling server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |