Personalized federal learning method, device and system based on gradient similarity dynamic model fusion

By calculating gradient similarity in personalized federated learning and dynamically adjusting the model fusion weight, the problems of limited performance improvement of personalized model and reduced convergence speed in the existing technology are solved, and more efficient personalized model optimization and data distribution adaptation are achieved.

CN120106246APending Publication Date: 2025-06-06NANJING UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510265048.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

When the existing personalized federated learning method processes non-independent and same-distributed data, it is difficult to dynamically adapt to the data distribution characteristics of different clients, resulting in limited improvement in the performance of the personalized model, and inconsistent gradient directions lead to a decrease in the convergence speed and stability of the model, and high computing and communication costs.

Method used

By calculating the gradient similarity between the local model and the global model on the client, dynamically adjusting the model fusion weights to achieve personalized model optimization. Specific steps include: independent training of the local model and the global model, gradient similarity calculation, dynamic adjustment of the fusion weight, generation of personalized models and uploading updated global model parameters.

Benefits of technology

Significantly improve the performance of personalized models, better adapt to the heterogeneity of data distribution, improve the model's adaptability on the client, while maintaining the convergence stability of the global model, and reducing computing and communication costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120106246A_ABST
    Figure CN120106246A_ABST
Patent Text Reader

Abstract

The invention discloses a personalized federal learning method, device and system based on gradient similarity dynamic model fusion. The method comprises the following steps that: a central server initializes global model parameters and distributes the global model parameters to each client; after receiving the global model parameters, the client independently performs global model and local model training based on the local data, calculates the similarity of a global gradient and a local gradient, dynamically adjusts the fusion weight of the global gradient and the local gradient, and generates a personalized model adaptive to the local data; and the client uploads the updated global model parameters to the central server, and the central server aggregates the parameters uploaded by the client and updates the global model parameters. According to the method, the hybrid weight of the model is dynamically adjusted, so that the heterogeneity problem caused by non-independent identically distributed data of each client is relieved, and the final personalized model of each client is more adaptive to local data of the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a personalized federated learning method, device and system based on gradient similarity dynamic model fusion. Background Art

[0002] Federated Learning (FL) is a new distributed machine learning framework that aims to protect data privacy while using the local data of multiple distributed clients to collaboratively train global models. In federated learning, each client retains its local data and does not upload it. It only uploads its trained model parameters for server aggregation, thus avoiding direct access to the original data and reducing the risk of data leakage. Therefore, federated learning has been widely used in privacy-sensitive scenarios such as healthcare, finance, and the Internet of Things.

[0003] Although the federated learning framework effectively solves the problem of data privacy protection, due to the complexity of real-world applications, the local data distribution between clients usually has the characteristics of non-independent and identically distributed (Non-IID). Non-independent and identically distributed data causes the performance of the global model on the client to drop significantly, which is manifested as insufficient personalization of the model, that is, the global model is difficult to adapt to the specific data distribution of each client. This phenomenon is particularly prominent in highly heterogeneous environments. For example, in the medical field, the distribution of patient data in different hospitals may vary significantly; in the financial industry, there are significant regional differences in economic data in different regions.

[0004] To address the above issues, Personalized Federated Learning (PFL) has gradually become an important research direction in the field of federated learning. Unlike traditional federated learning, which only focuses on building a global model, personalized federated learning attempts to generate a personalized model that can adapt to the local data distribution of the client while retaining the generalization ability of the global model to improve the performance of the model on the client. Personalized federated learning balances the needs of global shared knowledge and client local characteristics by introducing personalized strategies such as weight mixing, model decomposition, and multi-task learning.

[0005] However, existing personalized federated learning methods still face the following challenges:

[0006] (1) Conflict between global generalization and local personalization: Traditional methods often use fixed weights to fuse the global model and the local model, which makes it difficult to dynamically adapt to the data distribution characteristics of different clients, resulting in limited improvement in the performance of personalized models.

[0007] (2) Inconsistency in gradient direction: Under the condition of non-independent and identically distributed data, the directions of local model gradients and global model gradients are significantly different. Direct parameter aggregation may cause the global model update direction to deviate from the optimal path, thereby reducing the convergence speed and stability of the model.

[0008] (3) Balance between computing and communication costs: Personalized federated learning requires more computing and parameter optimization operations on the client side, which increases the computing burden of the device and may generate additional communication overhead, affecting the overall efficiency of the system. Summary of the invention

[0009] Purpose of the invention: In order to solve the above problems in the prior art, the present invention proposes a personalized federated learning method based on gradient similarity dynamic model fusion, which calculates the gradient similarity between the local model and the global model on the client, dynamically adjusts the model fusion weight, and realizes personalized model optimization. This method can significantly improve the performance of personalized models and better adapt to the heterogeneity of data distribution under the premise of protecting privacy.

[0010] Another object of the present invention is to provide a corresponding federated learning client device and a federated learning system.

[0011] In order to achieve the above invention object, the technical solution of the present invention is as follows:

[0012] In a first aspect, a personalized federated learning method based on gradient similarity dynamic model fusion is executed on a federated learning client, comprising the following steps:

[0013] In the current iteration round t, the local model is trained independently using the local dataset to generate the updated local model parameters w t+1,i ;

[0014] Receive the global model parameter w sent by the central server in the current iteration round t,g , use the local dataset to independently train the global model and generate updated global model parameters

[0015] Calculate the gradient similarity s between the local model gradient and the global model gradient i ;

[0016] Based on the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration;

[0017] The updated global model parameters Upload to the central server for aggregation and enter the next iteration round.

[0018] Furthermore, the gradient similarity s i The calculation formula is as follows:

[0019]

[0020] Among them, <·,·> represents the vector inner product, and ||·|| represents the Euclidean norm of the vector.

[0021] Furthermore, the fusion weight λ i The calculation formula is as follows:

[0022]

[0023] Among them, λ i ∈[0,1].

[0024] Furthermore, the personalized model is calculated as follows:

[0025]

[0026] In a second aspect, a federated learning client device includes:

[0027] The local model update module is used to independently train the local model using the local dataset in the current iteration round t to generate the updated local model parameters w t+1,i ;

[0028] The global model update module is used to receive the global model parameters w sent by the central server in the current iteration round. t,h , use the local dataset to independently train the global model and generate updated global model parameters

[0029] Gradient similarity calculation module, used to calculate the gradient similarity s between the local model gradient and the global model gradient i ;

[0030] A model fusion module is used to combine the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration;

[0031] Parameter upload module, used to upload updated global model parameters Upload to the central server for aggregation and enter the next iteration round.

[0032] In a third aspect, an electronic device is provided, characterized in that it comprises: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the personalized federated learning method based on gradient similarity dynamic model fusion as described in the first aspect are implemented.

[0033] In a fourth aspect, a computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, the steps of the personalized federated learning method based on gradient similarity dynamic model fusion as described in the first aspect are implemented.

[0034] In a fifth aspect, a personalized federated learning method based on gradient similarity dynamic model fusion is provided, the method comprising the following steps:

[0035] The central server initializes the global model parameters w 0 And initialize each local model parameter w 0,i , distribute the global model parameters to the clients in each iteration;

[0036] After receiving the global model parameters, the client uses the local data set to independently train the global model and generate updated global model parameters. And use the local dataset to independently train the local model to generate the updated local model parameters w t+1,i ; Calculate the gradient similarity s between the local model gradient and the global model gradient i ; Based on the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration; the updated global model parameters Upload to the central server;

[0037] The central server receives the updated global model parameters uploaded by the client, aggregates the global model parameters of the client, and performs a global update for the next round of iteration.

[0038] A sixth aspect, a federated learning system, comprising a plurality of clients and a central server;

[0039] The central server is responsible for initializing the global model parameters w 0 And initialize each local model parameter w 0,i, in each round of iteration, the global model parameters are distributed to the client, the updated global model parameters uploaded by the client are received, and the global model parameters of the client are aggregated and then globally updated for the next round of iteration;

[0040] The client is responsible for executing the federated learning method based on gradient similarity dynamic model fusion as described in the first aspect, completing local model update, global model update, gradient similarity calculation, model fusion and parameter upload operations.

[0041] Beneficial effects:

[0042] The present invention studies the problem of personalized federated learning in a classic edge environment. In view of the condition that the data is not independent and identically distributed, the performance of the personalized model is significantly improved by dynamically adjusting the fusion weights of the global model and the local model. Compared with the fixed weight fusion method in the traditional method, the present invention dynamically adjusts the weights by gradient similarity, which can reflect the consistency of the optimization direction of the local model and the global model in real time, thereby more accurately balancing the global generalization and local personalization needs. For example, when the gradient similarity is high (that is, the local and global optimization directions are consistent), the weight of the global model is increased to enhance the generalization ability; otherwise, the weight of the local model is increased to strengthen personalized adaptation. While protecting data privacy, the contradiction between global generalization ability and personalized needs is effectively resolved. The present invention can improve the adaptability of the personalized model on the client on the basis of ensuring the convergence stability of the global model. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a personalized federated learning framework diagram based on gradient similarity dynamic model fusion under non-independent and identically distributed data;

[0044] Figure 2 It is a flow chart of the personalized federated learning method based on gradient similarity dynamic model fusion. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described in conjunction with specific embodiments and corresponding drawings. At the same time, it should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, the modifications of various equivalent forms of the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0046] A federated learning system usually includes a remote central server and several clients, and the client terminal devices are connected to the remote central server via wireless or wired communication. Client devices are also called edge terminals, user nodes, client nodes, etc., which can be used interchangeably in this article. The central server can also be called an aggregation server, a global server, etc. In the present invention, each client stores local training data and machine learning models, and has computing power to perform local training tasks.

[0047] This paper proposes a personalized federated learning method based on gradient similarity dynamic model fusion, which is optimized based on the classic federated learning architecture. Figure 1 As shown in Figure 1, the current federated learning system consists of a central server and multiple client nodes. Each client has a different local data distribution, and there may be differences in data volume and feature distribution. The central server optimizes the global model by distributing global model parameters and aggregating the updated models of the clients.

[0048] like Figure 1 As shown in Figure 1, in a round of federated learning, the central server distributes the global model parameters to the client, and the client performs training based on local data, while calculating the gradient similarity between the global model and the local model and generating a personalized model. The client uploads the updated global model parameters, and the central server aggregates and updates the parameters uploaded by all clients to complete the current round of global model training.

[0049] The local training of the client is mainly based on multiple rounds of optimization based on the loss value of its objective function. In the entire system, a round of federated learning training is called a round of global iteration. In a round of global iteration, the client obtains updated model parameters through multiple rounds of local training.

[0050] According to an embodiment of the present invention, the tasks of each client node include local model update, global model training, gradient similarity calculation, dynamic weight adjustment, personalized model generation and global model upload, such as Figure 2 shown.

[0051] Specifically, after the client receives the global model parameters, it will perform training based on local data in each iteration. The training process includes calculating gradients, optimizing model parameters, and adjusting the fusion weights of the global model and the local model based on gradient similarity. While the client generates a personalized model, it uploads the updated global model parameters to the central server.

[0052] The central server plays a coordinating and aggregating role in the entire system. Its responsibilities include:

[0053] (1) Global model initialization: The central server selects appropriate initial parameters w for the global model 0,g,These parameters can be randomly generated or obtained through pre-training of public datasets.

[0054] (2) Global model distribution: In each round of global iteration, the central server distributes the latest global model parameters to the Distributed to all participating client nodes.

[0055] (3) Model aggregation and update: The central server updates the global model parameters after receiving the global model parameters uploaded by the client. After that, the aggregation calculation is performed, usually using the average aggregation method, the formula is as follows:

[0056]

[0057] Where N is the number of clients participating in the training.

[0058] (4) Global model update: The central server uses the aggregated parameters to update the global model and complete the current round of training.

[0059] Each client node contributes its computing resources to the global model optimization by participating in the training. Its responsibilities mainly include the following steps (corresponding to Figure 2 Flowchart shown):

[0060] (1) Receiving global model parameters: The client receives the latest global model parameters w from the central server t,g , as a reference for initializing local training.

[0061] (2) Local training of global model and local model: Using local dataset D i Independently train the local model w t,i and the global model w t,g , updated to the new local model parameter w t+1,i and the new global model parameters

[0062] The local model parameter update formula is as follows:

[0063]

[0064] Where η is the learning rate, Represents the gradient of the local model.

[0065] The global model parameter update formula is as follows:

[0066]

[0067] in, represents the gradient of the global model.

[0068] (3) Obtaining local model gradient and global model gradient: local model gradient and the global model gradient It has already been obtained in step (2), usually in the back-propagation step of the neural network.

[0069] (4) Calculate the gradient similarity s based on the local model gradient and the global model gradient i , the calculation formula is as follows:

[0070]

[0071] Among them, <·,·> represents the vector inner product, and ||·|| represents the Euclidean norm of the vector.

[0072] (5) Dynamically adjust the fusion weight of the local model and the global model based on the gradient similarity

[0073] (6) Using weight λ i Fusion of local and global models to generate personalized models In each round, the personalized model refers to the similarity between the local model and the global model to adjust the weight of the fusion of the two, so as to achieve dynamic evolution and personalized adaptation of model parameters and better adapt to local reasoning tasks. The formula is as follows:

[0074]

[0075] (7) Update the global model parameters Upload to the central server instead of uploading the personalized model parameters to reduce communication costs and ensure the consistency of the global model. The local model is retained locally to maintain its individuality, and then jump to step (1) for the next round of iteration until the personalized model converges.

[0076] The specific convergence condition is: the change of the local validation set loss of the client for K consecutive rounds (such as K = 5) is less than the threshold ∈ (such as ∈ = 0.001), or the preset maximum iteration round (such as T = 1000) is reached. After convergence, the client's personalized model will be used as the final deployment model for inference tasks on local data.

[0077] The present invention also provides a federated learning client device, comprising:

[0078] The local model update module is used to independently train the local model using the local dataset in the current iteration round t to generate the updated local model parameters w t+1,i ;

[0079] The global model update module is used to receive the global model parameters w sent by the central server in the current iteration round. t,g, use the local dataset to independently train the global model and generate updated global model parameters

[0080] Gradient similarity calculation module, used to calculate the gradient similarity s between the local model gradient and the global model gradient i ;

[0081] A model fusion module is used to combine the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration;

[0082] Parameter upload module, used to upload updated global model parameters Upload to the central server for aggregation and enter the next iteration round.

[0083] The present invention also provides an electronic device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the personalized federated learning method based on gradient similarity dynamic model fusion as described above are implemented.

[0084] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the personalized federated learning method based on gradient similarity dynamic model fusion as described above are implemented.

[0085] In another embodiment, the present invention further provides a personalized federated learning method based on gradient similarity dynamic model fusion, the method comprising the following steps:

[0086] The central server initializes the global model parameters w 0 And initialize each local model parameter w 0,i , distribute the global model parameters to the clients in each iteration;

[0087] After receiving the global model parameters, the client uses the local data set to independently train the global model and generate updated global model parameters. And use the local dataset to independently train the local model to generate the updated local model parameters w t+1,i ; Calculate the gradient similarity s between the local model gradient and the global model gradient i ; Based on the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global modeli , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration; the updated global model parameters Upload to the central server;

[0088] The central server receives the updated global model parameters uploaded by the client, aggregates the global model parameters of the client, and performs a global update for the next round of iteration.

[0089] In another embodiment, the present invention also provides a federated learning system, including a plurality of clients and a central server;

[0090] The central server is responsible for initializing the global model parameters w 0 And initialize each local model parameter w 0,i , in each round of iteration, the global model parameters are distributed to the client, the updated global model parameters uploaded by the client are received, and the global model parameters of the client are aggregated and then globally updated for the next round of iteration;

[0091] The client is responsible for executing the federated learning method based on gradient similarity dynamic model fusion as described in the first aspect, completing local model update, global model update, gradient similarity calculation, model fusion and parameter upload operations.

[0092] The present invention aims at the condition that the data is not independent and identically distributed, and significantly improves the performance of the personalized model by dynamically adjusting the fusion weights of the global model and the local model. Compared with the fixed weight fusion method in the traditional method, the present invention dynamically adjusts the weights through gradient similarity, which can reflect the consistency of the optimization direction of the local model and the global model in real time, so as to more accurately balance the global generalization and local personalized needs. For example, when the gradient similarity is high (that is, the local and global optimization directions are consistent), the weight of the global model is increased to enhance the generalization ability; otherwise, the weight of the local model is increased to strengthen personalized adaptation. While protecting data privacy, it effectively solves the contradiction between global generalization ability and personalized needs. The present invention can improve the adaptability of the personalized model on the client on the basis of ensuring the convergence stability of the global model.

Claims

1. A personalized federated learning method based on gradient similarity dynamic model fusion, characterized in that: The method is executed on a federated learning client and includes the following steps: In the current iteration round t, the local model is trained independently using the local dataset to generate the updated local model parameters w t+1,i ; Receive the global model parameter w sent by the central server in the current iteration round t,g , use the local dataset to independently train the global model and generate updated global model parameters Calculate the gradient similarity s between the local model gradient and the global model gradient i ; Based on the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration; The updated global model parameters Upload to the central server for aggregation and enter the next iteration round.

2. The method according to claim 1, characterized in that Gradient Similarity i The calculation formula is as follows: Among them, <·,·> represents the vector inner product, and ||·|| represents the Euclidean norm of the vector.

3. The method according to claim 1, characterized in that: Fusion weight λ i The calculation formula is as follows: Among them, λ i ∈[0,1].

4. The method according to claim 1, characterized in that: The personalization model is calculated as follows:

5. A federated learning client device, characterized in that: include: The local model update module is used to independently train the local model using the local dataset in the current iteration round t to generate the updated local model parameters w t+1,i ; The global model update module is used to receive the global model parameters w sent by the central server in the current iteration round. t,g , use the local dataset to independently train the global model and generate updated global model parameters Gradient similarity calculation module, used to calculate the gradient similarity s between the local model gradient and the global model gradient i ; A model fusion module is used to combine the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration; Parameter upload module, used to upload updated global model parameters Upload to the central server for aggregation and enter the next iteration round.

6. An electronic device, characterized in that: include: one or more processors; Memory; And one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the personalized federated learning method based on gradient similarity dynamic model fusion as described in any one of claims 1-4 are implemented.

7. A 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 personalized federated learning method based on gradient similarity dynamic model fusion as described in any one of claims 1 to 4 are implemented.

8. A personalized federated learning method based on gradient similarity dynamic model fusion, characterized in that: The method comprises the following steps: The central server initializes the global model parameters w0 and each local model parameter w 0,i , distribute the global model parameters to the clients in each iteration; After receiving the global model parameters, the client uses the local data set to independently train the global model and generate updated global model parameters. And use the local dataset to independently train the local model to generate the updated local model parameters w t+1,i ; Calculate the gradient similarity s between the local model gradient and the global model gradient i ; Based on the gradient similarity s i Dynamically adjust the fusion weight λ of the local model and the global model i , and based on the fusion weight λ i Generate a personalized model As the local model for the next iteration; the updated global model parameters Upload to the central server; The central server receives the updated global model parameters uploaded by the client, aggregates the global model parameters of the client, and performs a global update for the next round of iteration.

9. A federated learning system, characterized in that: Includes multiple clients and a central server; The central server is responsible for initializing the global model parameter w0 and initializing each local model parameter w 0,i , in each round of iteration, the global model parameters are distributed to the client, the updated global model parameters uploaded by the client are received, and the global model parameters of the client are aggregated and then globally updated for the next round of iteration; The client is responsible for executing the federated learning method based on gradient similarity dynamic model fusion as described in any one of claims 1-4, and completing local model update, global model update, gradient similarity calculation, model fusion and parameter upload operations.

Citation Information

Cited By

  • Modeling method, system and device of price elasticity model based on federal learning

    CN121188829A

  • Website content identification method and system based on federal learning

    CN121750304A

  • A website content identification method and system based on federated learning

    CN121750304B