Method for processing federal learning data heterogeneity based on conditional generative adversarial network
By using a conditionally generated adversarial network method in federated learning, the problem of instability in model training under non-independent homogeneous data conditions is solved, and higher generalization capabilities and performance are achieved, while ensuring data privacy.
Patent Information
- Application Number
- CN202411905625.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-25
AI Technical Summary
Under the conditions of non-independent and homogeneous data distribution, the federated learning model training is unstable, and it is prone to problems such as pattern crashes, gradient vanishing and overfitting, and the global model performs poorly on different client data.
The method of generating an adversarial network based on conditions is adopted, and the most suitable generator is allocated to each client through the global server, supplement the missing data samples locally, build a complete local data set, and dynamically adjust the proportion of client contributions during model aggregation on the server side.
It significantly improves the training stability of the generative adversarial network, solves the problems of pattern crash and gradient vanishing, improves the generalization ability and performance of the global model, and guarantees the privacy of client data.
Smart Images

Figure CN119885222A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a method for processing heterogeneous federated learning data based on a conditional generative adversarial network. Background Art
[0002] With the widespread deployment of IoT devices, people are increasingly concerned about data privacy and information security. As an emerging distributed machine learning technology, federated learning aims to address data leakage and privacy protection issues. Federated learning has been widely used in multiple scenarios involving sensitive data, such as training diagnostic models in the healthcare field and predicting stock risks in the financial field. In these scenarios, patient and user data are confidential and cannot be shared.
[0003] Research has shown that under the condition of independent and identically distributed data, the model trained by federated learning performs well on all clients. However, in practical applications, the global model of federated learning is trained based on the local model on the data set of each client. There are inconsistencies in the data of different clients, resulting in an uneven distribution of overall data among the clients. This difference makes the optimization of the local model tend to the local optimum rather than the global optimum, resulting in the model performing well on the local data set but poorly on the data of other clients. As a result, the effect of the global model will be reduced. Therefore, how to develop a federated learning framework that can train a high-performance global model with strong generalization ability under the condition of non-independent and identically distributed data has become a key challenge.
[0004] To address the instability of federated model training and data privacy protection under non-IID conditions, a variety of methods have been proposed, including aggregation algorithm optimization, differential privacy, data augmentation, and data sharing. Among them, the most direct way to deal with non-IID data is to convert the original data into IID by generating new data. In this context, generative adversarial networks have been proven to be a powerful and feasible model. Through adversarial training between the generator and the discriminator, generative adversarial networks can be iteratively improved to meet task requirements. However, generative adversarial networks are highly dependent on the quality and diversity of training data, which is usually lacking in federated learning. Therefore, in a non-IID federated environment, generative adversarial networks are often unstable and prone to problems such as mode collapse, gradient vanishing, and overfitting. Therefore, it is urgent to provide a method for adversarial networks to deal with non-IID data in federated learning to improve the above defects. Summary of the invention
[0005] In order to solve the above problems existing in the prior art, the present invention provides a method for processing heterogeneous federated learning data based on conditional generative adversarial networks. The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0006] In a first aspect, the present invention provides a method for processing heterogeneous federated learning data based on a conditional generative adversarial network, comprising:
[0007] The global server encrypts the initial global model parameters to obtain first encrypted data, and sends the first encrypted data to each client;
[0008] Each client decrypts the first encrypted data, uses the obtained initial global model parameters as the initial parameters of the initial local model of each client, and uses the respective local data sets to train the initial local model to generate local model parameters, build the local model of each client, and encrypt the local model parameters of each client to obtain second encrypted data, which is sent to the global server;
[0009] The global server decrypts the second encrypted data, obtains appropriate generator parameters corresponding to the missing data sample categories of each client according to the local model parameters of each client, encrypts the data, obtains third encrypted data, and sends the data to each client;
[0010] Each client decrypts the third encrypted data, uses the obtained appropriate generator parameters as the generator parameters of the local model to generate missing data samples, supplements the local training data set, trains the local model using the supplemented local training data set, generates updated local model parameters, encrypts the data, obtains fourth encrypted data, and sends the data to the global server;
[0011] The global server decrypts the fourth encrypted data, aggregates the updated local model parameters of each client, and obtains updated global model parameters, until the global server obtains a global model with data features of all clients.
[0012] Beneficial effects of the present invention:
[0013] The present invention provides a method for processing heterogeneous federated learning data based on a conditional generative adversarial network. In the first stage, considering the impact of the heterogeneity of client data sets on local model training, different loss calculation weight ratios are set for sample data of different categories when training each local model, and the most suitable generator is allocated to different clients through the server to supplement the missing data samples locally and build a complete local data set. In the second stage, when the server-side model is aggregated, the contribution ratio of different clients during model aggregation is dynamically adjusted according to the time factor. Through the combination of these two-stage training, the training stability of the generative adversarial network is significantly improved under the condition of non-independent and identically distributed data, and the problems of mode collapse and gradient vanishing that are prone to occur in the model in the existing method are effectively solved. At the same time, under the premise of ensuring the privacy of client data, the present invention improves the generalization ability of the global model and achieves better performance.
[0014] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic diagram of a system for processing heterogeneous federated learning data based on a conditional generative adversarial network provided by an embodiment of the present invention;
[0016] Figure 2 It is a flow chart of a method for processing heterogeneous federated learning data based on a conditional generative adversarial network provided by an embodiment of the present invention;
[0017] Figure 3 It is a schematic diagram of global model and local model training provided by an embodiment of the present invention;
[0018] Figure 4 It is a schematic diagram of a global model and a local model framework provided by an embodiment of the present invention;
[0019] Figure 5 It is a schematic diagram of the change of FID score curves of samples generated by different categories provided by an embodiment of the present invention;
[0020] Figure 6 It is a schematic diagram comparing the loss changes of the generator and the discriminator provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0022] See also Figure 1 , Figure 1 This is a schematic diagram of a system for processing heterogeneous federated learning data based on a conditional generative adversarial network provided by an embodiment of the present invention. The system includes a global server and multiple clients. Each client interacts with the global server. During the interaction, data is transmitted in an encrypted form, which greatly enhances the security and privacy of the data, so that the method can operate in a strict data protection regulatory environment. Specifically:
[0023] Each client generates its own first key, which includes a private key and a public key. Each client sends its own public key of the first key to the global server. The global server encrypts the data sent to each client using the public key of the first key to obtain encrypted data. Each client decrypts the encrypted data from the global server using its own private key of the first key.
[0024] The global server generates a second key, which includes a private key and a public key. The global server sends the public key of the second key to each client. Each client uses the public key of the second key to encrypt the data sent to the global server to obtain encrypted data. The global server uses the private key of the second key to decrypt the encrypted data from each client.
[0025] The ultimate goal of this system is to aggregate a global model that can reflect the characteristics of all client data without the global server accessing the client data.
[0026] See also Figures 2 to 4 , Figure 2 is a flow chart of a method for processing heterogeneous federated learning data based on a conditional generative adversarial network provided by an embodiment of the present invention. Figure 3 is a schematic diagram of global model and local model training provided by an embodiment of the present invention, Figure 4 is a schematic diagram of a global model and a local model framework provided by an embodiment of the present invention. A method for processing heterogeneous federated learning data based on a conditional generative adversarial network provided by the present invention includes:
[0027] S101. The global server encrypts initial global model parameters to obtain first encrypted data, and sends the first encrypted data to each client.
[0028] Specifically, the global server generates a pair of keys (gpk, gsk) and sends the public key gsk to each client. Each client generates a pair of keys (cpk i ,csk i ), i represents the client index, and the public key csk i Sent to the global server, the global server uses the public key csk i The initial global model parameters are encrypted to obtain first encrypted data, which is then sent to each client.
[0029] S102. Each client decrypts the first encrypted data, uses the obtained initial global model parameters as the initial parameters of the initial local model of each client, and uses their own local data sets to train the initial local model to generate local model parameters, build the local model of each client, and encrypt the local model parameters of each client to obtain second encrypted data, which is sent to the global server.
[0030] Specifically, in this embodiment, each client uses its own private key cpk i The first encrypted data is decrypted to obtain the initial global model parameters; in addition, each client uses the public key gsk to encrypt its own local model parameters to obtain the second encrypted data.
[0031] In this embodiment, the process of acquiring the local data set of each client includes:
[0032] Get multiple images and normalize the pixel values of the images to [0, 1]. Optionally, normalize the pixel values of the images from 0 to 255 to [0, 1]. Normalization is achieved by dividing each pixel value by 255. The purpose of normalization is to ensure that the data distribution is suitable for model training.
[0033] Label the images and convert the image labels into one-hot encoding; optionally, represent each image label (0-9) as a 10-dimensional vector to facilitate classification tasks;
[0034] Use the normalized images as real data samples to construct a local data set; wherein the local data sets corresponding to each client include real data samples of different categories; optionally, divide the constructed local data set into small batch data sets for training to reduce training memory and accelerate the gradient calculation of the model.
[0035] In this embodiment, the training of the local model and the global model is divided into two stages. In the first stage, the main purpose is for each client to build a complete local data set; specifically, each client sets the parameters θ of the local training generator Gi , Similarity measure Similarity i And the distribution Y of the categories of real samples in the local dataset i After encryption with the public key gsk, it is sent to the global server. After decryption with the private key gpk, the global server selects appropriate generator parameters for each client based on the data uploaded by each client, using the public key csk i After encryption, it is sent to each client, and each client uses the private key cpk i After decryption, load the appropriate generator parameters to generate missing data samples, merge the missing data samples into the local data set, build a complete local data set, and retrain the local model to complete the first stage of training. In the second stage, the main purpose is for the global server to obtain a global model with the data characteristics of all clients through multiple rounds of training; specifically: each client encrypts the updated local model parameters with the public key gsk and sends it to the global server. The global server decrypts it with the private key gpk, aggregates the local model parameters of each client to update the global model, and after multiple rounds of training, the second stage of training is achieved. In this embodiment, a two-stage training strategy for a federated generative adversarial network is proposed. By incorporating fuzzy logic to process uncertain data, stable training of the federated generative adversarial network under non-independent and identically distributed data conditions is ensured, while improving the generalization performance and convergence speed of the model.
[0036] In the first phase, for the i-th client C i , the client is equipped with its own discriminator and generator (G i ,D i ), and a local dataset P data,i , the client decrypts the first encrypted data received and obtains the initial global model parameters (θ G ,θ D );
[0037] The i-th client C i The initial global model parameters (θ G ,θ D ) as the initial parameters of the initial local model, using the local dataset P data,i , train the initial local model, the generator of the local model is from the Gaussian noise distribution P z ~{z1,...,z m} to obtain synthetic data samples Constructing synthetic datasets;
[0038] The synthetic data samples in the synthetic dataset Compared with the real data samples in the local data set Merge and input into the discriminator of the local model for training, the expression is:
[0039]
[0040] in, represents the loss function of the discriminator, p data,i Represents the i-th client C i The local dataset, D i (x|y) represents the probability that the discriminator classifies sample x as real and consistent with label y, p z represents the input noise distribution of the generator, G i (z|y) represents the synthetic data sample generated by the generator from the noise z under the condition of label y, represents the weight, reflecting the contribution of sample j belonging to category y to the overall loss calculation, m represents the total number of truly generated samples, and E represents the expectation;
[0041] After the discriminator training is completed, the generated sample D is fed back to the generator i (G i (z)|y), the generator generates samples according to D i (G i (z)|y), update the parameters of the generator, and its expression is:
[0042]
[0043] in, represents the loss function of the generator, t represents the current training round, represents the synthetic data samples generated according to the noise z;
[0044] According to the updated parameters of the generator, a trained generator is constructed to output the distribution Y of the categories of real samples in the local dataset i ;
[0045] By evaluating the similarity between synthetic data samples and real data samples, we can get the similarity measure Similarity i ~{sy1,...,sy m}, its expression is:
[0046]
[0047] in, Represents a synthetic data sample The eigenvector of f(x u |y u ) represents the real data sample x u The feature vectors of u is the condition, n0 represents the number of synthetic data samples in a batch, ‖·‖ represents the norm, and B represents the total number of batches;
[0048] The i-th client C i The local model parameters Similarity i And the distribution Y of the categories of real samples in the local dataset i as local model parameters.
[0049] In this embodiment, taking into account the differences in the categories of different data samples of each client, according to the category differences of the real data samples in the local data sets of each client, the weighted contribution of the loss function is designed based on the amount of data of different categories to reflect the scale and importance in the loss assessment. The weight of the loss function w y ~{w1,...,w l}, its expression is:
[0050]
[0051] Among them, w y It represents the contribution of sample data category y to the overall loss calculation, and l represents the total number of true sample data categories.
[0052] S103. The global server decrypts the second encrypted data, obtains appropriate generator parameters of each client according to the local model parameters of each client, encrypts the data, obtains third encrypted data, and sends the data to each client.
[0053] Specifically, in this embodiment, the global server uses the private key gpk to decrypt the second encrypted data, and uses the public key csk i The optimal generator parameters of each client are encrypted to generate third encrypted data.
[0054] In this embodiment, the global server decrypts the second encrypted data to obtain the generator parameters of each client. Similarity i And the distribution Y of the categories of real samples in the local dataset i ;
[0055] The global server calculates the distribution Y of the categories of real samples in the local dataset of each client. i ~{y1,...,y m}, determine the category label Y of the missing data samples in the local data set of each client lack,i , based on the similarity measure Similarity of all clients i , select the appropriate generator parameters corresponding to the missing data sample category for each client; where the corresponding sample similarity measure Similarity i The higher it is, the better the quality of the generated samples.
[0056] It is understandable that the global server is based on the i-th client C i The distribution of the categories of real samples in the local dataset Y i ~{y1,...,y m}, determine the client C i The global server determines which clients’ local datasets have missing data sample category labels based on the distribution of real sample categories in the local datasets of other clients, and then uses the similarity measure Similarity for the missing data sample categories of these clients. i , select the appropriate generator parameters to generate the missing data sample; where the similarity measure Similarity i The larger it is, the stronger the ability to generate the missing data samples is. In this way, appropriate generator parameters are selected for each client, and each client loads the appropriate generator parameters to generate the missing data samples in the local dataset of the client to build a complete local dataset.
[0057] In this embodiment, by using fuzzy rules, the most suitable generator is selected according to the individual data requirements of each client, thereby achieving local data enhancement of the client while protecting user privacy.
[0058] S104. Each client decrypts the third encrypted data, uses the obtained appropriate generator parameters as the generator parameters of the local model to generate missing data samples, supplements them to the local training data set, uses the supplemented local training data set to train the local model, generates updated local model parameters, encrypts them, obtains fourth encrypted data, and sends them to the global server.
[0059] Specifically, in this embodiment, each client uses a private key cpk i The third encrypted data is decrypted, and the updated local model parameters are encrypted using the public key gsk to obtain fourth encrypted data.
[0060] In this embodiment, for the i-th client C i , decrypt the third encrypted data to obtain appropriate generator parameters corresponding to the missing data sample category of the client;
[0061] The i-th client C i Use the appropriate generator parameters as the local model generator parameters to generate supplementary data samples X lack,i , the supplementary data sample X lack,i With real data samples Merge, as a supplementary local dataset To supplement the data sample categories missing in the local dataset;
[0062] The i-th client C i Using supplementary local datasets Train the local model and update the local model parameters. The updated local model parameters include the generator parameters. Discriminator parameters
[0063] S105. The global server decrypts the fourth encrypted data, aggregates the updated local model parameters of each client, and obtains updated global model parameters.
[0064] Specifically, in this embodiment, the global server uses the private key gpk to decrypt the fourth encrypted data and the public key csk i The updated global model is encrypted to obtain fifth encrypted data.
[0065] In this embodiment, the global server decrypts the fourth encrypted data to obtain updated local model parameters of each client;
[0066] Global server gets loss-based aggregation weights Its expression is:
[0067]
[0068] in, represents the generator loss, represents the discriminator loss, N represents the total number of clients;
[0069] Taking into account the difference in data volume between each client, the global server obtains the weight based on the data volume Balance The introduced deviation is expressed as:
[0070]
[0071] in, Indicates the updated local dataset size
[0072] To ensure that clients with larger datasets in early training rounds play a more critical role, a dynamic control parameter λ(t) is introduced, whose value decreases with the increase of training round t, so that the global model relies more on high-performance generators in the later stages of training. and weights based on the amount of data Get the generator and discriminator aggregate weights w i (t), its expression is:
[0073]
[0074] The global server aggregates the weights w using the generator and discriminator i (t), aggregate the generator and discriminator to obtain the parameters of the updated global model, including the parameters of the generator global and the global discriminator parameter, whose expression is:
[0075]
[0076] in, represents the generator parameters, Represents the discriminator parameters.
[0077] In this embodiment, the expression of the dynamic control parameter λ(t) is:
[0078]
[0079] Among them, ρ is the coefficient that controls the degree of smoothness, t is the current training round, and T is the training round.
[0080] Specifically, in this embodiment, by introducing a time factor and combining the client model loss with the data set size, the aggregation weights are dynamically calculated for different clients.
[0081] In summary, the present invention provides a method for processing heterogeneous federated learning data based on a conditional generative adversarial network. In the first stage, considering the impact of the heterogeneity of client data sets on local model training, different loss calculation weight ratios are set for sample data of different categories when training each local model, and the most suitable generator is allocated to different clients through the server to supplement the missing data samples locally and build a complete local data set. In the second stage, when the server-side model is aggregated, the contribution ratio of different clients during model aggregation is dynamically adjusted according to the time factor. Through the combination of these two-stage training, the training stability of the generative adversarial network is significantly improved under the condition of non-independent and identically distributed data, and the problems of mode collapse and gradient vanishing that are prone to occur in the model in the existing method are effectively solved. At the same time, under the premise of ensuring the privacy of client data, the present invention improves the generalization ability of the global model and achieves better performance.
[0082] In an optional embodiment of the present invention, alternative optimization algorithms such as Adam or RMSprop may be used to adapt to the training requirements of different models.
[0083] In an optional embodiment of the present invention, different network structures of generators and discriminators may be designed for different data sets, such as using different numbers of layers or different types of convolutional layers, pooling layers, normalization layers, etc.
[0084] In an optional embodiment of the present invention, the design of the generator and the discriminator can introduce a multi-scale or multi-path structure to improve the adaptability and processing efficiency of the network to complex data structures.
[0085] In an optional embodiment of the present invention, the normalization process of the data may be replaced by Z-score normalization or minimum-maximum scaling method to improve the distribution adaptability of the data.
[0086] In an optional embodiment of the present invention, the processing of data labels can adopt label embedding technology or other advanced label representation methods to optimize the effect of the classification task.
[0087] In an optional embodiment of the present invention, the effect of the method for processing heterogeneous federated learning data based on a conditional generative adversarial network provided in the above embodiment is verified by simulation experiments, specifically:
[0088] 1. Simulation conditions
[0089] Simulation experiment conditions of this embodiment: The experiment was conducted on a machine running Ubuntu 20.04, with Python 3.10, PyTorch 2.4.0, and CUDA 11.8. The machine was equipped with an Intel(R) Xeon(R) Platinum 8260 CPU @ 2.30 GHz processor and an NVIDIA Tesla P100-16GB GPU.
[0090] 2. Simulation content and result analysis
[0091] The generator and discriminator of each client share the same hyperparameters and initialization settings. The generator receives an input of size 110, which is converted to a 512*3*3 tensor through a fully connected layer, and then resizes the output to 256*7*7, 128*14*14, 64*28*28 through four deconvolution layers, and finally generates an image of size 1*28*28. The discriminator receives an image input of size 1*28*28, resizes the feature size to 64*14*14, 128*7*7, 256*4*4, and 512*4*4 through four convolutional layers, and finally outputs a vector of size 8192 through a fully connected layer. During initialization, the convolutional layer and the transposed convolutional layer are initialized with a normal distribution with a mean of 0 and a standard deviation of 0.02, and the batch normalization layer is initialized with a normal distribution with a mean of 1 and a standard deviation of 0.02. Both the generator and the discriminator use the SCD optimizer with a learning rate of 0.0002 and a momentum of 0.5. The noise input of the generator comes from a standard Gaussian distribution N(0, 1).
[0092] See also Figure 5 and Figure 6 , Figure 5 : is a schematic diagram of the change of the Fréchet Inception Distance (FID) score curve of different categories of generated samples provided by an embodiment of the present invention, Figure 6 is a schematic diagram comparing the loss changes of the generator and the discriminator provided by an embodiment of the present invention, Figure 5The figure shows the changing trend of the FID scores of samples of different categories generated by the method proposed in the present invention in each round, which intuitively reflects the improvement of the generation quality of each category during the training process. Through experimental verification, it can be observed that the FID scores of each category decrease significantly and tend to be stable after the increase of training rounds, reflecting the effectiveness of the generation model in improving the generation quality. As can be seen from the figure, the FID scores of most categories are high in the initial round (Round1), indicating that the generation quality of the generation model is low in the early stage of training. However, as the number of training rounds increases, the FID scores of each category decrease rapidly and gradually converge. This trend shows that the generation ability of the generation model continues to improve as the training progresses until it reaches a convergence state. Starting from around the 4th round, the FID scores of all categories remain basically at a low level, showing a stable generation quality.
[0093] Figure 6 The loss curves of the generator and discriminator of the method proposed in the present invention and the comparative method under different training rounds are shown in FIG. Through experimental verification, the convergence speed and fluctuation of the generator and discriminator losses of the method proposed in the present invention and the comparative method can be intuitively observed. As can be seen from the figure, the generator (solid triangle mark) of the method proposed in the present invention shows a higher loss value at the beginning of training, but as the number of training rounds increases, the generator loss decreases rapidly and tends to be stable, indicating that the model generation ability is gradually improved and reaches a convergence state. In contrast, the loss of the generator (dashed triangle mark) of the comparative method shows greater fluctuations and a slower convergence speed, indicating that the generator of this method is more difficult to train stably under the condition of non-independent and identically distributed data. In terms of discriminator loss, the discriminator (solid dot mark) of the method proposed in the present invention also shows a more stable downward trend, and the loss value quickly tends to be stable. In contrast, the loss curve of the discriminator (dashed dot mark) of the comparative method shows greater fluctuations, especially in the middle and late stages of training, the loss fails to remain stable, indicating that its ability to discriminate generated samples is not as good as that of the method proposed in the present invention.
[0094] Through the above experimental data and comparative analysis, the following beneficial effects can be obtained:
[0095] 1. Convergence speed: The proposed method is significantly better than the comparison method in terms of loss convergence speed of the generator and discriminator. This shows that the proposed method can improve model performance more quickly under the condition of non-independent and identically distributed data, thereby reducing training time and resource consumption.
[0096] 2. Stability: The proposed method has a small fluctuation in loss during the training process, especially in the later stage of training, the loss of the generator and discriminator and the FID score are kept at a relatively stable level. The lower volatility improves the robustness of the model, allowing the generator and discriminator to maintain efficient operation in a complex data environment.
[0097] 3. Generalization ability: The stable loss curve and the lower FID score curve also indirectly indicate that the proposed method has better generalization ability, can effectively perform model training in a non-independent and identically distributed data environment, and is suitable for privacy-sensitive distributed data scenarios.
[0098] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant is intended to cover non-exclusive inclusion, so that the article or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the article or device including the elements. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The orientation or position relationship indicated by "up", "down", "left", "right", etc. is based on the orientation or position relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention.
[0099] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification.
[0100] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A method for processing heterogeneous federated learning data based on conditional generative adversarial networks, characterized in that: include: The global server encrypts the initial global model parameters to obtain first encrypted data, and sends the first encrypted data to each client; Each of the clients decrypts the first encrypted data, uses the obtained initial global model parameters as initial parameters of the initial local model of each client, and uses respective local data sets to train the initial local model to generate local model parameters, builds the local model of each client, and encrypts the local model parameters of each client to obtain second encrypted data, and sends the second encrypted data to the global server; The global server decrypts the second encrypted data, obtains appropriate generator parameters corresponding to the missing data sample categories of each client according to the local model parameters of each client, encrypts the data, obtains third encrypted data, and sends the third encrypted data to each client; Each client decrypts the third encrypted data, uses the obtained appropriate generator parameters as generator parameters of the local model to generate missing data samples, supplements the local training data set, trains the local model using the supplemented local training data set, generates updated local model parameters, encrypts the data, obtains fourth encrypted data, and sends the fourth encrypted data to the global server; The global server decrypts the fourth encrypted data, aggregates the updated local model parameters of each client, and obtains updated global model parameters, until the global server obtains a global model with data features of all clients.
2. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1 is characterized in that: Both the local model and the global model are conditional generative adversarial networks, and the conditional generative adversarial network includes a discriminator and a generator.
3. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1 is characterized in that: Also includes: Each client generates its own first key, which includes a private key and a public key. Each client sends its own public key of the first key to the global server. The global server encrypts data sent to each client using the public key of the first key to obtain encrypted data. Each client decrypts the encrypted data from the global server using its own private key of the first key. The global server generates a second key, which includes a private key and a public key. The global server sends the public key of the second key to each of the clients. Each of the clients uses the public key of the second key to encrypt data sent to the global server to obtain encrypted data. The global server uses the private key of the second key to decrypt the encrypted data from each of the clients.
4. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1 is characterized in that: The process of acquiring the local data set of each client includes: Acquire multiple images, and normalize pixel values of the images to [0, 1]; Annotate the image and convert the image label into a one-hot encoding form; The normalized images are used as real data samples to construct local data sets; wherein the local data sets corresponding to each client include real data samples of different categories.
5. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1, characterized in that: Each client decrypts the first encrypted data, uses the obtained initial global model parameters as initial parameters of the initial local model of each client, and uses respective local data sets to train the initial local model to generate local model parameters, and constructs the local model of each client, including: For the i-th client C i , decrypt the received first encrypted data to obtain the initial global model parameters (θ G ,θ D ); The i-th client C i The initial global model parameters (θ G ,θ D ) as the initial parameters of the initial local model, using the local dataset P data,i , train the initial local model, the generator of the local model is from the Gaussian noise distribution P z ~{z1,...,z m } to obtain synthetic data samples Constructing synthetic datasets; The synthetic data samples in the synthetic data set The real data samples in the local data set Merge and input into the discriminator of the local model for training, the expression is: in, represents the loss function of the discriminator, p data,i Represents the i-th client C i The local dataset, D i (x|y) represents the probability that the discriminator classifies sample x as real and consistent with label y, p z represents the input noise distribution of the generator, G i (z|y) represents the synthetic data sample generated by the generator from the noise z under the condition of label y, represents the weight, reflecting the contribution of sample j belonging to category y to the overall loss calculation, m represents the total number of real generated samples, and E represents the expectation; After the discriminator training is completed, the generated sample discrimination result D is fed back to the generator i (G i (z)|y), the generator judges the result D according to the generated sample i (G i (z)|y), update the parameters of the generator, the expression is: in, represents the loss function of the generator, t represents the current training round, represents a synthetic data sample; According to the updated parameters of the generator, a trained generator is constructed to output the distribution Y of the categories of the real samples in the local dataset i ; By evaluating the similarity between the synthetic data sample and the real data sample, a similarity measure Similarity is obtained. i ~{sy1,...,sy m }, its expression is: in, Represents a synthetic data sample The eigenvector of f(x u |y u ) represents the real data sample x u The feature vectors of u is the condition, n0 represents the number of synthetic data samples in a batch, ‖·‖ represents the norm, and B represents the total number of batches; The i-th client C i The local model parameters θ Gi , the similarity measure Similarity i And the distribution Y of the categories of real samples in the local dataset i as upload parameters.
6. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 5 is characterized in that: Also includes: According to the category differences of the real data samples in the local data sets of each client, the weight w of the loss function is obtained y ~{w1,...,w l }, its expression is: Among them, w y It represents the contribution of sample data category y to the overall loss calculation, and l represents the total number of true sample data categories.
7. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1, characterized in that: The global server decrypts the second encrypted data and obtains appropriate generator parameters of each client according to the local model parameters of each client, including: The global server decrypts the second encrypted data to obtain the generator parameters of each client. The generated sample similarity measure Similarity i And the distribution Y of the categories of real samples in the local dataset i ; The global server is based on the distribution Y of the categories of real samples in the local data sets of each client. i ~{y1,...,y m }, determine the category label Y of the missing data samples in the local data set of each client lack,i , based on the similarity measure Similarity of all clients i , select appropriate generator parameters corresponding to the missing data sample category for each client.
8. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1, characterized in that: Each client decrypts the third encrypted data, uses the obtained appropriate generator parameters as generator parameters of the local model to generate missing data samples, supplements them to the local training data set, trains the local model using the supplemented local training data set, and generates updated local model parameters, including: For the i-th client C i , decrypting the third encrypted data to obtain appropriate generator parameters corresponding to the missing data sample category of the client; The i-th client C i The appropriate generator parameters are used as local model generator parameters to generate supplementary data samples X lack,i , the supplementary data sample X lack,i With real data samples Merge, as a supplementary local dataset The i-th client C i Using supplementary local datasets Train the local model and update the local model parameters. The updated local model parameters include the generator parameters. and the discriminator parameters 9. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 1, characterized in that: The global server decrypts the fourth encrypted data, aggregates the updated local model parameters of each client, and obtains an updated global model, including: The global server decrypts the fourth encrypted data to obtain updated local model parameters of each client; The global server obtains the loss-based aggregate weights Its expression is: in, represents the generator loss, represents the discriminator loss, N represents the number of clients; The global server obtains a weight based on the amount of data Its expression is: in, Indicates the updated client i dataset size Introduce a dynamic control parameter λ(t) based on the loss aggregation weight and aggregation weights based on data volume Get the global aggregate weights w of the generator and discriminator i (t), its expression is: The global server aggregates the weights w using the generator and discriminator i (t), aggregate the generator and discriminator to obtain the parameters of the updated global model, including the parameters of the generator global and the global discriminator parameter, whose expression is: in, represents the generator parameters, Represents the discriminator parameters.
10. The method for processing heterogeneous federated learning data based on conditional generative adversarial networks according to claim 9, characterized in that: The expression of the dynamic control parameter λ(t) is: Among them, ρ represents the coefficient that controls the degree of smoothness, t represents the current training round, and T represents the total training rounds.
Citation Information
Cited By
Label data expansion method and platform applied to retail scene and storage medium
CN120316273A
Distributed rehabilitation data analysis method based on federal learning
CN121768631A