Individualized federal learning method and system based on aggregation head

By splitting the global model and training the aggregate head in personalized federated learning, the problem of personalized model losing global information during local data training is solved, and the performance of personalized model is improved.

CN119578510APending Publication Date: 2025-03-07CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411627787.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

When the existing personalized federated learning method uses local data to train the head, it will cause the head to lose global information, affecting the performance of the personalized model.

Method used

By splitting the global model into a global feature extractor and a global header, and freezing these components on the client, training the aggregation weight of the header, and then performing element-level aggregation to obtain the aggregation header, and training the aggregation header and the global feature extractor locally.

Benefits of technology

While achieving personalization, learn more comprehensive global knowledge of the head, thereby improving the performance of the personalized model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578510A_ABST
    Figure CN119578510A_ABST
Patent Text Reader

Abstract

The invention relates to a personalized federal learning method and system based on an aggregation head, and belongs to the technical field of machine learning. The method comprises the following steps: a server sends an initialized global model to a client, and initializes a local model; the client performs iteration, splits the global model into a feature extractor and a head, and trains an aggregation weight of the head; performing element-level aggregation on the global head and the local head of the last round of iteration by using the new weight to obtain an aggregated head; the feature extractor is frozen, after the head is locally trained and aggregated, the head is frozen to train the feature extractor, and a trained local model is obtained and uploaded to a server; and the server globally aggregates the uploaded model to obtain a new global model and sends the new global model to the selected client to initialize the local model. According to the method provided by the invention, global information is introduced through the element-level aggregation model head, so that the personalized model performance can be improved, and the method has a good application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of machine learning and relates to a personalized federated learning method and system based on aggregated heads. Background Art

[0002] Centralized training of machine learning is facing major challenges due to the increasing attention paid to user data privacy. On the other hand, due to the data sparsity problem on a single client, it is difficult to independently learn a well-performing model on each client based on private local data. Federated learning, as a popular distributed machine learning paradigm, has excellent privacy protection and collaborative learning capabilities. Its learning task is coordinated by a server and solved by a network of multiple participating devices (called clients). The Federated Average Algorithm (FedAvg) is the original federated learning method and the basic framework of subsequent methods. Its iteration process can be described as five steps: (1) The server randomly selects a part of clients to join the federated learning and distributes the same global model to them for initialization; (2) The client overwrites its local model parameters with the parameters of the downloaded global model to obtain global knowledge; (3) The client trains its local model on private local data; (4) The client uploads the trained local model to the server; (5) The server receives the local model of the client and performs weighted average of the model parameters to obtain a new global model. The Federated Average Algorithm learns a single global model and expects it to perform well on all clients. However, this approach often suffers in statistically heterogeneous environments, such as when faced with non-IID and unbalanced data, which can lead to degraded model performance.

[0003] Personalized federated learning is proposed to address statistical heterogeneity and personalize federated learning. Personalized federated learning focuses on learning personalized models rather than a single global model. For each client that joins federated learning, the global model distributed by the server contains global information, which can enhance the local model and solve the problem of data shortage. Most of the existing personalized federated learning methods use the global model as a container to store global information and exploit global and personalized information by mining the parameters of global and local models. Specifically, one type of personalized aggregation-based method aggregates other client models, or global and local models, to perform better local initialization; another type of personalized head-based method splits the model into a global part (the bottom layer of the model, called the feature extractor) and a personalized part (the high layer of the model, called the head), where the feature extractor is collaboratively trained and shared, while the head is locally trained and not shared, in the hope of simultaneously utilizing global and personalized information in the model parameters.

[0004] However, in the actual implementation process, it is found that the personalized federated learning method based on the personalized head only uses local data to train the head, which will cause the head to lose some global information, thus affecting the performance of the personalized model. In order to solve the above problems of such methods, a new accurate and efficient personalized federated learning method is urgently needed. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a personalized federated learning method and system based on aggregated heads, which can achieve personalization with the help of heads while more completely learning the global knowledge of the heads, thereby improving the performance of the personalized model.

[0006] In order to achieve the above object, the present invention provides the following technical solutions:

[0007] A personalized federated learning method based on aggregated heads, the method comprising the following steps:

[0008] S1. The server sends the initialized global model to all clients and initializes the local model of each client; where i is the client number and t is the current iteration number;

[0009] S2, client i executes the tth iteration, splits the global model into the global feature extractor and the global head, and trains the aggregation weight of the head by freezing the global feature extractor, the global head, and the local head of the t-1th iteration;

[0010] S3: The client uses the new header aggregation weight to aggregate the global header and the local header of the t-1th iteration at the element level to obtain the aggregated header.

[0011] S4, the client freezes the global feature extractor, trains the aggregated head, and obtains the local head of the tth iteration;

[0012] S5. The client freezes the local head, trains the global feature extractor, obtains the local feature extractor of the tth iteration, thereby obtaining the trained local model and uploading it to the server;

[0013] S6. The server performs global aggregation on the uploaded local model to obtain a global model, and sends it to the selected client as its initialization local model;

[0014] S7. Repeat steps S2 to S6 and perform T rounds of iterations until the local model training of all clients converges; where t∈[0, T].

[0015] Furthermore, in step S1, the global objective function of federated learning is defined as:

[0016]

[0017] in, and and is the local loss function of the i-th client; D i represents the dataset of the i-th client; |D i | represents the dataset size of the i-th client; Represents the initialized local model of the i-th client.

[0018] Further, in step S2, it specifically includes:

[0019] Client i executes the tth iteration and converts the global model Θ t Split into global feature extractor r t and the global header h t ; Client i freezes the global feature extractor r t 、Global Header h t and the local head of the t-1th iteration The aggregation weights of the head are trained by gradient descent method The specific method is as follows:

[0020]

[0021] Where η is the learning rate of the aggregate weight; then, client i prunes the updated aggregate weight according to σ(w)=max(0,min(1,w)) to ensure that

[0022] Further, in step S3, it specifically includes:

[0023] Client i uses the new header's aggregate weight Set the global header h t and the local head of the t-1th iteration Perform element-level aggregation between them to get the aggregation head The specific method is as follows:

[0024]

[0025] Where ⊙ is the Hadamard product, which means that the elements in the same position of two matrices are multiplied. represents the aggregate weight of the model header of client i, where

[0026] Further, in step S4, it specifically includes:

[0027] Client i freezes the global feature extractor r t , local training aggregation head Get the local header of the tth iteration The specific method is as follows:

[0028]

[0029] Further, in step S5, it specifically includes:

[0030] Client i freezes local header Train the global feature extractor r t , get the local feature extractor of the tth iteration So as to obtain the trained local model And upload it to the server as follows:

[0031]

[0032] Further, in step S6, it specifically includes:

[0033] The server performs global aggregation on the uploaded local models and obtains the global model {r t+1 ,h t +1} and sent to the selected client as its initialization local model, the specific method is as follows:

[0034]

[0035] Among them, S t It is the subset of clients selected by the server in the tth iteration.

[0036] The present invention also provides a personalized federated learning system based on aggregated headers.

[0037] The beneficial effects of the present invention are:

[0038] The present invention provides a personalized federated learning method and system based on aggregated heads, which obtains an aggregated head by performing element-level aggregation between the local model head of the previous iteration and the global model head of this iteration, so as to introduce the global information in the global model head; the method can learn the global knowledge of the head more completely while achieving personalization by splitting the head, thereby improving the performance of the personalized model.

[0039] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0041] Figure 1 A schematic diagram of the process flow of the personalized federated learning method based on aggregated headers provided by the present invention;

[0042] Figure 2 A system framework diagram of the personalized federated learning method based on aggregated headers provided by the present invention;

[0043] Figure 3 A schematic diagram of the local training process of the personalized federated learning method based on aggregated heads provided by the present invention. DETAILED DESCRIPTION

[0044] The technical solution of the present invention is described in detail below with reference to the accompanying drawings.

[0045] Figure 1 The flowchart of the personalized federated learning method based on aggregated headers provided by the present invention is shown in FIG. Figure 1 The process of the personalized federated learning method based on aggregated headers provided by the present invention includes the following steps:

[0046] Step 1: The server sends the initialized global model to all clients and initializes the local model of each client; where i is the client number and t is the current iteration number;

[0047] Specifically, step 1 includes:

[0048] Step 1.1: Number the N clients participating in federated learning from 1 to N; record the dataset of the i-th client as D i , the size of the data set is denoted as |D i |, and these data sets are not independent and identically distributed; the local model of the i-th client is recorded as Θ i ; The initial local model of the i-th client is recorded as The global model is denoted as Θ; the local feature extractor of the i-th client is denoted as r i ;Record the local header of the i-th client as h i ; The aggregate header of the i-th client is recorded as The global feature extractor is denoted as r; the global head is denoted as h; the local model Θ of the i-th client i It is split into a combination of feature extractor and head, denoted as {r i ,h i}; The header aggregation weight of the i-th client is recorded as W i ; The local loss function of the i-th client is recorded as

[0049] Step 1.2: Define the global objective function of federated learning as:

[0050]

[0051] in, and and is the local loss function of the i-th client;

[0052] Step 1.3: The server sends the initialized global model Θ 0 For all clients, initialize the client's local model.

[0053] Step 2: Client i executes the tth iteration and converts the global model Θ t Split into global feature extractor r t and the global header h t ; Client i freezes the global feature extractor r t 、Global Header h t and the local head of the t-1th iteration The aggregation weights of the head are trained by gradient descent method The specific method is as follows:

[0054]

[0055] Where η is the learning rate of the aggregate weight; then, client i prunes the updated aggregate weight according to σ(w)=max(0,min(1,w)) to ensure that

[0056] Step 3: Client i uses the new header’s aggregation weight Set the global header h t and the local head of the t-1th iteration Perform element-level aggregation between them to get the aggregation head The specific method is as follows:

[0057]

[0058] Where ⊙ is the Hadamard product, which means that the elements in the same position of two matrices are multiplied. represents the aggregate weight of the model header of client i, where

[0059] Step 4: Client i freezes the global feature extractor r t , local training aggregation head Get the local header of the tth iteration The specific method is as follows:

[0060]

[0061] Step 5: Client i freezes the local header Train the global feature extractor r t , get the local feature extractor of the tth iteration So as to obtain the trained local model And upload it to the server as follows:

[0062]

[0063] Step 6: The server performs global aggregation on the uploaded local model to obtain the global model {r t +1 ,h t+1} and sent to the selected client as its initialization local model, the specific method is as follows:

[0064]

[0065] Among them, S t is the subset of clients selected by the server in the tth iteration;

[0066] Step 7: Repeat steps 2 to 6 for T rounds of iterations until the local model training of all clients converges; where t∈[0,T].

[0067] Reference Figure 2 , which is a system framework diagram of the personalized federated learning method based on aggregated heads provided by the present invention. Specifically, during the t-th round of iterative training:

[0068] (1) The server accepts the local models uploaded by all clients in the previous round Perform global aggregation to obtain the global model {r t ,h t}, and send it to the selected client;

[0069] (2) Client i sends the global header h t and the local head of the t-1th iteration Perform element-level aggregation between them to get the aggregation head And the model As its initialization local model;

[0070] (3) Client i first trains the aggregation head Retrain the global feature extractor r t , thus obtaining the trained local model And upload it to the server;

[0071] Reference Figure 3 , which is a schematic diagram of the local training process of the personalized federated learning method based on aggregated heads provided by the present invention. Specifically, during the t-th round of iterative training:

[0072] (1) Client i freezes the global feature extractor r t 、Global Header h t and the local head of the t-1th iteration The aggregation weights of the head are trained by gradient descent method

[0073] (2) Client i uses the new header’s aggregation weight Set the global header h t and the local head of the t-1th iteration Perform element-level aggregation between them to get the aggregation head

[0074] (3) Client i freezes the global feature extractor r t , local training aggregation head Get the local header of the tth iteration

[0075] Client i freezes local header Train the global feature extractor r t , get the local feature extractor of the tth iteration So as to obtain the trained local model And upload it to the server.

[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.

Claims

1. A personalized federated learning method based on aggregated heads, characterized by: The method comprises the following steps: S1. The server sends the initialized global model to all clients and initializes the local model of each client; where i is the client number and t is the current iteration number; S2, client i executes the tth iteration, splits the global model into the global feature extractor and the global head, and trains the aggregation weight of the head by freezing the global feature extractor, the global head, and the local head of the t-1th iteration; S3: The client uses the new header aggregation weight to aggregate the global header and the local header of the t-1th iteration at the element level to obtain the aggregated header. S4, the client freezes the global feature extractor, trains the aggregated head, and obtains the local head of the tth iteration; S5. The client freezes the local head, trains the global feature extractor, obtains the local feature extractor of the tth iteration, thereby obtaining the trained local model and uploading it to the server; S6. The server performs global aggregation on the uploaded local model to obtain a global model, and sends it to the selected client as its initialization local model; S7. Repeat steps S2 to S6 and perform T rounds of iterations until the local model training of all clients converges; where t∈[0, T].

2. The personalized federated learning method based on aggregated headers according to claim 1, characterized in that: In step S1, the global objective function of federated learning is also defined as: in, and and is the local loss function of the i-th client; D i represents the data set of the i-th client; |D i | represents the dataset size of the i-th client; Represents the initialized local model of the i-th client.

3. The personalized federated learning method based on aggregated headers according to claim 2, characterized in that: In step S2, it specifically includes: Client i executes the tth iteration and converts the global model Θ t Split into global feature extractor r t and the global header h t ; Client i freezes the global feature extractor r t 、Global Header h t and the local head of the t-1th iteration The aggregation weights of the head are trained by gradient descent method The specific method is as follows: Where η is the learning rate of the aggregate weight; then, client i prunes the updated aggregate weight according to σ(w)=max(0,min(1,w)) to ensure that w∈[0,1] is satisfied.

4. The personalized federated learning method based on aggregated headers according to claim 3, characterized in that: In step S3, it specifically includes: Client i uses the new header's aggregate weight Set the global header h t and the local head of the t-1th iteration Perform element-level aggregation between them to get the aggregation head The specific method is as follows: Where ⊙ is the Hadamard product, which means that the elements in the same position of two matrices are multiplied. represents the aggregate weight of the model header of client i, where w∈[0,1], 5. The personalized federated learning method based on aggregated headers according to claim 4, characterized in that: In step S4, it specifically includes: Client i freezes the global feature extractor r t , local training aggregation head Get the local header of the tth iteration The specific method is as follows:

6. The personalized federated learning method based on aggregated headers according to claim 5, characterized in that: In step S5, it specifically includes: Client i freezes local header Train the global feature extractor r t , get the local feature extractor of the tth iteration So as to obtain the trained local model And upload it to the server as follows:

7. The personalized federated learning method based on aggregated headers according to claim 6, characterized in that: In step S6, it specifically includes: The server performs global aggregation on the uploaded local models and obtains the global model {r t+1 ,h t+1 } and sent to the selected client as its initialization local model, the specific method is as follows: Among them, S t It is the subset of clients selected by the server in the tth iteration.

8. A personalized federated learning system based on aggregated headers, characterized by: The system adopts the method as claimed in any one of claims 1 to 7.