Personalized federal learning method and system based on parameter similarity
By using iterations weighted cumulative parameters key values and similarity matrix in federated learning to select similar clients for weighted average, the problem of inaccurate aggregation of key parameters in the existing technology is solved, and the high accuracy of the personalized model is achieved. reliability.
Patent Information
- Application Number
- CN202411424047.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-10-12
AI Technical Summary
The existing federated learning method is difficult to achieve accurate personalized aggregation of key parameters under non-IID data distribution, resulting in a lack of reliability and accuracy of personalized models.
By training the model locally on the client and building the data set, using the iterations to weight the accumulated parameter key values, the server calculates the similarity matrix of the key parameter positions, selects similar clients for weighted average, and builds a personalized aggregation matrix to guide the key parameters. Personalize aggregation and optimize the aggregation weights in each round of training.
Accurate personalized aggregation of key parameters is realized, which improves the model's fitting to local data distribution and aggregation reliability, and ensures the accuracy of the personalized model.
Smart Images

Figure CN119294559A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a personalized federated learning method and system based on parameter similarity. Background Art
[0002] Federated learning (FL) is a distributed machine learning framework that allows multiple parties to collaborate on training models without directly sharing data, effectively protecting user privacy and data security. It has been widely used in the Internet of Things, mobile devices, and healthcare.
[0003] As a key research in federated learning, FedAvg can perform multiple steps of local iterations before each client uploads model parameters. Compared with traditional distributed model training, it greatly improves the efficiency of the entire FL process. However, a key problem with the FedAvg method is that it assumes that the data distribution of all clients is independent and identically distributed (IID), and the global model should be suitable for all clients. However, in real-world application scenarios, data is usually non-IID. In this case, the global model may not be well adapted to the specific circumstances of each client. Considering that in most cases, different clients do not need to use a global model together, each client only needs to have a personalized model that can perform well under its own data distribution. Therefore, some research works study personalized federated learning methods under non-IID data distribution.
[0004] In order to retain the expression effect of each client model parameter, FedALA proposes to use learnable weights to dynamically weight the aggregation model parameter values and personalized model parameter values for some layers of the network; in order to extract important knowledge from existing models and stitch out personalized models, PFedHR uses clustering to generate stitched models that perform similarly to each client model on a public data set, and uses the stitched model to guide the subsequent training of each client model. However, the implementation complexity of this method is relatively high; in order to achieve the aggregation of personalized models, FedGraph determines the similarity between different client models by analyzing the expression ability of model parameters. It constructs a graph matrix to represent the weight of personalized aggregation of each client, and uses the similarity information of each client model to construct an optimization target. The personalized aggregation weight of the client is further obtained on the server, so that clients with high similarity will obtain a larger aggregation weight, thereby achieving the generation of personalized models. However, it does not distinguish between the aggregation of key parameters and non-key parameters, resulting in the failure to accurately and reasonably aggregate key parameters, making the personalized model lack reliability, credibility and accuracy. In order to better aggregate key parameters, FedCAC determines the key parameter set based on the sensitivity of the parameters and further determines similar clients. For key parameters, similar clients are used for aggregation, and conventional weighted average aggregation is used for non-key parameters. However, this method does not consider the differences between clients when aggregating key parameters, so its personalized effect is still unsatisfactory. Summary of the invention
[0005] The purpose of the present invention is to provide a personalized federated learning method and system based on parameter similarity to solve the problems existing in the above-mentioned prior art.
[0006] The personalized federated learning method based on parameter similarity described in the present invention comprises the following steps:
[0007] S1. Each client collects data locally and builds a local data set. Each client uses its data set to train a local model independently locally, and uses a proportional function to the number of iterations to weight and accumulate the critical value of the parameters of each iteration;
[0008] S2. Set the proportion of key parameters to obtain a binary key parameter mask matrix;
[0009] S3. Each client uploads the trained model parameters and the binary mask matrix to the server;
[0010] S4. The server calculates the l-based 1The overlap rate of the norm is used to obtain the similarity matrix of the key parameter position, in which each element represents the similarity degree of the two models at the corresponding position; based on the key parameter position similarity matrix, the server selects several clients with the most similar model parameter distribution to the client to build a similar client set;
[0011] S5. The server calculates a personalized aggregation matrix based on the cosine similarity between key parameters of similar client models, and performs a weighted average of key parameters of similar client models of each client to guide personalized aggregation of key parameters;
[0012] S6. The server transmits the aggregated personalized model parameters of each client to the corresponding client, and repeats steps S1 to S5 until a predetermined number of communication rounds is reached.
[0013] The personalized federated learning system based on parameter similarity in the present invention includes a server and a plurality of clients connected to the server for communication, and the method is used to perform federated learning.
[0014] The personalized federated learning method and system based on parameter similarity described in the present invention have the following advantages:
[0015] 1. Determine the distribution of key parameters through the training status of each client model in each round of training, and determine similar clients based on the similarity of key parameter distribution, so that similar clients have similar training levels and achieve aggregation of key parameters. According to the similarity of the expression of key parameters of each similar client, further determine the aggregation ratio of key parameters to achieve accurate and personalized aggregation of key parameters.
[0016] 2. Determine the importance of each parameter based on the number of iterations in a single round, and further determine the location of key parameters. This key parameter determination principle allows the client model to assign a smaller weight to the sensitivity value of the parameter at a single iteration time point in the early stage of a single round of training when the model has a large deviation from the data distribution, and to assign a higher weight in the later stage of training when the client model fits better, thereby improving the accuracy of determining the location of key parameters.
[0017] 3. Based on the similar client sets of each client, according to the similarity of the key parameters of the clients and the proportion of the data volume, the optimization target of the personalized aggregation weight of the key parameters is constructed to realize the personalized aggregation of the key parameters based on the parameter expression effect, so that the personalized aggregation model can better fit the local data distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of the training process of the model described in the present invention.
[0019] Figure 2It is a schematic diagram of personalized aggregation of key parameters of the model described in the present invention. DETAILED DESCRIPTION
[0020] Federated learning has a wide range of application scenarios, especially in areas with high requirements for data privacy, security, and distributed computing. In the healthcare field, by training models locally in each hospital and sharing only model parameters rather than data, patient privacy is protected while improving the generalization ability of the model, such as disease prediction and medical image analysis. In the financial services field, banks and financial institutions are also restricted by data privacy and regulations and cannot freely share customer information. Federated learning can help different financial institutions collaborate to jointly improve the performance of credit scoring, anti-fraud detection, and risk management models without exposing customer data. In the field of autonomous driving, autonomous vehicles need to learn driving behavior from a large amount of sensor data. The data collected locally by each vehicle is highly private. Through federated learning, automakers can collaboratively train models without sharing specific data to improve the accuracy of vehicle perception and decision-making. In the field of education, educational institutions can use federated learning to build personalized learning systems to improve student learning outcomes. Without directly sharing student data, the model can use data from different regions and schools to build personalized teaching models.
[0021] like Figure 1 and Figure 2 As shown, the personalized federated learning method based on parameter similarity in the present invention includes the following steps:
[0022] S1. Each client collects data locally and builds a local data set. Each client uses its data set to train a local model independently locally, and uses a proportional function to the number of iterations to weight and accumulate the critical value of the parameters of each iteration. The specific steps are:
[0023] S1.1. Each client uses a local data set to train the model and records the gradient of each iteration and the parameter amplitude before the iteration.
[0024] S1.2. Each client calculates the sensitivity value of each parameter based on the gradient and parameter amplitude before the iteration. The parameter sensitivity matrix is:
[0025]
[0026] Where ⊙ represents the multiplication of corresponding elements, t represents the round in which the server completes the aggregation operation, k represents the number of iterations in each round, i represents the client sequence number, θ represents the model parameters, and the parameter sensitivity matrix Each element in reflects the training status of the corresponding parameter before the kth iteration.
[0027] S1.3. Calculate the weighted coefficient of the sensitivity value obtained in each iteration according to the number of training iterations
[0028] S1.4.Accumulate the parameter sensitivity matrix according to the weighting coefficient to obtain the parameter criticality matrix. Since the deviation of each client model on the local data set is more serious in the early stage of training after each model is decentralized, and the fitting is better in the later stage, the sensitivity value in the later stage can better reflect the importance of the parameter. The parameter criticality matrix obtained by accumulating the increasing weighting coefficient is as follows:
[0029]
[0030] This matrix reflects the training status of each parameter of each client model in the current round.
[0031] S2. Set the hyperparameter τ = 0.5 to represent the proportion of key parameters. Take the parameter with the largest importance value before τ and mark it as 1, and mark the rest as 0 to get the binary key parameter mask matrix
[0032] S3. Each client uploads the trained model parameters And a binary mask matrix representing the location of key parameters to the server.
[0033] S4. The server calculates the l-based 1 The overlap rate of the norm is used to obtain the similarity matrix of the key parameter position, where each element represents the similarity between the two models at the corresponding position. Based on the key parameter position similarity matrix, the server selects several clients with the most similar model parameter distribution to each client to build a similar client set. The specific steps are:
[0034] S4.1. The server masks the matrix according to the key parameters Calculate the key parameter similarity matrix between each client, where the similarity between the i-th client and the j-th client is calculated as follows:
[0035]
[0036] Here ‖.‖ 1 Indicates l 1 norm, and m represents the total number of parameters.
[0037] S4.2. Based on the key parameter similarity matrix O t , calculate the similarity threshold for the current round:
[0038]
[0039] in β is an adjustable hyperparameter, β∈(0,1), and N represents the number of clients. The threshold can be adjusted according to the round, so that as the training converges, the constraints on the judgment of similar clients are reduced, thereby enhancing the transfer of knowledge from different clients.
[0040] S4.3. According to Thre t Divide similar clients and build a similar client set:
[0041]
[0042] S5. The server calculates a personalized aggregation matrix based on the cosine similarity between key parameters of similar client models, and performs a weighted average of key parameters of similar client models of each client to guide personalized aggregation of key parameters. The specific steps are:
[0043] S5.1. The server constructs the corresponding personalized key parameter aggregation weight optimization problem based on the similarity client set of each client:
[0044]
[0045] Among them, sim(·,·) represents the cosine similarity function, The weight of the key parameter aggregation of the i-th client using the j-th client, where n j is the dataset size of the jth client, and α is a predefined hyperparameter used to balance the impact of dataset size and model similarity in the calculation of collaboration graph weights.
[0046] S5.2. Solve the quadratic programming problem and obtain the personalized aggregation weights of key parameters The aggregation is used for key parameters, and the remaining parameters are averaged. The aggregation process is expressed as:
[0047]
[0048] Where J represents an all-1 matrix.
[0049] S6. The server transmits the aggregated personalized model parameters of each client to the corresponding client, and repeats steps S1 to S5 until a predetermined number of communication rounds is reached.
[0050] The personalized federated learning system based on parameter similarity in the present invention includes a server and a plurality of clients connected to the server for communication, and the method is used to perform federated learning.
[0051] For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present invention.
Claims
1. A personalized federated learning method based on parameter similarity, characterized in that: The following steps are involved: S1. Each client collects data locally and builds a local data set. Each client uses its data set to train a local model independently locally, and uses a proportional function to the number of iterations to weight and accumulate the critical value of the parameters of each iteration; S2. Set the proportion of key parameters to obtain a binary key parameter mask matrix; S3. Each client uploads the trained model parameters and the binary mask matrix to the server; S4. The server calculates the overlap rate between the key mask matrices of all clients based on the l1 norm, and obtains the similarity matrix of the key parameter position, in which each element represents the similarity degree between the two models represented by the corresponding position; Based on the key parameter position similarity matrix, the server constructs a similar client set for each selected client whose model parameter distribution is most similar to that of the client; S5. The server calculates a personalized aggregation matrix based on the cosine similarity between key parameters of similar client models, and performs a weighted average of key parameters of similar client models of each client to guide personalized aggregation of key parameters; S6. The server transmits the aggregated personalized model parameters of each client to the corresponding client, and repeats steps S1 to S5 until a predetermined number of communication rounds is reached.
2. The personalized federated learning method based on parameter similarity according to claim 1, characterized in that: The step S1 is specifically as follows: The specific steps are: S1.
1. Each client uses the local data set to train the model and records the gradient of each iteration and the parameter amplitude before the iteration; S1.
2. Each client calculates the sensitivity value of each parameter based on the gradient and parameter amplitude before the iteration; the parameter sensitivity matrix is: Where ⊙ represents the multiplication of corresponding elements, t represents the round in which the server completes the aggregation operation, k represents the number of iterations in each round, i represents the client sequence number, θ represents the model parameters, and the parameter sensitivity matrix Each element in reflects the training status of the corresponding parameter before the kth iteration; S1.
3. Calculate the weighted coefficient of the sensitivity value obtained in each iteration according to the number of training iterations Where K i represents the total number of iterations in a single round of the i-th client; S1.4.Accumulate the parameter sensitivity matrix according to the weighting coefficient to obtain the parameter criticality matrix; since the deviation of each client model on the local data set is more serious in the early stage of training after each model is decentralized, and the fitting is better in the later stage, the sensitivity value in the later stage can better reflect the importance of the parameter; the parameter criticality matrix obtained by accumulating the increasing weighting coefficient is as follows: This matrix reflects the training status of each parameter of each client model in the current round.
3. The personalized federated learning method based on parameter similarity according to claim 2, characterized in that: The step S2 is specifically as follows: setting the hyperparameter τ=0.5 to represent the proportion of the key parameters, according to Take the parameter with the largest importance value before τ and mark it as 1, and mark the rest as 0 to get the binary key parameter mask matrix 4. The personalized federated learning method based on parameter similarity according to claim 3, characterized in that: The step S4 is specifically as follows: S4.
1. The server masks the matrix according to the key parameters Calculate the key parameter similarity matrix between each client, where the similarity between the i-th client and the j-th client is calculated as follows: ‖.‖1 represents the l1 norm, and m represents the total number of parameters; S4.
2. Based on the key parameter similarity matrix O t , calculate the similarity threshold for the current round: in β is an adjustable hyperparameter, β∈(0,1); S4.
3. Based on Thr t , divide similar clients and build a similar client set:
5. The personalized federated learning method based on parameter similarity according to claim 4, characterized in that: The specific steps of step S5 are: S5.
1. The server constructs the corresponding personalized key parameter aggregation weight optimization problem based on the similarity client set of each client: Among them, sim(·,·) represents the cosine similarity function, The weight of the key parameter aggregation of the i-th client using the j-th client, where n j is the dataset size of the jth client, and α is a predefined hyperparameter used to balance the impact of dataset size and model similarity in the calculation of collaboration graph weights; S5.
2. Solve the quadratic programming problem and obtain the personalized aggregation weights of key parameters The aggregation is used for key parameters, and the remaining parameters are averaged. The aggregation process is expressed as: Where J represents the all-1 matrix and N represents the number of clients.
6. A personalized federated learning system based on parameter similarity, comprising a server and a plurality of clients communicating with the server, characterized in that: Federated learning is performed using the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Federal learning local model parameter aggregation method
CN115021905A
Federated learning anti-reasoning attack privacy protection method based on double perturbation
CN115481431A
Personalized federal learning method based on parameter layering
CN115587633A
Federal learning optimization method and system based on reinforcement learning
CN116523079A
Efficient privacy protection federated learning method and device for defending poisoning attack
CN118094618A
Cited By
Personalized federal learning method based on server dynamic combination optimization
CN120509505A
Federal learning-based edge node user load prediction method and system
CN121118003A