Heterogeneous federal learning method based on momentum alignment technology

By using momentum alignment technology in federated learning, combined with model pre-training loss and activation loss, the problem of model offset caused by data heterogeneity is solved, flat convergence and generalization improvement of the model are achieved, and the performance of federated learning is significantly improved. performance.

CN118569355AActive Publication Date: 2024-08-30FUJIAN NORMAL UNIV +1

Patent Information

Application Number
CN202410655018.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-08-30
Estimated Expiration
2044-05-24

Smart Images

  • Figure CN118569355A
    Figure CN118569355A
Patent Text Reader

Abstract

The invention discloses a heterogeneous federal learning method based on a momentum alignment technology. The heterogeneous federal learning method comprises the following steps: s1, a server sends a global model and global momentum of a current round to a client after random sampling; and s2, on each selected client, using the global model after global momentum acceleration as initialization of the local model. Then, calculating an overall loss function, and carrying out gradient descent of a certain round on the initialized local model; and finally, uploading the local model after gradient descent to a server. And s3, the server aggregates the local models uploaded by the client to obtain a global model of the next round, and calculates the global momentum of the next round. According to the method, the problem of model offset caused by data heterogeneity in distributed learning is effectively solved, and the generalization of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of federated learning in 6G wireless networks, and in particular to a heterogeneous federated learning method based on momentum alignment technology. Background Art

[0002] With the rapid development of digital technology, the concept and initial research and development of the sixth generation (6G) network technology has become the focus of global attention. The 6G network is expected to significantly increase data transmission speeds to more than 1Tbps, far exceeding the current 5G network. This unprecedented high-speed network can not only support complex streaming and high-definition video communication needs, but more importantly, it provides the necessary technical support for data-intensive artificial intelligence (AI) model training. In the field of AI, especially in the training of deep learning models that require processing large amounts of data, 6G's ultra-high speed and extensive connectivity can significantly shorten training time and improve overall efficiency.

[0003] In this context, the introduction of the federated learning (FL) paradigm is particularly necessary. Federated learning allows multiple participants to jointly train a global AI model without sharing the original data, greatly enhancing data privacy protection. This is particularly important for the growing concerns about data security and privacy. In the fields of medicine and finance, federated learning can enable different institutions to share the optimization results of their AI models while protecting customer privacy. In addition, federated learning supports data processing and model training locally on the device, reducing the need for data transmission, thereby effectively reducing the burden on the network while taking advantage of the high-speed transmission advantage of the 6G network. However, although the 6G network provides powerful data processing capabilities for AI, the introduction of federated learning has brought new challenges. On the one hand, the impact of client data heterogeneity is widely present in real-world scenarios, that is, the client data distribution is non-independent and identically distributed, which will lead to a sharp decline in the performance of the global model. On the other hand, the nature of distributed training also easily causes the global model to converge to a sharp loss landscape, which in turn affects the generalization ability of the model.

[0004] At present, how to solve the heterogeneity of user data and improve the generalization of the model has become a research hotspot. There are some related research results: Tian Li et al. (Federated optimization in heterogeneous networks. Proceedings of Machine learning and systems, 2: 429–450, 2020.) alleviated the problem of model deviation caused by data heterogeneity by aligning the global model of each round; Yue Zhao et al. (Federated learning based on dynamic regularization. arXiv preprint arXiv: 2111.04263, 2021.) minimized the client model deviation problem by introducing a dynamic regularization term; Zhe Qu et al. (Generalized federated learning via sharpness aware minimization. In International conference on machine learning, pages 18250–18280. PMLR, 2022.) minimized the flatness of the loss landscape of the local model to improve the generalization of the global model; M Yashwanth et al. (Minimizing layerwise activation norm improves generalization in federated learning. In Proceedings of the IEEE / CVF Winter Conference on Applications of Computer Vision, pages 2287–2296, 2024.) improves performance by taking the sum of the norms of all layer activation values ​​of the local model as the loss; Geeho Kim et al. (Communication-efficient federated learning with accelerated client gradient.arXiv preprint arXiv:2201.03172, 2023.) use momentum to improve the consistency between local models and accelerate the convergence of the global model.

[0005] However, existing methods cannot effectively solve the two key problems of model shift caused by data heterogeneity and make the global model converge to a flat loss landscape to improve generalization. Therefore, combining momentum alignment technology with minimizing the norm of model activation values ​​to design a method that can effectively reduce the model shift caused by data heterogeneity and make the global model converge to a flat loss landscape to improve generalization has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0006] The purpose of the present invention is to provide a heterogeneous federated learning method based on momentum alignment technology, which can solve the problems brought about by federated learning to a certain extent.

[0007] The technical solution adopted by the present invention is:

[0008] A heterogeneous federated learning method based on momentum alignment technology includes the following steps:

[0009] S1. The server sends the global model and global momentum of the current round to the client after random sampling;

[0010] S2. On each selected client, use the global model after global momentum acceleration as the initialization of the local model. Then calculate the overall loss function, and perform a set number of rounds of gradient descent on the initialized local model. Finally, upload the local model after gradient descent to the server.

[0011] S3. The server aggregates the local models uploaded by the client to obtain the global model for the next round and calculates the global momentum for the next round.

[0012] Furthermore, client-side local model training is based on three indicators: model pre-training loss, model activation loss, and model momentum alignment loss.

[0013] Furthermore, the step S2 specifically includes the following steps:

[0014] S20. Each selected client initializes the local model using the global model accelerated by the global momentum.

[0015] S21. Calculate the model pre-training loss of the kth client according to formula (1):

[0016]

[0017] in l k represents the cross entropy loss function, ω represents "model", which refers to the machine learning model parameters being trained and updated, representing a neural network or other machine learning architecture; x,y∈D k . represents samples from the local dataset.

[0018] S22. Calculate the model activation loss of the kth client according to formula (2):

[0019]

[0020] in represents the activation norm loss, the regularization term Calculate a layer l after nonlinear activation (using a l represents the second-order moment of ), and is further summed over L layers. represents the desired operation, which is approximated by averaging over mini-batches. l represents the layer index, which can be a convolutional layer or a fully connected layer.

[0021] S23. Calculate the model alignment loss of the kth client according to formula (3):

[0022]

[0023] in is the momentum alignment loss, m k (ω) is the local momentum of the kth client, m t is the global momentum.

[0024] S24. The overall loss function of the model calculated based on the three loss functions mentioned above is as follows:

[0025]

[0026] Among them, γ pre , γ act and γ mom are tunable hyperparameters that balance the importance of pre-training loss, activation loss, and momentum alignment loss by adjusting their values.

[0027] Furthermore, the step S22 further includes:

[0028] If l is a convolution,

[0029]

[0030] In the above equation, B is the batch size, C is l is the number of feature maps, H l and W lRepresents the height and width of the activation of the lth layer. i indicates that the i-th sample is a picture; j1 indicates the j1-th feature map; j2 indicates the j2-th height of the activation of the l-th layer, and j3 indicates the j3-th width of the activation of the l-th layer. Specifically, convolutional neural networks are often used to process image data, because image data itself has three dimensions, and the color value of each pixel can be stored in a small unit in a three-dimensional space, where the horizontal axis represents the width of the image, the vertical axis represents the height of the image, and the height represents the feature or color value of the image. j1, j2, j3 represent the position of the feature map.

[0031] If l is a fully connected layer, but

[0032]

[0033] Where B is the batch size, d l is the feature dimension of the fully connected layer.

[0034] Furthermore, the step S23 further includes:

[0035] m t =ω t -ω t-1 (7);

[0036] Where m t is the global momentum, ω t represents the model after t rounds of training.

[0037] Furthermore, the step S23 further includes:

[0038] m k (ω)=ω-(ω t +λm t )(8);

[0039] Where m k (ω) is the local momentum. λ represents the acceleration ratio of the local model. In traditional federated learning, the global model of the tth round is used to directly initialize the local model. However, the present invention adds a full momentum of λ proportion to the original model and performs local training based on it. Therefore, λ can control the size of the model update.

[0040] From the above description, we can see that each client accelerates the convergence of the model by using the global model accelerated by the global momentum as the initialization of the local model. The generalization of the model is enhanced by minimizing the activation paradigm. By aligning the local momentum with the global momentum, the direction of the update of the local model is indicated, and the model deviation caused by data heterogeneity is reduced.

[0041] Furthermore, the step S3 is specifically as follows:

[0042] The server performs weighted averaging of local models to obtain the next round of global models, and calculates the difference between the next round of global models and the current round of global models to obtain the global momentum.

[0043] The present invention adopts the above technical solution, and aligns the local momentum with the global momentum by using momentum alignment technology, thereby reducing model deviation and improving the generalization of the model. The algorithm is connected to the activation norm of each layer of the model, so that the local model converges to a flat landscape by minimizing the activation norm value of each layer of each client, thereby improving generalization. In addition, the algorithm further aligns the local target with the global target through momentum alignment technology. Each client has a reference for future optimization directions while training locally, which not only reduces the model deviation caused by data heterogeneity, but also makes the global model converge to a flat loss landscape to improve generalization. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments;

[0045] Figure 1 This is an overall flow chart of a heterogeneous federated learning method based on momentum alignment technology according to an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of a framework of a heterogeneous federated learning method based on momentum alignment technology according to an embodiment of the present invention;

[0047] Figure 3 This is a specific flow chart of a heterogeneous federated learning method based on momentum alignment technology according to an embodiment of the present invention. Implementation

[0049] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0050] like Figures 1 to 3 As shown in one, the present invention discloses a heterogeneous federated learning method based on momentum alignment technology, which includes the steps of:

[0051] S1. The server sends the global model and global momentum of the current round to the client after random sampling.

[0052] S2. On each selected client, use the global model after global momentum acceleration as the initialization of the local model. Then calculate the overall loss function and perform a certain number of rounds of gradient descent on the initialized local model. Finally, upload the local model after gradient descent to the server.

[0053] S3. The server aggregates the local models uploaded by the client to obtain the global model for the next round and calculates the global momentum for the next round.

[0054] It should be noted that in this embodiment, steps S1, S2, and S3 need to go through multiple cycles to finally achieve convergence. That is, this process needs to go through multiple cycles, continuously iterate and optimize the model, so that the model gradually converges to a better state. By iterating these steps multiple times, the federated learning system can improve the performance and generalization ability of the model.

[0055] Furthermore, client-side local model training is based on three indicators: model pre-training loss, model activation loss, and model momentum alignment loss.

[0056] Furthermore, the step S2 specifically includes the following steps:

[0057] S20. Each selected client initializes the local model using the global model accelerated by the global momentum.

[0058] S21. Calculate the model pre-training loss of the kth client according to formula (1):

[0059]

[0060] in l k represents the cross entropy loss function, x,y∈D k . represents samples from the local dataset.

[0061] S22. Calculate the model activation loss of the kth client according to formula (2):

[0062]

[0063] in represents the activation norm loss, the regularization term Calculate a layer l after nonlinear activation (using a l represents the second-order moment of ), and is further summed over L layers. represents the desired operation, which is approximated by averaging over mini-batches. l represents the layer index, which can be a convolutional layer or a fully connected layer.

[0064] S23. Calculate the model alignment loss of the kth client according to formula (3):

[0065]

[0066] in is the momentum alignment loss, m k (ω) is the local momentum of the kth client, m t is the global momentum.

[0067] S24. The overall loss function of the model calculated based on the three loss functions mentioned above is as follows:

[0068]

[0069] Among them, γ pre , γ act and γ mom are tunable hyperparameters that balance the importance of pre-training loss, activation loss, and momentum alignment loss by adjusting their values.

[0070] Furthermore, the step S22 further includes:

[0071] If l is a convolution,

[0072]

[0073] In the above equation, B is the batch size, C is l is the number of feature maps, H l and W l Represents the height and width of the activations of layer l.

[0074] If l is a fully connected layer, but

[0075]

[0076] Where B is the batch size, d l is the feature dimension of the fully connected layer.

[0077] Furthermore, the step S23 further includes:

[0078] m t =ω t -ω t-1 (7);

[0079] Where m t is the global momentum.

[0080] Furthermore, the step S23 further includes:

[0081] m k (ω)=ω-(ω t +λm t )(8);

[0082] Where m k (ω) is the local momentum.

[0083] From the above description, we can see that each client accelerates the convergence of the model by using the global model accelerated by the global momentum as the initialization of the local model. The generalization of the model is enhanced by minimizing the activation paradigm. By aligning the local momentum with the global momentum, the direction of the update of the local model is indicated, and the model deviation caused by data heterogeneity is reduced.

[0084] Furthermore, the step S3 is specifically as follows: the server performs weighted averaging on the local models to obtain the global model of the next round. And the difference between the global model of the next round and the global model of the current round is calculated to obtain the global momentum. From the above description, it can be seen that this method indicates the update optimization direction of the local gradient for the client by calculating the global momentum, thereby reducing the model deviation caused by data heterogeneity.

[0085] The present invention is an innovative method for alleviating model deviation caused by data heterogeneity in federated learning and improving model generalization. The method achieves local model convergence to a flat landscape by minimizing the activation norm of the model, thereby improving generalization. By aligning the global momentum with the local momentum, the update direction of the local model is restricted to ensure that there is no large deviation from the update direction of the global model, thereby reducing the divergence and deviation of the model. Experiments have shown that the method has significant advantages in improving the performance of federated learning.

[0086] The present invention has the following beneficial effects: (1) From the perspective of accelerating model convergence analysis: the FedMA algorithm accelerates the convergence of the model in federated learning. By adding a certain proportion of global momentum to the global model as the initialization of the local model, the update of the local model is accelerated. This method accelerates the convergence of the model. (2) From the perspective of model generalization analysis: the FedMA algorithm achieves the convergence of the local model to a flat landscape by minimizing the activation norm of the model, thereby improving generalization. (3) From the perspective of reducing model deviation analysis: the FedMA algorithm limits the update direction of the local model by aligning the global momentum with the local momentum, ensuring that there is no large deviation between the update direction of the local model and the global model, thereby reducing the divergence and deviation of the model.

[0087] Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians of the art without making creative work are within the scope of protection of the present application.

Claims

1. A heterogeneous federated learning method based on momentum alignment technology, characterized by: It includes the steps of: S1. The server sends the global model and global momentum of the current round to the client after random sampling; S2. Use the global model accelerated by global momentum as the initialization of the local model on each selected client; calculate the overall loss function, and perform a set number of rounds of gradient descent on the initialized local model; finally upload the local model after gradient descent to the server; S3. The server aggregates the local models uploaded by the client to obtain the global model for the next round and calculates the global momentum for the next round.

2. According to claim 1, a heterogeneous federated learning method based on momentum alignment technology is characterized by: Client local model training in S2 is based on three indicators: model pre-training loss, model activation loss, and model momentum alignment loss.

3. The heterogeneous federated learning method based on momentum alignment technology according to claim 1, characterized in that: Step S2 specifically includes the following steps: S20, each selected client initializes the local model using the global model accelerated by the global momentum; S21. Calculate the model pre-training loss of the k-th client. The calculation formula is as follows: in, represents the model pre-training loss, ω represents the model being trained; l k represents the cross entropy loss function; x,y∈D k represents samples from the local dataset; S22. Calculate the model activation loss of the kth client. The calculation formula is as follows: in, Represents the model activation loss; l represents the layer index, which is a convolutional layer or a fully connected layer; a l represents the lth layer after nonlinear activation, and L represents the total number of layers; represents the expected operation, which is approximated by averaging over mini-batches; S23. Calculate the model alignment loss of the kth client. The calculation formula is as follows: in, represents the model alignment loss; m k (ω) represents the local momentum of the kth client, m t is the global momentum; S24. Calculate the overall loss function of the model. The calculation formula is as follows: Among them, γ pre represents the adjustable hyperparameter of the model pre-training loss, γ act represents the adjustable hyperparameters of the model activation loss and γ mom An adjustable hyperparameter representing the model alignment loss. By adjusting the corresponding value, we can balance the importance of model pre-training loss, model activation loss, and model alignment loss.

4. The heterogeneous federated learning method based on momentum alignment technology according to claim 3 is characterized by: Step S22 also includes: When the lth layer is convolutional, that is, Then we have: Where B is the batch size, C l is the number of feature maps, H l and W l represents the height and width of the activation of the lth layer; i represents that the i-th sample is a picture; j1 represents the j1-th feature map; j2 represents the j2-th height of the activation of the lth layer, and j3 represents the j3-th width of the activation of the lth layer; When the lth layer is a fully connected layer, that is, Then we have: Where B is the batch size, d l is the feature dimension of the fully connected layer.

5. The heterogeneous federated learning method based on momentum alignment technology according to claim 3 is characterized by: Step S23 also includes: m t =ω t -oh t-1 (7); Among them, m t is the global momentum, ω t represents the model after t rounds of training.

6. The heterogeneous federated learning method based on momentum alignment technology according to claim 3, characterized in that: Step S23 also includes: m k (ω)=ω-(ω t +λm t ) (8); Among them, m k (ω) is the local momentum and λ represents the speedup of the local model.

7. The heterogeneous federated learning method based on momentum alignment technology according to claim 1, characterized in that: Step S3 is specifically as follows: the server performs weighted averaging on the local models to obtain the global model of the next round, and calculates the difference between the global model of the next round and the global model of the current round to obtain the global momentum.

Citation Information

Patent Citations

  • Unbalanced data federal learning method and system based on meta learning

    CN116628543A

  • Federal learning multi-objective optimization method fusing hierarchical clustering and particle swarm

    CN117093885A

  • Generator-based prototype confrontation method for heterogeneous federated learning

    CN117787385A

  • Horizontal and vertical federated learning combined algorithm

    WO2024060410A1

Cited By

  • Personalized federal learning method based on hierarchical self-adaption and momentum collaboration

    CN120509459A