A Clustering-Based Federated Domain Adaptation Method

By generating semi-homomorphic encryption public keys and calculating distribution probability, using JS divergence and cosine similarity matrix to divide the domains, the balance of the local adaptation and generalization capabilities of the model in federated learning is achieved, solving the problem of difficult aggregation of global parameters caused by data heterogeneity, and improving the model's adaptability and training efficiency.

CN115964663BActive Publication Date: 2025-08-05TIANJIN UNIVERSITY OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211129165.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-16
Publication Date
2025-08-05
Estimated Expiration
2042-09-16

AI Technical Summary

Technical Problem

In federated learning, the heterogeneous data problem of participants makes it difficult to aggregate global parameters and the model is difficult to adapt to the data distribution of any participant. How to enhance the local adaptability of the model on the basis of expanding the training sample size is an urgent problem.

Method used

By generating semi-homomorphic encryption public keys, calculating the category distribution probability and information entropy, dividing the cluster domains using the JS divergence matrix, dividing the task domains using the cosine similarity matrix, and performing parameter aggregation in two ways, realizing knowledge sharing to balance the generalization ability and local adaptability of the global model.

Benefits of technology

It realizes the safe analysis of data distributions of each participant, reduces heterogeneous problems, enhances the model's local adaptability and extensive learning capabilities, ensures the similarity of data distribution within the domain, and improves the model's adaptability and training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964663B_ABST
    Figure CN115964663B_ABST
Patent Text Reader

Abstract

A clustering-based federated domain adaptation method. Its CSP generates public and private keys, and the federated learning aggregation server AS distributes the public key; the participating parties calculate the class distribution probability and information entropy; the participating parties encrypt the class distribution probability and information entropy; cluster domain division based on JS divergence; distribute the initial federated learning model parameters and index model; the participating parties extract the local updated model parameters; take the intersection of the parameters of the local updated model and the parameters of the index model to obtain the parameters of the sub-updated model; task domain division based on the cosine similarity matrix; perform steps such as federated learning. The present invention can analyze the data distribution information among the participating parties, and adopt different partitioning strategies to divide the participating parties into multiple domains to reduce two heterogeneous problems, while ensuring stronger similarity in the data distribution within the domain, and the federated learning model trained within the domain is more adaptable to the local data distribution of the participating parties. It can also endow the model with extensive learning ability and local distribution adaptation ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of federated machine learning, and particularly relates to a clustering-based federated domain adaptation method. Background Art

[0002] With the wide attention of deep learning in the academic and industrial fields, applications related to deep learning have developed rapidly. However, data is often stored in different departments or devices, and due to industry requirements, data between devices cannot be simply integrated. In addition, with the continuous improvement of laws and regulations related to network security and information security, the emphasis on data security and privacy has become a global trend. Facing the above problems, traditional machine learning methods have faced severe challenges. To solve the data island problem of traditional machine learning, federated learning technology has emerged.

[0003] In the industrial and academic fields, federated learning technology related to swarm intelligence still faces many challenges. One important challenge is the data heterogeneity problem of participants. Due to the different environments where data acquisition devices are located, it is almost impossible for the data distribution owned by any specific device to represent the overall data distribution, that is, the data of participants often follows non-independent and identically distributed. The heterogeneity problem in federated learning is mainly divided into two types, namely label distribution shift and feature distribution shift. The existence of these two shifts leads to the situation that global parameters are often difficult to aggregate, and also leads to the global model not adapting to the data distribution of any participant. How to make the local adaptation ability of the model stronger on the basis of expanding the training sample size is an urgent problem to be solved by federated learning in the field of swarm intelligence. Summary of the Invention

[0004] In order to solve the above problems, the purpose of the present invention is to provide a clustering-based federated domain adaptation method, aiming to balance the generalization ability and local adaptation ability of the global model.

[0005] To achieve the above purpose, the clustering-based federated domain adaptation method provided by the present invention includes the following steps carried out in sequence:

[0006] 1) The encryption service provider CSP randomly generates a pair of semi-homomorphic encrypted public and private keys Puk, Prk, and the federated learning aggregation server AS distributes the above semi-homomorphic encrypted public key Puk and the initial federated learning model parameters to each participant LC of the federated learning.

[0007] 2) The i-th participant LC i calculates the category distribution probability p of the local data i and the information entropy lp corresponding to the category distribution probability i ;

[0008] 3) Each participating party LC uses the public key Puk of the above semi - homomorphic encryption to encrypt the class distribution probability p i and the information entropy lp i respectively, obtaining the ciphertext of the class distribution probability <p i > and the ciphertext of the information entropy <lp i >. Then the i - th participating party LC i uploads the ciphertext of the class distribution probability <p i > and the ciphertext of the information entropy <lp i > to the federated learning aggregation server AS;

[0009] 4) After the federated learning aggregation server AS receives the ciphertext of the class distribution probability <p i > and the ciphertext of the information entropy <lp i >, the encryption service provider CSP calculates the JS divergence between each participating party LC in the homomorphic environment based on the above ciphertext of the class distribution probability <p i > and the ciphertext of the information entropy <lp i >, and forms a JS divergence matrix with the participating party set as rows and columns. Then the federated learning aggregation server AS divides the participating party set into K cluster domains CD according to the results of the JS divergence matrix;

[0010] 5) The federated learning aggregation server AS randomly selects 40 - 60% of the model parameters from the above initial federated learning model parameters, and forms an index model I - model from the indices of these model parameters. Then it sends the initial federated learning model parameters and the index model I - Model to the participating party LC together;

[0011] 6) Each participating party LC uses local data to perform a single - round training on the above initial federated learning model parameters, obtaining the parameters of a local updated model U - model as the unique feature information of the local data of the participating party LC;

[0012] 7) The participating party LC takes the intersection of the parameters of the above local updated model U - model and the parameters of the index model T - model to obtain the parameters of the sub - updated model SU - model, and then uploads the parameters of the sub - updated model SU - model to the federated learning aggregation server AS;

[0013] 8) In each cluster domain CD, the federated learning aggregation server AS calculates the cosine similarity between the sub - updated models SU - model of any two participating parties LC, and forms a cosine similarity matrix with the participating party set as rows and columns. Then it divides the participating party set in the same cluster domain CD into T task domains TD according to the results of the cosine similarity matrix;

[0014] 9) The participating party LC and the federated learning aggregation server AS perform federated learning based on the above-mentioned cluster domain CD and task domain TD. Among them, for different cluster domains CD and task domains TD, the federated learning aggregation server AS adopts two different methods for parameter aggregation to achieve knowledge sharing.

[0015] In step 2), the i-th participating party LC i calculates the class distribution probability p of the local data i and the information entropy lp corresponding to the class distribution probability i The method is as follows:

[0016] 201) The i-th participating party LC i uses a dictionary structure to count the types of each class and the number of class samples of the local data, and obtains the statistical result dic_p i , and the expression is:

[0017] dic_p i ={L1: num1, L2: num2,..., L N : numN}

[0018] where, L N represents the type of the participating party class; numN represents the number of class samples of the class of type L N ;

[0019] According to the above statistical result dic_p i calculate the class distribution probability p i , and the expression of the class distribution probability p i is:

[0020]

[0021] where, M = num1 + num2 + … + numN

[0022] 202) The i-th participating party LC i According to the above class distribution probability p i calculate the information entropy lp corresponding to the class distribution probability p i , and the calculation formula of the information entropy lp i is: i

[0023]

[0024] where, N represents the number of classes of the local data of all participating parties; p(x j ) represents the class distribution probability of class j.

[0025] In step 4), the encryption service provider CSP calculates the JS divergence between each participating party LC in the homomorphic environment based on the above-mentioned categorical distribution probability ciphertext <p i > and the information entropy ciphertext <lp i >, and forms a JS divergence matrix with the participating party set as rows and columns. Then, the federated learning aggregation server AS divides the participating party set into K cluster domains CD according to the result of the JS divergence matrix as follows:

[0026] 401) Since the categorical distribution probability ciphertext <p i > and the information entropy ciphertext <lp i > cannot be directly substituted into the JS divergence calculation formula, but the categorical distribution probability ciphertext <p i > and the information entropy ciphertext <lp i > satisfy the following equations in the homomorphic environment: <p i +q i > = <p i > + <q i >, <(p i +q i )log(p i +q i )> = <(p i +q i )>log<(p i +q i )>. Therefore, the encryption service provider CSP transforms the JS divergence calculation formula, and then substitutes the above equations into the transformed JS divergence calculation formula, so as to obtain the JS divergence between any two participating parties LC in the homomorphic environment without revealing the data distribution information of any party. The transformed JS divergence calculation formula is:

[0027]

[0028] where p and q respectively represent the categorical distribution probabilities of two participating parties LC; N represents the number of categories of all participating parties' local data; the categorical distribution satisfies

[0029] 402) The federated learning aggregation server AS uses the JS divergence between any two participating parties LC to form a JS divergence matrix with the participating party set as rows and columns;

[0030] 403) The federated learning aggregation server AS divides the set of participants into K cluster domains CD according to the results of the JS divergence matrix to weaken the degree of label distribution offset heterogeneity within the cluster domains. The division criterion for the cluster domain CD should satisfy that the sum of the JS divergences of the participants LC within the same cluster domain CD is the smallest, and the sum of the JS divergences of the participants LC in different cluster domains CD is the largest. The expression is:

[0031]

[0032] where {c} represents the set of participants; c k represents the cluster domain CD k ; c other represents any cluster domain other than the cluster domain c k ; JSD i,j represents the JS divergence between the i-th participant LC i and the j-th participant LC j .

[0033] In step 6), the method for each participant LC to use local data to perform a single round of training on the above initial federated learning model parameters to obtain the parameters of a local updated model U-model is as follows:

[0034] The participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model, obtains the trained model parameters, then calculates the increment value between the trained model parameters and the initial federated learning model parameters, and records this increment value as the parameters of the local updated model U-Model. The combined formula for one round of training and calculating the increment value is:

[0035]

[0036] where θ k,U-model represents the local updated model of the k-th participant LC k ; θ ini represents the initial federated learning model parameters issued by the federated learning aggregation server AS; n k represents the sample size of the k-th participant LC k ; f(·) represents the prediction function; L(·) represents the loss function.

[0037] In step 7), the expression for the parameters θ k,SU-model of the sub-updated model SU-mode1 is:

[0038] θ k,SU-model =θ k,U-model ∩θ k,I-model

[0039] where θ k,U-modelare the parameters of the local updated model; θ k,I-model are the parameters of the indexed model.

[0040] In step 8), in each cluster domain CD, the federated learning aggregation server AS calculates the cosine similarity of the parameters of the sub-updated models SU-model of any two participating parties LC, and forms a cosine similarity matrix with the set of participating parties as rows and columns. Then, according to the results of the cosine similarity matrix, the method of dividing the set of participating parties in the same cluster domain CD into T task domains TD is as follows:

[0041] 801) The federated learning aggregation server AS first flattens the parameters of the sub-updated model SU-model uploaded by the participating party LC into a sub-updated model parameter vector, and then calculates the cosine similarity between the sub-updated model parameter vectors of two participating parties LC. The calculation formula is:

[0042]

[0043] where, ω i represents the sub-updated model parameter vector of the i-th participating party LC i ; ω j represents the sub-updated model parameter vector of the j-th participating party LC j .

[0044] 802) The federated learning aggregation server AS uses the cosine similarity between the sub-updated model parameter vectors of any two participating parties LC to form a cosine similarity matrix with the set of participating parties as rows and columns;

[0045] 803) According to the results of the above cosine similarity matrix, the set of participating parties is divided into T task domains TD to weaken the degree of feature distribution offset heterogeneity within the same cluster domain CD. The division criterion of the task domain TD should satisfy that the sum of the cosine similarities of the same task domain TD is the largest, and the sum of the cosine similarities of different task domains TD is the smallest. The expression is:

[0046]

[0047] where, c k,t represents the t-th task domain TD k in the k-th cluster domain CD t ; c k,other represents any task domain other than the t-th task domain TD k in the k-th cluster domain CD s t ; Cos i,j represents the cosine similarity between the sub-updated model parameter vectors of the i-th participating party LC i and the j-th participating party LC j .

[0048] In step 9), federated learning is performed between the participating party LC and the federated learning aggregation server AS based on the above cluster domain CD and task domain TD. For different cluster domains CD and task domains TD, the federated learning aggregation server AS adopts two different methods for parameter aggregation to achieve knowledge sharing, and the method is as follows:

[0049] 901) The participating party LC uses the initial federated learning model parameters to perform multiple rounds of training on the local data of the participating party, and obtains the parameters of the local model after training. The calculation formula for the parameters of the local model after the t-th round of local training is as follows:

[0050]

[0051] Among them, represents the k-th participating party LC k The parameters of the local model after the t-th round of training; n k represents the k-th participating party LC k The sample size of; f(·) represents the prediction function; L(·) represents the loss function;

[0052] 902) Each participating party LC uploads the parameters of the local model after the last round of training to the federated learning aggregation server AS;

[0053] 903) The federated learning aggregation server AS divides different participating parties into the corresponding cluster domains and task domains according to the division results of the cluster domain CD and task domain TD, and then performs the first parameter aggregation on the local model parameters of the participating parties belonging to the same cluster domain and task domain. The formula for the first parameter aggregation is:

[0054]

[0055] Among them, represents the parameters of the local model in the t-th round, the k-th cluster domain, and the t-th task domain; {c} k,t represents the set of all participating parties in the k-th cluster domain and the t-th task domain; D i represents the sample size of the i-th participating party; D k,t represents the sum of all sample sizes in the k-th cluster domain and the t-th task domain;

[0056] 904) The federated learning aggregation server AS performs the second parameter aggregation on the local model parameters of the participating parties belonging to the same cluster domain but not the same task domain according to the division result of the cluster domain, and the aggregation method is to only aggregate the neural network parameters of the first N-1 layers to achieve the purpose of multi-task learning. The formula for the second parameter aggregation is:

[0057]

[0058] Among them, represents the neural network parameters of the k-th cluster domain and the first N - 1 layers; |T k | represents the number of task domains in the k-th cluster domain; represents the parameters of the local model of the task domain obtained by the first parameter aggregation for the k-th cluster domain, the t-th task domain, and the first N - 1 layers.

[0059] 905) The aggregation server AS distributes the parameters of different local models obtained by the secondary aggregation to each participating party LC according to the cluster domain CD and the task domain TD, thus completing a round of the global federated learning process.

[0060] The clustering-based domain adaptation federated learning method provided by the present invention can safely analyze the data distribution information among participating parties, and adopt different partitioning strategies to divide the participating parties into multiple domains to reduce two heterogeneous problems, while ensuring stronger similarity of data distribution within the domain and the federated learning model trained within the domain is more adaptable to the local data distribution of the participating parties. In addition, according to the characteristics of label distribution shift and feature distribution shift, the method adopts different knowledge sharing strategies between domains, enabling the model to have extensive learning ability and local distribution adaptation ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is a flowchart of the clustering-based domain adaptation federated learning method provided by the present invention.

[0062] Figure 2 is a flowchart of the clustering domain partitioning method based on JS divergence in the present invention.

[0063] Figure 3 is a flowchart of the task domain partitioning method based on cosine similarity in the present invention.

[0064] Figure 4 is a flowchart of the domain adaptation federated learning training method in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0065] The following combines the drawings and specific embodiments to elaborate on the clustering-based domain adaptation federated learning method provided by the present invention.

[0066] As Figure 1 shown, the clustering-based federated domain adaptation method provided by the present invention includes the following steps carried out in sequence:

[0067] 1) The encryption service provider CSP randomly generates a pair of public and private keys Puk, Prk for semi-homomorphic encryption, and the federated learning aggregation server AS distributes the above-mentioned public key Puk for semi-homomorphic encryption and the initial federated learning model parameters to each participating party LC of the federated learning;

[0068] 2) The i-th participating party LC i Calculate the class distribution probability p of the local data i And the information entropy lp corresponding to the class distribution probability i ;

[0069] The method is as follows:

[0070] 201) The i-th participating party LC i Use a dictionary structure to count the types of each class and the number of class samples of the local data, and obtain the statistical result dic_p i , and the expression is:

[0071] dic_p i ={L1: num1, L2: num2,..., L N : numN}

[0072] Among them, L N represents the type of the participating party class; numN represents the number of class samples of the class with the type of L N ;

[0073] According to the above statistical result dic_p i Calculate the class distribution probability p i , and the expression of the class distribution probability p i is:

[0074]

[0075] Among them, M = num1 + num2 + … + numN

[0076] 202) The i-th participating party LC i According to the above class distribution probability p i Calculate the information entropy lp corresponding to the class distribution probability p i , and the calculation formula of the information entropy lp i is: i

[0077]

[0078] Among them, N represents the number of classes of the local data of all participating parties; p(x j ) represents the class distribution probability of class j.

[0079] 3) Each participating party LC uses the public key Puk of the above semi-homomorphic encryption to encrypt the class distribution probability p i and the information entropy lp i respectively, and obtains the ciphertext <p i > of the class distribution probability and the ciphertext <lp i > of the information entropy, and then the i-th participating party LCi Upload the ciphertext <p of the class distribution probability i > and the ciphertext <lp of the information entropy i > to the federated learning aggregation server AS;

[0080] 4) After the federated learning aggregation server AS receives the ciphertext <p of the class distribution probability i > and the ciphertext <lp of the information entropy i >, based on the above ciphertext <p of the class distribution probability i > and the ciphertext <lp of the information entropy i >, the encryption service provider CSP calculates the JS divergence between each participating party LC in the homomorphic environment and constructs a JS divergence matrix with the set of participating parties as rows and columns. Then, the federated learning aggregation server AS divides the set of participating parties into K cluster domains CD according to the result of the JS divergence matrix;

[0081] As Figure 2 shown, the method is as follows:

[0082] 401) Since the ciphertext <p of the class distribution probability i > and the ciphertext <lp of the information entropy i > cannot be directly substituted into the JS divergence calculation formula, but the ciphertext <p of the class distribution probability i > and the ciphertext <lp of the information entropy i > satisfy the following equations in the homomorphic environment: <p i +q i > = <p i > + <q i >, <(p i +q i )log(p i +q i )> = <(p i +q i )>log<(p i +q i ). Therefore, the encryption service provider CSP transforms the JS divergence calculation formula and then substitutes the above equations into the transformed JS divergence calculation formula, so as to obtain the JS divergence between any two participating parties LC in the homomorphic environment without revealing the data distribution information of any party. The transformed JS divergence calculation formula is:

[0083]

[0084] where p and q respectively represent the class distribution probabilities of two participating parties LC; N represents the number of classes of all participating parties' local data; the class distribution satisfies

[0085] 402) The federated learning aggregation server AS uses the JS divergence between any two participants LC to construct a JS divergence matrix with the participant sets as rows and columns;

[0086] 403) The federated learning aggregation server AS divides the participant set into K cluster domains CD according to the result of the JS divergence matrix to reduce the degree of heterogeneity of the label distribution offset within the cluster domain. The division criteria of the cluster domain CD should satisfy the minimum sum of the JS divergences of the participant LCs in the same cluster domain CD and the maximum sum of the JS divergences of the participant LCs in different cluster domain CDs. The expression is:

[0087]

[0088] Where {c} represents the set of participants; c k Indicates cluster domain CD k ;c other Indicates that except cluster domain c k Any cluster domain other than JSD i,j Indicates the i-th participant LC i and the jth participant LC j JS divergence between .

[0089] 5) The federated learning aggregation server AS randomly selects 40-60% of the model parameters from the above initial federated learning model parameters, and constructs an index model I-model from the indexes of these model parameters. It then sends the initial federated learning model parameters and the index model I-Model together to the participating party LC;

[0090] The model parameters randomly selected by the federated learning aggregation server AS from the above-mentioned initial federated learning model parameters have the following two characteristics: First, the construction of the index model I-Model occurs before the federated learning training process, so the federated learning aggregation server AS does not know which parameters can express more feature distribution information; Second, the randomness of the index model I-model is not the randomness of neurons, but the randomness of parameters. The output of the neural network cannot be obtained using only |I-model| parameters.

[0091] 6) Each participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model, and obtains the parameters of a local update model U-model as the unique feature information of the participant LC's local data;

[0092] Here’s how:

[0093] Participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model, obtains the parameters of the trained model, then calculates the incremental value between the parameters of the trained model and the parameters of the initial federated learning model, and records this incremental value as the parameters of the local updated model U-Model. The combined formula for one round of training and calculating the incremental value is as follows:

[0094]

[0095] where, θ k,U-model represents the local updated model of the k-th participant LC k ; θ ini represents the parameters of the initial federated learning model issued by the federated learning aggregation server AS; n k represents the sample size of the k-th participant LC k ; f(·) represents the prediction function; L(·) represents the loss function.

[0096] 7) Participant LC takes the intersection of the parameters of the above local updated model U-model and the parameters of the index model I-model to obtain the parameters of the sub-updated model SU-model, and then uploads the parameters of the sub-updated model SU-model to the federated learning aggregation server AS;

[0097] The method by which Participant LC takes the intersection of the parameters of the above local updated model U-model and the parameters of the index model I-model to obtain the parameters of the sub-updated model SU-model is as follows:

[0098] Since the local updated model U-model can both exhibit the characteristic distribution information of the local data of Participant LC and be used for sample prediction, however, the purpose of the local updated model U-model is only to compare the characteristic distribution differences between two participants LC. Therefore, by taking the intersection of the parameters θ k,U-model of the local updated model and the parameters θ k,I-model of the index model, that is, the parameters θ k,SU-model of the sub-updated model SU-model, to ensure that the extracted characteristic distribution information cannot be used for sample prediction, while carrying the characteristic distribution information of Participant LC. The expression for the parameters θ k,SU-model of the sub-updated model SU-model is:

[0099] θ k,SU-model = θ k,U-model ∩θ k,I-model <>

[0100] 8) In each cluster domain CD, the federated learning aggregation server AS calculates the cosine similarity between the sub-update models SU-model of any two participating parties LC and forms a cosine similarity matrix with the set of participating parties as rows and columns. Then, according to the results of the cosine similarity matrix, the set of participating parties in the same cluster domain CD is divided into T task domains TD;

[0101] As Figure 3 shown, the method is as follows:

[0102] 801) The federated learning aggregation server AS first flattens the parameters of the sub-update model SU-model uploaded by the participating party LC into a sub-update model parameter vector, and then calculates the cosine similarity between the sub-update model parameter vectors of two participating parties LC. The calculation formula is:

[0103]

[0104] where ω i represents the sub-update model parameter vector of the i-th participating party LC i ; ω j represents the sub-update model parameter vector of the j-th participating party LC j ;

[0105] 802) The federated learning aggregation server AS uses the cosine similarity between the sub-update model parameter vectors of any two participating parties LC to form a cosine similarity matrix with the set of participating parties as rows and columns;

[0106] 803) According to the results of the above cosine similarity matrix, the set of participating parties is divided into T task domains TD to weaken the degree of feature distribution offset heterogeneity within the same cluster domain CD. The division criterion of the task domain TD should satisfy that the sum of cosine similarities of the same task domain TD is the largest, and the sum of cosine similarities of different task domains TD is the smallest. The expression is:

[0107]

[0108] where c k,t represents the t-th task domain TD k in the k-th cluster domain CD t ; c k,other represents any task domain other than the t-th task domain TD k in the k-th cluster domain CD t ; Cos i,j represents the cosine similarity between the sub-update model parameter vectors of the i-th participating party LC i and the j-th participating party LC j .

[0109] 9) The participating party LC and the federated learning aggregation server AS perform federated learning based on the above-mentioned cluster domain CD and task domain TD. Among them, for different cluster domains CD and task domains TD, the federated learning aggregation server AS adopts two different methods for parameter aggregation to achieve knowledge sharing.

[0110] As Figure 4 shown, the method is as follows:

[0111] 901) The participating party LC uses the initial federated learning model parameters to perform multiple rounds of training on the local data of the participating party, and obtains the parameters of the local model after training. The calculation formula for the parameters of the local model after the t-th round of local training is as follows:

[0112]

[0113] Among them, represents the k-th participating party LC k the parameters of the local model after the t-th round of training; n k represents the k-th participating party LC k the sample size; f(·) represents the prediction function; L(·) represents the loss function;

[0114] 902) Each participating party LC uploads the parameters of the local model after the last round of training to the federated learning aggregation server AS;

[0115] 903) The federated learning aggregation server AS divides different participating parties into the corresponding cluster domains and task domains according to the division results of the cluster domain CD and task domain TD, and then performs the first parameter aggregation on the local model parameters of the participating parties belonging to the same cluster domain and task domain. The formula for the first parameter aggregation is:

[0116]

[0117] Among them, represents the parameters of the local model in the t-th round, the k-th cluster domain, and the t-th task domain; {c} k,t represents the set of all participating parties in the k-th cluster domain and the t-th task domain; D i represents the sample size of the i-th participating party; D k,t represents the sum of all sample sizes in the k-th cluster domain and the t-th task domain;

[0118] 904) The federated learning aggregation server AS performs the second parameter aggregation on the local model parameters of the participating parties belonging to the same cluster domain but not the same task domain according to the division results of the cluster domain, and the aggregation method is to only aggregate the neural network parameters of the first N - 1 layers to achieve the purpose of multi-task learning. The formula for the second parameter aggregation is:

[0119]

[0120] Among them, represents the parameters of the first N - 1 layers of the k-th cluster domain; |T k | represents the number of task domains of the k-th cluster domain; represents the parameters of the local model of the task domain obtained by the first parameter aggregation for the k-th cluster domain, the t-th task domain, and the first N - 1 layers.

[0121] 905) The aggregation server AS distributes the parameters of different local models obtained by the secondary aggregation to each participating party LC according to the cluster domain CD and the task domain TD, thus completing a round of the global federated learning process.

Claims

1. A clustering-based federated domain adaptation method, characterized by: The clustering-based federated domain adaptation method includes the following steps performed in sequence: 1) The encryption service provider CSP randomly generates a pair of semi-homomorphically encrypted public and private keys Puk and Prk, and the federated learning aggregation server AS sends the semi-homomorphically encrypted public key Puk and the initial federated learning model parameters to each federated learning participant LC; 2) LC of the i-th participant i Calculate the category distribution probability p of local data i And the information entropy lp corresponding to the category distribution probability i ; 3) Each participant LC uses the above semi-homomorphic encryption public key Puk to distribute the probability p of the category i and information entropy lp i Encrypt and obtain the category distribution probability ciphertext <p i > and information entropy ciphertext <lp i >, then the i-th participant LC i The category distribution probability ciphertext <p i > and information entropy ciphertext <lp i >Upload to the federated learning aggregation server AS; 4) The federated learning aggregation server AS receives the category distribution probability ciphertext <p i > and information entropy ciphertext <lp i >After that, the encryption service provider CSP distributes the probability ciphertext based on the above categories <p i > and information entropy ciphertext <lp i >, calculate the JS divergence between each participant LC in the homomorphic environment and form a JS divergence matrix with the participant set as the row and column. Then the federated learning aggregation server AS divides the participant set into K cluster domains CD according to the result of the JS divergence matrix; 5) The federated learning aggregation server AS randomly selects 40-60% of the model parameters from the above initial federated learning model parameters, and constructs an index model I-model from the indexes of these model parameters. It then sends the initial federated learning model parameters and the index model I-Model together to the participating party LC; 6) Each participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model, and obtains the parameters of a local update model U-model as the unique feature information of the participant LC's local data; 7) The participant LC intersects the parameters of the local update model U-model with the parameters of the index model I-model to obtain the parameters of the sub-update model SU-model, and then uploads the parameters of the sub-update model SU-model to the federated learning aggregation server AS; 8) In each cluster domain CD, the federated learning aggregation server AS calculates the cosine similarity of the sub-update model SU-model of any two participants LC and constructs a cosine similarity matrix with the participant set as the row and column. Then, based on the results of the cosine similarity matrix, the participant set of the same cluster domain CD is divided into T task domains TD; 9) Federated learning is performed between the participant LC and the federated learning aggregation server AS based on the above cluster domain CD and task domain TD. The federated learning aggregation server AS adopts two different methods to perform parameter aggregation for different cluster domains CD and task domains TD to achieve knowledge sharing.

2. The clustering-based federated domain adaptation method according to claim 1, characterized in that: In step 2), the i-th participant LC i Calculate the category distribution probability p of local data i And the information entropy lp corresponding to the category distribution probability i The method is as follows: 201) LC of the i-th participant i Use the dictionary structure to count the types and number of samples of each category of local data and obtain the statistical results dic_p i , the expression is: dic_p i ={L1:num1,L2:num2,…,L N :numN} Among them, L N Indicates the type of participant; numN indicates the type is L N The number of category samples; According to the above statistical results dic_p i Calculate the category distribution probability p i , category distribution probability p i The expression is: Where M = num1 + num2 + ... + numN 202) LC of the i-th participant i According to the above category distribution probability p i Calculate the probability p of the category distribution i The corresponding information entropy lp i , information entropy lp i The calculation formula is: Where N represents the number of categories of local data of all participants; p(x j ) represents the category distribution probability of category j.

3. The clustering-based federated domain adaptation method according to claim 1, wherein: In step 4), the encryption service provider CSP distributes the probability ciphertext based on the above categories <p i > and information entropy ciphertext <lp i >, calculate the JS divergence between each participant LC in the homomorphic environment and form a JS divergence matrix with the participant set as the rows and columns. Then, the federated learning aggregation server AS divides the participant set into K cluster domains CD according to the results of the JS divergence matrix as follows: 401) Due to the probability of category distribution ciphertext <p i > and information entropy ciphertext <lp i >Cannot be directly substituted into the JS divergence calculation formula, but the category distribution probability ciphertext <p i > and information entropy ciphertext <lp i >In a homomorphic environment, the following equations are satisfied: <p i +q i >= <p i >+ i >、<(p i +q i )log(p i +q i )>=<(p i +q i )>log<(p i +q i )>, so the encryption service provider CSP transforms the JS divergence calculation formula, and then substitutes the above formulas into the transformed JS divergence calculation formula. In this way, the JS divergence between any two participants LC in the homomorphic environment can be obtained without leaking the data distribution information of either party. The transformed JS divergence calculation formula is:​ Among them, p and q represent the category distribution probability of the two participants' LC respectively; N represents the number of categories of all participants' local data; the category distribution satisfies 402) The federated learning aggregation server AS uses the JS divergence between any two participants LC to construct a JS divergence matrix with the participant sets as rows and columns; 403) The federated learning aggregation server AS divides the participant set into K cluster domains CD according to the result of the JS divergence matrix to reduce the degree of heterogeneity of the label distribution offset within the cluster domain. The division criteria of the cluster domain CD should satisfy the minimum sum of the JS divergences of the participant LCs in the same cluster domain CD and the maximum sum of the JS divergences of the participant LCs in different cluster domain CDs. The expression is: Where {c} represents the set of participants; c k Indicates cluster domain CD k ;c other Indicates that except cluster domain c k Any cluster domain other than JSD i,j Indicates the i-th participant LC i and the jth participant LC j JS divergence between .

4. The clustering-based federated domain adaptation method according to claim 1, wherein: In step 6), each participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model to obtain the parameters of a local update model U-model as follows: The participant LC uses local data to perform a single round of training on the parameters of the initial federated learning model to obtain the parameters of the trained model. It then calculates the incremental value between the trained model parameters and the initial federated learning model parameters and records the incremental value as the parameter of the local update model U-Model. The joint formula for one round of training and calculation of the incremental value is: Among them, θ k,U-model Indicates the kth participant LC k Local update model of θ; ini Indicates the initial federated learning model parameters issued by the federated learning aggregation server AS; n k Indicates the kth participant LC k The sample size; f(·) represents the prediction function; L(·) represents the loss function.

5. The clustering-based federated domain adaptation method according to claim 1, wherein: In step 7), the parameter θ of the sub-update model SU-model is k,SU-model The expression is: i k,SU-model =θ k,U-model ∩θ k,I-model Among them, θ k,U-model is the parameter of the local update model; θ k,I-model Parameters for the index model.

6. The clustering-based federated domain adaptation method according to claim 1, characterized in that: In step 8), in each cluster domain CD, the federated learning aggregation server AS calculates the cosine similarity of the parameters of the sub-update model SU-model of any two participants LC, and forms a cosine similarity matrix with the participant set as the row and column. Then, based on the result of the cosine similarity matrix, the participant set of the same cluster domain CD is divided into T task domains TD as follows: 801) The federated learning aggregation server AS first flattens the parameters of the sub-update model SU-model uploaded by the participant LC into a sub-update model parameter vector, and then calculates the cosine similarity between the sub-update model parameter vectors of the two participants LC. The calculation formula is: Among them, ω i Indicates the i-th participant LC i The sub-update model parameter vector; ω j Indicates the jth participant LC j The sub-update model parameter vector of 802) The federated learning aggregation server AS uses the cosine similarity between the sub-update model parameter vectors of any two participants LC to construct a cosine similarity matrix with the participant sets as rows and columns; 803) Based on the result of the above cosine similarity matrix, the participant set is divided into T task domains TD to reduce the degree of heterogeneity of feature distribution offset within the same cluster domain CD. The division criteria of task domain TD should satisfy the maximum sum of cosine similarities of the same task domain TD and the minimum sum of cosine similarities of different task domain TDs. The expression is: Among them, c k,t Denotes the kth cluster domain CD k The t-th task domain TD in t ;c k,other Denotes the kth cluster domain CD k Except for the t-th task domain TD t Any task domain other than Cos i,j Indicates the i-th participant LC i and the jth participant LC j The cosine similarity between the sub-updated model parameter vectors.

7. The clustering-based federated domain adaptation method according to claim 1, characterized in that: In step 9), the participant LC and the federated learning aggregation server AS perform federated learning based on the cluster domain CD and task domain TD. The federated learning aggregation server AS adopts two different methods to perform parameter aggregation for different cluster domains CD and task domains TD to achieve knowledge sharing as follows: 901) The participant LC uses the initial federated learning model parameters to perform multiple rounds of training on the participant's local data to obtain the parameters of the trained local model. The calculation formula for the parameters of the local model after the tth round of local training is as follows: in, Indicates the kth participant LC k Parameters of the local model after the tth round of training; n k Indicates the kth participant LC k The sample size; f(·) represents the prediction function; L(·) represents the loss function; 902) Each participant LC uploads the parameters of the local model after the last round of training to the federated learning aggregation server AS; 903) The federated learning aggregation server AS divides different participants into corresponding cluster domains and task domains according to the division results of the cluster domain CD and the task domain TD, and then performs the first parameter aggregation on the local model parameters of the participants belonging to the same cluster domain and task domain. The formula for the first parameter aggregation is: in, represents the parameters of the local model in the tth round, kth cluster domain, and tth task domain; {c} k,t represents the set of all participants in the kth cluster domain and the tth task domain; D i represents the sample size of the ith participant; D k,t represents the sum of all sample sizes in the k-th cluster domain and the t-th task domain; 904) The federated learning aggregation server AS performs a second parameter aggregation on the local model parameters of the participants belonging to the same cluster domain but not the same task domain according to the cluster domain division result. The aggregation method is to aggregate only the parameters of the first N-1 layers of neural network to achieve the purpose of multi-task learning. The second parameter aggregation and formula is: in, represents the kth cluster domain and the parameters of the first N-1 layers of neural network; |T k | represents the number of task domains in the kth cluster domain; represents the parameters of the local model of the task domain obtained by the first parameter aggregation in the k-th cluster domain, the t-th task domain, and the first N-1 layers; 905) The aggregation server AS sends the parameters of the different local models obtained by secondary aggregation to each participant LC according to the cluster domain CD and the task domain TD, thereby completing a round of global federated learning process.

Citation Information

Patent Citations

  • Training method of personalized model of distillation-based semi-supervised federated learning

    CN113205863A

  • Data set division method and system in federated learning scene

    WO2022121032A1