A federated learning method based on distributed generative adversarial model
By simulating globally distributed data training in federated learning through distributed generative adversarial models, the data island problem is solved, the generalization and overall performance of the model are improved, and the generated model can be used for subsequent tasks.
Patent Information
- Application Number
- CN202111393636.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2041-11-23
AI Technical Summary
Existing federated learning methods are unable to effectively improve model training results when faced with the problem of non-independent and identically distributed data between different institutions. They also face the dilemma of private data being unable to be shared, resulting in data value loss and insufficient model generalization.
A distributed generative adversarial model is adopted. By establishing a generative adversarial network between the client and the server, the generative model is used to simulate the globally distributed data, train and generate data that conforms to the global distribution for the training and updating of the client model, avoiding data transmission and enhancing the generalization of the model.
The training effect and generalization of the federated learning model are improved, the generated model can be used for subsequent tasks, the data island problem is reduced, and the overall performance and stability of the model are improved.
Smart Images

Figure CN114021738B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated learning technology, and in particular to a federated learning method based on a distributed generative adversarial model. Background Art
[0002] With advances in machine learning and big data technologies, the value of data is increasing, and the protection of data privacy and security is gaining increasing attention. However, due to industry competition and legal regulations, various institutions and organizations are unable to effectively circulate data, resulting in the loss of data value and the inability to effectively train data, forming various "data silos."
[0003] Federated learning was first proposed by Google to address the issue of local model updates on Android phones. Federated learning has gained significant attention due to its promising application in addressing the current "data silo" problem. As an innovative mechanism, federated learning can train a global model with privacy properties from decentralized data sources. The specific method is as follows: First, the server selects different institutions or organizations to participate in the training and submits the trained models. The selected institutions then train the models using their local data. Finally, the selected institutions upload the locally trained model parameters, which are aggregated on the server for the next iteration.
[0004] While federated learning offers a solution to the current data dilemma, real-world data distribution and other issues pose challenges to federated learning training. For example, when conducting federated learning across financial or medical institutions, the overall data distribution may not meet the independent and identically distributed (IID) requirement, as participating institutions may come from different regions or have a bias towards different populations. This makes it difficult to significantly improve traditional machine learning methods. Furthermore, because the same data may have different application scenarios and models, training using federated learning requires the participation of several other institutions or organizations; otherwise, the training results will not be significantly improved. Furthermore, the fundamental purpose of using federated learning for training is to increase the amount of local data under privacy constraints, thereby improving the effectiveness of local models and their global generalization. This is also a major concern for federated learning participants.
[0005] Therefore, for federated learning across data silos, how to alleviate the problems caused by non-independent and identically distributed data between different institutions, provide a public dataset that does not involve privacy issues for subsequent tasks, and at the same time improve the training effect of the model in federated learning are issues that urgently need to be studied. Summary of the Invention
[0006] The purpose of the present invention is to address the shortcomings of the existing technology and provide a federated learning method based on a distributed generative adversarial model. Using a distributed generative adversarial method, a generative model that simulates the global distribution is learned without transmitting data. This increases the amount of data in the federated learning process, alleviates the problems caused by data heterogeneity between different clients, and improves the effectiveness and generalization of federated learning. Furthermore, after completing federated learning training in this way, the learned generative model can be retained for subsequent downstream tasks, eliminating the need for repeated federated learning training with other clients.
[0007] In one aspect, the present invention provides a federated learning method based on a distributed generative adversarial model, comprising the following steps:
[0008] Step 1: The server maintains the generated model, selects the clients participating in the training, and sends the generated data to the clients participating in the training;
[0009] Step 2: The client uses local data to train the classification model, and uses local real data and generated data to train the discrimination model, and uploads the client's discrimination results on the generated data to the server;
[0010] Step 3: After receiving the client's discrimination results, the server uses the discrimination results to update the generation model and finally sends the new round of generated data to the selected client;
[0011] Step 4: After the client training is completed, it is uploaded to the server again until the server generates a model that meets the preset standards. The training of the generation model and the discriminant model is stopped, and the client uploads the classification model parameters each time;
[0012] Step 5: After the server aggregates the client model parameters, it uses the filtered generated data for training and sends the trained classification model to the client as a new round of model.
[0013] Among them, when the training process meets step 4, steps 4 and 5 are repeated until the preset stopping condition of federated learning is met.
[0014] The present invention sets up a distributed generative adversarial network between clients in federated learning, uses client data to train the discriminator and classification model and update the generative model in the server, and then uses the trained generative model to generate data that conforms to the global distribution to improve the effect of federated learning. This process has been effectively verified through experiments.
[0015] Optionally, in step 2, the client determines the result of the generated data based on the following criteria:
[0016] For each generated data, the discrimination result of the data is the output result of the discriminant model in all selected clients minus the cross entropy loss of the output result of the classification model and the generated data label, and the largest one is selected as the discrimination result of the data.
[0017] Optionally, the process of the client outputting the judgment result of the generated data according to the method is as follows:
[0018] For K clients participating in federated learning, the server combines the classification model C with the generated data in t iterations. Send to client k, where k∈K. The server generates data through the following iterative steps The judgment result:
[0019] A: Client k is any one of the K clients, which receives the generated data from the server Finally, use local data to train the classification model to obtain the updated classification model Use local data (x, y) and generated data at the same time Training the discriminative model Get the updated discriminant model
[0020] B: Client k will generate data Input classification model separately and discriminant model Get the classification results after classification and the discriminator output Calculate classification results and generate data labels The cross entropy loss is used to obtain the classification results in Finally, the client will judge the result Upload to the server;
[0021] C: The server receives the discrimination results from K clients and selects the maximum discrimination result uploaded by the client for the i-th generated data (where i∈m) As generated data The discriminant results of each generated data are used to generate the server's generation model G t Update to get G t+1 , and then proceed to the next round of iteration;
[0022] Optionally, the screening process for the generated data in step 5 is as follows:
[0023] First, the server updates the generative model and uses it to generate a batch of generated data;
[0024] The server then uses the aggregated classification model to classify the generated data, and filters out the data whose classification results are inconsistent with the preset labels of the generated data. The rest are classified as generated data for this round of updates.
[0025] Finally, the server uses the filtered data to update the aggregation model, completing this round of iteration;
[0026] Optionally, steps 4 and 5 can be replaced with other federated learning algorithm implementation processes. For example, when using the federated distillation algorithm process, step 4 is performed after the generated model meets the preset criteria, wherein the client uploads the local task model parameters and distillation results, and the distillation result is the output result of the client using the same batch of generated data on the task model before passing through the Softmax layer; in step 5, the server aggregates the client task model and distillation result respectively, and then uses the aggregated model to output the distillation result on the same generated data. Finally, the aggregated client distillation result is used as a "teacher" to guide the server aggregation model update.
[0027] Optionally, the termination condition for the generative model in step 4 is based on: using the generated data generated by the generative model to train an initialized task model, and when the task model achieves a certain result in the real test data set using the generated data, the training of the generative model is terminated.
[0028] In a second aspect, the present invention provides a federated learning method based on a distributed generative adversarial model, which, when applied on a client, comprises the following steps:
[0029] Step 1: The client receives the task model and generated data sent by the server, uses local real data and generated data to train the discrimination model, and uses local data to train the classification model, and finally uploads the generated data discrimination results;
[0030] Step 2: When the server-generated model meets the preset criteria, the client stops training the discriminant model, receives the aggregated task model from the server, and uploads the task model parameters for each iteration;
[0031] Among them, the local classification model is uploaded to the server for cyclic update until the preset conditions are met.
[0032] In a third aspect, the present invention provides a federated learning method based on a distributed generative adversarial model, which, when applied to a server, comprises the following steps:
[0033] Step 1: The server selects the client to participate in training and sends the latest generated data to the selected client;
[0034] Step 2: The server receives the discrimination result sent by the client, uses the discrimination result to update the generation model, and then executes step 1;
[0035] Step 3: When the generated model meets the preset conditions, stop executing steps 1 and 2, aggregate after receiving the client model parameters, and use the filtered generated data to train the aggregate model. Finally, select the participating clients and send the trained aggregate model to the selected clients;
[0036] Among them, when the generation model does not meet the preset conditions, steps 1 and 2 are executed in a loop. When the generation model meets the preset conditions, step 3 is executed until the task model meets the preset conditions.
[0037] Fourthly, after training is completed, the present invention will provide a generative model that can generate generative data with an approximate global distribution to train downstream tasks or a series of tasks that meet client requirements.
[0038] The beneficial effects of the present invention are as follows: The present invention provides a federated learning method based on a distributed generative adversarial model. This method uses a distributed generative adversarial network to add more data that obeys the global distribution to the original algorithm process, thereby increasing the generalization and accuracy of the model trained by the federated learning algorithm. In a further optimization scheme of the present invention, the generated data generated by the generative model is used as a public distillation data set, and a federated knowledge distillation algorithm can be used to improve the performance and stability of task model training. In the subsequent work after the present invention completes the training, the distributed generative model trained by federated learning can also be used in subsequent tasks or downstream tasks, which can increase the amount of data required for the task and provide data with an approximate global distribution to improve the generalization of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0040] Figure 1 A schematic diagram of model communication provided by the method of the present invention;
[0041] Figure 2 Schematic diagram of the process of the present invention;
[0042] Figure 3 Schematic diagram of an application example of the present invention. DETAILED DESCRIPTION
[0043] The present invention provides a method for implementing federated learning based on a distributed generative adversarial model, which is used to solve the current data island problem. Federated learning refers to the calculation process in which data owners can participate in model training and obtain the model without sharing data. Among them, this method focuses on the problems caused by data heterogeneity and insufficient data volume in federated learning. In order to enable personnel in the same technical field to better understand the technical solutions described in the present invention, and to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the present invention are further described in detail below with reference to the accompanying drawings, but the present invention can be implemented in a variety of different ways defined and covered by the claims.
[0044] Example 1:
[0045] The present invention provides a method for implementing federated learning based on a distributed generative adversarial network, which specifically includes the following steps:
[0046] Step 1: The server maintains the generated model, selects the clients to participate in the training, and sends the generated data;
[0047] like Figure 1 As shown in FIG, after selecting a client, the server maintains communication with the client and sends generated data. The model is a shared model that has a good effect on the task before starting training, such as a convolutional neural network model.
[0048] Step 2: The client uses local data to train the classification model, and uses local real data and generated data to train the discrimination model, and uploads the discrimination results of the generated data to the server;
[0049] After initializing the classification model, the client trains the model using local real data to obtain a local classification model. Simultaneously, the discriminant model parameters are initialized locally and trained using the generated data generated by the server-generated model and local real data. This ensures that the local discriminant model judges the generated data as "false" and the real data as "true."
[0050] Assume there are K clients in total, n is the total number of samples, n k To distribute the sample size on the kth client, F k is the objective function of the classification model of the kth client. k , its objective function is:
[0051]
[0052]
[0053] Among them, l i (ω) is the loss function of the model, ω ck is the classification model parameter, y i is the real data x i The label, y i ′ is the prediction result of the classification model. For general models whose optimization objective is a convex function, the gradient descent algorithm is used to find the minimum value of the objective function, that is, the optimal solution:
[0054]
[0055] Where η is the learning rate, and the classification model in the k-th client is updated using the above formula.
[0056] For the discriminant model in the client, the local real data (x, y) and the generated data sent by the server are compared. Update. The k-th client discriminant model D k The model parameter ω d k , updated by maximizing the stochastic gradient in formula (4):
[0057]
[0058] Among them, the discriminant model D k By iterating over m data, maximize the true data x i The output of while minimizing the generated data Output.
[0059] Among them, the discrimination results of the data generated in the kth client are divided into two parts, the score results of the discrimination model and the score results of the classification model. First, the score results of the discrimination model To generate data Upper discriminant model D k The direct result of the output, where i∈m. And the score result for the classification model is: each generated data Using classification model C k Classification and label generation Cross entropy loss As shown in formula (5).
[0060]
[0061] Finally, each client will generate the judgment result of the data Upload to the server and complete local iteration.
[0062] Step 3: After receiving the client's results, the server uses the discriminant results to update and iterate the generation model, and finally sends the new round of generated data to the selected client;
[0063] Among them, ω c is the parameter of the client discriminant model, and n is the total number of samples. When the server is updated in round t+1, it is updated using formula (6).
[0064]
[0065]
[0066] In a distributed generative adversarial network, when client 1 and client 2 only have data of one category x1 and x2, the discriminator output in the client is D1(x1)>>D2(x1), and similarly D2(x2)>>D1(x2). Therefore, the largest discriminator score max is selected. k D k (x) Update the generative model, that is, select the client distribution with the largest distribution of this category among all the client data distributions max k p k (x) is updated. For the update of the generative model, according to formula (7), it can be deduced that when the discriminator D of the kth client k (x) Through client data distribution p k (x) and the generator data distribution p g (x) reaches the optimal hour, It can be regarded as distributed by all clients p max (x) The optimal discriminator trained, so:
[0067]
[0068] Among them, α is a positive integer. It is proved that when p g (x) is equal to p max (x) When the objective function of the generative model reaches the minimum, the generative model training is trained through the distributed discriminant model.
[0069] Since the above-mentioned training process of the distributed generative adversarial network only trains a generative model that can generate unlabeled data, the present invention combines it with the training method of federated learning, and utilizes the task model in the federated learning training process, so that the generative model deployed on the server can generate labeled generative data, thereby improving the federated learning effect. Among them, in the present invention, the discriminant model and the classification model are used to replace the original discriminator D. k The output result of (x), when client 1 and client 2 only have one type of data (x1, y1) and (x2, y2), the output of the discriminator in the client is D1(x1)>>D2(x1), and the corresponding classification result C kThe cross entropy loss between (x1) and the original label y1 of the data, that is, the distance between the classification result and the true label, CrossEntropy[C1(x1),y1]>>CrossEntropy[C2(x1),y1]. At this time, the server selects the maximum score of each data among the K clients for each of the m generated data as the judgment result of this round:
[0070]
[0071] The server's generative model minimizes the gradient of the parameter ω in formula (10). g To update:
[0072]
[0073] After the server completes the update, it sends the new round of generated data to the client for the next iteration.
[0074] Step 4: After the client training is completed, it is uploaded to the server again until the server-generated model meets the preset standards. The training of the generation model and the discriminant model is stopped, and the client only uploads the classification model parameters each time;
[0075] Among them, when the client uses the generative model to train the classification model separately, when a certain accuracy is reached in the test set, the server stops training the generative model. The client only updates the task model through local data and uploads the task model parameters each time.
[0076] Step 5: After the server aggregates the client model parameters, it uses the filtered generated data for training and sends the trained classification model to the client as a new round of model.
[0077] The task model is updated by aggregating the update parameters obtained from the client into new update parameters. The overall goal of the task model is:
[0078]
[0079]
[0080] First, the server's screening process for generated data is as follows: After accepting all client parameters, the server executes the aggregation model parameters using formula (12). After aggregation is complete, the generated model generates a batch of unfiltered generated data. At this time, the generated data is classified using the aggregated model, and data whose classification results are consistent with the preset labels of the generated data is considered usable data. After screening, a new round of generated data is selected to train the aggregated model. The model update method is the same as that in the client, as shown in formula (3).
[0081] The server then sends the aggregate model parameters trained using the generated data to the selected client, completing this round of aggregate updates. If the federated learning preset stopping conditions are not met, steps 4 and 5 are repeated until training terminates.
[0082] Among them, the specific process of the above steps is as follows Figure 2 In this embodiment, the distributed generative adversarial model is integrated with the federated learning training process, which has a mutually reinforcing effect, improving the effect and generalization of the final federated learning model, and also training a generative model that can generate labeled data.
[0083] Example 2:
[0084] This embodiment adjusts the federated learning algorithm in Example 1 and replaces it with a knowledge distillation algorithm, thereby improving the effectiveness and stability of the original algorithm. The specific implementation steps are as follows:
[0085] Step 1: The server maintains the generated model, selects the clients to participate in the training, and sends the generated data;
[0086] Step 2: The client uses local data to train the classification model, and uses local real data and generated data to train the discrimination model, and only uploads the discrimination results of the generated data to the server;
[0087] Step 3: After receiving the client's results, the server uses the discriminant results to update and iterate the generation model, and finally sends the generated data after the new round of screening to the selected client;
[0088] For steps 1 to 3 in this embodiment, reference may be made to the relevant introduction in embodiment 1.
[0089] Step 4: After the client training is completed, it is uploaded to the server again until the server-generated model meets the preset standards. The training of the generative model and the discriminant model is stopped. The client changes to upload the classification model parameters and the output results before the Softmax layer on the task model using the same batch of generated data each time;
[0090] Step 5: The server aggregates the client model parameters as the "student" network and uses the same batch of filtered generated data to obtain the output result of the aggregated model in the layer before Softmax. The aggregated client output result is used as the "teacher" to guide the update of the aggregated student model using knowledge distillation.
[0091] The server aggregates the client output results using the following formula:
[0092]
[0093] Logitsk The output of the aggregate model before the Softmax layer is obtained for the kth client using the same batch of filtered generated data, where K is the number of clients. The server's aggregated model generates Logits' for the same batch of generated data, making Logits' increasingly close to Logits, thereby learning the knowledge contained in each client.
[0094] In this embodiment, the method of generating data replaces the process of data collection or public data set in federated knowledge distillation. Compared with the method of collecting data, the data generated by the method of the present invention is closer to the overall true distribution results, which is conducive to the federated learning model to learn more overall generalization results.
[0095] Example 3
[0096] After completing federated learning training, the generative model can be used to train downstream tasks. By inputting noise and random labels that conform to a Gaussian distribution into the generative model, the model generates corresponding labeled data for use in downstream tasks.
[0097] The present invention takes the public data set FashionMNSIT as an example, divides the public data into 10 clients without overlap according to Dirichlet Distribution, and uses parameter α as the degree to which the client data sets are non-independent and identically distributed. When a is larger, the probability of the client data sets being non-independent and identically distributed is smaller. The task model in the present invention uses a multi-layer convolutional neural network model (CNN), the generation model is the conditional deep convolutional generative adversarial network (cDCGAN), and the discriminant model is selected as the deep convolutional generative adversarial network (DCGAN) for practical application. The specific structure is as follows: Figure 3 shown.
[0098] The method described in the present invention is widely applicable to various application scenarios of cross-island problems. For example, a certain disease has different symptoms in different medical institutions. Comprehensive consideration of all symptoms of the disease is conducive to improving the treatment effect. In addition, anti-fraud data also has different manifestations in different financial institutions. Due to policy and legal regulations, the data privacy of financial institutions needs to comply with the requirements of regulatory authorities. It is of great significance for financial institutions to establish an effective anti-fraud model while complying with regulations. In response to the above-mentioned cross-island problem, a federated learning method based on a distributed adversarial generative model is used to establish a federated model. It can connect scattered financial or medical institution nodes, reuse data from multiple parties to establish an effective federated learning model to solve practical problems, and use generated data to improve the performance and generalization of the federated model. Finally, the generated model is retained to facilitate subsequent research work.
[0099] An embodiment of the present invention further provides a storage medium storing a computer program that, when executed by a processor, implements some or all of the steps of each embodiment of the method for federated learning based on a distributed generative adversarial model provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0100] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention or certain portions of the embodiments.
[0101] The above-described embodiments of the present invention do not limit the protection scope of the present invention.
Claims
1. A federated learning method based on a distributed generative adversarial model, characterized in that: include: Generate adversarial models for training in a distributed environment, with the server equipped with a generative model and the client equipped with a discriminative model and a classification model for performing specific tasks. The server's generative model generates generated data, and sends the generated data to the client; The client updates the classification model and the discrimination model using local data and the generated data, and sends the discrimination result of the generated data to the server; The server updates the generation model according to the discrimination result; The server determines whether the generated data generated by the updated generation model meets the preset termination condition; If the generated data generated by the updated generation model does not meet the preset termination condition, jump to the step of sending the generated data to the client and thereafter; If the generated data produced by the updated generative model meets the preset termination conditions, the federated learning training process is carried out using the generative model; In the step where the client updates the classification model and the discrimination model using the local data and the generated data, and sends the discrimination result of the generated data to the server, the client determines the discrimination result of the generated data based on the following: The discrimination result of each generated data is the output of the discriminant model among all selected clients minus the cross entropy loss of the output of the classification model and the generated data label. The largest one is selected as the discrimination result of the data. The client outputs the generated data to judge the process of obtaining the judgment result as follows: For K clients participating in federated learning, the server combines the classification model C with the generated data in t iterations. Send to client k, where k∈K, the server generates data through the following iterative steps The judgment result: Client k is any one of the K clients, and after receiving the classification model C from the server t and generate data Finally, use local data to train the classification model to obtain the updated classification model Use local data (x, y) and generated data at the same time Training the discriminative model Get the updated discriminant model Client k will generate data Input classification model separately and discriminant model Get the classification results after classification and the discriminator output Calculate classification results and generate data labels The cross entropy loss is used to obtain the classification results in Finally, the client will judge the result Upload to the server; The server receives the discrimination results from K clients, and for the i-th generated data, where i∈m, selects the maximum discrimination result uploaded by the client As generated data The discriminant results of each generated data are used to generate the server's generation model G t Update to get G t+1 , and then proceed to the next round of iteration; The preset termination condition is: using the generated data generated by the generative model to train an initialized task model, and when the task model achieves a predetermined result in a real test data set using the generated data, the training of the generative model is terminated; The federated learning training process using a generative model includes: the server aggregates the client model parameters after receiving them, and uses the filtered generated data to train the aggregated model. Finally, the server selects the participating clients and sends the trained aggregated model to the selected clients. The screening process for generated data is as follows: The server updates the generation model and uses the generation model to generate a batch of generated data; The server uses the aggregated classification model to classify the generated data, and filters out the data whose classification results are inconsistent with the preset labels of the generated data. The rest are classified as generated data for this round of updates; The server uses the filtered data to update the aggregation model and complete this round of iteration.