A non-identically distributed federated learning performance optimization method based on local model drift
By adding a penalty term to federated learning and optimizing the loss function using the model difference L2 norm and gradient gain, the model skew problem caused by heterogeneous data distribution is solved, and the recognition accuracy and adaptability of the global model are improved.
Patent Information
- Application Number
- CN202211725787.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In federated learning, the heterogeneity of data distribution leads to model skew, resulting in the generated global model failing to perform well on all datasets and exhibiting over-parameterization of neural networks.
By adding a penalty term during local training, the penalty term is formed by using the L2 difference between the parameters of the local model and the parameters of the remaining client models and the gradient gain of the remaining client models as weight coefficients. This penalty term is then optimized by gradient descent in the loss function to suppress local model bias.
It effectively suppresses local model shifts, improves the recognition accuracy of the global model, and adapts to the actual application environment without changing the aggregation method, achieving plug-and-play optimization of the framework.
Smart Images

Figure CN116011585B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of artificial intelligence edge computing, and particularly relates to a non-identically distributed federated learning performance optimization method based on local model bias. BACKGROUND
[0002] Federated learning has become an important direction in modern large-scale distributed machine learning. Unlike traditional centralized learning, which uses a large data set stored in a central server to train a model, in federated learning, training data can be distributed across a large number of clients, such as phones, network sensors, hospitals, or various edge devices, and then aggregated into a complete global model by a server without transmitting user data, thereby protecting the privacy of users.
[0003] The key challenge of federated learning optimization is the heterogeneity of data distribution. Due to the differences in the actual physical environment of various edge devices participating in federated learning, the data provided by the federated learning framework is different, and this different data distribution will cause model bias in the local training process of edge devices. Using such models for aggregation, the global model generated cannot have excellent performance on the full data set.
[0004] During the training of a neural network on a data set, only part of the parameters fit the characteristics of the data, while the other part of the parameters plays a smaller role in the training process. This phenomenon is also called over-parameterization of neural networks. SUMMARY
[0005] The purpose of the application is to overcome the deficiencies in the prior art and provide a non-identically distributed federated learning performance optimization method based on local model bias, which uses the models of each client in the system as a standard to limit local optimization, maintains the fitting ability of the model on other client data distributions, reduces model bias during local training, and thus improves the accuracy of the global aggregated model.
[0006] Technical solution: To achieve the above purpose, the application provides a non-identically distributed federated learning performance optimization method based on local model bias, comprising the following steps:
[0007] S1: Limiting local updates to make the local training model close to the remaining client models, receiving pre-training gradient update information reported by each client during the pre-training process, and the server integrates the gradient information of each client to form a penalty term for each client in the next round of global training;
[0008] S2: In the new round of global training, the client participating in this round of global training receives the penalty term information sent by the server, which is added to the local cross-entropy loss to form a newly constructed loss function. SGD is performed under this loss function, the model is submitted after training is completed, and the model is aggregated according to the regular FEDAVG.
[0009] Furthermore, the method for obtaining the penalty term in step S1 is as follows:
[0010] During the local training process of federated learning, the L2 difference between the parameters of the model to be trained and the parameters of the remaining client models is added to its loss function. The gradient gain of the remaining client models is used as the weight coefficient of each parameter position of the L2 difference, and the whole is formed into a penalty term.
[0011] Furthermore, the penalty term in step S1 is expressed as follows:
[0012]
[0013] The entire summation formula at the end of the above equation is the penalty term, which is the difference between the local model and the other models.
[0014] θ i For the local model to be trained on client i, L s (θ) is the loss function of the model parameters θ on the dataset s, where t is the number of training epochs. k For the remaining client models, k is the set of clients other than i, and λ is the regularization hyperparameter used to control the weight of the regularization term in the loss function; G t-1,j Locally updating gradient gain for other clients can identify key parameters of other client models, giving these key parameters higher weight during optimization and thus preserving the direction of their update.
[0015] Furthermore, the newly constructed loss function in step S2 is expressed as follows:
[0016]
[0017] Where S is the set of nodes and t is the number of global training rounds.
[0018] Loss function L t,s (θ) That is, the aggregation is performed using FedAvg. These nodes optimize their local loss by running SGD for E local cycles. After each global round t ends, each client j uploads the gradient, and the server updates the model of each client based on the gradient uploaded by the client. The updated model will be used to calculate the local loss of the next round.
[0019] The storage and transmission of all historical data required to maintain the FedOC appear to be burdensome. However, these potential drawbacks can be avoided by integrating the calculation of the loss function. The loss function in step S2 can be integrated as follows:
[0020]
[0021] where C is a polynomial combination of the remaining client model parameters, which are constant during the training process, and is replaced by C.
[0022] The server in step S2 only needs to maintain and transmit two elements with the same dimension as theta to the edge device in addition to theta:
[0023]
[0024] where u t and v t represent the model coefficients in the loss function, and the letters u and v are used for convenience of expression.
[0025] The gradient change quantity reflects the role of the parameter in the model training process, and the relevant parameters that actively fit the data characteristics will produce more gradient gain in the training. The present application uses this conclusion to add the difference between the to-be-trained model and the remaining client model parameters in the loss function during the local training process of federated learning. The difference is the two-norm, and the model gradient gain of the remaining clients is used as the weight coefficient of each parameter position of the difference two-norm. The whole forms a penalty term, and the newly constructed loss function is optimized by gradient descent in the optimization process, so that the models of all clients still maintain the fitting ability to the data distribution of the remaining clients during the local training process, effectively suppressing the local model deviation. Therefore, all clients participating in federated learning can maintain the recognition ability of the data distribution of all other clients, and the performance of the global model generated by aggregating the gradient updates of these clients is guaranteed.
[0026] Advantages: Compared with the prior art, the present application has the following advantages:
[0027] 1. By increasing the two-norm of the gradient gain related parameters of the difference between the local to-be-trained model and the remaining client models as a penalty term, the model deviation of the local model to the respective data set is suppressed, thereby improving the recognition accuracy of the global model.
[0028] 2. Without changing the aggregation method, the problem of non-independent and identically distributed is effectively solved, making the model framework better adapt to the actual application environment and realizing the plug-and-play of the optimized framework.
[0029] 3. The proposed optimization scheme is systematically proved, ensuring convergence and convergence speed in theory. BRIEF DESCRIPTION OF DRAWINGS
[0030] Figure 1 A local model offset suppression framework is provided.
[0031] Figure 2 A non-identically distributed federated learning performance optimization effect diagram of local model offset is provided. DETAILED DESCRIPTION
[0032] The present application will be further illustrated below in conjunction with the drawings and specific embodiments, and it should be understood that these embodiments are only used to illustrate the present application and not to limit the scope of the present application, and after reading the present application, various equivalent modifications of the present application by those skilled in the art fall within the scope defined by the appended claims.
[0033] The present application provides a local model offset based non-identically distributed federated learning performance optimization method, comprising the following steps:
[0034] S1: by limiting local update to approach the remaining client model, receiving the pre-training gradient update information reported by each client in the pre-training process, and the server integrates the gradient information of each client to form a penalty term sent to each client in the next round of global training;
[0035] S2: in a new round of global training process, the client participating in the round of global training receives the penalty term related information sent by the server, and the local cross-entropy loss is added to form a newly constructed loss function, and the SGD is performed under the loss function, and the model is submitted after training, and the model is aggregated according to the conventional FEDAVG.
[0036] The problem solved in step S1 of the embodiment is how to suppress the problem of global model recognition performance decline caused by local model offset, and a local model offset suppression framework is provided as shown in Figure 1
[0037] In order to correct the model offset of local model to each data set, that is, to ensure that the model can still maintain the model update direction of local training model on the data set of the remaining client in the local training process.
[0038] The acquisition method of the penalty term in step S1 is:
[0039] In the local training process of federated learning, the difference between the to-be-trained model and the model parameters of the remaining clients is added to the loss function, and the model gradient gain of the remaining clients is used as the weight coefficient of each parameter position of the difference, and the whole is formed into a penalty term.
[0040] The expression of the penalty term in step S1 is as follows:
[0041]
[0042] The entire summation formula in the above formula is the penalty term, which is the difference between the local model and the remaining models.
[0043] θ i is the local model to be trained for client i, L s (θ) is the loss function of the model parameter θ on the data set s, t is the number of training periods, θ k is the model of the remaining clients, where k is the set of clients other than i, λ is a regularization term hyperparameter, which is used to control the weight of the regularization term in the loss function; G t-1,j is the gain of the local update gradient of the remaining clients, which can be used to identify the key parameters of the model of the remaining clients, so that the key parameters are given higher weights in the optimization process, thereby retaining the update direction of the parameters.
[0044] The parameter is added to the loss function in the local training process as a penalty term for gradient descent, which can make each client maintain the model update direction of the remaining clients during model update in the optimization process, so that each client does not produce serious model deviation for its local data distribution, thereby effectively improving the recognition accuracy in subsequent global aggregation.
[0045] The neural network generally has over-parameterization phenomenon for data sample training, that is, for a certain set of data distribution samples, only part of the neuron parameters in the neural network plays a role in fitting the data distribution, which can be called key parameters. Therefore, during the local training process of each client, the update of the key parameters of the remaining clients should be reduced, so as to ensure that the remaining clients can still effectively recognize the data after the local training of each client is completed.
[0046] The expression of the newly constructed loss function in step S2 is as follows:
[0047]
[0048] Where S is the node set, and t is the global training round.
[0049] The loss function L t,s (θ) in the above formula is That is, the FedAvg is used to aggregate, and these nodes optimize their local loss by running SGD in E local cycles, and after each global round t, each client j uploads the gradient, and the server side updates the model of each client according to the uploaded gradient of the client, and the updated model will be used to calculate the local loss of the next round.
[0050] The storage and transmission of all historical data required by the FedOC scheme of the application seem to be heavy. However, these potential drawbacks can be avoided by integrating the calculation of the loss function. The loss function can be organized as follows:
[0051]
[0052] Where C is a polynomial combination of the model parameters of the remaining clients, and since these model parameters are constant during training, C is used instead.
[0053] The server only needs to maintain and transmit two elements with the same dimension as theta to the edge device in addition to theta based on the application:
[0054]
[0055] Where u t , v t represent the model coefficients in the loss function, and for convenience of expression, the letters u and v are used to represent them.
[0056] The application scheme only needs to send aggregation information related to local gradients from the device to the center point. In terms of privacy, it is no different from the classic FedAvg algorithm. Figure 1 The framework structure diagram is given.
[0057] Before formal training, the clients participating in federated learning training first upload their respective training gradients, and the server updates the corresponding model. After entering the formal federated learning training, a subset of the total set of clients is selected for training, and the server sends specified parameters to the subset of clients. Each client participating in this round of training constructs a loss function using the specified parameters, performs gradient descent optimization, uploads the updated gradient of this round, and the server updates the corresponding local model and global model, and calculates the next round of parameters to be sent for distribution. Iterate until the training reaches the global round. Figure 2 The training effect comparison chart is given.
[0058] Finally, since FedOC only makes a light modification to FedAvg, there is no change in the aggregation, only the newly constructed loss function is used to optimize during the local training process. Therefore, the reasoning process that holds for FedAvg can be used and makes FedOC easily integrated into existing systems. In particular, it is noted that FedAvg is a special case of FedOC, i.e., λ = 0.
Claims
1. A non-identically distributed federated learning performance optimization method based on local model drift, characterized in that, Comprise the following steps: S1: by limiting local update makes local training model close to the rest of the client model, in the pre-training process to receive each client reported pre-training gradient update information, server side integration of each client gradient information to form the next round of global training issued to each client penalty term; S2: in the new round of global training process, the client participating in the global training of this round receives the penalty term related information sent by the server, adds the local cross entropy loss to form a newly constructed loss function, and carries out SGD under the loss function, trains and submits the model, and carries out model aggregation according to the conventional FEDAVG; The acquisition method of the penalty term in step S1 is: In the process of federated learning local training, the difference between the to-be-trained model and the model parameters of the remaining clients is added to the loss function, and the model gradient gain of the remaining clients is used as the weight coefficient of each parameter position of the difference, so as to form the penalty term; The expression of the penalty term is as follows: θ is the local model to be trained for client i, L s (θ) is the loss function of model θ on dataset s, t is the global training round number, θ t-1,j is the model of the remaining clients, where j is the set of clients other than i, λ is a regularization term hyperparameter, used to control the weight of the regularization term in the loss function; G t-1,j is the local update gradient gain of the remaining clients; The expression of the newly constructed loss function in step S2 is as follows: Wherein, S is a node set, and t is the global training round number.
2. The method of claim 1, wherein, The newly constructed loss function L in step S2 t,s in (θ) That is, the aggregation is performed in the manner of FedAvg, these nodes optimize their local losses by running SGD in E local cycles, at the end of each global training round t, each client i uploads the gradient, and the server side updates the model of each client according to the gradient uploaded by the client, and the updated model will be used to calculate the local loss of the next round.
3. The method of claim 1, wherein the method is characterized by, The loss function in step S2 is arranged as follows: Wherein, C is a polynomial combination of the model parameters of the remaining clients.
4. The method of claim 1, wherein, In the step S2, the server only needs to maintain and transmit two elements with the same dimension as θ except θ to the edge device: where u t , v t represent model coefficients in the loss function.
Citation Information
Patent Citations
Federal learning optimization method and device
CN113435604A