A federated learning method, device and electronic device based on global model optimization

By updating the global model parameters in the federated learning system and using pseudo data to optimize the global model, the problem of insufficient local model optimization in the existing technology is solved and the model performance is improved.

CN114818510BActive Publication Date: 2024-09-20JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210541875.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-17
Publication Date
2024-09-20
Estimated Expiration
2042-05-17

AI Technical Summary

Technical Problem

Existing data-free knowledge distillation methods only optimize local models, resulting in errors within local models in heterogeneous data scenarios, resulting in model performance degradation during knowledge distillation, and lack of methods to optimize global models in federated learning.

Method used

By randomly selecting at least one client as the target client in the federated learning system, sending initial global parameters, receiving and updating local parameters, generating pseudo data, updating global model parameters based on pseudo data and local parameters, and optimizing the global model. Specific steps include updating global model parameters based on local model parameters, client state differences and the number of data sets, and generating pseudo data through generator parameters for backpropagation updates.

Benefits of technology

It effectively optimizes the global model in federated learning, improves model performance, and solves the problem of model performance degradation during the knowledge distillation process caused by data heterogeneity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114818510B
    Figure CN114818510B
Patent Text Reader

Abstract

The present disclosure provides a federated learning method, device and electronic device based on global model optimization, the method comprising: randomly selecting at least one client as a target client, and sending initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c; receiving local parameters sent by the target client, wherein the local parameters are generated by the target client through training a local model according to the initial global parameters; updating the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the generator parameters θ in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω, so as to achieve the effect of optimizing the global model in federated learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a federated learning method, device and electronic device based on global model optimization. Background Art

[0002] In recent years, artificial intelligence technology has become increasingly dependent on large amounts of training data. As data management policies in various countries gradually improve, direct aggregation and access to private data have been gradually prohibited by many industries. In this context, federated learning consisting of global models and local models has been proposed. One of the main difficulties of federated learning is data heterogeneity. In order to cope with data heterogeneity, a data-free knowledge distillation method has been proposed.

[0003] The current data-free knowledge distillation method only optimizes the local model, which leads to erroneous knowledge in the local model in data heterogeneous scenarios, thus causing the model performance to degrade during the knowledge distillation process. Therefore, optimizing the global model in federated learning is an important issue that needs to be solved in the industry. Summary of the invention

[0004] The present disclosure provides a federated learning method based on global model optimization, which is used to solve the defect of the prior art that there is a lack of optimization of the global model in federated learning, and achieve the effect of optimizing the global model in federated learning.

[0005] The present disclosure provides a federated learning based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and a plurality of clients, the server is provided with a global model, and the clients are provided with a local model;

[0006] The method is applied to a server and includes:

[0007] Randomly select at least one client as a target client, and send initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c;

[0008] Receiving local parameters sent by the target client, wherein the local parameters are generated by the target client through training the local model according to the initial global parameters;

[0009] Update the global model parameter ω and the server state c in the global model according to the local parameter;

[0010] Generate pseudo data according to the generator parameter θ, update the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and output the updated global model parameter ω.

[0011] According to a federated learning method based on global model optimization provided by the present disclosure, the local parameters include the local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0012] The updating of the global model parameter ω and the server state c in the global model according to the local parameter comprises:

[0013] According to the local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k , update the global model parameter ω and the server state c.

[0014] According to a federated learning method based on global model optimization provided by the present disclosure, generating pseudo data according to the generator parameter θ, updating the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and outputting the updated global model parameter ω, comprises:

[0015] Generate pseudo data according to the generator parameter θ, and use the pseudo data and the local model parameter ω k and the number n of the client dataset in each category k The global model is trained and the global model parameter ω and the generator parameter θ are updated, and the updated global model parameter ω is output.

[0016] According to a federated learning method based on global model optimization provided by the present disclosure, pseudo data is generated according to the generator parameter θ, and the pseudo data and the local model parameter ω are used. k and the number n of the client dataset in each category k Training the global model and updating the global model parameter ω and the generator parameter θ, and outputting the updated global model parameter ω, comprises:

[0017] According to the number n of each category of the client dataset k , calculate the sampling probability p t (y);

[0018] Sampling random noise data z, wherein the random noise data z conforms to a Gaussian distribution;

[0019] Sampling a random class label y, where the random class label y obeys the sampling probability p tThe probability distribution of (y);

[0020] According to the number n of each category of the client dataset k Calculate ensemble weights

[0021] According to the random noise data z, the random category label y and the generator parameter θ, the initial first pseudo data is generated, and according to the sampling probability p t (y) screening the initial first pseudo data to obtain first pseudo data G(z, y; θ);

[0022] According to the first pseudo data G(z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Weighted, calculate the first loss, and back-propagate to update the generator parameters θ;

[0023] According to the random noise data z, the random category label y and the generator parameter θ, the initial second pseudo data is generated, and according to the sampling probability p t (y) screening the initial second pseudo data to obtain second pseudo data G2 (z, y; θ);

[0024] According to the second pseudo data G2 (z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Weighted, calculate the second loss, and back-propagate to update the global model parameter ω;

[0025] Output the updated global model parameters ω.

[0026] According to a federated learning method based on global model optimization provided by the present disclosure, the number n of the client data set in each category k , calculate the sampling probability p t (y) including:

[0027] According to the number n of each category of the client dataset k , determine the number of data of category y in the client dataset

[0028] The sampling probability p is calculated according to the following formula t (y):

[0029]

[0030] Where k represents the client identity, S tRepresents the set of target clients.

[0031] According to a federated learning method based on global model optimization provided by the present disclosure, according to the number n of the client data set in each category k Calculate ensemble weights The steps include:

[0032] The number of data in the client dataset according to the category y Determine the number of data for category y in the sum of the client datasets for each target client

[0033] The integration weight is calculated according to the following formula

[0034]

[0035] Wherein, j represents the target client.

[0036] According to a federated learning method based on global model optimization provided by the present disclosure,

[0037] The first loss is obtained using the following formula:

[0038]

[0039] in, represents the model difference loss between the global model and the local model, λ cls is the data authenticity factor, represents the fidelity loss of the first pseudo data generated, λ d is the data diversity factor, represents the diversity loss of the first pseudo data generated;

[0040] Model difference loss between the global model and the local model It is obtained using the following formula:

[0041]

[0042] Among them, the represents the divergence between the global model and the local model, and the D KL represents the divergence, the D(G(z, y; θ); ω) represents the knowledge extracted by the global model on the first pseudo data G(z, y; θ), the D(G(z, y; θ); ω k ) represents the knowledge extracted by the local model from the pseudo data G(z, y; θ);

[0043] The fidelity loss of the generated first pseudo data It is obtained using the following formula:

[0044]

[0045] Among them, the represents the cross entropy loss between the knowledge extracted by the local model from the first pseudo data G(z, y; θ) and the category y of the first pseudo data G(z, y; θ), represents the cross entropy loss;

[0046] The diversity loss of the first pseudo data generated by the representation It is obtained using the following formula:

[0047]

[0048] Wherein, R represents a matrix vector function, and the matrix vector function R is obtained using the following formula:

[0049]

[0050] Wherein, e is a natural base, M is the number of first pseudo data vectors f expanded from the first pseudo data G(z, y; θ), and D f represents a matrix consisting of the distances between the M vectors f, D z Represents a matrix consisting of the distances between M noise data z. Indicates the corresponding element points.

[0051] According to a federated learning method based on global model optimization provided by the present disclosure, the second loss is obtained using the following formula:

[0052]

[0053] Among them, the represents the divergence between the global model and the local model, and the D KL represents the divergence, the D(G2(z, y; θ); ω) represents the knowledge extracted by the global model on the second pseudo data G2(z, y; θ), the D(G2(z, y; θ); ω k ) represents the knowledge extracted by the local model on the second pseudo data G2(z, y; θ).

[0054] The present disclosure also provides a federated learning based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and a plurality of clients, the server is provided with a global model, and the clients are provided with a local model;

[0055] The method is applied to a target client and includes:

[0056] Receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameter ω, generator parameter θ and server state c;

[0057] The local model is trained according to the initial global parameters to generate local parameters, and the local parameters are sent to the server so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; pseudo data is generated according to the generator parameter θ, the global model parameters ω and the server state c in the global model are updated according to the pseudo data and the local parameters, and the updated global model parameters ω are output.

[0058] According to a federated learning method based on global model optimization provided by the present disclosure, the local parameters include the local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0059] The training of the local model according to the initial global parameters to generate local parameters, and sending the local parameters to the server, comprises:

[0060] According to the global model parameter ω and the server state c, the local model is trained to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0061] The local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k Upload to the server.

[0062] According to a federated learning method based on global model optimization provided by the present disclosure, the client has a client state c k ;

[0063] The local model is trained according to the global model parameter ω and the server state c to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k The steps include:

[0064] Initialize the local model parameter ω using the global model parameter ω k ;

[0065] Calculate the gradient g(ω) of the local model on a batch of random data k );

[0066] According to the gradient g(ω k ), the client status c k and the server state c, update the local model parameter ω k ;

[0067] According to the client state c k , the server state c, the global model parameter ω and the local model parameter ω k , update the client state c k ;

[0068] According to the server state c, the global model parameter ω and the local model parameter ω k , calculate the difference Δc of the client state k ;

[0069] Calculate the number n of client datasets in each category k .

[0070] The present disclosure also provides a federated learning device based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and a plurality of clients, wherein the server is provided with a global model, and the client is provided with a local model;

[0071] The device comprises:

[0072] A distribution unit, configured to randomly select at least one client as a target client, and send initial global parameters to the target client, wherein the initial global parameters include: a global model parameter ω, a generator parameter θ, and a server state c;

[0073] A server receiving unit, configured to receive a local parameter sent by the target client, wherein the local parameter is generated by the target client through training the local model according to the initial global parameter;

[0074] A first updating unit, configured to update the global model parameter ω and the server state c in the global model according to the local parameter;

[0075] The second updating unit is used to generate pseudo data according to the generator parameter θ, update the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and output the updated global model parameter ω.

[0076] The present disclosure also provides a federated learning device based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and a plurality of clients, wherein the server is provided with a global model, and the client is provided with a local model;

[0077] The device comprises:

[0078] The client receiving unit is used to receive the initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c;

[0079] A training unit is used to train the local model according to the initial global parameters to generate local parameters, and send the local parameters to the server so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generates pseudo data according to the generator parameters θ, updates the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputs the updated global model parameters ω.

[0080] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the federated learning method based on global model optimization as described in any one of the above are implemented.

[0081] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described federated learning methods based on global model optimization.

[0082] The present disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned federated learning methods based on global model optimization.

[0083] The present disclosure provides a federated learning method, device and electronic device based on global model optimization, which randomly selects at least one client as a target client and sends initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server status c; receives local parameters sent by the target client, wherein the local parameters are generated by the target client through training the local model according to the initial global parameters; updates the global model parameters ω and the server status c in the global model according to the local parameters; generates pseudo data according to the generator parameters θ, updates the global model parameters ω and the generator parameters θ in the global model according to the pseudo data and the local parameters, and outputs the updated global model parameters ω, thereby achieving the effect of optimizing the global model in federated learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0085] Figure 1 It is one of the flowcharts of the federated learning method based on global model optimization provided by the present disclosure;

[0086] Figure 2 This is the second flow chart of the federated learning method based on global model optimization provided by the present disclosure;

[0087] Figure 3 This is the third flow chart of the federated learning method based on global model optimization provided by the present disclosure;

[0088] Figure 4 This is the fourth flow chart of the federated learning method based on global model optimization provided by the present disclosure;

[0089] Figure 5 It is one of the structural schematic diagrams of the federated learning device based on global model optimization provided by the present disclosure;

[0090] Figure 6 This is the second structural schematic diagram of the federated learning device based on global model optimization provided by the present disclosure;

[0091] Figure 7 It is a schematic diagram of the structure of an electronic device provided by the present disclosure. DETAILED DESCRIPTION

[0092] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0093] In recent years, artificial intelligence technology has become increasingly dependent on large amounts of training data. As data management policies in various countries gradually improve, direct aggregation and access to private data have been gradually prohibited by many industries. In this context, federated learning consisting of global models and local models has been proposed. One of the main difficulties of federated learning is data heterogeneity. In order to cope with data heterogeneity, a data-free knowledge distillation method has been proposed.

[0094] The current data-free knowledge distillation method only optimizes the local model, which leads to erroneous knowledge in the local model in data heterogeneous scenarios, thus causing the model performance to degrade during the knowledge distillation process. Therefore, optimizing the global model in federated learning is an important issue that needs to be solved in the industry.

[0095] The present disclosure provides a federated learning method based on global model optimization, which is applied to a federated learning system. The federated learning system includes a server and multiple clients. The server is provided with a global model, and the client is provided with a local model. The method is applied to the server, such as Figure 1 As shown, the method comprises the following steps:

[0096] S11, randomly selecting at least one client as a target client, and sending initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c;

[0097] Specifically, the server can randomly select at least one client from multiple clients as the target client, and send the initial global parameters of the global model in the server to the target server, the initial global parameters including global model parameters ω and generator parameters θ, and server state c.

[0098] S12, receiving a local parameter sent by the target client, wherein the local parameter is generated by the target client through training the local model according to the initial global parameter;

[0099] Specifically, the server may receive local parameters sent by the target client, where the local parameters are generated by the target client through training a local model in the client according to the initial global parameters sent by the server.

[0100] S13, updating the global model parameter ω and the server state c in the global model according to the local parameter;

[0101] Specifically, the server may update the global model parameter ω and the server state c in the global model in the server according to the local parameters sent by the target client.

[0102] S14, generating pseudo data according to the generator parameter θ, updating the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and outputting the updated global model parameter ω;

[0103] Specifically, the server may generate pseudo data according to the server's generation parameters θ, update the global model ω and the generator parameters θ according to the pseudo data and the local parameters sent by the client to the server, and output the updated global model parameters ω.

[0104] In the disclosed embodiment, the server selects a target client and sends the global model parameters ω, generator parameters θ and server status c to the target client; the target client trains the local model according to the global model parameters ω, generator parameters θ and server status c to generate local parameters and sends them to the server; the server receives the local parameters sent by the target client; updates the global model parameters ω and server status c according to the local parameters; generates pseudo data according to the generator parameters θ, updates the global model parameters ω and generator parameters θ according to the pseudo data and the local parameters, and outputs the updated global model parameters ω, thereby achieving the effect of optimizing the global model in federated learning.

[0105] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, the local parameters include local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; Step S13 may specifically be:

[0106] S131, according to the local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k , update the global model parameter ω and the server state c;

[0107] Specifically, the server can calculate the local model parameters ω sent by the client. k , the difference Δc of the client status k And the number of client datasets in each category n k, update the global model parameters ω and server state c.

[0108] In the embodiment of the present disclosure, according to the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k , update the global model parameters ω and server status c, optimize the global model parameters ω and facilitate further optimization of the global model based on the global model parameters ω and server status c, thereby achieving the effect of global model optimization in federated learning.

[0109] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, step S14 may be specifically as follows:

[0110] S141, generating pseudo data according to the generator parameter θ, and using the pseudo data and the local model parameter ω k and the number n of the client dataset in each category k Training the global model and updating the global model parameter ω and the generator parameter θ, and outputting the updated global model parameter ω;

[0111] Specifically, the server can generate pseudo data according to the generator parameter θ, and use the pseudo data and local model parameter ω k And the number of client datasets in each category n k The global model is trained and the global model parameters ω and generator parameters θ are updated, and the updated global model parameters ω are output.

[0112] In one embodiment of the present disclosure, the server may execute the above steps according to Algorithm 1, thereby achieving the effect of optimizing the global model in federated learning.

[0113]

[0114]

[0115] In the embodiment of the present disclosure, pseudo data is generated by using the generator parameter θ, and the pseudo data and the local model parameter ω are used. k And the number of client datasets in each category n k The process of training the global model, updating the global model parameters ω and the generator parameters θ, and outputting the updated global model parameters ω can achieve the effect of optimizing the global model in federated learning.

[0116] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, Figure 2 As shown, step S141 may include the following steps:

[0117] S21, according to the number n of the client data set in each category k , calculate the sampling probability p t (y);

[0118] Specifically, the server receives the number n of client data sets in each category sent by the target client. k After that, we can use n k Calculate the sampling frequency p t (y).

[0119] S22, sampling random noise data z, wherein the random noise data z conforms to Gaussian distribution;

[0120] Specifically, the server may sample a batch of random noise data z, wherein the random noise data z conforms to a Gaussian distribution.

[0121] S23, sampling a random category label y, wherein the random category label y obeys the sampling probability p t The probability distribution of (y);

[0122] Specifically, the server can sample a batch of random category labels y, where the random category labels obey the sampling frequency p t The probability distribution of (y).

[0123] S24, according to the number n of the client data set in each category k Calculate ensemble weights

[0124] Specifically, the server can calculate the number of categories n in the client dataset according to the number of categories n k Calculate ensemble weights

[0125] In the data heterogeneity scenario, the data distribution of the client is different, which means that the knowledge in the local model is heterogeneous. Therefore, for the same category, the importance of knowledge in different local models is different. If the same weight is assigned to the local models, the important knowledge cannot be reasonably used. Therefore, the integration weight is assigned according to the local data distribution of the client, using Indicates the importance of the local model for category y.

[0126] S25, generating initial first pseudo data according to the random noise data z, the random category label y and the generator parameter θ, and t (y) screening the initial first pseudo data to obtain first pseudo data G(z, y; θ);

[0127] Specifically, the server can generate the initial first pseudo data according to the random noise data z, the random category label y and the generator parameter θ, and according to the sampling probability p t (y) Filter the initial first pseudo data to obtain the first pseudo data G(z, y; θ).

[0128] S26, based on the first pseudo data G(z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Weighted, calculate the first loss, and back-propagate to update the generator parameters θ;

[0129] Specifically, the server can use the filtered pseudo data G(z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of local models and use the integrated weights Weighted, calculate the first loss. The server can back-propagate according to the first loss and update the generator parameters θ.

[0130] S27, generating initial second pseudo data according to the random noise data z, the random category label y and the generator parameter θ, and t (y) screening the initial second pseudo data to obtain second pseudo data G2 (z, y; θ);

[0131] Specifically, the server can generate initial second pseudo data according to random noise data z, random category label y and generator parameter θ, and according to the sampling probability p t (y) Filter the initial second pseudo data to obtain the second pseudo data G2 (z, y; θ).

[0132] S28, according to the second pseudo data G2 (z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Deduct the weight, calculate the second loss, and back-propagate to update the global model parameter ω;

[0133] Specifically, the server can calculate the model parameters according to the second pseudo data G2 (z, y; θ), the global model parameter ω, and the local model parameter ω. k Extract the knowledge of local models and use the integrated weights Weighted, calculate the second loss, and backpropagate to update the global model parameters ω.

[0134] S29. Output the updated global model parameter ω.

[0135] Specifically, the server may output an updated global model parameter ω.

[0136] In the embodiment of the present disclosure, the generator parameter θ is described in detail to generate pseudo data, and the pseudo data and the local model parameter ω are used. k And the number of client datasets in each category n k The process of training the global model, updating the global model parameters ω and the generator parameters θ, and outputting the updated global model parameters ω can improve the effect of global model optimization in federated learning through this scheme.

[0137] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, step S21 may include the following steps:

[0138] S211, according to the number n of the client data set in each category k , determine the number of data of category y in the client dataset

[0139] Specifically, the server can calculate the number of categories n in the client dataset according to the number of categories n k , determine the number of data of category y in the client dataset

[0140] S212, calculating the sampling frequency p t (y);

[0141] Specifically, the server can calculate the sampling frequency p according to formula 1 t (y):

[0142]

[0143] Among them, p t (y) represents the sampling frequency, k represents the identity of the current target client, S t Represents the set of target clients, Indicates the number of data of category y in the client dataset.

[0144] In the embodiment of the present disclosure, the number n of client data sets in each category is k Determine the number of data of category y in the client dataset Calculate the sampling frequency p according to formula 1 t (y), to achieve simple and quick calculation of the sampling frequency p t (y), which is convenient for subsequent use according to the sampling frequency p t (y) Filtering pseudo data helps optimize the global model in federated learning.

[0145] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, step S24 may include the following steps:

[0146] S241: The number of data in the client data set according to category y Determine the number of data for category y in the sum of the client datasets for each target client

[0147] Specifically, the server can calculate the number of categories in the client dataset. Determine the number of data for category y in the sum of the client datasets for each target client

[0148] S242, calculating the integration weight

[0149] Specifically, the server can calculate the integration weight according to Formula 2

[0150]

[0151] in, represents the integration weight, represents the number of data of category y in the client dataset, j represents the target client, Represents the number of data of category y in the sum of client datasets of each target client.

[0152] In the embodiment of the present disclosure, the number of data in the client data set by category y Determine the number of data for category y in the sum of the client datasets for each target client Calculate the integration weight according to formula 2 Achieve simple and fast calculation of integrated weights Convenient for subsequent integration weights The first loss and the second loss are weighted to calculate the pseudo data, thereby helping to achieve the effect of optimizing the global model in federated learning.

[0153] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, the first loss is obtained using Formula 3:

[0154]

[0155] in, represents the model difference loss between the global model and the local model, λ cls is the data authenticity factor, represents the fidelity loss of the generated pseudo data, λd is the data diversity factor, represents the diversity loss of generated pseudo data.

[0156] Specifically, by maximizing Update the generator parameters θ to generate high-quality data.

[0157] Model difference loss between global model and local model It is obtained using formula 4:

[0158]

[0159] in, represents the divergence between the global model and the local model, D KL represents the divergence, D(G(z, y; θ); ω) represents the knowledge extracted by the global model on the first pseudo data G(z, y; θ), and D(G(z, y; θ); ω k ) represents the knowledge extracted by the local model on the first pseudo data G(z, y; θ).

[0160] Specifically, using ω and ω k The parameterized D represents the global model and the local model respectively. G is the generator of the server and θ is its parameter. The input of G is random noise data z and class label y, and the output is pseudo data that conforms to the distribution of y category data.

[0161] By D KL Measuring global model ω and local model ω k The difference between the models. Two variables are used for training adversarial learning: (1) generator parameter θ, which is used to generate “difficult” samples that increase model differences; (2) global model parameter ω, which is used to train the global model using “difficult” samples to minimize model differences. This allows continuous exploration of knowledge in local models and migration to the global model.

[0162] The fidelity loss of the first pseudo data generated It is obtained using Formula 5:

[0163]

[0164] in, represents the cross entropy loss between the knowledge extracted by the local model for the first pseudo data G(z, y; θ) and the category y of the first pseudo data G(z, y; θ), represents the cross entropy loss;

[0165] Specifically, Used to improve the fidelity of generated data, it is formulated as the knowledge D(G(z, y; θ); ω) extracted from the first pseudo data by the predicted local model k ) and the cross entropy loss between the first desired pseudo data category y By updating the generator parameters θ to minimize The first pseudo data G(z, y; θ) generated by the generator can produce higher predictions on category y, thereby fitting the data distribution of category y.

[0166] Diversity loss of the first pseudo data generated It is obtained using the following formula 6:

[0167]

[0168] Where R represents a matrix-vector function.

[0169] Specifically, Used to improve the diversity of the generated first pseudo data.

[0170] The matrix-vector function R is obtained using Formula 7:

[0171]

[0172] Wherein, e is the natural base, M is the number of first pseudo data vectors f expanded from the first pseudo data G(z, y; θ), and D f represents a matrix consisting of the distances between two M vectors f, D z Represents a matrix consisting of the distances between M noise data z. Indicates the corresponding element points.

[0173] In the disclosed embodiment, the method and steps for calculating the first loss are introduced in detail according to Formulas 3 to 7, so that the first loss can be calculated simply and quickly, which facilitates the subsequent back propagation according to the first loss and updates the generator parameter θ, thereby helping to achieve the effect of optimizing the global model in federated learning.

[0174] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, the second loss is obtained using Formula 8:

[0175]

[0176] Among them, the represents the divergence between the global model and the local model, and the D KL represents the divergence, the D(G2(z, y; θ); ω) represents the knowledge extracted by the global model on the second pseudo data G2(z, y; θ), the D(G2(z, y; θ); ωk ) represents the knowledge extracted by the local model on the second pseudo data G2(z, y; θ).

[0177] Specifically, by minimizing the model difference loss between the global model and the local model Update the global model parameters ω.

[0178] In one embodiment of the present disclosure, the server may execute the above steps according to Algorithm 2, thereby achieving the effect of optimizing the global model in federated learning.

[0179]

[0180]

[0181] In the disclosed embodiment, the method and steps for calculating the second loss are described in detail according to Formula 8, so that the second loss can be calculated simply and quickly, which facilitates the subsequent back propagation according to the second loss and updates the global model parameter ω, thereby helping to achieve the effect of optimizing the global model in federated learning.

[0182] The present disclosure also provides a federated learning method based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and multiple clients, wherein the server is provided with a global model, and the client is provided with a local model; the method is applied to a target client, such as Figure 3 As shown, the method comprises the following steps:

[0183] S31, receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameter ω, generator parameter θ and server state c;

[0184] Specifically, the target client may receive the initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c.

[0185] S32. Train the local model according to the initial global parameters to generate local parameters, and send the local parameters to the server so that the server updates the global model parameters ω and the server status c in the global model according to the local parameters; generate pseudo data according to the generator parameters θ, update the global model parameters ω and the server status c in the global model according to the pseudo data and the local parameters, and output the updated global model parameters ω.

[0186] Specifically, the target client may train the local model according to the initial global parameters to generate local parameters, and send the local parameters to the server.

[0187] In the disclosed embodiment, the target client receives the global model parameters ω, the generator parameters θ and the server state c sent by the server, trains the local model to generate local parameters and sends them to the server, so that the server receives the local parameters sent by the target client; the global model parameters ω and the server state c are updated according to the local parameters; pseudo data is generated according to the generator parameters θ, the global model parameters ω and the generator parameters θ are updated according to the pseudo data and the local parameters, and the updated global model parameters ω are output, thereby achieving the effect of optimizing the global model in federated learning.

[0188] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, the local parameters include local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; Step S32 may specifically include the following steps:

[0189] S321: Train a local model according to the global model parameter ω and the server state c to obtain a local model parameter ω. k , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0190] Specifically, the target client can train the local model according to the global model parameter ω and the server state c to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k .

[0191] S322, the local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k Upload to the server;

[0192] Specifically, the target client can set the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k Upload to the server.

[0193] In the embodiment of the present disclosure, the local parameters include the local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k, by training the local model, we get the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k , and sent to the server. It is convenient for the subsequent server to update the global model parameters ω and server state c according to the local parameters, generate pseudo data according to the generator parameters θ, update the global model parameters ω and generator parameters θ according to the pseudo data and local parameters, and output the updated global model parameters ω, thereby achieving the effect of optimizing the global model in federated learning.

[0194] According to a federated learning method based on global model optimization provided by an embodiment of the present disclosure, the client has a client state c k ;like Figure 4 As shown, step S321 may specifically include the following steps:

[0195] S41, using the global model parameter ω to initialize the local model parameter ω k ;

[0196] Specifically, the target client can use the global model parameter ω received from the server to initialize the local model parameter ω of the target client. k .

[0197] S42, calculating the gradient g(ω) of the local model on a batch of random data k );

[0198] Specifically, the target client can calculate the gradient g(ω) of the local model on a batch of random data k ).

[0199] S43, according to the gradient g(ω k ), the client status c k and the server state c, update the local model parameter ω k ;

[0200] Specifically, the target client can k ), client status c k and server state c, update local model parameters ω k .

[0201] S44, according to the client state c k , the server state c, the global model parameter ω and the local model parameter ω k , update the client state c k ;

[0202] Specifically, the target client cank , server state c, global model parameter ω and local model parameter ω k , update the client status c k .

[0203] S45, according to the server state c, the global model parameter ω and the local model parameter ω k , calculate the difference Δc of the client state k ;

[0204] Specifically, the target client can calculate the server state c, the global model parameter ω, and the local model parameter ω according to the server state c, the global model parameter ω, and the local model parameter ω. k , calculate the difference Δc of the client state k .

[0205] S46. Calculate the number n of client data sets in each category k .

[0206] Specifically, the target client can calculate the number n of client datasets in each category k .

[0207] In one embodiment of the present disclosure, the target client may perform the above steps according to Algorithm 3, thereby achieving the effect of optimizing the global model in federated learning.

[0208]

[0209]

[0210] In the embodiment of the present disclosure, the target client trains the local model according to the global model parameter ω and the server state c to obtain the local model parameter ω. k , the difference Δc of the client status k And the number of client datasets in each category n k The local model parameter ω can be obtained simply and efficiently through the solution of the embodiment of the present disclosure. k , the difference Δc of the client status k And the number of client datasets in each category n k , which is convenient for subsequent servers to calculate the local model parameters ω k , the difference Δc of the client status k And the number of client datasets in each category n k The global model parameters ω and server status c are updated, pseudo data is generated according to the generator parameters θ, the global model parameters ω and generator parameters θ are updated according to the pseudo data and local parameters, and the updated global model parameters ω are output, thereby achieving the effect of optimizing the global model in federated learning.

[0211] A federated learning device based on global model optimization provided by the present disclosure is described below. The federated learning device based on global model optimization described below and the federated learning method based on global model optimization described above can refer to each other.

[0212] The present disclosure also provides a federated learning device based on global model optimization, which is applied to a federated learning system. The federated learning system includes a server and multiple clients. The server is provided with a global model, and the client is provided with a local model. Figure 5 As shown, the device comprises:

[0213] A distribution unit 51 is used to randomly select at least one client as a target client and send initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c;

[0214] A server receiving unit 52 is configured to receive a local parameter sent by the target client, wherein the local parameter is generated by the target client through training the local model according to the initial global parameter;

[0215] A first updating unit 53, configured to update the global model parameter ω and the server state c in the global model according to the local parameter;

[0216] The second updating unit 54 is used to generate pseudo data according to the generator parameter θ, update the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and output the updated global model parameter ω.

[0217] In the disclosed embodiment, at least one client is randomly selected as a target client, and initial global parameters are sent to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server status c; local parameters sent by the target client are received, wherein the local parameters are generated by the target client through training the local model according to the initial global parameters; the global model parameters ω and the server status c in the global model are updated according to the local parameters; pseudo data is generated according to the generator parameters θ, the global model parameters ω and the generator parameters θ in the global model are updated according to the pseudo data and the local parameters, and the updated global model parameters ω are output, thereby achieving the effect of optimizing the global model in federated learning.

[0218] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the local parameters include a local model parameter ωk , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0219] The first updating unit 53 is specifically configured to update the local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k , update the global model parameter ω and the server state c.

[0220] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the second updating unit 54 is specifically used to generate pseudo data according to the generator parameter θ, and use the pseudo data and the local model parameter ω k and the number n of the client dataset in each category k The global model is trained and the global model parameter ω and the generator parameter θ are updated, and the updated global model parameter ω is output.

[0221] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the second updating unit 54 is specifically configured to update the client data set according to the number n of each category. k , calculate the sampling probability p t (y); sampling random noise data z, wherein the random noise data z conforms to Gaussian distribution; sampling random category label y, wherein the random category label y obeys the sampling probability p t (y) probability distribution; according to the number n of the client data set in each category k Calculate ensemble weights According to the random noise data z, the random category label y and the generator parameter θ, the initial first pseudo data is generated, and according to the sampling probability p t (y) filtering the initial first pseudo data to obtain first pseudo data G(z, y; θ); according to the first pseudo data G(z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights weighted, calculate the first loss, back propagate and update the generator parameter θ; generate initial second pseudo data according to the random noise data z, the random category label y and the generator parameter θ, and according to the sampling probability p t (y) filtering the initial second pseudo data to obtain second pseudo data G2(z, y; θ); according to the second pseudo data G2(z, y; θ), the global model parameter ω and the local model parameter ωk Extract the knowledge of the local model and use the ensemble weights Weighting, calculating the second loss, back-propagating to update the global model parameter ω; outputting the updated global model parameter ω.

[0222] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the second updating unit 54 is specifically configured to update the client data set according to the number n of each category. k , determine the number of data of category y in the client dataset The sampling probability p is calculated using formula 1 t (y).

[0223] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the second updating unit 54 is specifically configured to update the data of the category y in the client data set according to the amount of data of the category y in the client data set. Determine the number of data for category y in the sum of the client datasets for each target client The integration weight is calculated according to Formula 2

[0224] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the first loss is obtained using formula three; the model difference loss between the global model and the local model is is obtained using Formula 4; the fidelity loss of the first pseudo data generated is is obtained using Formula 5; the diversity loss of the first pseudo data generated by the representation is obtained using formula six; the matrix-vector function R is obtained using formula seven.

[0225] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the second loss is obtained using formula eight.

[0226] The present disclosure also provides a federated learning device based on global model optimization, which is applied to a federated learning system. The federated learning system includes a server and multiple clients. The server is provided with a global model, and the client is provided with a local model. Figure 6 As shown, the device comprises:

[0227] The client receiving unit 61 is used to receive the initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c;

[0228] The training unit 62 is used to train the local model according to the initial global parameters to generate local parameters, and send the local parameters to the server so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generates pseudo data according to the generator parameter θ, updates the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputs the updated global model parameters ω.

[0229] In the disclosed embodiment, the target client receives the global model parameters ω, the generator parameters θ and the server state c sent by the server, trains the local model to generate local parameters and sends them to the server, so that the server receives the local parameters sent by the target client; the global model parameters ω and the server state c are updated according to the local parameters; pseudo data is generated according to the generator parameters θ, the global model parameters ω and the generator parameters θ are updated according to the pseudo data and the local parameters, and the updated global model parameters ω are output, thereby achieving the effect of optimizing the global model in federated learning.

[0230] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the local parameters include a local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ;

[0231] The training unit 62 is specifically used to train the local model according to the global model parameter ω and the server state c to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; The local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k Upload to the server.

[0232] According to a federated learning device based on global model optimization provided by an embodiment of the present disclosure, the training unit 62 is specifically used to initialize the local model parameter ω using the global model parameter ω k ; Calculate the gradient g(ω) of the local model on a batch of random data k ); According to the gradient g(ω k ), the client status c k and the server state c, update the local model parameter ω k ; According to the client state ck , the server state c, the global model parameter ω and the local model parameter ω k , update the client state c k According to the server state c, the global model parameter ω and the local model parameter ω k , calculate the difference Δc of the client state k ; Calculate the number n of client datasets in each category k .

[0233] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 630 and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740. The processor 710 can call the logic instructions in the memory 730 to execute a federated learning method based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to the server, and the method includes: randomly selecting at least one client as a target client, and sending initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; receiving local parameters sent by the target client, wherein the local parameters are generated by the target client training the local model according to the initial global parameters; updating the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the generator parameters θ in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0234] The processor 710 can also call the logic instructions in the memory 730 to execute a federated learning method based on global model optimization, which is applied to a federated learning system, wherein the federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to a target client, and the method includes: receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; training the local model according to the initial global parameters to generate local parameters, and sending the local parameters to the server, so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0235] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0236] On the other hand, the present disclosure also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the federated learning method based on global model optimization provided by the above methods, and is applied to a federated learning system. The federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to the server, and the method includes: randomly selecting at least one client as a target client, and sending initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; receiving local parameters sent by the target client, wherein the local parameters are generated by the target client training the local model according to the initial global parameters; updating the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the generator parameters θ in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0237] Alternatively, when the computer program is executed by a processor, the computer can execute the federated learning method based on global model optimization provided by the above methods, and apply it to a federated learning system, wherein the federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to a target client, and the method includes: receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; training the local model according to the initial global parameters to generate local parameters, and sending the local parameters to the server, so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0238] On the other hand, the present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the federated learning method based on global model optimization provided by the above-mentioned methods, and is applied to a federated learning system, wherein the federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to the server, and the method includes: randomly selecting at least one client as a target client, and sending initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; receiving local parameters sent by the target client, wherein the local parameters are generated by the target client training the local model according to the initial global parameters; updating the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the generator parameters θ in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0239] Or when the computer program is executed by a processor, it is implemented to execute the federated learning method based on global model optimization provided by the above methods, and is applied to a federated learning system, wherein the federated learning system includes a server and multiple clients, the server is provided with a global model, and the client is provided with a local model; the method is applied to a target client, and the method includes: receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; training the local model according to the initial global parameters to generate local parameters, and sending the local parameters to the server, so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generating pseudo data according to the generator parameters θ, updating the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputting the updated global model parameters ω.

[0240] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0241] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0242] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. A federated learning method based on global model optimization, characterized in that: Applied to a federated learning system, the federated learning system comprising a server and a plurality of clients, the server being provided with a global model, and the clients being provided with a local model; The method is applied to a server and includes: Randomly select at least one client as a target client, and send initial global parameters to the target client, wherein the initial global parameters include: global model parameters ω, generator parameters θ and server state c; Receiving local parameters sent by the target client, wherein the local parameters are generated by the target client through training the local model according to the initial global parameters; Update the global model parameter ω and the server state c in the global model according to the local parameter; Generate pseudo data according to the generator parameter θ, update the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and output the updated global model parameter ω.

2. The federated learning method based on global model optimization according to claim 1, characterized in that: The local parameters include the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; The updating of the global model parameter ω and the server state c in the global model according to the local parameter comprises: According to the local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k , update the global model parameter ω and the server state c.

3. The federated learning method based on global model optimization according to claim 2, characterized in that: The generating pseudo data according to the generator parameter θ, updating the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and outputting the updated global model parameter ω, comprises: Generate pseudo data according to the generator parameter θ, and use the pseudo data and the local model parameter ω k and the number n of the client dataset in each category k The global model is trained and the global model parameter ω and the generator parameter θ are updated, and the updated global model parameter ω is output.

4. The federated learning method based on global model optimization according to claim 3, characterized in that: The pseudo data is generated according to the generator parameter θ, and the pseudo data and the local model parameter ω are used. k and the number n of the client dataset in each category k Training the global model and updating the global model parameter ω and the generator parameter θ, and outputting the updated global model parameter ω, comprises: According to the number n of each category of the client dataset k , calculate the sampling probability p t (y); Sampling random noise data z, wherein the random noise data z conforms to a Gaussian distribution; Sampling a random class label y, where the random class label y obeys the sampling probability p t The probability distribution of (y); According to the number n of each category of the client dataset k Calculate ensemble weights According to the random noise data z, the random category label y and the generator parameter θ, the initial first pseudo data is generated, and according to the sampling probability p t (y) filtering the initial first pseudo data to obtain first pseudo data G(z, y; θ); According to the first pseudo data G(z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Weighted, calculate the first loss, and back-propagate to update the generator parameters θ; According to the random noise data z, the random category label y and the generator parameter θ, the initial second pseudo data is generated, and according to the sampling probability p t (y) filtering the initial second pseudo data to obtain second pseudo data G2(z, y; θ); According to the second pseudo data G2 (z, y; θ), the global model parameter ω and the local model parameter ω k Extract the knowledge of the local model and use the ensemble weights Weighted, calculate the second loss, and back-propagate to update the global model parameter ω; Output the updated global model parameters ω.

5. The federated learning method based on global model optimization according to claim 4, characterized in that: The number n of each category of the client data set k , calculate the sampling probability p t (y) including: According to the number n of each category of the client dataset k , determine the number of data of category y in the client dataset The sampling probability p is calculated according to the following formula t (y): Where k represents the client identity, S t Represents the set of target clients.

6. The federated learning method based on global model optimization according to claim 5, characterized in that: According to the number n of each category of the client dataset k Calculate ensemble weights The steps include: The number of data in the client dataset according to the category y Determine the number of data for category y in the sum of the client datasets for each target client The integration weight is calculated according to the following formula Wherein, j represents the target client.

7. The federated learning method based on global model optimization according to claim 6, characterized in that: The first loss is obtained using the following formula: in, represents the model difference loss between the global model and the local model, λ cls is the data authenticity factor, represents the fidelity loss of the first pseudo data generated, λ d is the data diversity factor, represents the diversity loss of the first pseudo data generated; Model difference loss between the global model and the local model It is obtained using the following formula: Among them, the represents the divergence between the global model and the local model, and the D KL represents the divergence, the D(G(z, y; θ); ω) represents the knowledge extracted by the global model on the first pseudo data G(z, y; θ), the D(G(z, y; θ); ω k ) represents the knowledge extracted by the local model from the first pseudo data G(z, y; θ); The fidelity loss of the generated first pseudo data It is obtained using the following formula: Among them, the represents the cross entropy loss between the knowledge extracted by the local model from the first pseudo data G(z, y; θ) and the category y of the pseudo first data G(z, y; θ), represents the cross entropy loss; The diversity loss of the first pseudo data generated by the representation It is obtained using the following formula: Wherein, R represents a matrix vector function, and the matrix vector function R is obtained using the following formula: Wherein, e is a natural base, M is the number of first pseudo data vectors f expanded from the first pseudo data G(z, y; θ), and D f represents a matrix consisting of the distances between the M vectors f, D z Represents a matrix consisting of the distances between M noise data z. Indicates the corresponding element points.

8. The federated learning method based on global model optimization according to claim 6, characterized in that: The second loss is obtained using the following formula: Among them, the represents the divergence between the global model and the local model, and the D KL represents the divergence, and the D(G2(z, y; θ); ω) represents the knowledge extracted by the global model on the second pseudo data G2(z, y; θ). k ) represents the knowledge extracted by the local model on the second pseudo data G2(z,y;θ).

9. A federated learning method based on global model optimization, characterized in that: Applied to a federated learning system, the federated learning system comprising a server and a plurality of clients, the server being provided with a global model, and the clients being provided with a local model; The method is applied to a target client, comprising: Receiving initial global parameters sent by the server, wherein the initial global parameters include: global model parameter ω, generator parameter θ and server state c; The local model is trained according to the initial global parameters to generate local parameters, and the local parameters are sent to the server so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; pseudo data is generated according to the generator parameter θ, the global model parameters ω and the server state c in the global model are updated according to the pseudo data and the local parameters, and the updated global model parameters ω are output.

10. The federated learning method based on global model optimization according to claim 9, characterized in that: The local parameters include the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; The training of the local model according to the initial global parameters to generate local parameters, and sending the local parameters to the server, comprises: According to the global model parameter ω and the server state c, the local model is trained to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k ; The local model parameter ω k , the difference Δc of the client state k and the number n of the client dataset in each category k Upload to the server.

11. The federated learning method based on global model optimization according to claim 10, characterized in that: The client has a client state c k ; The local model is trained according to the global model parameter ω and the server state c to obtain the local model parameter ω k , the difference Δc of the client status k And the number of client datasets in each category n k The steps include: Initialize the local model parameter ω using the global model parameter ω k ; Calculate the gradient g(ω) of the local model on a batch of random data k ); According to the gradient g(ω k ), the client status c k and the server state c, update the local model parameter ω k ; According to the client state c k , the server state c, the global model parameter ω and the local model parameter ω k , update the client state c k ; According to the server state c, the global model parameter ω and the local model parameter ω k , calculate the difference Δc of the client state k ; Calculate the number n of client datasets in each category k .

12. A federated learning device based on global model optimization, characterized in that: Applied to a federated learning system, the federated learning system comprising a server and a plurality of clients, the server being provided with a global model, and the clients being provided with a local model; The device comprises: A distribution unit, configured to randomly select at least one client as a target client, and send initial global parameters to the target client, wherein the initial global parameters include: a global model parameter ω and a generator parameter θ, and a server state c; A server receiving unit, configured to receive a local parameter sent by the target client, wherein the local parameter is generated by the target client through training the local model according to the initial global parameter; A first updating unit, configured to update the global model parameter ω and the server state c in the global model according to the local parameter; The second updating unit is used to generate pseudo data according to the generator parameter θ, update the global model parameter ω and the generator parameter θ in the global model according to the pseudo data and the local parameter, and output the updated global model parameter ω.

13. A federated learning device based on global model optimization, characterized in that: Applied to a federated learning system, the federated learning system comprising a server and a plurality of clients, the server being provided with a global model, and the clients being provided with a local model; The device comprises: The client receiving unit is used to receive the initial global parameters sent by the server, wherein the initial global parameters include: global model parameters ω and generator parameters θ, and server state c; A training unit is used to train the local model according to the initial global parameters to generate local parameters, and send the local parameters to the server so that the server updates the global model parameters ω and the server state c in the global model according to the local parameters; generates pseudo data according to the generator parameters θ, updates the global model parameters ω and the server state c in the global model according to the pseudo data and the local parameters, and outputs the updated global model parameters ω.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the federated learning method based on global model optimization as described in any one of claims 1 to 10 are implemented.

15. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the federated learning method based on global model optimization as described in any one of claims 1 to 10 are implemented.

16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the federated learning method based on global model optimization as described in any one of claims 1 to 10 are implemented.