An efficient client screening privacy-preserving federated learning method for data heterogeneity
By combining gradient similarity clustering and an improved AVG-Shapley value filtering client with personalized differential privacy protection, the challenges of data heterogeneity and privacy protection in federated learning are addressed, enabling efficient and secure model training.
Patent Information
- Application Number
- CN202411945969.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2044-12-26
AI Technical Summary
Existing federated learning methods are susceptible to low-quality data when dealing with data heterogeneity and privacy protection, resulting in degraded model performance, high privacy budget consumption, high communication overhead, and client selection strategies failing to effectively balance model performance and personalized privacy requirements.
We design an efficient client selection mechanism that uses gradient similarity clustering to group clients and an improved AVG-Shapley value to evaluate their contribution. Combined with a personalized differential privacy protection strategy, we select high-quality clients to participate in training and dynamically adjust the privacy budget during training to reduce costs.
It improves model training efficiency and security, reduces privacy budget consumption and communication overhead, and ensures that the model converges quickly and maintains high accuracy in heterogeneous data environments.
Smart Images

Figure CN119830347B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of computer science and information technology, and specifically relates to a high-efficiency client screening privacy protection federated learning method for data heterogeneity. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, data-driven machine learning models have been widely applied in medical, financial and smart city fields. However, in practical applications, data is usually distributed among different devices or organizations, and direct sharing of original data becomes infeasible due to privacy protection and data security requirements. Federated learning, as a distributed machine learning framework, achieves collaborative training of global models without direct transmission of data by sinking model training to clients, effectively solving the problem of data privacy. However, federated learning still faces many challenges in practical applications.
[0003] Firstly, due to the significant differences in data distribution and quality among different clients (i.e. data heterogeneity), traditional federated learning methods are easily affected by low-quality or unbalanced data, leading to decreased model performance or slower convergence speed. Secondly, in order to protect data privacy, federated learning usually adopts differential privacy technology to inject noise during parameter transmission. However, existing differential privacy methods have the problems of large privacy budget consumption and high communication overhead in practical applications, limiting their application in resource-constrained environments. In addition, how to balance model performance and client individualized privacy requirements is also a major challenge in current federated learning research.
[0004] Some existing client selection methods often use a unified client selection criterion, i.e., selecting clients with large local data sets. This criterion often leads to fixed client selection. These frequently selected clients inject a large amount of noise into model parameters, which adversely affects model performance. Therefore, we need to consider privacy in the selection of clients. The paper "Chen Y, Xu W, Wu X, et al. Personalized Local Differentially Private Federated Learning with Adaptive Client Sampling [C] / / ICASSP 2024-2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2024: 6600-6604." proposes an adaptive client sampling algorithm that selects clients by optimizing the client sampling probability. However, when allocating privacy budgets among different clients, they do not consider the impact of changes in client privacy requirements, but instead choose a random distribution. The paper "Li Q, Li X, Zhou L, et al. Adafl: Adaptive client selection and dynamic contribution evaluation for efficient federated learning [C] / / ICASSP 2024-2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2024: 6645-6649." proposes an adaptive client selection method that selects clients for local training based on their contribution values. In addition, the number of participating clients gradually increases as the communication round increases. This scheme ignores the adverse effects of adding personalized differential privacy in the client selection strategy, and the increase in the number of clients can lead to an increase in the noise injected into the model, resulting in a decrease in model performance. SUMMARY
[0005] To solve the above problems, the application provides a high-efficiency client screening privacy protection federated learning method for data heterogeneity, designs an efficient client screening mechanism, and combines an individualized differential privacy protection strategy, so that the participation of clients with high data quality in model training can be improved, the consumption of privacy budget and communication overhead can be reduced while ensuring strong privacy protection, and the overall efficiency and security of federated learning are improved, which is of great significance for the wide application of federated learning in practical scenarios.
[0006] In order to achieve the above purpose, the application is realized by the following technical scheme:
[0007] The application is a high-efficiency client screening privacy protection federated learning method for data heterogeneity, and the proposed federated learning framework mainly consists of two parts: one is a client C k (k=1,2,…,N), each client has its own data set D k (k=1,2,…,N), and the local data of each client is heterogeneous, that is, their data label distribution is inconsistent, some clients have more label quantity, and some have less. The second is a server S, which cooperates with N clients to complete the model training of federated learning.
[0008] The federated learning method specifically includes the following steps:
[0009] Step 1, initialization phase: the server S generates a federated learning task, initializes the global model parameters ω 0 of the 0th round, and sends the global model parameters ω 0 of the 0th round to the candidate client set TS participating in the next round of training, and allocates privacy budget to the client;
[0010] Step 2, client screening phase: selecting the best client to join the candidate client set TS for training, specifically including the following steps:
[0011] Step 2-1, calculate and store the gradient of all clients, and cluster and group all clients to obtain a grouping set {G1, G2, …, G n +;
[0012] Step 2-2, select the best client in each group to join the candidate client set TS for training according to the contribution value AVG-Shapley value;
[0013] Step 2-3, a privacy budget allocation strategy is adopted to provide privacy protection;
[0014] Step 3, local training phase: the client trains based on the local data set D i and the global model parameters ω to generate a local model parameter Local model parameters are sent to the server S. Noise is injected, and local model parameters are sent to the server S.
[0015] Step 4, model aggregation and parameter distribution phase: the server S performs mean aggregation on the received local model parameters Step 4, model aggregation and parameter distribution phase: the server S performs mean aggregation on the received local model parameters
[0016]
[0017] The aggregated model parameters ω t are sent to the client as the global model parameters ω of the next round for the next round of training.
[0018] Step 5, repeat steps 2-4 until the maximum training round or the global model parameters ω t converge, the maximum training round T = 50, and t < T.
[0019] Further improvement of the application is that in step 2-2, the best client in each group is selected according to the contribution value AVG-Shapley value to form a candidate client set TS for training, specifically: all clients in the grouping set {G1, G2, …, G n + are sorted in descending order according to the contribution value AVG-Shapley value, and the client with the highest contribution value AVG-Shapley value is selected to form a candidate client set TS for training.
[0020] Further improvement of the application is that in step 2-3, a total consumption privacy budget set E is defined, E = {E1, E2, …, E N , which stores the total privacy budget consumed by each client in the entire training process, and the privacy budget allocation strategy includes the following steps:
[0021] Step 2-3-1, the server S uses a total consumption privacy budget set E to calculate the total privacy budget consumed by each client in the federated learning iteration, and also sets a privacy budget upper bound ∈ max and a privacy budget lower bound ∈ min .
[0022] Step 2-3-2, for the client C i∈TS , compare its total consumption privacy budget E i with the privacy budget upper bound ∈ max , if E i < ∈ max , the client C i still participates in training.
[0023] Step 2-3-3, if E i ≥ ∈max and ∈ i ≤ ∈ min , the client C i exits the training candidate client set TS;
[0024] Step 2-3-4, if E i ≥ ∈ max and ∈ i > ∈ min , the privacy budget ∈ i of the client is reduced by ∈0, and ∈0 is set by the client, wherein 0 < ∈0 < 5;
[0025] Step 2-3-5, if the originally screened client in each group no longer participates in training, the second order client is added to the training candidate client set TS to supplement the client participating in training.
[0026] Further improvement of the application is that in step 3, the local training stage specifically comprises the following steps:
[0027] Step 3-1, each client C i∈TS in the candidate client set TS receives the global model parameter ω from the server S, and performs model training based on the local data set D i and the global model parameter ω;
[0028] Step 3-2, after the local model training is completed, noise is injected based on the allocated privacy budget, and the model after injecting the noise is sent to the server S;
[0029] Step 3-3, after the server S receives the model after injecting the noise, the contribution level of each client to the model training compared with the last round is calculated, and the contribution level is calculated using AVG-Shapley.
[0030] Further improvement of the application is that in step 3-3, AVG-Shapley refers to using the mean of the loss function of all clients after training in the last round instead of the global loss function in the last round, and the contribution value φ i-AVG calculated by using the AVG-Shapley method is:
[0031]
[0032] Wherein, |TS| represents the number of clients in the candidate client set TS, f(W S∪{i+ ) represents the loss function after the client i participates in training, and f(W S∈TS) represents the loss function of each client in the candidate client set TS after the last round of training, and the server S stores the average loss function of all clients in the candidate client set TS after the last round of training, and uses the average loss function of all clients after the last round of training as the global loss function after the last round of training, and the client i calculates the marginal contribution value of the global model by using the loss function obtained after the self-training and the global loss function, and thereafter, the server S can sort the clients according to the marginal contribution value of each client in the next round of client selection stage, so as to select the clients participating in the next round of training.
[0033] Further improvement of the application is that the step 3-1 is to calculate the marginal contribution value of each client C i∈TS After receiving the global model parameter ω from the server S, the client C i performs model training based on the local data set D i∈TS and the global model parameter ω, in the t-th round of training, the client C i updates the global model parameter ω based on the local data set D (t-1) and the global model parameter ω updated in the t-1th round (t-1) , and the specific steps are as follows:
[0034] After receiving the global model parameter ω from the server S, the client C i∈TS performs model training based on the local data set D i and the global model parameter ω updated in the t-1th round (t-1) , and the specific steps are as follows: i t (ω (t-1) , D i ), and the gradient is obtained by deriving the global model parameter ω (t-1) updated in the t-1th round, and the formula is:
[0035]
[0036] Based on the calculated gradient , the global model parameter ω updated in the t-1th round is updated by using the stochastic gradient descent algorithm SGD, and the specific formula is: (t-1)
[0037]
[0038] Wherein, η is the learning rate.
[0039] A further improvement of the present invention is that: step 3-2 involves injecting noise based on the allocated privacy budget after local training is completed, and then sending the noise-injected model to the server S and client C. i∈TS After local training is completed, the local model parameters for round t are obtained. Generate Gaussian noise N(μ,σ) that follows a normal distribution. 2 ), to local model parameters Inject Gaussian noise N(μ,σ) 2 The client C sends the noisy local model parameters to the server S. Specifically, in the t-th round of training, the client C... i∈TS Based on the set privacy budget ∈ and failure probability δ, generate Gaussian noise N(μ,σ) that follows a normal distribution. 2 ), where μ = 0, Δf is the sensitivity, defined as the maximum magnitude by which a single data point changes the function f, and then the local model parameters are adjusted. Inject Gaussian noise N(0,σ) 2 ):
[0040]
[0041] The parameters of the noisy local model Send to server S.
[0042] A further improvement of the present invention is that, in step 3-3, the Shapley Value defines the contribution value φ of client i. i The calculation formula is as follows:
[0043]
[0044] Where N represents N participants, v represents the payoff function, and for any subset S of N, the function v(S) represents the total payoff resulting from the cooperation of the participants in that subset. The last two terms of the summation in the formula... Let represent the combination weight, represent the probability of subset S appearing in all possible permutations, and v(S∪{i+)-v(S)- represent the marginal contribution of participant i to subset S.
[0045] Using a loss function to represent the profit function, the Shapley Value calculation formula is expressed as:
[0046]
[0047] Where, Δf(W)=f(W) S∪{i+ )-f(W S );
[0048] The above formula can be expressed using an approximate algorithm to reduce the time complexity as follows:
[0049]
[0050] where f(W S ) represents the loss function after training without the participation of client i, f(W S∪{i+ ) represents the loss function after training with the participation of client i, and is assigned a weight represents the marginal contribution value of client i.
[0051] A further improvement of the present application is that the initialization phase of step 1 mainly includes the following steps:
[0052] Step 1-1: The server S generates a federated learning task and initializes the global model parameters ω 0 of the 0th round, and prepares to send the global model parameters ω 0 of the 0th round to the candidate client set TS participating in the next round of training;
[0053] Step 1-2: Assign different privacy budgets to each client, and the assignment method is the proportion of its local data set to the total data amount, and the privacy budget of client i is i The calculation formula is as follows:
[0054]
[0055] where |D i | is the sample number of the local data set of client i.
[0056] A further improvement of the present application is that the step 2-1 calculates and stores the gradients of all clients, and all clients are clustered and grouped according to the generated gradient similarity matrix, which specifically includes the following steps:
[0057] Step 2-1-1, each client in the candidate client set TS stores the gradient g (t-1) obtained by the current training after the completion of the t-1th round of training to form a gradient set gList, gList=(g1, g2, …, g N ), after the t-1th round of training, client (C1, …, C i , …, C N ) ∈ TS (t-1) ;
[0058] Step 2-1-2, the gradient set gList stores the gradient of each client, and for the gradient g i of client i and the gradient g j of client j, the cosine similarity is calculated, that is:
[0059]
[0060] Step 2-1-3, fill the calculated cosine similarity cos(g i ,g j ) into the gradient similarity matrix, calculate the cosine similarity between all clients, and fill the gradient similarity matrix V t In the client screening stage of the tth round, the server S generates a gradient similarity matrix V t :
[0061]
[0062] Wherein, V t ,i-,j- is the gradient similarity between client i and client j, V t ,i-,j- = cos(g i ,g j ), the closer to 1, the more similar the data distribution between them, according to the preset threshold alpha, when V t ,i-,j-> alpha, the client i and the client j are clustered into a class and divided into a group, after clustering and grouping all clients, a grouping set {G1, G2, …, G n + is obtained, for any grouping, any client i and client j satisfy V t ,i-,j-> alpha.
[0063] The beneficial effects of the application are:
[0064] The application designs a client screening method, which combines gradient similarity to cluster and group clients, and evaluates the contribution of clients to model training according to an improved Shapley Value calculation method AVG-Shapley, so as to screen out the optimal client for training, which can reduce more communication overhead.
[0065] The application provides personalized differential privacy protection for clients, and reallocates privacy budget during training to enhance the security of privacy protection, which can save a large amount of privacy budget.
[0066] The application can screen out clients with high data quality for training every round, and provide strong privacy protection for clients and model parameters. Compared with the existing framework, the framework can save a large amount of privacy budget, reduce more communication overhead, realize efficient training of the model, and the convergence speed of the model is faster. BRIEF DESCRIPTION OF DRAWINGS
[0067] Figure 1A flowchart of the high-efficiency client screening privacy protection federated learning framework for data heterogeneity proposed by the present application.
[0068] Figure 2 A flowchart of the high-efficiency client screening privacy protection federated learning framework for data heterogeneity proposed by the present application.
[0069] Figure 3 A comparison diagram of the accuracy rate of the present application and the existing OptimalQ method and AdaFL method.
[0070] Figure 4 A comparison diagram of the total privacy budget consumed by the present application and the existing OptimalQ method and AdaFL method.
[0071] Figure 5 A comparison diagram of the communication overhead consumed by the present application and the existing OptimalQ method and AdaFL method.
[0072] Figure 6 A comparison diagram of the communication overhead consumed by the present application and the existing OptimalQ method and AdaFL method. DETAILED DESCRIPTION
[0073] Embodiments of the present application will be described below with reference to drawings. Many practical details will be described in the following description for the purpose of clear illustration. However, it should be understood that these practical details should not be used to limit the present application. That is, in some embodiments of the present application, these practical details are not necessary.
[0074] Figure 1 The federated learning framework flowchart of the present application is shown, in which the system architecture is mainly composed of two parts of client and server. The client C k (k = 1, 2, …, N), each client has its own data set D k (k = 1, 2, …, N), and the local data of each client is heterogeneous, i.e. their data label distribution is inconsistent, some clients have more label quantity, and some have less. The server S cooperates with N clients to complete the model training of federated learning.
[0075] The high-efficiency client screening privacy protection federated learning method for data heterogeneity described in the present application mainly includes four stages, which are initialization stage, client screening stage, local training stage, model aggregation and parameter distribution stage. Except for the initialization stage which needs to be executed only once, the other three stages need to be executed in a loop until the model converges.
[0076] The initialization stage includes the following steps:
[0077] Step 1-1: The server S generates a federated learning task and initializes the global model parameters ω of the 0th round 0 , prepares to send ω 0 to the candidate client set TS participating in the next round of training;
[0078] Step 1-2: In order to meet the privacy requirements of client individualization, a different privacy budget is allocated to each client, and the allocation method is the proportion of its local data set to the total data amount, and the privacy budget of client i ∈ i The calculation formula is as follows:
[0079]
[0080] Where |D i | is the sample number of the local data set of client i.
[0081] The client screening stage includes the following steps:
[0082] Step 2-1: All clients are clustered and grouped according to the generated gradient similarity matrix;
[0083] Step 2-1-1: Each client in the candidate client set TS stores the gradient g (t-1) obtained after the t-1th round of training, and gList stores the gradient of each client, i.e. gList=(g1, g2, …, g N ), after the t-1th round of training, Clients (C1, …, C i , …, C N ) ∈ TS (t-1) . The gradient similarity matrix V t is generated as follows:
[0084] Step 2-1-2: gList stores the gradient of each client, and for the gradients g i and g j of clients i and j, the cosine similarity is calculated, i.e.:
[0085]
[0086] Step 2-1-3: Fill the calculated cosine similarity into the gradient similarity matrix, i.e. V t , i-,j- = cos(g i , g j ). Calculate the cosine similarity between all clients, fill the gradient similarity matrix V t , and in the client screening stage of the tth round, the server S generates the gradient similarity matrix V t from the gradient set gList:
[0087]
[0088] where V t ,i-,j- represents the gradient similarity between client i and client j. The closer to 1, the more similar the data distribution between them. According to the threshold α set in advance, when V t ,i-,j-> α, client i and j are clustered into a class and divided into a group. After clustering and grouping all clients, the grouped result {G1, G2, …, G n + is obtained. For any group, any client i and j in the group satisfy V t ,i-,j-> α.
[0089] Step 2-2: Select the best client in each group according to the AVG-Shapley value to join the training candidate client set TS; specifically: for any group, sort all clients in the group according to the AVG-Shapley value in descending order, and select the client with the highest AVG-Shapley value to join the training candidate client set TS.
[0090] Step 2-3: Use a privacy budget allocation strategy to provide stronger privacy protection. The privacy budget allocation strategy is specifically: the server S sets a privacy budget upper bound ∈ max in advance, and each round of training client consumes a certain amount of privacy budget to provide differential privacy protection for model parameters. Count the privacy budget consumed by each round of client, and when the privacy budget consumed exceeds the privacy budget upper bound ∈ max , make its own privacy budget ∈ i drop by a certain amplitude, which makes the privacy protection degree stronger, and the client participating in the training is less likely to leak data privacy. Define a total consumed privacy budget set E, E = {E1, E2, …, E N +, which stores the total privacy budget consumed by each client in the entire training process, specifically including the following steps:
[0091] Step 2-3-1: The server uses a total consumed privacy budget set E to calculate the total privacy budget consumed by each client in federated learning iteration, and also sets a privacy budget upper bound ∈ max and a privacy budget lower bound ∈ min . The allocation of privacy budget is as follows:
[0092] Step 2-3-2: For the client C i∈TS participating in training, compare its total consumed privacy budget E i with the privacy budget upper bound ∈ max , if E i<∈ max Client C i He is still participating in training.
[0093] Step 2-3-3: If E i ≥∈ max and ∈ i ≤∈ min Client C i Exit the training candidate client set TS.
[0094] Steps 2-3-4: If E i ≥∈ max and ∈ i >∈ min This allows the client's privacy budget to be ∈ i The decrease is a certain amount ∈0, where ∈0 is set by the server, and 0 < ∈0 < 5;
[0095] Steps 2-3-5: If the clients originally selected in each group no longer participate in training, add the second-ranked client to the training candidate client set TS to supplement enough clients to participate in training.
[0096] The local training phase includes the following steps:
[0097] Step 3-1: For each client C in the candidate client set TS i∈TS After receiving the global model parameters ω from server S, based on its local dataset D i The model is trained using global model parameters ω. In the t-th training round, the client C... i∈TS Based on local dataset D i and the global model parameters ω after t-1 round update (t-1) Calculate the local loss value and its gradient, and update the global model parameters ω using the SGD stochastic gradient descent algorithm. (t-1) .
[0098] The specific steps are as follows:
[0099] In the t-th round of training, client C i∈TS Based on local dataset D i and the global model parameters ω after t-1 round update (t-1) Calculate the local loss value f i t (ω (t-1) D i ), for global model parameters ω (t-1) The gradient is obtained by differentiation, and the formula is:
[0100]
[0101] Based on the calculated gradient Update the global model parameters ω by using the stochastic gradient descent algorithm SGD (t-1) The specific formula is:
[0102]
[0103] Where η is the learning rate.
[0104] Step 3-2: After local training is completed, inject noise based on the allocated privacy budget, and send the model after injecting noise to the server S. The client C i∈TS After local training is completed, obtain the local model parameters of the t-th round Generate Gaussian noise N(μ,σ 2 ) that obeys a normal distribution, and inject the Gaussian noise N(μ,σ 2 ) into the local model parameters Send the noisy local model parameters to the server S. The specific steps are as follows:
[0105] In the t-th round of training, the client C i∈TS According to the set privacy budget ∈ and failure probability δ, generate Gaussian noise N(μ,σ 2 ) that obeys a normal distribution, where μ=0, Δf is the sensitivity, defined as the maximum magnitude that a single data can change the function f. Then inject Gaussian noise N(0,σ 2 ) into the global model parameters :
[0106]
[0107] Send the noisy local model parameters to the server S.
[0108] Step 3-3: After the server receives the model parameters, calculate the contribution level of each client to the model training compared to the previous round. The contribution level is calculated using the approximate calculation method AVG-Shapley of Shapley Value. The contribution value φ i of the client i is defined as:
[0109]
[0110] In this formula, N represents N participants, v represents the revenue function, and for any subset S of N, the function v(S) represents the total revenue brought by the cooperation of the participants in the subset. The last two items of the summation symbol in the formula represent the combination weight, which represents the probability of the appearance of the subset S in all possible arrangements, and the marginal contribution of participant i to the subset S.
[0111] The Shapley Value formula can be expressed as:
[0112]
[0113] Where, Δf(W) = f(W S∪{i+ )-f(W S ).
[0114] The above formula can be expressed using an approximation algorithm to reduce time complexity:
[0115]
[0116] Where f(W S ) represents the loss function after client i does not participate in training, f(W S∪{i+ ) represents the loss function after client i participates in training, and the weight represents the marginal contribution value of client i.
[0117] In order to more accurately reflect the contribution of each client participating in training to the global model, we improved the Shapley Value method, using the average of the loss function of all clients after training in the last round instead of the global loss function in the last round, that is, AVG-Shapley. The contribution value φ i-AVG calculated using the AVG-Shapley method is:
[0118]
[0119] Where |TS| represents the number of clients in the candidate client set TS, f(W S∪{i+ ) represents the loss function after client i participates in training, and f(W S∈TS ) represents the loss function after each client in the candidate client set TS in the last round participates in training. After client i completes training in each round, the loss function after client i participates in training is obtained, while the server stores the average of the loss function after all clients in the candidate client set in the last round participate in training, using the average as the global loss function after the last round of training. Client i calculates the marginal contribution value to the global model using the loss function obtained after its own training and the global loss function. Thereafter, the server can sort the clients according to the marginal contribution value of each client in the next round of client selection stage, so as to select the clients participating in training in the next round.
[0120] The model aggregation and parameter distribution stage includes the following steps:
[0121] Step 4-1: The server performs mean aggregation on the received t-th round model parameters, and the specific formula is as follows:
[0122]
[0123] Step 4-2: The aggregated model parameters ω t are issued to the client as the new round of global model parameters for the next round of training. This goes back and forth until the maximum training round T is reached or the global model parameters ω t converge. The maximum training round T is 50, and t < T.
[0124] In order to verify the present application, the present application is tested.
[0125] The data set used by the present application is the MNIST data set, a standard data set widely used in deep learning, mainly used for handwritten digit classification tasks. It contains 10 classes of grayscale images, each corresponding to a digit. Each image pixel is 28*28. The data set has 60,000 training images and 10,000 test images.
[0126] For the local training model architecture, the present application uses CNN, a neural network specialized in image processing, which has strong feature extraction and pattern recognition capabilities. In the local training phase, the present application uses the stochastic gradient descent algorithm SGD to update the model parameters. In addition, the present application sets the number of samples each user has to be 2000, the learning rate lr to be 0.01, the learning rate decay γ to be 0.998, the number of iterations T to be 50, the local iteration number to be 30, the batch size BatchSize to be 50, the threshold α to be 0.4, the initial privacy budget ∈ to be allocated according to the amount of client local data, and the subsequent privacy budget allocation strategy to be re-allocated, the upper bound of the privacy budget ∈ max is 30, the lower bound of the privacy budget ∈ min is 3, and the drop rate ∈0 is 1. The Dirichlet distribution is used to divide the data set, where the α parameter is used to control the degree of heterogeneity. The smaller the α, the deeper the degree of heterogeneity, and the more uneven the label distribution. α is set to 0.5.
[0127] The present application framework (OurScheme) is compared with two existing federated learning client selection methods, OptimalQ and AdaFL. OptimalQ is an adaptive sampling algorithm that calculates the sampling probability of the client through an optimization algorithm to select the client. AdaFL is an adaptive client selection method that samples the client for local training according to the contribution value of the client. The experimental results are as follows Figures 3-6The experimental results show that the three schemes can effectively screen the clients for training, and the test accuracy is more than 85%. Compared with the other two schemes, the scheme of the application converges faster and achieves higher model accuracy in the first 20 rounds. The accuracy of AdaFL is the highest, but the privacy budget and communication overhead consumed are much higher than those of the scheme of the application. The accuracy of OptimalQ is lower than that of the other two schemes, and the privacy budget and communication overhead consumed are the highest. The scheme of the application saves about 48% of the privacy budget and about 37% of the communication overhead. Figure 6 It can be found that the scheme of the application achieves higher model accuracy under the same communication overhead.
[0128] The efficient client screening privacy protection federated learning framework for data heterogeneity proposed in the application can effectively cope with the data heterogeneous environment according to the gradient similarity matrix clustering grouping, can screen the clients with high data quality and representative data for training, greatly improves the convergence of the model, and ensures the diversity of the training data, so that the model maintains a high accuracy. The client screening strategy can effectively screen part of the clients for training, rather than all the clients, which greatly reduces the communication overhead. Compared with other methods, the application can also maintain a high model accuracy while maintaining a low communication overhead; and the privacy budget allocation strategy provides personalized differential privacy protection for the clients, and continuously adjusts the privacy budget of the clients during the training process, which can further improve the noise scale of the clients and improve the privacy, and the adjustment and redistribution of the privacy budget can save a large amount of privacy budget. The application considers the data heterogeneity and the data privacy of the clients, proposes a targeted scheme to solve the existing problems, and is a trade-off between the two; at the same time, the model maintains a high model accuracy after training, and the usability of the model is greatly improved.
[0129] The above description is only an embodiment of the application and is not intended to limit the application. Those skilled in the art can make various modifications and changes to the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the application shall be included in the scope of the claims of the application.
Claims
1. An efficient client screening privacy-preserving federated learning method for data heterogeneity, characterized in that: A federated learning framework applying the federated learning method mainly comprises a plurality of clients C k (k=1, 2, …, N) and a server S, each client has its own data set D k (k=1, 2, …, N) and the local data of each client is heterogeneous, specifically, the federated learning method specifically comprises the following steps: Step 1, initialization phase: the server S generates a federated learning task, initializes the global model parameters ω of the 0th round 0 sends the global model parameters ω of the 0th round to the candidate client set TS participating in training of the next round, and allocates a privacy budget to the client; 0 sends the global model parameters ω of the 0th round to the candidate client set TS participating in training of the next round, and allocates a privacy budget to the client; Step 2, client screening stage: select the best client, join the candidate client set TS for training, which includes the following steps: Step 2-1, compute and store the gradient of all clients, all clients are clustered into groups to get a set of groups {G1, G2, …, G n}; Step 2-2, select the best client in each group according to the contribution value AVG-Shapley value to join the candidate client set TS for training; Step 2-3, use a privacy budget allocation strategy to provide privacy protection; Step 3, local training phase: the client i trains based on the local dataset D i and the global model parameters ω, to generate the local model parameters injects noise into the local model parameters and sends the local model parameters to the server S; Step 4, model aggregation and parameter distribution stage: the server S performs mean value aggregation on the received local model parameters performs mean value aggregation: specifically, The model parameters ω after the aggregation are updated as follows: t The updated model parameters ω are sent to the clients for the next round of training. Step 5, repeat Step 2-Step 4 until the maximum training rounds or global model parameters ω t converge, maximum training rounds T = 50, t < T, wherein, In step 3, the local training stage specifically includes the following steps: Step 3-1, for each client C in the candidate client set TS i∈TS After receiving the global model parameters ω from the server S, based on its local data set D i and the global model parameters ω, the model training is carried out, in the tth round of training, the client C i∈TS based on the local data set D i and the global model parameters ω updated in the t-1th round (t-1) calculate the local loss value and its gradient, update the global model parameters ω by the SGD stochastic gradient descent algorithm (t-1) The specific steps are as follows: In the t-th round of training, the client C i∈TS Based on the local data set D i And the global model parameter ω (t-1) updated in the t-1th round i Calculate the local loss value f t (ω (t-1) , D i ), derive the gradient of the global model parameter ω (t-1) updated in the t-1th round, the formula is: based on the computed gradient updating the global model parameters ω using the stochastic gradient descent algorithm SGD (t-1) The specific formula is: Where η is the learning rate; Step 3-2, after the local training is completed, noise is injected based on the allocated privacy budget, and the model after the noise is injected is sent to the server S, and the client C i∈TS After the local training is completed, the local model parameters of the t-th round are obtained Gaussian noise N(μ,σ 2 ) conforming to a normal distribution is generated, and the local model parameters Gaussian noise N(μ,σ 2 ) is injected, and the local model parameters after the noise is added are sent to the server S, specifically: in the t-th round of training, the client C i∈TS According to the set privacy budget ∈ and failure probability δ, Gaussian noise N(μ,σ 2 ) conforming to a normal distribution is generated, wherein μ=0, Δf is the sensitivity, defined as the maximum amplitude of a single data change function f, and then Gaussian noise N(0,σ ) is injected to the local model parameters 2 ): the local model parameters after adding noise to the server S; Step 3-3, after the server S receives the model injected with noise, calculate the contribution level of each client to the model training compared to the last round, and the contribution level is calculated using AVG-Shapley, In the step 3-3, the Shapley Value defines the contribution value φ of the client i i The calculation formula is: where N denotes the N participants, v denotes the payoff function, for any subset S of N, v(S) denotes the total payoff from the cooperation of the participants in S, and the last two terms in the summation, denotes the combination weight, denotes the probability of occurrence of the subset S in all possible permutations, and [v(S∪{i})-v(S)] denotes the marginal contribution of participant i to the subset S. Using the loss function to represent the revenue function, the Shapley Value calculation formula is expressed as: where Δf(W) = f(W S∪{i} ) - f(W S ); Using an approximation algorithm to reduce the time complexity, the above formula can be expressed as: where f(W S ) denotes the loss function after the training without the participation of the client i, f(W S∪{i} ) denotes the loss function after the training with the participation of the client i, and w denotes the marginal contribution value of the client i. In step 3, AVG-Shapley refers to using the mean of the loss functions of all clients after training in the last round instead of the global loss function in the last round, and the contribution value φ calculated in the AVG-Shapley manner i-AVG is: wherein |TS| represents the number of clients in the candidate client set TS, f(W S∪{i} ) represents the loss function after client i participates in training, f(W S∈TS ) represents the loss function after each client in the candidate client set TS of the last round participates in training, after client i completes training in each round, the loss function after client i participates in training is obtained, and the server S stores the average of the loss functions after all clients in the candidate client set of the last round participate in training, uses the average of the loss functions after all clients participate in training as the global loss function after the last round of training, and calculates the marginal contribution value of the global model of client i using the loss function obtained after the client i trains itself and the global loss function. Thereafter, the server S can sort the clients according to the marginal contribution value of each client in the next round of client selection stage, so as to select the clients participating in training in the next round.
2. The method of claim 1, wherein the method is characterized in that: In step 2-2, the best client set TS of candidate clients joining the training is selected according to the contribution value AVG-Shapley value in each group, specifically: all clients in the group set {G1, G2, …, G n} are sorted in descending order according to the contribution value AVG-Shapley value, and the client with the highest contribution value AVG-Shapley value is selected to join the candidate client set TS of training.
3. The method of claim 2, wherein: In step 2-3, a total consumed privacy budget set E is defined, E = {E1, E2, …, E N}, which stores the total privacy budget consumed by each client during the entire training process, and the privacy budget allocation strategy specifically includes the following steps: Step 2-3-1, the server S calculates the total privacy budget consumed by each client in the federated learning iteration using a total consumption privacy budget set E, while also setting a privacy budget upper bound ∈ max and a privacy budget lower bound ∈ min ; Step 2-3-2, for the client C participating in training i∈TS compare its total consumed privacy budget E i with the privacy budget upper bound ∈ max If E i < ∈ max , the client C i still participates in training; Step 2 - 3 - 3, if E i ≥ ∈ max and ∈ i ≤ ∈ min , the client C i exit the training candidate client set TS; Step 2-3-4, if E i ≥∈ max and ∈ i >∈ min decrease the privacy budget ∈ i of the client by ∈0, which is set by the client, where 0<∈0<5; Step 2-3-5, if the originally selected client in each group no longer participates in training, the second-ranked client is added to the training candidate client set TS to supplement the client participating in training.
4. The method of claim 1, wherein: The initialization stage of step 1 mainly includes the following steps: Step 1-1: The server S generates a federated learning task and initializes the global model parameters ω 0 for the 0th round, and prepares to send the global model parameters ω 0 for the 0th round to the candidate client set TS participating in the training of the next round; Step 1-2: Assign different privacy budgets to each client, which is the proportion of its local dataset in the total data. The privacy budget of client i is i The calculation formula is as follows: where |D i | is the number of samples of the local dataset of client i.
5. The method of claim 1, wherein: The step 2-1 calculates and stores the gradient of all clients, and all clients are clustered and grouped according to the generated gradient similarity matrix, which includes the following steps: Step 2-1-1, each client in the candidate client set TS, after the completion of the t-1th round of training, will the gradient g obtained in this round of training (t-1) to form a gradient set gList, gList = (g1, g2, …, g N ), after the t-1th round of training, client (C1, …, C i , …, C N ) ∈ TS (t-1) ; Step 2-1-2, the gradient set gList stores the gradient of each client, for the gradient g of client i and client j i With g j , the cosine similarity is calculated, that is: Step 2-1-3, fill the calculated cosine similarity cos(g i ,g j ) into the gradient similarity matrix, calculate the cosine similarity between all clients, and fill the gradient similarity matrix V t , in the client screening stage of the t-th round, the server S generates the gradient similarity matrix V t : V t [i][j] is the gradient similarity between client i and client j, V t [i][j] = cos(g i , g j ), the closer to 1, the more similar the data distribution between them, according to the threshold α set in advance, when V t [i][j] > α, client i and client j are clustered into a class and divided into a group, after clustering and grouping all clients, a grouping set {G1, G2, …, G n} is obtained, for any grouping, any client i and client j satisfy V t [i][j] > α.
Citation Information
Patent Citations
Federated learning method of image analysis model based on heterogeneous CXR image with noise
CN116452495A
Federal contrast clustering learning method and system for non-independent identically distributed data
CN117808121A