Personalized federal learning model optimization method oriented to data isomerism

By using cosine similarity to select clients and a dynamic masking mechanism, combined with local hypernetworks and homomorphic encryption, personalized federated learning for heterogeneous data is optimized, solving the problems of non-IID data and privacy protection, and achieving efficient model collaboration and privacy protection.

CN121145993APending Publication Date: 2025-12-16ANHUI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511368686.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-24
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Existing federated learning suffers from problems such as degraded model performance and high consumption of communication and computing resources when dealing with non-IID data distribution and privacy protection. Existing methods have failed to effectively coordinate and optimize data heterogeneity and privacy protection.

Method used

The system employs cosine similarity to filter clients, combines a dynamic masking mechanism to divide global and personalized parameters, and uses local hypernetwork knowledge transfer and Paillier homomorphic encryption to encrypt and aggregate parameters, thereby reducing resource consumption and privacy leakage risks.

Benefits of technology

It effectively mitigates performance degradation caused by Non-IID data, reduces communication and computing resource consumption, and is suitable for edge devices and heterogeneous scenarios such as medical and IoT.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 32574559-1546-4F0D-861D-8F1F6C3DF34E
    Figure 32574559-1546-4F0D-861D-8F1F6C3DF34E
  • Figure 3E37FF47-BDE5-4C98-8051-6BFEA16B6BAD
    Figure 3E37FF47-BDE5-4C98-8051-6BFEA16B6BAD
  • Figure 46D383ED-51A0-49A0-96D6-F5F38BD14E0B
    Figure 46D383ED-51A0-49A0-96D6-F5F38BD14E0B
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a data isomerism-oriented personalized federal learning model optimization method. Comprising the following steps: an initialization stage: a client gradient calculation and uploading stage, a client selection stage, a dynamic personalized parameter selection stage, a local knowledge migration stage, a security parameter uploading stage and a security aggregation stage; and an iterative training stage: repeating the steps of client gradient calculation, client selection, dynamic personalized parameter selection, local knowledge migration, security parameter uploading and security aggregation until the global model converges or reaches a preset training round. According to the method, high-correlation clients are screened through cosine similarity, global and personalized parameters are divided in combination with a dynamic mask mechanism, balance is achieved between global cooperation and local adaptation, and performance reduction caused by Non-IID data is effectively relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, specifically to a personalized federated learning model optimization method for heterogeneous data. Background Technology

[0002] Federated learning, as a distributed machine learning paradigm, allows participants to collaboratively train models without sharing raw data, effectively addressing the issues of data privacy and data silos. However, in practical applications, federated learning faces two core challenges: the non-independence and non-identical distribution (Non-IID) of client data distribution, leading to a decline in global model performance; and the risk of privacy leakage during model parameter transmission and aggregation, where existing privacy protection methods often increase communication and computational overhead, making them unsuitable for resource-constrained edge devices.

[0003] Existing personalized federated learning methods for Non-IID data (such as FedRep and FedPer) achieve global sharing and local personalization through parameter partitioning, but suffer from limitations in applicable scenarios and high communication overhead. Privacy protection methods are mostly based on differential privacy and homomorphic encryption technologies, but they do not fully integrate with personalization needs, and encrypted transmission exacerbates resource consumption on edge devices. In addition, existing solutions mostly address data heterogeneity or privacy protection issues separately, failing to achieve synergistic optimization between the two and making it difficult to meet practical application requirements.

[0004] In summary, to address the aforementioned problems, we propose an optimization method for personalized federated learning models with heterogeneous data. Summary of the Invention

[0005] The purpose of this invention is to provide a personalized federated learning model optimization method for heterogeneous data, so as to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: A personalized federated learning model optimization method for heterogeneous data includes the following steps: Initialization phase: The server distributes initial global model parameters and mask vectors to each client. The mask vectors are initialized to all zeros to distinguish between globally shared parameters and locally personalized parameters. Client-side gradient calculation and upload phase: Each client trains a model based on its local dataset, calculates the gradient vector of the model parameters, and uploads it to the server; Client selection phase: The server collects the gradient vectors of all clients, calculates the global average gradient, calculates the similarity score between the gradient of each client and the global average gradient using the cosine similarity formula, and selects clients whose similarity scores meet the preset conditions to participate in subsequent aggregation. Dynamic personalization parameter selection phase: The selected client performs multiple rounds of training locally, records the global parameter values ​​before and after training, and calculates the update magnitude of each parameter; based on the personalization rate... and personalization restrictions The largest update The parameters are labeled as personalized parameters and the mask vector is adjusted accordingly. When the sparsity of the mask vector reaches... Stop adjusting at this time; Local knowledge transfer phase: Each client deploys a local hypernetwork, which is a fully connected neural network that generates parameters for the new local model by absorbing historical knowledge from the old local model; Security parameter upload phase: The client uses The homomorphic encryption algorithm encrypts the newly generated model parameters and uploads the encrypted parameters to the server; Secure aggregation phase: The server uses the additive homomorphic property of homomorphic encryption to perform aggregation operations on the encrypted parameters, generate encrypted global model updates, and after decryption, obtain the global model parameters and distribute them to each client; Iterative training phase: Repeat the steps of client gradient calculation, client selection, dynamic personalized parameter selection, local knowledge transfer, secure parameter uploading and secure aggregation until the global model converges or reaches the preset training rounds.

[0007] Preferably, the cosine similarity calculation formula in the client selection phase is: (1) in For the client gradient vector, The global average gradient, The value range is [-1, 1]. The higher the similarity score, the stronger the consistency between the client data distribution and the global data distribution.

[0008] Preferably, in the dynamic personalized parameter selection stage, the formula for calculating the parameter update magnitude is: (2) in These are the global parameter values ​​before training. For the process The global parameter values ​​after local training. This is the current training round.

[0009] Preferably, the adjustment rule for the mask vector is: sort the parameter update magnitudes by... The mask position corresponding to the parameter is set to 1, and the mask positions corresponding to the other parameters are kept to 0; The sparsity of the mask vector is the proportion of elements with a value of 0 in the mask vector. When the sparsity is ≥ Stop adjusting the mask vector when the time comes.

[0010] Preferably, the parameters of the local hypernetwork are generated in the following way: Let the hypernetwork be ,in For the embedding vector of the target model, These are the parameters of the hypernetwork, and the output of the hypernetwork is the parameter of the target model; When the dimension of the target model parameters exceeds the dimension of the hypernetwork output, generation is performed in blocks: (3) in , For block embedding vectors, This represents the number of blocks.

[0011] Preferably, in the secure aggregation phase, the server's aggregation operation on the encryption parameters satisfies: (4) in for Encryption function, For the client Model parameters, The number of clients participating in the aggregation. These are the aggregated global model parameters.

[0012] Preferably, in the dynamic personalized parameter selection stage, the model parameters are divided into global parameters and personalized parameters through a mask vector. The global parameters are the parameters corresponding to the positions with a value of 0 in the mask vector, and the personalized parameters are the parameters corresponding to the positions with a value of 1 in the mask vector. The global parameters participate in server aggregation, while the personalized parameters are retained locally.

[0013] Compared with the prior art, the beneficial effects of the present invention are: This invention filters highly relevant clients using cosine similarity and combines a dynamic masking mechanism to divide global and personalized parameters, achieving a balance between global collaboration and local adaptation, effectively mitigating the performance degradation caused by Non-IID data. This invention employs local hypernetwork knowledge transfer to reduce the amount of original parameter transmission, and combines Paillier homomorphic encryption to achieve encrypted parameter uploading and aggregation, resisting passive attacks on servers and collusive attacks on clients, and reducing the risk of privacy leakage. The dynamic masking mechanism of this invention reduces the scale of parameters involved in aggregation, and homomorphic encryption supports direct ciphertext computation, reducing communication and computing resource consumption, making it suitable for edge devices; The hypernetwork design of this invention supports nonlinear models, and the masking mechanism and encryption strategy can be dynamically adjusted according to the data distribution, making it suitable for heterogeneous scenarios such as medical care and the Internet of Things. Attached Figure Description

[0014] Figure 1 This is a schematic diagram of the technical route of the present invention; Figure 2 This is a schematic diagram of the steps of the federated learning method based on client selection and dynamic personalized parameter selection of the present invention; Figure 3 This is a schematic diagram of the steps of the federated security aggregation method based on local knowledge transfer and homomorphic encryption of the present invention. Detailed Implementation

[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0016] Please see Figure 1-3 As shown, a personalized federated learning model optimization method for heterogeneous data includes the following steps: Initialization phase: The server distributes initial global model parameters and mask vectors to each client. The mask vectors are initialized to all zeros to distinguish between globally shared parameters and locally personalized parameters. The formula for calculating cosine similarity in the client selection phase is: (1) in For the client gradient vector, The global average gradient, The value range is [-1, 1]. The higher the similarity score, the stronger the consistency between the client data distribution and the global data distribution. Client-side gradient calculation and upload phase: Each client trains a model based on its local dataset, calculates the gradient vector of the model parameters, and uploads it to the server; Client selection phase: The server collects the gradient vectors of all clients, calculates the global average gradient, calculates the similarity score between the gradient of each client and the global average gradient using the cosine similarity formula, and selects clients whose similarity scores meet the preset conditions to participate in subsequent aggregation. Dynamic personalized parameter selection phase: The selected client performs multiple rounds of training locally, records the global parameter values ​​before and after training, and calculates the update magnitude of each parameter; During the dynamic personalized parameter selection phase, the formula for calculating the parameter update magnitude is: (2) in These are the global parameter values ​​before training. For the process The global parameter values ​​after local training. This is the current training round; Based on personalization rate and personalization restrictions The largest update The parameters are labeled as personalized parameters and the mask vector is adjusted accordingly. When the sparsity of the mask vector reaches... Stop adjusting at this time; The adjustment rule for the mask vector is: sort the parameter update magnitudes by the first... The mask position corresponding to the parameter is set to 1, and the mask positions corresponding to the other parameters are kept to 0; The sparsity of the mask vector is the proportion of elements with a value of 0 in the mask vector. When the sparsity is ≥ Stop adjusting the mask vector at this time; In the dynamic personalized parameter selection stage, model parameters are divided into global parameters and personalized parameters through a mask vector. Global parameters are the parameters corresponding to the positions with a value of 0 in the mask vector, and personalized parameters are the parameters corresponding to the positions with a value of 1 in the mask vector. Global parameters participate in server aggregation, while personalized parameters are retained locally. Local knowledge transfer phase: Each client deploys a local hypernetwork, which is a fully connected neural network that generates parameters for the new local model by absorbing historical knowledge from the old local model; The parameter generation method for local hypernetworks is as follows: Let the hypernetwork be ,in For the embedding vector of the target model, These are the parameters of the hypernetwork, and the output of the hypernetwork is the parameter of the target model; When the dimension of the target model parameters exceeds the dimension of the hypernetwork output, generation is performed in blocks: (3) in , For block embedding vectors, This represents the number of blocks; Security parameter upload phase: The client uses The homomorphic encryption algorithm encrypts the newly generated model parameters and uploads the encrypted parameters to the server; Secure aggregation phase: The server uses the additive homomorphic property of homomorphic encryption to perform aggregation operations on the encrypted parameters, generate encrypted global model updates, and after decryption, obtain the global model parameters and distribute them to each client; During the secure aggregation phase, the server's aggregation operation on the encrypted parameters satisfies: (4) in for Encryption function, For the client Model parameters, The number of clients participating in the aggregation. These are the aggregated global model parameters; Iterative training phase: Repeat the steps of client gradient calculation, client selection, dynamic personalized parameter selection, local knowledge transfer, secure parameter uploading and secure aggregation until the global model converges or reaches the preset training rounds.

[0017] Example 2: like Figure 1-3 As shown, a personalized federated learning model optimization method for heterogeneous data includes the following steps: First, personalized parameter selection and local knowledge transfer are performed on the client-side local model. Then, the data is transmitted encrypted. The server uses the homomorphism of the Paillier encryption algorithm to aggregate the uploaded ciphertext and update the global model weights. After updating the global model, it is distributed to the client for the next round of training. This process is iterated until the global model converges or reaches the target accuracy. Finally, the experimental results are analyzed using various public datasets. The technical approach is as follows: (1) To address the issues of Non-IID data distribution on edge devices and the common problems of decreased model accuracy and algorithm complexity in existing algorithms, a PFL method based on client selection and dynamic personalized parameter selection is proposed. Each client trains its model on local data to obtain the gradient of its model parameters. The central server collects the gradients from all clients, calculates the global average gradient, and uses cosine similarity for client selection. Then, a mask is used to separate global and personalized parameters for the selected clients. Only parameters with a mask value of 1 are updated among clients, while parameters with a mask value of 0 are aggregated from the global model. This improves the model's personalization capabilities and collaborative efficiency.

[0018] (2) To address the shortcomings of current privacy-preserving algorithms, such as some security limitations and the inability to accommodate data heterogeneity, a federated secure aggregation algorithm based on local knowledge transfer and homomorphic encryption is proposed. Each client deploys a local hypernetwork to learn knowledge from the old local model and transfer it to the newly generated local model. When the hypernetwork generates new model parameters, privacy-preserving techniques are used to process the input data to prevent the leakage of sensitive information.

[0019] Federated learning methods based on client selection and dynamic personalized parameter selection include the following steps: (1) Client selection: Each client trains the model on local data and obtains the local gradient vector. The client sends the calculated gradient to the server, and the central server collects the gradients from all clients and calculates the global average gradient. Calculate client gradient and the globally averaged gradient dot product · And their models || ||and|| The cosine similarity formula is used to calculate the similarity score. The value of cosine similarity ranges from [-1, 1], and the closer the value is to 1, the higher the similarity.

[0020] (2) Dynamic personalized parameter selection: After the client completes the selection, the mask of all clients. Initialize to all 0s, indicating that all parameters are initially global parameters; each client performs L rounds of training on local data, updating the local model parameters accordingly. Record global parameters before training and global parameters after training Calculate the update magnitude Δ for each global parameter. According to the update magnitude Δ The parameter with the largest change (P%) is selected as the new personalized parameter. The mask positions corresponding to these new personalized parameters are set to 1, and the remaining positions are kept to 0. If the sparsity of the current mask (i.e. the proportion of values ​​of 0) is less than the personalization limit α, then the next round of parameter selection and training continues; otherwise, the mask is stopped from being updated, the current personalized parameters and global parameter division are maintained, and the updated mask is returned for the next round of model aggregation and local training.

[0021] (3) Combining mask and parameters: using the updated mask Resegmenting model parameters For new global parameters and personalized parameters global parameters pass Get, personalize Parameters passed get.

[0022] (4) Server Aggregation: The central server updates the mask and parameters based on the client. For global parameters, it performs average aggregation; for personalized parameters, it keeps the client updated. The updated global model parameters are distributed back to all clients, and the clients update their local models according to the new mask until the predetermined number of training epochs is reached or the model converges. The server receives the global parameters uploaded by the clients, aggregates them to generate a global model, and then sends the global model back to all clients.

[0023] The federated security aggregation method based on local knowledge transfer and homomorphic encryption includes the following steps: (1) Local knowledge transfer: Each client initializes a hypernet, which is used to realize local knowledge transfer: it absorbs the historical knowledge of the old local model and releases it to the new local model. The client uses the hypernet to generate encrypted parameters of the local model. The client trains on the encrypted data using the encrypted model parameters, and performs addition and multiplication operations using the characteristics of Paillier homomorphic encryption. Finally, the client sends the updated local model parameters (encrypted state) back to the server.

[0024] (2) Hypernetwork configuration: The hypernetwork is designed as a fully connected neural network. The input is an embedding vector v, representing the embedding of the target model. The output is the parameters of the target model. Let the hypernetwork be h(v, ), where v is the embedding vector, These are the parameters of the hypernetic network. The parameters of the target model generated by the hypernetic network are represented as follows: If the parameters of the target model If the dimension exceeds the output dimension of the hypernetwork, it is generated by dividing it into blocks: (3) Server secure aggregation: By utilizing the additive homomorphic property of Paillier homomorphic encryption, the server can directly aggregate the encrypted model parameters. After the aggregation is completed, the server will obtain an encrypted global model update. After updating the global model, the server will distribute the new encrypted global model to all clients.

[0025] The process of the federated security aggregation method based on local knowledge transfer and homomorphic encryption is as follows: Figure 3 As shown.

[0026] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for optimizing a personalized federated learning model for heterogeneous data, characterized in that, Includes the following steps: Initialization phase: The server distributes initial global model parameters and mask vectors to each client. The mask vectors are initialized to all zeros to distinguish between globally shared parameters and locally personalized parameters. Client-side gradient calculation and upload phase: Each client trains a model based on its local dataset, calculates the gradient vector of the model parameters, and uploads it to the server; Client selection phase: The server collects the gradient vectors of all clients, calculates the global average gradient, calculates the similarity score between the gradient of each client and the global average gradient using the cosine similarity formula, and selects clients whose similarity scores meet the preset conditions to participate in subsequent aggregation. Dynamic personalization parameter selection phase: The selected client performs multiple rounds of training locally, records the global parameter values ​​before and after training, and calculates the update magnitude of each parameter; based on the personalization rate... and personalization restrictions The largest update The parameters are labeled as personalized parameters and the mask vector is adjusted accordingly. When the sparsity of the mask vector reaches... Stop adjusting at that time; Local knowledge transfer phase: Each client deploys a local hypernetwork, which is a fully connected neural network that generates parameters for the new local model by absorbing historical knowledge from the old local model; Security parameter upload phase: The client uses The homomorphic encryption algorithm encrypts the newly generated model parameters and uploads the encrypted parameters to the server; Secure aggregation phase: The server uses the additive homomorphic property of homomorphic encryption to perform aggregation operations on the encrypted parameters, generate encrypted global model updates, and after decryption, obtain the global model parameters and distribute them to each client; Iterative training phase: Repeat the steps of client gradient calculation, client selection, dynamic personalized parameter selection, local knowledge transfer, secure parameter uploading and secure aggregation until the global model converges or reaches the preset training rounds.

2. The method for optimizing a personalized federated learning model for heterogeneous data as described in claim 1, characterized in that, The formula for calculating cosine similarity in the client selection phase is: (1) in For the client gradient vector, The global average gradient, The value range is [-1, 1]. The higher the similarity score, the stronger the consistency between the client data distribution and the global data distribution.

3. The optimization method for a personalized federated learning model oriented towards heterogeneous data as described in claim 1, characterized in that, In the dynamic personalized parameter selection stage, the formula for calculating the parameter update magnitude is: (2) in These are the global parameter values ​​before training. For the process The global parameter values ​​after local training. This is the current training round.

4. The optimization method for a personalized federated learning model oriented towards heterogeneous data as described in claim 1, characterized in that, The adjustment rule for the mask vector is as follows: sort the parameter update magnitudes by the first... The mask position corresponding to the parameter is set to 1, and the mask positions corresponding to the other parameters are kept to 0; The sparsity of the mask vector is the proportion of elements with a value of 0 in the mask vector. When the sparsity is ≥ Stop adjusting the mask vector when the time comes.

5. The method for optimizing a personalized federated learning model for heterogeneous data as described in claim 1, characterized in that, The parameters of the local hypernetwork are generated as follows: Let the hypernetwork be ,in For the embedding vector of the target model, These are the parameters of the hypernetwork, and the output of the hypernetwork is the parameter of the target model; When the dimension of the target model parameters exceeds the dimension of the hypernetwork output, generation is performed in blocks: (3) in , For block embedding vectors, This represents the number of blocks.

6. The method for optimizing a personalized federated learning model for heterogeneous data as described in claim 5, characterized in that, During the secure aggregation phase, the server's aggregation operation on the encryption parameters satisfies: (4) in for Encryption function, For the client Model parameters, The number of clients participating in the aggregation. These are the aggregated global model parameters.

7. The method for optimizing a personalized federated learning model for heterogeneous data as described in claim 5, characterized in that, In the dynamic personalized parameter selection stage, the model parameters are divided into global parameters and personalized parameters through a mask vector. Global parameters are the parameters corresponding to the positions with a value of 0 in the mask vector, and personalized parameters are the parameters corresponding to the positions with a value of 1 in the mask vector. Global parameters participate in server aggregation, while personalized parameters are retained locally.