Personalized federation method based on layer information perception
By dividing the client model into head and body parts, and separating personalized parameters and global parameters according to parameter sensitivity, dynamically adjusting the personalized and generalized characteristics of the model, the federated learning method has solved the failure to fully consider the importance of model hierarchy in full consideration. The problem of the model improves the personality and generalization ability of the model.
Patent Information
- Application Number
- CN202411544505.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-31
AI Technical Summary
Existing federated learning methods fail to fully consider the importance of different types of hierarchies in the model in a specific task, resulting in poor model performance.
By dividing the client model into head part and body part, and dividing the body part into personality parameters and global parameters according to the sensitivity of the parameters, fine-tuning the body part, using similar clients to update personal parameters, and using global clients to update Global parameters, personalized and generalized characteristics of dynamic adjustment model.
The personality and generalization capabilities of each layer of the model are improved, the clustering effect is enhanced, and the local optimal solution is avoided, and the accuracy and communication overhead are balanced.
Smart Images

Figure CN119476532A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning, and in particular to a personalized federation method based on layer information perception. Background Art
[0002] Federated learning allows multiple institutions or individuals to jointly develop and optimize models through joint modeling without sharing the original data. The data of each participant does not need to leave the local area, and data privacy is effectively protected. However, it still faces some severe challenges. First, global model accuracy is a key issue facing federated learning. For example, the uneven distribution of data among participants may cause the model to perform better in some areas than in other areas. Secondly, federated learning also faces the problem of communication costs. For example, the growing number of IoT devices and the access to the network of more and more smart devices also mean that the application of federated learning in the IoT will face more complex network environments and greater device management challenges. In order to solve these challenges mentioned above, 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 trained more targeted, improve personalization capabilities, and solve the problems of data imbalance and local model update bias.
[0003] Although cluster federated learning provides an effective path to solve the problems mentioned above, it also has some challenges that need to be addressed. (1) During the training process, cluster federated learning often does not fully consider the importance of different types of layers in the model in specific tasks. This neglect results in some key parts of the model not being fully optimized, thus affecting the performance of the overall model. (2) When performing client clustering, although the devices are divided into different clusters, the correlation between the parameter differences of the data distribution training between each device is often not fully analyzed and utilized. This deficiency limits the improvement of clustering effect and has a negative impact on the performance of the model. (3) Current cluster federated learning usually relies on static personalized training methods and lacks a flexible adjustment mechanism. It is easy to fall into the local optimal solution and cannot further approach the global optimal effect. This also limits cluster federated learning from achieving ideal performance in more complex scenarios. Summary of the invention
[0004] The main purpose of this application is to provide a personalized federated method based on layer information perception, which aims to solve the problem that the existing federated learning methods do not fully consider the importance of different types of layers in the model in specific tasks, resulting in poor model performance.
[0005] To achieve the above-mentioned purpose, the present application provides a personalized federation method based on layer information perception, including: 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, the 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 the 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, and the updated body part is obtained, and the updated body part is updated. The first personalized client model is obtained by combining the body part and the head part according to the similarity; Step 6: determining the feature optimization state of the client model according to the similarity, and when it is determined that the optimization state of the client model reaches the preset optimization state, freezing the body part of the first personalized client model and fine-tuning the head part to obtain the second personalized client model; Step 7: repeating steps 2-6 until the total training rounds of the fine-tuning of the body part and the fine-tuning of the head part reach the preset communication rounds to obtain a personalized client model; wherein, when the fine-tuning of the body part is completed, the total training rounds reach the preset communication rounds, and the first personalized client model is used as the personalized client model; when the fine-tuning of the head part is completed, the total training rounds reach the preset communication rounds, and the second personalized client model is used as the personalized client model.
[0006] Optionally, step 6 also includes, when it is determined that the optimization state of the client model has not reached a preset optimization state, returning to step 2.
[0007] Optionally, in step 4, the sum of the overall similarity and the 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 a similarity threshold are used as similar clients of each client; The formula for the similarity threshold is:
[0008]
[0009] In the formula, is a hyperparameter, E is the number of training rounds, , There are two clients, is the average similarity distance.
[0010] Optionally, the similarity of the structural layers is obtained in the following manner: determining the sensitivity value of the structural layer of each client, and converting the client model of each client and the client models of other clients into two sequences, wherein the elements in each sequence include a structural layer name and a sensitivity value; determining the minimum number of operations required to sequentially convert the structural layer names of one sequence into the structural layer names of another sequence in the two sequences, and taking the minimum number of operations as the structural layer similarity.
[0011] Optionally, the similarity between each client and other clients is calculated as:
[0012] in, For overall similarity, For the minimum number of operations, is a hyperparameter, , are the number of layers of the two client models respectively.
[0013] Optionally, the formula for the minimum number of operations is as follows: ; In the formula, For Clients No. Layer name, For Clients No. The layer name.
[0014] Optionally, in step 5, the update model of the personality parameters of each client is:
[0015] In the formula, is the number of similar clients, For the The client model parameters of a client at the tth training; The update model of the global parameters of each client is:
[0016] Where N is the number of clients.
[0017] Optionally, the feature optimization state of the client model in step 6 is determined by determining the average distance between each client and its similar clients based on similarity, and determining the average value of the average distances corresponding to all clients, and using the average value as the feature optimization state of the client model.
[0018] Optionally, in step 6, the formula for the feature optimization state of the client model is as follows:
[0019] Among them, the optimization state of the client model reaches the preset optimization state through the following formula:
[0020] In the formula, is the number of training rounds for each fine-tuning, is a hyperparameter of the threshold.
[0021] Optionally, in step 6, the minimum number of training rounds to reach the preset optimization state is K t Determined by the following formula:
[0022] In the formula, is the maximum value of K.
[0023] Compared with the prior art, the present invention has the following beneficial effects: The personalized federation method based on layer information perception of the present invention divides the client model into a head part and a body part according to the sensitivity of local data distribution, fine-tunes the body part, and divides the body part into individual parameters and global parameters according to the sensitivity of the parameters, which can fully optimize the body part, thereby improving the individuality and generalization ability of each layer of the model; considering the correlation between layers, the Levenshtein distance is introduced to select similar clients, and the correlation of parameter differences trained by data distribution between various devices is fully analyzed and utilized, thereby improving the clustering effect; the optimization state of the client model is determined according to the average distance between each client and its similar clients, and dynamic personalized scheduling is determined, and each client only transmits part of the model for communication, which can avoid falling into a local optimal solution and balance accuracy and communication overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is the distribution diagram of the CIFAR-10 dataset; Figure 2 The experimental results of 30 rounds of experiments on the CIFAR-10 dataset using the FedAvg algorithm are shown in the figure. Figure 3 The figure is a flowchart of a personalized federation method based on layer information awareness.
[0025] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] The existing cluster federated learning algorithms often fail to fully consider the importance of different types of layers in the model in specific tasks during the training process. This neglect results in some key parts of the model not being fully optimized, thus affecting the performance of the overall model. To solve this problem, the FedAvg algorithm is used as an example for analysis. Figure 1 As shown in the figure, the CIFAR-10 dataset is used. The dataset 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. In addition, client 1 and clients 9, 10, and 14 belong to the "travel" category and have similar basic features. 30 rounds of experiments were conducted on the FedAvg algorithm. The specific results are shown in the figure. Figure 2 As shown in the figure, the first column shows the changes of the BN layer before and after communication, the second column is the FC layer, and the third column is the CONV layer. We specially marked the 6 clients most similar to client 1 in each figure with boxes in the second row. By observing the changes in the CONV layer in the third column, it can be found that the similarity of client 1 has gradually improved accurately after communicating with other clients. For example, the similarity between client 1 and clients 2, 11, and 15 has increased significantly. In addition, the similarity with clients 9, 10, and 14 has also emerged, which shows that the CONV layer reflects not only the category similarity, but also the similarity of shallow basic features. However, in the BN layer in the first column and the FC layer in the second column, we found the opposite phenomenon. After communication, the BN and FC layers introduced misleading similarity information. For example, the similarity between client 1 and clients 7 and 8 increased, but this is inconsistent with the actual situation because there are neither similar categories nor common basic features between them. This phenomenon shows that the communication of the BN and FC layers may mislead the similarity judgment between clients. Based on this, the present invention proposes a personalized federation method based on layer information perception, which divides the client model into a header part and a body part, and then further decomposes the body part into global parameters and personalized parameters, as follows.
[0028] The first embodiment of the present invention provides a personalized federation method based on layer information perception, such as Figure 3 As shown, the specific steps include: Step S1, according to the sensitivity of local data distribution, the client model θ is divided into the head part and the body part, θ = {h, b}; In this embodiment, the client model is divided into a head part and a body part according to the sensitivity of the parameters to reflect the local data distribution, which can avoid the introduction of misleading similarity information into the body part during training, resulting in errors in similarity judgment.
[0029] Step S2, freezing the head part and fine-tuning the body part; It is understandable 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. Among them, the specific method of adjusting the training parameters belongs to the conventional method in the field and will not be repeated here.
[0030] 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 parameters is greater than the sensitivity of the global parameters, the data sensitive part (bp) is used to enhance personalization, and the rest (bg) is used for generalization.
[0031] In this embodiment, the body parts are further decomposed into individual parameters and global parameters according to parameter sensitivity, and the parameters with higher sensitivity are defined as individual parameters, while the parameters with lower sensitivity are defined as global parameters. Parameter sensitivity is an indicator that measures the contribution of parameters to model performance during training. 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 tasks of the client.
[0032] Step S4: determining the similarity between each client and other clients, and determining similar clients of each client according to the similarity; specifically, taking clients whose similarity is greater than a similarity threshold as similar clients of each client; 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 judgments based on overall differences, and does not focus on the subtle differences between clients. On this basis, this embodiment takes into account the correlation between layers and introduces the Levenshtein distance to improve the traditional similarity judgment method. Specifically, the sum of the overall similarity and structural layer similarity of each client with other clients is taken as the similarity of each client with other clients. Similarity The formula is as follows:
[0033] in, , are the client model parameters of any two clients, For overall similarity, is the minimum number of operations, i.e. the structural layer similarity, is a hyperparameter, is the client model sequence, k and l are the number of layers of the client models of the two clients respectively. The structural layer similarity is determined as follows: Determine the sensitivity value of the structural layer of each client, and convert the client model of each client into two sequences with the client models of other clients , where the elements in each sequence include the structure layer name and sensitivity value; Determine the minimum number of operations required to convert the structure layer names of one sequence into the structure layer names of another sequence in two sequences, that is, the structure layer similarity. Further, the formula for the minimum number of operations is:
[0034] In the formula, For Clients No. Layer name, For Clients No. Layer name; Similarity Threshold The formula is:
[0035] In order to improve the degree of personalization and generalization, this embodiment sets a time-varying threshold, that is, communicate with more clients in the early stage to learn more features; communicate with more similar clients in the late stage to achieve personalization. The formula is:
[0036] In the formula, is a hyperparameter, is the current training round, is the total number of training rounds, is the number of clients, , There are two clients, is the average similarity distance; Step S5: using similar clients to update individual parameters of each client, and using global clients to update global parameters of each client, to obtain an updated body part, and combining the updated body part with the head part to obtain a first personalized client model; The update model of each client's personality parameter is:
[0037] In the formula, is the number of similar clients, For the The client model parameters of a client at the tth training; The update model of the global parameters of each client is:
[0038] When used specifically, the body of each client is updated according to the personality mask. For the position where the value in the mask is 1, Output parameter; for positions with a value of 0 in the mask, Output parameters.
[0039] Step S6, determining the feature optimization state of the client model according to the similarity, and when it is determined that the optimization state of the client model reaches the preset optimization state, freezing the body part of the first personalized client model, and fine-tuning the head part to obtain a second personalized client model, and proceeding to the next step; when it is determined that the optimization state of the client model does not reach the preset optimization state, returning to step 2; Specifically, step S61 determines the average distance between each client and its similar clients based on the similarity, and determines the average of the average distances corresponding to all clients, and uses the average as the feature optimization state of the client model. If the average value is smaller, it means that the average distance between each client and its similar clients is smaller, and the greater the degree of aggregation, it means that the relationship between cluster members is closer. Feature Optimization State The calculation formula is:
[0040] Step S62, judging whether the optimization state of the client model reaches the preset optimization state by the following formula:
[0041] In the formula, is the number of training rounds for each fine-tuning, i.e., the window size, is a hyperparameter of the threshold.
[0042] 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. Based on this, a two-stage strategy is proposed, that is, first training the CONV layer, that is, the body part, and judging that the preset optimization state is reached through the above method, that is, triggering the fine-tuning of the BN and FC layers, and fine-tuning the head. The details are as follows.
[0043] Step S63: If the optimization state of the client model reaches the preset optimization state, that is, the compactness can be maintained in the continuous K rounds, it means that the feature is optimized. At this time, the body part of the first personalized client model is frozen, and 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; According to the formula for determining the optimization state of the client model, K will first affect the triggering frequency of personalized scheduling. Therefore, K is very important for the optimization of body parameter features and the personalization of head parameters. Usually, long-term BN / FC fine-tuning may lead to overfitting. In order to prevent overfitting of the parameters of the head part, K0 is initialized to 20 and doubled the next time the head part is fine-tuned, that is, K1 is 40. However, this doubling operation should not last too long, because the possibility of triggering personalized scheduling will be reduced, which may lead to insufficient head training and inability to achieve effective personalization. In order to avoid this situation, this embodiment sets the maximum feature optimization communication round number of the trigger window , that is, the minimum number of training rounds to achieve the preset optimization state, is determined by the following formula:
[0044] In the formula, is the maximum value of K.
[0045] Step S7, repeating steps 2-6 until the total training rounds of fine-tuning of the body part and the head part reach the preset communication rounds, and obtaining a personalized client model; When the fine-tuning of the body part is completed and the total number of training rounds reaches the preset number of 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.
[0046] Example 1 The personalized federation method of the present invention can be used in the medical field. For example, multiple hospitals each have a large amount of medical data (such as CT scans of patients, medical records, etc.), but due to data privacy and security reasons, these hospitals cannot directly share patient data. Therefore, the personalized federation method of the present invention can be used to train a client model capable of disease diagnosis using patient data. Since the data distribution of different hospitals is very different (such as hospital A processes cancer patient data, and hospital B processes heart disease patient data), the global model may not be able to capture the differences in the data of each hospital well, resulting in the model performing poorly in some hospitals in a certain place. Therefore, the method of the present invention can be used to divide the client model into body and 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 communication cost of the process of transmitting model parameters is very high, especially when the model is complex and the hospital participants are distributed, the network bandwidth may become a limit. The present invention sets personalized scheduling, and each client only transmits part of the model for communication, thereby reducing communication costs.
[0047] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A personalized federation method based on layer information awareness, characterized in that: include: Step 1: Divide the client model into the head part and the body part according to the sensitivity of the local data distribution; Step 2, freezing the head part and fine-tuning the body part; Step 3, determining the sensitivity of the parameter of the body part, and determining the individual parameter and the global parameter of the body part according to the sensitivity of the parameter of the body part; wherein the sensitivity of the individual parameter is greater than the sensitivity of the global parameter; Step 4: Determine the similarity between each client and other clients, and determine similar clients of each client based on the similarity; Step 5: using similar clients to update individual parameters of each client, and using global clients to update global parameters of each client, to obtain an updated body part, and combining the updated body part with the head part to obtain a first personalized client model; Step 6: 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 a preset optimization state, freeze the body part of the first personalized client model and fine-tune the head part to obtain a second personalized client model. Step 7: Repeat steps 2-6 until the total training rounds of fine-tuning of the body part and the head part reach the preset communication rounds, and obtain a personalized client model; When the fine-tuning of the body part is completed and the total number of training rounds reaches the preset number of 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.
2. The personalized federation method based on layer information perception according to claim 1 is characterized in that: Step 6 also includes returning to step 2 when it is determined that the optimization state of the client model has not reached a preset optimization state.
3. The personalized federation method based on layer information perception according to claim 1 is characterized in that: In step 4, the sum of the overall similarity and structural layer similarity between each client and other clients is taken as the similarity between each client and other clients; The clients whose similarity is greater than the similarity threshold are regarded as similar clients of each client; The formula for the similarity threshold is: In the formula, is a hyperparameter, E is the number of training rounds, , There are two clients, is the average similarity distance.
4. The personalized federation method based on layer information perception according to claim 3 is characterized in that: The similarity of the structural layer is obtained in the following way: Determine a sensitivity value of a structure layer of each client, and convert a client model of each client and client models of other clients into two sequences, wherein an element in each sequence includes a structure layer name and a sensitivity value; The minimum number of operations required to sequentially convert the structure layer names of one sequence into the structure layer names of another sequence in two sequences is determined, and the minimum number of operations is taken as the structure layer similarity.
5. The personalized federation method based on layer information perception according to claim 1 or 4, characterized in that: The formula for calculating the similarity between each client and other clients is: in, For overall similarity, For the minimum number of operations, is a hyperparameter, , are the number of layers of the two client models respectively.
6. The personalized federation method based on layer information perception according to claim 5 is characterized in that: The formula for the minimum number of operations is as follows: In the formula, For Clients No. Layer name, For Clients No. The layer name.
7. The personalized federation method based on layer information perception according to claim 1 is characterized in that: In step 5, the update model of the personality parameters of each client is: In the formula, is the number of similar clients, For the The client model parameters of a client at the tth training; The update model of the global parameters of each client is: Where N is the number of clients.
8. The personalized federation method based on layer information perception according to claim 1, characterized in that: The feature optimization state of the client model in step 6 is determined as follows: Determine the average distance between each client and its similar clients based on similarity, And determine the average value of the average distances corresponding to all clients, and use the average value as the characteristic optimization state of the client model.
9. The personalized federation method based on layer information perception according to claim 1, characterized in that: In step 6, the formula for the feature optimization state of the client model is as follows: Among them, the optimization state of the client model reaches the preset optimization state through the following formula: In the formula, is the number of training rounds for each fine-tuning, is a hyperparameter of the threshold.
10. The personalized federation method based on layer information perception according to claim 1, characterized in that: In step 6, the minimum number of training rounds to reach the preset optimization state is K t 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
Personalized federal learning method based on parameter layering
CN115587633A
Personalized federal learning method based on comparative learning and conditional calculation
CN118396082A
Personalized federated learning method and system based on similar features and collaboration
WO2024169374A1