A method for alleviating non-iid influence based on explainable federated learning
By introducing a validation set interpretability mechanism into federated learning, the learning capabilities of each category are evaluated and client parameters are adjusted, thus solving the problem of decreased model accuracy in Non-IID scenarios, improving model performance and reducing overhead.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
- Filing Date
- 2022-12-30
- Publication Date
- 2026-05-08
AI Technical Summary
In Non-IID scenarios, federated learning models suffer from decreased accuracy and slower convergence speed. Traditional methods may lead to slower convergence speed or increased communication and computational overhead.
A validation set interpretability mechanism is introduced to evaluate the learning ability of each category through structural similarity indicators, screen out clients with imbalanced data, and dynamically adjust their model parameters to mitigate the negative impact of data imbalance.
It effectively improves the performance of federated learning models in Non-IID scenarios, reduces communication and computational overhead, and enhances the transparency and security of the models.
Smart Images

Figure CN116070713B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence security, and specifically relates to an interpretable federated learning method to mitigate the impact of model performance degradation in Non-IID scenarios. Background Technology
[0002] Research indicates that with the continuous advancement of artificial intelligence technology, the quality and volume of data have become crucial factors restricting the development of AI models. However, traditional centralized machine learning, which directly collects data from various parties, leads to serious privacy and security issues. Therefore, federated learning addresses this critical problem by maintaining the dispersion of user data while collaboratively training a shared global machine learning model. However, as federated learning applications increase, the scenarios it addresses become increasingly complex. In real-world scenarios, each client has its own preferences, resulting in data with different characteristics. This can lead to reduced accuracy and slower convergence speed in federated learning models. Traditional solutions to the Non-IID problem in federated learning typically address two aspects: optimizing the weight differences among participating clients and optimizing client selection. However, optimizing client weight differences often leads to slower convergence speeds, while optimizing client selection incurs excessive communication and computational overhead.
[0003] As various artificial intelligence models begin to replace humans in decision-making, supporting the interpretation of model outputs is crucial. The initial goal of interpretability research is to improve model transparency by constructing interpretable models or designing interpretation methods, while simultaneously verifying and evaluating the reliability and security of model decision-making behavior and results, thus eliminating security risks in practical deployment applications. Therefore, this invention utilizes interpretability to address the problem of model accuracy degradation caused by Non-IID in federated learning scenarios in a more reasonable and interpretable way, making the proposed solution more practical and valuable. Summary of the Invention
[0004] To address the technical problems mentioned in the background section, this invention provides an interpretability-based federated learning method, which can effectively alleviate the accuracy degradation of federated learning models caused by Non-IID scenarios.
[0005] To achieve the above-mentioned technical objectives, the technical solution of the present invention is as follows:
[0006] A method for mitigating the impact of Non-IID (Data Imbalanced Influence) based on interpretable federated learning introduces a validation set interpretability mechanism, based on the impact of local client updates on the learning capabilities of the aggregated model across different categories. By characterizing the interpretability results of validation samples—that is, characterizing the impact of local clients on the global model's learning capabilities—the changes in the model's learning capabilities across different categories can be determined. The Structural Similarity Index (SSIM) is used to evaluate the representative interpretability results for each category, thereby inferring imbalanced clients. The parameters of these imbalanced clients are then adjusted iteratively to reduce the distance between the client parameters and the previously updated aggregated model parameters, thus mitigating the negative impact of data imbalance.
[0007] Furthermore, it includes the following steps:
[0008] (1) Constructing a Non-IID scenario: For the target dataset, using the Dirichlet distribution, assign different amounts of data with different labels to each client to construct a Non-IID scenario;
[0009] (2) Constructing a validation set: In the central server, one image is placed for each category as a validation set;
[0010] (3) Select clients for interpretability: score the clients based on the cosine similarity of the update directions aggregated in the previous round of local update direction, and select the top-k clients with lower scores to participate in interpretability; or cluster the clients based on the representative gradient of the clients, and select m clients from the c clusters to participate in interpretability.
[0011] (4) Screening clients with imbalanced data: By comparing the model of each client participating in the aggregation with the global model of the previous aggregation, the difference of the highlighted feature map after interpretability on the same validation set is calculated, and the similarity is calculated. If the change of various similarity values exceeds the set threshold, the client is considered to have imbalanced data.
[0012] (5) Dynamically adjust client model parameters: minimize the gradient distance between the unbalanced client model and the previous round of global aggregation model parameters, correct the client model parameters by the convergence of gradient distance, and flexibly adjust the number of iterations to minimize gradient based on the time of federated learning aggregation.
[0013] The beneficial effects of adopting the above technical solution are: (1) This is an interpretability-based method that alleviates the performance degradation of the model caused by Non-IID in the federated learning process. It can be clearly known which clients caused the performance degradation during the aggregation process, which helps us to better select clients for aggregation. (2) This method effectively improves the performance of the federated learning model in the Non-IID scenario. Under more severe data imbalance, it still has a good improvement compared to other methods. (3) It will not increase the communication and computational overhead of federated learning too much. Attached Figure Description
[0014] Figure 1 This is a flowchart of the method of the present invention;
[0015] Figure 2 This is a schematic diagram of a federated learning model based on interpretability. Detailed Implementation
[0016] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.
[0017] This invention designs a method based on interpretability-based federated learning to mitigate the impact of Non-IID. First, a Non-IID scenario is constructed for the target dataset. Then, a central server selects one image from each class of samples as a validation set. Next, trust scores and clustering are used to select clients for interpretability testing. By comparing each client model with the previous round of the global model, i.e., comparing the similarity of the highlighted feature maps after interpretability testing of the same sample, clients with imbalanced data are selected. Finally, for these imbalanced clients, the gradient distance between their parameters and the global model is dynamically minimized to mitigate the performance degradation problem of federated learning models in Non-IID scenarios.
[0018] The present invention discloses a method for mitigating the impact of Non-IID based on interpretable federated learning, comprising the following steps:
[0019] Step 1: Construct a Non-IID scenario: For the target dataset, use the Dirichlet distribution to assign different amounts of data with different labels to each client to construct a Non-IID scenario;
[0020] Step 2: Construct the validation set: In the central server, place one image for each category as the validation set;
[0021] Step 3: Select clients for interpretability: Use the cosine similarity between the client's local update direction and the update direction of the previous aggregation as a score, and select the top-k clients with the lowest scores to participate in interpretability; or cluster the clients according to their representative gradients, and select m clients from the c clusters to participate in interpretability.
[0022] Step 4: Filter clients with imbalanced data: By comparing the model of each client participating in the aggregation with the global model of the previous aggregation, the difference of the interpreted highlighted feature map of the same validation set is calculated, and the similarity is calculated. If the change in similarity of each category exceeds the set threshold, the client is considered to have imbalanced data.
[0023] Step 5: Dynamically adjust client model parameters: Minimize the gradient distance between the imbalanced client model and the previous round of global aggregation model, correct the parameters of the client model by the convergence of the gradient distance, and flexibly adjust the number of iterations to minimize the gradient based on the time of federated learning aggregation.
[0024] Furthermore, regarding the construction of the Non-IID scenario described in step 1, the specific steps are as follows:
[0025] Step 1.1: Using the Dirichlet distribution function with parameter alpha = 0.5, from the Dirichlet distribution function... Where α=(α1,α2,…,α) c ).α i Random sampling is performed from (where x is a random vector and α is the parameter of the probability distribution) to generate a category label distribution matrix, which represents the proportion of data occupied by each category for each client (and the types of categories are therefore different for each client).
[0026] Step 1.2: Based on the category label distribution matrix generated in the above steps, obtain the data proportion of different categories for each client, and then randomly sample and distribute the dataset according to the proportion to form the final Non-IID dataset (the number of categories and the number of samples for each client are different and follow a Dirichlet distribution).
[0027] Furthermore, regarding step 2, the specific steps for constructing the central server verification set are as follows:
[0028] Step 2.1: The central server collects data;
[0029] Step 2.2: Extract one image from each category of the collected data as a validation set element, and use the data set with one image extracted from each category as the central server validation set.
[0030] Furthermore, regarding step 3, selecting the client for interpretability, the specific steps are as follows:
[0031] Step 3.1: Use cosine similarity (measures the deviation between the client's local update direction and the previous aggregation update direction; client-side local updates with large deviations are considered to require interpretability testing to further determine whether the client's data is balanced) to select interpretable clients: calculate the cosine similarity between the client's local update direction and the update direction of the previous aggregation round (…). Where g i Let g0 and g0 represent the local update gradient and global gradient of the i-th client, respectively, and S i (representing the rating of the i-th client) is used as the rating;
[0032] Step 3.2: Sort the above ratings in ascending order, and select the top k clients with the lowest ratings (i.e., the top k clients with the lowest ratings) to participate in the subsequent interpretability operation;
[0033] Step 3.3: Alternatively, select interpretable clients using gradient similarity clustering: First, calculate the "representative gradient" (Grad) for each client. rep =p i -p0, where p i p0 and p1 are respectively the parameters updated locally by the i-th client and the parameters updated globally in the last model update.
[0034] Step 3.4: Based on the "representative gradient" calculated in the above steps (that is, the difference between the client's local updated parameters and the model parameters in the previous global update), the client is clustered into c classes (clusters) using hierarchical clustering (using the Ward method to divide classes (clusters) by measuring the distance between classes):
[0035] The "representative gradient" is input as the clustering data, and it is used to create the distance matrix. Assuming there are N clusters, the sum of squared residuals (ESS) within each cluster is 0. The ESS is calculated as follows:
[0036]
[0037] Calculate the ESS difference after merging every two clusters sequentially. Find the two clusters with the smallest difference in ESS after merging and merge them. The formula for calculating the ESS after merging each pair of clusters is as follows:
[0038]
[0039] Where x represents all points in the first two clusters after merging, μ C1∪C2 It is the center point (mean point) of the merged new cluster, D(x,μ) C1∪C2() represents the distance from each point x to the center point; repeat the above process until c clusters are formed;
[0040] Step 3.5: Randomly select one client from each of the c classes until the number of clients participating in the aggregation is m, and then perform the subsequent interpretability operation.
[0041] Furthermore, for step 4, which filters clients with imbalanced data, the specific steps are as follows:
[0042] Step 4.1: Input the validation set deployed on the central server into the previous aggregation model and the client model for interpretability operation in this round, respectively. Then, based on the classification results of the model, perform interpretability on the network layer that is most likely to leak privacy (which best reflects the model's feature learning ability), obtain the highlighted feature map and store it. Then, perform one-to-one similarity calculation on the highlighted feature maps of each category of the two models.
[0043] Step 4.2: Calculate the magnitude of the change in similarity of each category for the client performing the interpretability operation. If the magnitude of the change in similarity of each category exceeds the set threshold, the client is considered to have unbalanced data. These categories that exceed the set threshold are considered unbalanced categories, and these unbalanced categories and their corresponding client IDs are recorded for subsequent parameter correction. If the magnitude of the change in similarity of each category does not exceed the set threshold, the client enters the waiting stage for mean aggregation.
[0044] Furthermore, regarding step 5, dynamically adjusting the client-side model parameters, the specific steps are as follows:
[0045] Step 5.1: Select imbalanced client models, and then use the imbalanced validation set as input to calculate the gradient distance between the parameters of each sample in the validation set and the parameters of the imbalanced client models and the previous round of global aggregation models. in These are the gradients of the kth validation set sample generated by the local model and the gradient of the kth validation set sample generated by the previously aggregated global model, respectively. The distance between these gradients is summed and used as the iterative optimization objective.
[0046] Step 5.2: Optimize the gradient distance summation formula described above. The calculated gradient distance sum (total loss) is used to correct the offset parameters of the imbalanced client models, and the number of iterations to minimize the gradient is flexibly adjusted according to the time of federated learning aggregation. In the initial stage of federated learning, the number of iterations is adjusted to a small range. As the federated model training gradually stabilizes, the number of iterations is gradually adjusted to a larger range. The loss feedback is used to iteratively optimize the offset parameters of the imbalanced client models, reducing the adverse effects of imbalanced clients in the mean aggregation process. The adjusted clients then enter the mean aggregation stage.
[0047] Repeat steps 1-5 above until the aggregation model converges or the preset number of aggregations is reached.
[0048] Invention Results
[0049] This invention first conducted performance validation experiments on the MNIST, CIFAR-10, CIFAR-100, and CINIC-10 datasets. MNIST contains 10 categories (handwritten digits 0-9), including 60,000 training samples and 10,000 test samples. CIFAR-10 consists of 60,000 32×32 color images across 10 categories, including 50,000 training samples and 10,000 test samples. The CIFAR-100 dataset has 100 classes. Each class has 600 32×32 color images, with 500 used as the training set and 100 as the test set. CINIC-10 is an image classification dataset. This dataset contains a total of 270,000 images, 4.5 times the size of the CIFAR-10 dataset. It is built upon both ImageNet and CIFAR-10 datasets. The dataset was divided into three equal subsets (training, validation, and testing), each containing 90,000 images.
[0050] To evaluate the effectiveness of the method for mitigating the impact of Non-IID based on interpretable federated learning implemented in this invention, the evaluation results are shown in Tables 1 and 2. Table 1 shows the accuracy results of applying the method of this invention on the MNIST and CIFAR-10 datasets. Table 1 adopts the same model structure as the state-of-the-art method FedMA. Table 2 shows the accuracy results of applying the method of this invention on the CIFAR-10, CIFAR-100, and CINIC-10 datasets. Table 2 adopts the same model structure as the state-of-the-art method CCVR. In the tables, α represents the distribution parameter of the Dirichlet distribution. The larger the value, the closer the distribution is to a uniform distribution. FedGDI represents the application of the interpretable method based on "trust score" to select clients in Non-IID federated learning, and FedCI represents the application of the interpretable method based on "representative gradient" to select clients in Non-IID federated learning.
[0051] Table 1 shows the accuracy results generated on the MNIST and CIFAR-10 datasets using the method of this invention.
[0052]
[0053] Table 2 shows the accuracy results generated using the method of this invention on the CIFAR-10, CIFAR-100, and CINIC-10 datasets (CNN+MLP model structure).
[0054]
[0055] Tables 1 and 2 show the accuracy performance of this technique on the MNIST, CIFAR-10, CIFAR-100, and CINIC-10 datasets, respectively, and compare it with other state-of-the-art methods. The results show that the method for mitigating the impact of Non-IID based on interpretable federated learning provided in this application is effective.
Claims
1. A method for mitigating the impact of Non-IID based on interpretable federated learning, characterized in that, Includes the following steps: (1) Constructing a Non-IID scenario: For the target dataset, using the Dirichlet distribution, a different number of data with different labels are assigned to each client to construct a Non-IID scenario; specifically, it includes: firstly, there are K category labels, and the number of clients participating in federated learning is N. The samples of each category label need to be divided on different clients according to different proportions, and the number of categories on each client is also different. Next, set up the matrix. This is the category label distribution matrix; Where row vector This represents the probability distribution vector of category c across different clients, with each dimension representing the sample partitioning of the c-th category; This probability distribution vector is sampled from the Dirichlet distribution: ; ; ; in For parameters; (2) Constructing a validation set: In the central server, one image is placed for each category as a validation set; (3) Select clients for interpretability: use the cosine similarity calculated by the local update direction of the client and the update direction of the previous aggregation model as a score, and select the k clients with the lowest scores to participate in interpretability; or cluster the clients according to the representative gradient of the clients, and select m clients from the c clusters to participate in interpretability. (4) Screening clients with imbalanced data: By comparing each client model participating in the aggregation with the global model of the previous aggregation, the difference between the interpreted highlighted feature maps of the same validation set is calculated, and the similarity is calculated. If the change in the similarity of each type exceeds the set threshold, the client is considered to have imbalanced data. Specifically, this includes: inputting the validation set deployed on the central server into the previous aggregation model and the client model performing the interpretability operation in this round, and then performing interpretability based on the classification results of the model to obtain the highlighted feature map; performing a one-to-one similarity calculation on the highlighted feature maps of the two models. The similarity calculation formula is as follows: ; in The coefficient representing image x. The complex conjugate of the coefficients is represented by K, which represents a normal quantity used to enhance robustness. If the variation of various similarities exceeds the set threshold, the client's data is considered unbalanced. (5) Dynamically adjust client model parameters: minimize the gradient distance between the unbalanced client model and the previous round of global aggregation model parameters, correct the client model parameters by the convergence of gradient distance, and flexibly adjust the number of iterations to minimize gradient based on the time of federated learning aggregation.
2. The method for mitigating the impact of Non-IID based on interpretable federated learning according to claim 1, characterized in that, In step (3), the client is selected for interpretability based on the score, including: using the cosine similarity calculated between the client's local update direction and the update direction of the previous round of aggregation as the score, and the calculation formula is as follows: ; in and Let these represent the local update gradient and the global gradient of the i-th client, respectively. This represents the rating of the i-th client; Arrange the above scores in ascending order, and select the top k clients by score to participate in subsequent interpretability operations.
3. The method for mitigating the impact of Non-IID based on interpretable federated learning according to claim 1, characterized in that, Step (3) involves selecting clients for interpretability based on representative gradients, including: using the difference between the client's local model and the global model as the "representative gradient"; first, calculating the "representative gradient" for each client, as follows: ,in and These are the local update parameters of the i-th client and the parameters from the last global update, respectively. Then, based on the "representative gradient," the clients are clustered into c classes through hierarchical clustering. From these c classes, m clients participating in the aggregation are extracted sequentially, and then subsequent interpretability operations are performed.
4. The method for mitigating the impact of Non-IID based on interpretable federated learning according to claim 3, characterized in that, Hierarchical clustering in interpretability is performed on clients selected based on representative gradients, including: Clustering is performed using the Ward method, with the "representative gradient" as the input data for clustering, and it is used to create a distance matrix. Assuming there are N clusters, the sum of squared residuals (ESS) within each cluster is 0. The ESS calculation formula is as follows: ; Calculate the ESS difference for each pair of clusters merged sequentially, i.e. - Find the two clusters with the smallest ESS difference after merging and merge them, then repeat the above process.
5. The method for mitigating the impact of Non-IID based on interpretable federated learning according to claim 1, characterized in that, Dynamically adjust client-side model parameters, including: inputting the imbalanced validation set into the imbalanced client-side model, and calculating the gradient distance between each imbalanced client-side model and the previous round of global aggregation model. The gradient distance calculation formula is as follows: ; in These are the gradients of the kth validation set sample generated by the local model and the gradients of the kth validation set sample generated by the previously aggregated global model, respectively. The offset parameters of the client model are corrected by reducing the gradient distance calculated by the above formula, and the number of gradient iterations is minimized by flexibly adjusting the time of federated learning aggregation.
Citation Information
Patent Citations
Non-IID data-based semi-supervised federated learning method
CN114065951A
Federal learning method and system for data non-independent identically distributed scene
CN114580663A