A personalized federated learning method based on adaptive local aggregation
By adopting a personalized federated learning method with adaptive local aggregation, this approach addresses the issues of data privacy leakage and high network communication costs. It achieves the effect of improving the quality of local models and reducing costs while protecting data privacy, and is applicable to various federated learning methods.
Patent Information
- Application Number
- CN202211253769.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-13
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-10-13
AI Technical Summary
Existing personalized federated learning methods suffer from high risks of data privacy breaches, high network communication costs, and difficulty in improving the quality of local models during transmission and training.
We employ a personalized federated learning approach with adaptive local aggregation. Through adaptive local aggregation weight training and gradient descent optimization, we accurately extract useful information from the global model and introduce adaptive adjustments during the local model initialization process to reduce network communication and computation costs.
It achieves accurate extraction of global model information while protecting data privacy, improves the quality of local models, reduces network communication and computing costs, and is applicable to various federated learning methods to enhance personalized performance.
Smart Images

Figure CN115481755B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of federated learning, and particularly relates to a personalized federated learning method based on adaptive local aggregation. BACKGROUND
[0002] With the continuous development of intelligent terminals, the number of intelligent terminal devices is increasing, and the amount of data generated by the use of terminal devices every day is also growing exponentially. However, since the ownership of these data belongs to an institution or a user, people will not publicly disclose the data on the terminal device for the purpose of data privacy protection and data asset protection. That is, the owner holds the data alone. Even though there is a large amount of data in the world, because the data usage rights from other institutions or individuals cannot be obtained, the specific application still faces the problem of data deficiency, that is, the "data island" phenomenon. In recent years, artificial intelligence (AI) has maintained a high speed of development, and the size of AI models has also increased with each passing day, so that the demand for training data of huge AI models is also increasing. Through federated learning to train AI models, the data of multiple institutions or individuals can be utilized while protecting data privacy, and information fusion can be achieved.
[0003] Federated learning adopts a "client-server" architecture mode, and the following three steps are iteratively trained until the model converges: (1) the server sends the global model to the client participating in the training in this round through the network; (2) the client receives the global model, covers the old local model, and performs training on the local data; (3) after the training is completed, the client uploads the local model to the server through the network; (4) the server receives the client model that meets the set number, performs model aggregation, and generates a new global model. Since the client data is not uploaded in the federated learning process, the model training is completed without the data leaving the local, so as to train the AI model while protecting the data privacy. However, due to the inconsistent data collection methods or behaviors of each client, the data between multiple clients does not satisfy the independent and identically distributed characteristics, causing problems such as the global model not being able to adapt to the local data and poor generalization. Different from the goal of obtaining a global model in traditional federated learning, personalized federated learning aims to use the federated learning process to make up for the lack of local data of the client, and to learn a model suitable for the local data set for each client. If the information in the global model is utilized well, it is one of the key factors to improve the training effect of the personalized federated learning model.
[0004] In the field of personalized federated learning, the existing methods extract the information required by each client from the global model in an implicit or coarse-grained manner, which easily introduces information that degrades the quality of the local model. In addition, since each client can recover the training data from the received model, the way the existing methods transmit other client models to the current client increases the risk of data privacy leakage and also increases the cost of network communication.
[0005] Therefore, the skilled in the art is committed to developing a personalized federated learning method based on adaptive local aggregation, which can accurately extract information from the global model that is beneficial to improving the quality of the local model at a lower network communication cost. SUMMARY
[0006] In view of the above defects of the prior art, the technical problem to be solved by the present application is how to utilize the global model to promote local model training and achieve accurate extraction of information in the global model.
[0007] To achieve the above object, the present application provides a personalized federated learning method based on adaptive local aggregation, which comprises the following steps:
[0008] Step 1, the server sends an initial global model Θ 0 to all clients to initialize the local model of each client, and the client initializes the adaptive local aggregation weight; wherein i is the client number, and t is the current round number of personalized federated learning;
[0009] Step 2, the client i performs the tth round of iterative training, and performs adaptive local aggregation according to the global model Θ t-1 sent by the server to obtain the initialized local model of this iteration;
[0010] Step 3, according to the value of t, it is judged whether adaptive local aggregation weight training is needed to obtain new adaptive local aggregation weight; if new adaptive local aggregation weight is obtained, adaptive local aggregation is performed to update the initialized local model;
[0011] Step 4, the client i updates the local model by gradient descent and sends the local model to the server;
[0012] Step 5, the server performs global aggregation on the received local model to generate a global model Θ t ;
[0013] Step 6, repeat steps 2 to 5 to perform T rounds of iterative training until the local model of each client converges; wherein t∈[0,T].
[0014] Further, the step 1 further comprises:
[0015] Define the global objective function as:
[0016]
[0017] Generally,
[0018] where L i is the local objective function; L(·) is the loss function; D i is the dataset on the i-th client; |D i | is the size of the dataset on the i-th client; Θ is the global model; is the initialized local model on the i-th client.
[0019] Furthermore, step 1 further includes:
[0020] Due to the additivity of the global objective function, find respectively:
[0021]
[0022] to implement the solution of G(·).
[0023] Furthermore, in step 2, in each round of personalized federated learning, the server randomly selects a subset I of N clients according to the participation rate ρ of the clients t and sends the global model.
[0024] Furthermore, perform adaptive local aggregation according to the following formula:
[0025]
[0026] where W i p is the adaptive local aggregation weight, p represents applying only local aggregation on the penultimate p-th layer of the local model; Θ i is the local model on the i-th client; and Θ <00
[0028] If t = 1, no adaptive local aggregation weight training is performed;
[0029] If t = 2, adaptive local aggregation weight training is repeatedly performed until adaptive local aggregation weights converge;
[0030] If t > 2, adaptive local aggregation weight training is performed once.
[0031] Further, the adaptive local aggregation weight training comprises:
[0032] freezing local models and weight updates that do not participate in training;
[0033] training on partial local data sets to obtain new adaptive local aggregation weights.
[0034] Further, the training on partial local data sets to obtain new adaptive local aggregation weights is:
[0035] Client i samples s% data from local data set D i to obtain partial data set D optimizing in a gradient descent manner:
[0036]
[0037] where η is the learning rate of weight training;
[0038] obtaining adaptive adjusted W i p pruning according to σ(w) = max(0, min(1, w)) element by element.
[0039] Further, the client i updates the local model in a gradient descent manner as follows:
[0040]
[0041] where α is the learning rate of local model training.
[0042] Further, in the step 5, global aggregation is performed according to the following formula:
[0043]
[0044] Compared with the prior art, the present application has the following beneficial technical effects:
[0045] 1. The application first realizes adaptive local aggregation in an element mode, can accurately capture information in the global model that is conducive to local model training, introduces information from outside the local client data, and effectively alleviates the problem of local data scarcity;
[0046] 2. In terms of communication, the application only needs to upload and download a parameter amount of a global model size per iteration, and has lower communication cost compared to other coarse-grained adaptive local aggregation methods;
[0047] 3. By adjusting the hyperparameter p, the range of adaptive local aggregation can be adjusted, the parameter amount of adaptive local aggregation weight can be adjusted, and the local computing cost can be reduced;
[0048] 4. The local aggregation operation of the application only modifies the local model initialization process in each iteration, and this process exists universally in other federated learning methods, so the application can be applied to other federated learning methods to improve their performance in personalization.
[0049] The concept, specific structure and technical effects of the application will be further described below with reference to the accompanying drawings, so as to fully understand the purpose, features and effects of the application. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 is a method flowchart of a preferred embodiment of the application;
[0051] Figure 2 is a federated learning framework schematic diagram of a preferred embodiment of the application;
[0052] Figure 3 is a local training process schematic diagram with adaptive aggregation of a preferred embodiment of the application;
[0053] Figure 4 is an adaptive aggregation parameter training process schematic diagram of a preferred embodiment of the application. DETAILED DESCRIPTION
[0054] The following reference description of the drawings introduces several preferred embodiments of the application, so that the technical content of the application is clearer and easier to understand. The application can be embodied in many different forms of embodiments, and the protection scope of the application is not limited to the embodiments mentioned in the text.
[0055] In the drawings, components with the same structure are denoted by the same reference numerals, and components with similar structure or function are denoted by similar reference numerals. The size and thickness of each component shown in the drawings are arbitrarily shown, and the application does not limit the size and thickness of each component. In order to make the drawing clearer, the thickness of some components is appropriately exaggerated in some places in the drawing.
[0056] As Figure 1 shown, it is a method flow chart of a preferred embodiment of the application, comprising the following steps:
[0057] Step 1, the server sends the initial global model Θ 0 to all clients to initialize the local model of each client, and the client initializes the adaptive local aggregation weight; wherein i is the client number, and t is the current round number of personalized federated learning;
[0058] Specifically, step 1 includes:
[0059] Step 1.1, number the N clients participating in federated learning as 1, 2, …, i, …, N; denote the data set on the i-th client as D i ; denote the size of the data set as |D i |; denote the local model on the i-th client as Θ i ; denote the number of layers of the local model as |Θ i |; denote the adaptive local aggregation weight as W i p , wherein p represents that only local aggregation is applied on the (p-1)th layer of the local model from the bottom; denote the initialized local model on the i-th client as Θ ; denote the global model as Θ; denote the loss function as L(·); and denote the local objective function as
[0060] Step 1.2, define the global objective function as:
[0061]
[0062] wherein wherein
[0063] Step 1.3, since the global objective function is additive, respectively solve:
[0064]
[0065] to realize the solution of G(·).
[0066] Step 1.4, the server sends the initial global model Θ 0 to all clients to initialize the local model; and the client initializes the adaptive local aggregation weight W i p .
[0067] Step 2, the client i performs the t-th round of iteration training, performs adaptive local aggregation according to the global model Θ t-1 sent by the server, and obtains the initialized local model of this iteration;
[0068] Specifically, step 2 includes:
[0069] Step 2.1: For the t-th round of iterative training, the server randomly selects a subset of N clients denoted as I according to the client participation rate ρ of each iteration t , and sends the global model Θ t-1 obtained in the previous iteration to the clients in the set I t ;
[0070] Step 2.2: The client numbered i performs adaptive local aggregation after receiving the global model Θ t-1 to obtain the initialized local model in this iteration:
[0071]
[0072] where, |Θ i | is the number of layers of the local model on the i-th client; has the same shape as the first |Θ t-1 |-p layer network layers in Θ i , W i p has the same shape as the last p layer network layers in Θ t-1 , indicating that the parameters in |Θ t-1 |-p in Θ i are used to overwrite the corresponding layer parameters in Θ t-1 to achieve local initialization of the parameters of the lower layer network layers in ;
[0073] Step 3: Determine whether to perform adaptive local aggregation weight training according to the t value to obtain a new adaptive local aggregation weight; if a new adaptive local aggregation weight is obtained, perform adaptive local aggregation to update the initialized local model;
[0074] Specifically, step 3 includes:
[0075] Step 3.1: The client i samples s% of the data from the local dataset D i to obtain a partial dataset and then optimizes it in the way of gradient descent:
[0076]
[0077] where, η is the learning rate of weight training; thus, the adaptively adjusted W i p is obtained;
[0078] Step 3.2: The client i performs... on the obtained adaptive weight W ip , according to σ(w) = max(0, min(l, w)) pruning by element;
[0079] Step 3.3, if t = 1, then skip step 3.1 and step 3.2, because if t = 2, then perform step 3.1 and step 3.2 until W i p no longer changes (i.e. converges); if t > 2, then perform step 3.1 and step 3.2 only once in each iteration;
[0080] Step 3.4, the client i updates the initialized local model i p according to the newly obtained adaptive weight W
[0081] Step 4, the client i updates the local model in a gradient descent manner as follows, and sends the local model to the server:
[0082]
[0083] wherein a is the learning rate of the local model training;
[0084] Step 5, the server performs global aggregation on the received local models to generate a global model Θ t as follows:
[0085]
[0086] Step 6, repeat steps 2 to 5 to perform T rounds of iterative training until the local model training of each client converges; wherein t ∈ [0, T].
[0087] As shown in FIG. 1, it is a federated learning framework in the server-client mode of the present embodiment. Specifically, in the tthround of iterative training: Figure 2
[0088] (1) the server sends the global model Θ t-1 obtained by the last round of aggregation to all clients in the client set I t participating in the current round of federated learning;
[0089] (2) these clients receive the global model and perform local learning process, and then upload the local model trained by each client to the server;
[0090] (3) the server receives these local models, performs global aggregation, and generates a new global model. Repeat the process iteratively to finally obtain the optimal local initialization model
[0091] As shown in Figure 3 , the local learning process of the tth iteration on the client i is described. Specifically, during the tth iteration training:
[0092] (1) First, the client i receives the global model Θ t-1 sent by the server;
[0093] (2) Then, it is adaptively aggregated with the local model obtained in the last round of training to obtain the local initialization model of the tth iteration
[0094] (3) The local model training obtains the local model
[0095] (4) The local model is uploaded to the server.
[0096] As shown in Figure 4 , the adaptive weight training process of the tth iteration on the client is described. Specifically, during the tth iteration training:
[0097] (1) The local model and the weight update are frozen and do not participate in training;
[0098] (2) According to , the new adaptive aggregation weight W i p is obtained by training on part of the local data set. Note that p = 4 in Figure 4 , and dark gray represents
[0099] The preferred embodiments of the present application are described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and changes to the present application without creative labor based on the concept of the present application. Therefore, any technical solutions obtained by logical analysis, reasoning or limited experiments based on the prior art according to the concept of the present application shall be within the protection scope defined by the claims.
Claims
1. A personalized federated learning method based on adaptive local aggregation, characterized in that, The method includes the following steps: Step 1: The server sends the initial global model. In all clients, initialize the local model for each client, and initialize adaptive local aggregate weights for each client; among them, i Number the client. t This represents the current round number of the personalized federated learning process. Define the global objective function as: Generally, , , ; In the formula, For local objective functions; The loss function; For the first i Data sets on multiple clients; For the first i The size of the dataset on each client; For global models; For the first i Initialize the local model on each client; Due to the additivity of the global objective function, we calculate the following separately: To achieve Solve for; Step 2, Client i Execute the t Rounds of iterative training, based on the global model sent by the server. Perform adaptive local aggregation to obtain the initial local model for this iteration; in each round of personalized federated learning, the server randomly selects a subset I of N clients based on the client participation rate ρ. t Send the global model; Perform adaptive local aggregation based on the following formula: in, To adapt local aggregation weights, p This indicates that only the local aggregation is applied in the penultimate step of the local model. p On the upper level; For the first i Local model on each client; and The front of the middle The layers of the network have the same shape. and The middle p Layered network layers have the same shape, representing the use of middle Parameter coverage The parameters of the corresponding layer are used to achieve the desired result. Local initialization of parameters for lower and middle network layers; Step 3, according to t The value determines whether adaptive local aggregation weight training is needed to obtain new adaptive local aggregation weights; if new adaptive local aggregation weights are obtained, then adaptive local aggregation is performed to update and initialize the local model. Step 4, Client i The local model is updated using gradient descent, and then sent to the server. Step 5: The server performs global aggregation on the received local model to generate a global model. ; Step 6: Repeat steps 2 to 5, performing T rounds of iterative training until the local model training on each client machine converges; where, t [0,T].
2. The personalized federated learning method based on adaptive local aggregation as described in claim 1, characterized in that, Step 3 also includes: like t If =1, then adaptive local aggregated weight training will not be performed; like t If the value is 2, then repeat the adaptive local aggregate weight training until the adaptive local aggregate weight converges. like t If the result is greater than 2, then perform an adaptive local aggregated weight training.
3. The personalized federated learning method based on adaptive local aggregation as described in claim 2, characterized in that, The adaptive local aggregated weight training includes: Local model and weight update Freeze from training; New adaptive local aggregation weights are obtained by training on a partial local dataset.
4. The personalized federated learning method based on adaptive local aggregation as described in claim 3, characterized in that, The new adaptive local aggregation weights obtained by training on a partial local dataset are as follows: Client i From local dataset i A portion of the dataset was obtained by sampling s% of the data. Optimize using gradient descent: in, The learning rate for training the weights; Obtain adaptive adjustment ,according to Prune by element.
5. The personalized federated learning method based on adaptive local aggregation as described in claim 4, characterized in that, The client i The local model is updated using gradient descent as follows: Where α is the learning rate for training the local model.
6. The personalized federated learning method based on adaptive local aggregation as described in claim 5, characterized in that, In step 5, global aggregation is performed according to the following formula: 。