Personalized federated approach based on layer information awareness
By dividing the client model into head and body parts and performing personalized training based on parameter sensitivity and similarity, the problem of poor model performance in cluster federated learning is solved, and more efficient model optimization and communication optimization are achieved.
Patent Information
- Application Number
- CN202411544505.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-10-31
AI Technical Summary
Existing cluster federated learning methods do not fully consider the importance of different types of layers in the model for specific tasks, resulting in poor model performance and a lack of flexible adjustment mechanisms, making them prone to getting trapped in local optima.
The client model is divided into a head and a body. The head is frozen, the body is fine-tuned, and individual parameters and global parameters are divided according to parameter sensitivity and similarity. The model is updated using similar clients, and the training process is dynamically adjusted to avoid local optima.
It improves the model's personalization and generalization capabilities, optimizes clustering results, balances accuracy and communication overhead, and enhances the overall performance of the model.
Smart Images

Figure CN119476532B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of machine learning, and particularly relates to a personalized federated method based on layer information perception. BACKGROUND
[0002] Federated learning allows multiple institutions or individuals to jointly develop and optimize models through joint modeling without sharing raw data. The data of each participant does not need to leave the local, and the data privacy is effectively protected. However, it still faces some severe challenges. First, the global model accuracy is a key problem faced by federated learning. For example, the uneven distribution of data of various participants may lead to the model performing better in some fields than in others. Second, federated learning also faces the problem of communication cost. For example, the growing Internet of Things devices, and more and more smart devices accessing the network, which also means that federated learning in the Internet of Things will face more complex network environments and greater device management challenges. In order to solve the above-mentioned challenges, cluster federated learning provides an effective solution. By identifying and grouping client devices with similar data distribution or characteristics, cluster federated learning divides these devices into multiple clusters, and the devices within each cluster are more similar in data and characteristics. In this way, the model can be more targeted for training, improving the individualization ability, and solving the problems of data imbalance and local model update bias.
[0003] Although cluster federated learning provides an effective path to solve the above-mentioned problems, it itself also has some challenges to be solved. (1) In the training process, cluster federated learning often does not fully consider the importance of different types of layers in the model in a specific task. This neglect leads to the fact that some key parts of the model cannot be fully optimized, thereby affecting the performance of the overall model. (2) When clustering clients, although devices are divided into different clusters, the correlation of parameter differences in data distribution training between devices is often not fully analyzed and utilized. This deficiency limits the improvement of clustering effect, and further negatively affects the performance of the model. (3) The current cluster federated learning usually relies on static personalized training methods, and lacks flexible adjustment mechanism. It is easy to fall into local optimal solution, and cannot further approach the global optimal effect. This also limits the ideal performance of cluster federated learning in more complex scenarios. SUMMARY
[0004] The main purpose of the present application is to provide a personalized federated method based on layer information perception, aiming at solving the problem that the existing federated learning method does not fully consider the importance of different types of layers in the model in a specific task, resulting in poor model performance.
[0005] To achieve the above objectives, this application provides a personalized federated model based on layer information awareness, comprising: Step 1, dividing the client model into a head part and a body part according to the sensitivity of local data distribution; Step 2, freezing the head part and fine-tuning the body part; Step 3, determining the sensitivity of the body part parameters, and determining the individual parameters and global parameters of the body part based on the sensitivity of the body part parameters; wherein the sensitivity of the individual parameters is greater than the sensitivity of the global parameters; Step 4, determining the similarity between each client and other clients, and determining the similar clients of each client based on the similarity; Step 5, updating the individual parameters of each client using the similar clients, and updating the global parameters of each client using the global clients, to obtain the updated body part, and then updating the body part... Step 6: Combine the body and head parts to obtain the first personalized client model; Step 7: Determine the feature optimization state of the client model based on similarity. When the optimization state of the client model reaches the preset optimization state, freeze the body part of the first personalized client model and fine-tune the head part to obtain the second personalized client model; Step 8: Repeat steps 2-6 until the total number of training rounds for fine-tuning the body and head parts reaches the preset communication rounds to obtain the personalized client model; Wherein, when the fine-tuning of the body part is completed and the total number of training rounds reaches the preset communication rounds, the first personalized client model is used as the personalized client model; when the fine-tuning of the head part is completed and the total number of training rounds reaches the preset communication rounds, the second personalized client model is used as the personalized client model.
[0006] Optionally, step 6 also includes returning to step 2 if it is determined that the optimization state of the client model has not reached the preset optimization state.
[0007] Optionally, in step 4, the sum of the overall similarity and structural layer similarity between each client and other clients is used as the similarity between each client and other clients; clients with similarity greater than the similarity threshold are considered as similar clients of each client.
[0008] The formula for the similarity threshold is:
[0009]
[0010]
[0011] In the formula, Here, E is the hyperparameter, and E is the number of training epochs. , There are two clients respectively. The average similarity distance is given.
[0012] Optionally, the structural layer similarity is obtained by: determining the sensitivity value of the structural layer for each client, and converting the client model of each client into two sequences with the client models of other clients, wherein each sequence contains elements including the structural layer name and the sensitivity value; determining the minimum number of operations required to sequentially convert the structural layer name of one sequence into the structural layer name of the other sequence, and using the minimum number of operations as the structural layer similarity.
[0013] Optionally, the formula for calculating the similarity between each client and other clients is:
[0014]
[0015] in, For overall similarity, To minimize the number of operations, For hyperparameters, , These represent the number of layers in the two client-side models.
[0016] Alternatively, the formula for the minimum number of operations is as follows:
[0017] ;
[0018] In the formula, For the client The Layer name, For the client The Layer name.
[0019] Optionally, in step 5, the update model for each client's personalized parameters is as follows:
[0020]
[0021] In the formula, For the number of similar clients, For the first The client model parameters of each client during the t-th training iteration;
[0022] The update model for global parameters for each client is as follows:
[0023]
[0024] In the formula, N is the number of clients.
[0025] Optionally, in step 6, the feature optimization state of the client model is determined in the following manner: the average distance of each client to its similar clients is determined according to the similarity, and the average of the average distances of all clients is determined, and the average is taken as the feature optimization state of the client model.
[0026] Optionally, in step 6, the feature optimization state of the client model is determined in the following manner:
[0027]
[0028] The optimization state of the client model reaching the preset optimization state is determined by the following formula:
[0029]
[0030] In the formula, is the training round at each fine-tuning, is a hyperparameter of the threshold.
[0031] Optionally, in step 6, the minimum value K of the training round reaching the preset optimization state t is determined by the following formula:
[0032]
[0033] In the formula, is the maximum value of K.
[0034] Compared with the prior art, the application has the following beneficial effects:
[0035] The personalized federated method based on layer information perception of the application can divide the client model into a head part and a body part according to the sensitivity of local data distribution, fine-tune the body part, and divide the body part into individual parameters and global parameters according to the sensitivity of the parameters, so that the body part can be fully optimized, and the individuality and generalization ability of each layer of the model are improved; considering the correlation between layers, the Levenshtein distance is introduced to select similar clients, the correlation of the parameter differences of the data distribution trained by each device is fully analyzed and utilized, and the clustering effect is improved; the optimization state of the client model is determined according to the average distance of each client to its similar clients, the dynamic individuality scheduling is determined, each client only transmits part of the model for communication, and the local optimal solution can be avoided, and the accuracy and communication overhead are balanced. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 is a distribution diagram of a CIFAR-10 data set;
[0037] Figure 2 is an experimental result diagram of the CIFAR-10 data set using the FedAvg algorithm for 30 rounds.
[0038] Figure 3 A flowchart of a personalized federated method based on layer information perception.
[0039] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely in combination with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0041] Because of the existing cluster federated learning algorithm, the importance of different types of layers in the model in the specific task is often not fully considered in the training process. This neglect leads to the fact that some key parts of the model are not fully optimized, thereby affecting the performance of the overall model. In order to solve this problem, taking the FedAvg algorithm as an example for analysis, as shown in Figure 1 , using the CIFAR-10 dataset, which contains 10 categories, 15 clients are set in the experiment, and each client has local data of different categories. Among them, client 1 shares similar categories with clients 2, 11 and 15, and in addition, client 1 belongs to the "travel" category with clients 9, 10 and 14, which have similarities in basic features. The experiment is carried out for 30 rounds on the FedAvg algorithm. The specific results are as shown in Figure 2The first column of the figure shows the changes of the BN layer before and after the communication, the second column is the FC layer, and the third column is the CONV layer. We specially mark the six clients most similar to client 1 in the second row of each figure. By observing the changes of the CONV layer in the third column, it can be found that the similarity of client 1 gradually improves after communicating with other clients. For example, the similarity of client 1 with clients 2, 11 and 15 is significantly enhanced, and in addition, the similarity with clients 9, 10 and 14 also appears, which indicates that the CONV layer not only reflects the category similarity, but also reflects the similarity of the shallow basic features. However, in the BN layer of the first column and the FC layer of the second column, we found the opposite phenomenon. After the communication, the BN and FC layers introduced misleading similarity information, for example, the similarity of client 1 with clients 7 and 8 increased, but this does not conform to the actual situation, because they have neither similar categories nor common basic features. This phenomenon shows that the communication of the BN and FC layers may mislead the similarity judgment between clients. Based on this, the application proposes a personalized federated method based on layer information perception, which divides the client model into a head part and a body part, and further divides the body part into global parameters and personalized parameters, as follows.
[0042] The first embodiment of the application provides a personalized federated method based on layer information perception, as shown in the formula (1), specifically comprising the following steps. Figure 3 As shown in the formula (1), specifically comprising the following steps.
[0043] Step S1, according to the sensitivity of local data distribution, the client model θ is divided into a head part and a body part, θ = {h, b};
[0044] In this embodiment, according to the sensitivity of the parameters reflecting the local data distribution, the client model is divided into a head part and a body part, which can avoid the introduction of misleading similarity information by the body part during training, resulting in similarity judgment errors.
[0045] Step S2, freezing the head part and fine-tuning the body part.
[0046] It can be understood that the fine-tuning involved in this embodiment refers to adjusting some training parameters of the client model, and training the adjusted client model using the data set of the target task. The specific method of adjusting the training parameters belongs to the conventional method in the art, which will not be described here.
[0047] Step S3, determine the sensitivity of the parameters of the body part, and determine the individual parameters and global parameters of the body part according to the sensitivity of the parameters of the body part, that is, divide the body part into two parts b = {bp, bg}; wherein the sensitivity of the individual parameter is greater than the sensitivity of the global parameter, the data sensitive part (bp) is used to enhance individualization, and the remaining part (bg) is used for generalization.
[0048] In this embodiment, the body part is further disassembled into individual parameters and global parameters according to the parameter sensitivity, and the parameters with higher sensitivity are defined as individualized parameters, and the parameters with lower sensitivity are defined as global parameters. Parameter sensitivity is an index for measuring the contribution of parameters in the training process to the performance of the model. Under different data distributions, parameters with higher sensitivity play an important role in model performance, and identifying these local sensitive parameters helps to understand the local task of the client.
[0049] Step S4, determine the similarity between each client and other clients, and determine the similar clients of each client according to the similarity; specifically, the clients with a similarity greater than a similarity threshold are used as the similar clients of each client;
[0050] It is worth noting that the overall similarity involved in this embodiment is a traditional method of calculating similarity, for example, calculating the similarity of two clients based on Euclidean distance, or calculating the similarity of two clients based on Euclidean distance. This method only makes similarity judgment on the overall difference, and does not pay attention to the subtle differences between clients. On this basis, this embodiment considers the relevance between layers and introduces the Levenshtein distance to improve the traditional similarity judgment method. Specifically, the sum of the overall similarity and the structural layer similarity of each client and other clients is used as the similarity between each client and other clients. Similarity The formula is as follows:
[0051]
[0052] wherein, , are the client model parameters of any two clients, is the overall similarity, is the minimum number of operations, that is, the structural layer similarity, is a hyperparameter, is the client model sequence, and k and l are the number of layers of the client model of the two clients. The structural layer similarity is determined in the following manner:
[0053] Determine the sensitivity value of the structural layer of each client, and convert the client model of each client and the client model of other clients into two sequences Each sequence contains elements including the structural layer name and sensitivity value;
[0054] Determine the minimum number of operations required to sequentially convert the structural layer names of one sequence to the structural layer names of the other sequence; this is known as structural layer similarity. Furthermore, the formula for the minimum number of operations is:
[0055]
[0056] In the formula, For the client The Layer name, For the client The Layer name;
[0057] Similarity threshold The formula is:
[0058]
[0059] To improve personalization and generalization, this embodiment sets a time-varying threshold. This means that in the early stages, the system interacts with more clients to learn more features; in the later stages, it interacts with more similar clients to achieve personalization. The formula is:
[0060]
[0061] In the formula, For hyperparameters, For the current training round, For the total number of training rounds, Number of clients , There are two clients respectively. The average similarity distance;
[0062] Step S5: Update the individual parameters of each client using similar clients, and update the global parameters of each client using global clients to obtain the updated body part. Combine the updated body part with the head part to obtain the first personalized client model.
[0063] The update model for each client's personalized parameters is as follows:
[0064]
[0065] In the formula, For the number of similar clients, For the first The client model parameters of each client during the t-th training iteration;
[0066] The update model of the global parameters of each client is:
[0067]
[0068] In specific use, the body of each client is updated according to the individual mask. Wherein for the position with value 1 in the mask, the output parameter is updated by For the position with value 0 in the mask, the output parameter is updated by .
[0069] Step S6, determine the feature optimization state of the client model according to the similarity, when it is determined that the optimization state of the client model reaches the preset optimization state, freeze the body part of the first personalized client model and fine-tune the head part to obtain the second personalized client model, and proceed to the next step; when it is determined that the optimization state of the client model does not reach the preset optimization state, return to step 2.
[0070] Specifically, step S61, determine the average distance of each client to its similar clients according to the similarity, and determine the average value of the average distances of all clients, and take the average value as the feature optimization state of the client model. If the average value is smaller, it means that the average distance of each client to its similar clients is smaller, and the aggregation degree is larger, which means that the relationship between the cluster members is closer. The calculation formula of the feature optimization state is as follows:
[0071]
[0072] Step S62, judge whether the optimization state of the client model reaches the preset optimization state by the following formula:
[0073]
[0074] In the formula, is the training round at each fine-tuning, that is, the window size, is a hyperparameter of the threshold value.
[0075] In this embodiment, it is found through experiments that the optimization speed of the CONV layer is different from that of the BN layer and the FC layer. Specifically, the convergence speed of the BN layer and the FC layer is very fast, and based on this, a two-stage strategy is proposed, that is, first train the CONV layer, that is, the body part, and determine whether it reaches the preset optimization state by the above-mentioned method, that is, trigger the fine-tuning of the BN and FC layers, and fine-tune the head part. The specific process is as follows.
[0076] Step S63, if the optimization state of the client model reaches the preset optimization state, that is, the tightness can be maintained in the continuous K rounds, it means that the feature optimization is in this state, at this time, the body part of the first personalized client model is frozen, the head part is fine-tuned to obtain the second personalized client model, and the next step is performed; if the optimization state of the client model does not reach the preset optimization state, return to step 2;
[0077] According to the formula for determining the optimization state of the client model, K will first affect the triggering frequency of the personalized scheduling. Therefore, K is very important for the optimization of the body parameter feature and the personalization of the head parameter. Generally, long-time BN / FC fine-tuning can cause overfitting. In order to prevent the parameters of the head part from overfitting, K0 is initialized as 20, and is doubled when fine-tuning the head part next time, that is, K1 is 40. However, this doubling operation should not last too long, because the possibility of triggering the personalized scheduling will be reduced, which can lead to insufficient training of the head and cannot achieve effective personalization. In order to avoid this situation, the embodiment sets the maximum feature optimization communication round number of the trigger window , that is, the minimum value of the training round number reaching the preset optimization state, which is determined by the following formula:
[0078]
[0079] In the formula, is the maximum value of K.
[0080] Step S7, repeating steps 2-6 until the total training round number of the fine-tuning of the body part and the fine-tuning of the head part reaches the preset communication round number, to obtain the personalized client model;
[0081] When the fine-tuning of the body part is completed, the total training round number reaches the preset communication round number, and the first personalized client model is taken as the personalized client model.
[0082] When the fine-tuning of the head part is completed, the total training round number reaches the preset communication round number, and the second personalized client model is taken as the personalized client model.
[0083] Embodiment 1
[0084] The personalized federated method of the present application can be used in the medical field, for example, a plurality of hospitals each have a large amount of medical data (such as CT scans of patients, medical history, etc.), but due to data privacy and security reasons, the hospitals cannot directly share patient data. Therefore, a client model capable of disease diagnosis can be trained using patient data by the personalized federated method of the present application. Since the data distribution of different hospitals is very different (for example, hospital A processes cancer patient data, and hospital B processes heart disease patient data), a global model may not be able to capture the differences in data from each hospital well, resulting in the model performing poorly in some places for some hospitals, so the method of the present application can divide the client model into the body and the head, and train the body part and the head part respectively to obtain a personalized client model. In addition, the core of federated learning occupies a large amount of local training and model parameter transmission, so the process of transmitting model parameters has a large communication cost, especially in the case of complex models and distributed hospitals, network bandwidth may become the limit, the present application sets personalized scheduling, each client only transmits part of the model for communication, thereby reducing the communication cost.
[0085] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation using the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A personalized federated approach based on tier information awareness, characterized in that, The method comprises the following steps: Step 1, according to the sensitivity of local data distribution, the client model is divided into a head part and a body part; Step 2, the head part is frozen and the body part is fine-tuned; Step 3, the sensitivity of the parameters of the body part is determined, and according to the sensitivity of the parameters of the body part, individual parameters and global parameters of the body part are determined; wherein the sensitivity of the individual parameters is greater than the sensitivity of the global parameters; Step 4, the similarity between each client and other clients is determined, and similar clients of each client are determined according to the similarity; Step 5, the individual parameters of each client are updated by using the similar clients, and the global parameters of each client are updated by using the global clients, to obtain an updated body part, the updated body part is combined with the head part to obtain a first personalized client model; Step 6, the feature optimization state of the client model is determined according to the similarity, when the optimization state of the client model reaches a preset optimization state, the body part of the first personalized client model is frozen, and the head part is fine-tuned to obtain a second personalized client model; Step 7, steps 2-6 are repeated until the total training rounds of the fine-tuning of the body part and the fine-tuning of the head part reach a preset communication round, to obtain a personalized client model; When the fine-tuning of the body part is completed, the total training rounds reach the preset communication round, and the first personalized client model is taken as the personalized client model; When the fine-tuning of the head part is completed, the total training rounds reach the preset communication round, and the second personalized client model is taken as the personalized client model.
2. The personalized federated method based on layer information awareness according to claim 1, wherein, Step 6 further comprises, when the optimization state of the client model does not reach the preset optimization state, returning to step 2. 3.The personalized federated method based on layer information awareness according to claim 1, wherein, In step 4, the sum of the overall similarity and the structural layer similarity between each client and other clients is taken as the similarity between each client and other clients; Clients with a similarity greater than a similarity threshold value are taken as the similar clients of each client; The formula of the similarity threshold value is: wherein is a hyperparameter, E is the learning training epoch, , are two clients respectively, is the average similarity distance.
4. The personalized federated method based on layer information awareness according to claim 3, wherein, The structural layer similarity is obtained by the following method: The sensitivity value of the structural layer of each client is determined, and the client model of each client and the client model of other clients are converted into two sequences, wherein the elements in each sequence include a structural layer name and a sensitivity value; The minimum operation times required for sequentially converting the structural layer name of one sequence into the structural layer name of the other sequence in the two sequences are determined, and the minimum operation times are taken as the structural layer similarity.
5. The personalized federated method based on layer information awareness according to claim 1 or 4, characterized in that, The calculation formula of the similarity between each client and other clients is: wherein, is the overall similarity, is the minimum number of operations, is the hyperparameter, , are the number of layers of the two client models, respectively.
6. The personalized federated method based on layer information awareness according to claim 5, characterized in that, The formula of the minimum operation times is as follows: In the formula, the first layer name of the client, the first layer name of the client, the first layer name of the client.
7. The personalized federated method based on layer information awareness according to claim 1, wherein, In step 5, the update model of the individual parameters of each client is: In the formula, is the number of similar clients, is the client model parameter of the th client at the tth training. The update model of the global parameters of each client is: In the formula, N is the number of clients.
8. The personalized federated method based on layer information awareness according to claim 1, wherein, In step 6, the determination method of the feature optimization state of the client model is: According to the similarity, the average distance between each client and its similar clients is determined, and the average value of the average distances corresponding to all clients is determined, and the average value is taken as the feature optimization state of the client model.
9. The personalized federated method based on layer information awareness according to claim 1, wherein, In step 6, the formula of the feature optimization state of the client model is as follows: Wherein, the optimization state of the client model reaches the preset optimization state is determined by the following formula: wherein is the training epoch at each fine-tuning, is a hyperparameter for the threshold value.
10. The personalized federated method based on layer information awareness according to claim 1, wherein, In step 6, the minimum value K of the training epochs to reach the preset optimization state t is determined by the following formula: In the formula, is the maximum value of K.
Citation Information
Patent Citations
Ocean data sharing method and system based on block chain and federated learning, and medium
CN114493594A
Phishing mail detection method based on personalized federal learning
CN114928501A