A method based on alliance game theory to solve the data heterogeneity problem in federated learning.
By measuring client data heterogeneity through EMD and utilizing federated game theory and computational resource differentiation for grouping, the problem of excessive weight dispersion caused by data heterogeneity in federated learning is solved, thereby improving model accuracy and accelerating convergence.
Patent Information
- Application Number
- CN202310167065.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-02-27
AI Technical Summary
In federated learning, non-independent and identically distributed data leads to excessive weight dispersion between the local and global models, affecting model accuracy. Furthermore, existing technologies do not fully utilize client computing resources, resulting in slow model convergence.
The mean bulldozing distance (EMD) is used to measure the non-IID degree of client data. Clients are divided into several alliances through alliance game and grouped according to the differences in computing resources. The client computing resources of each group are similar. The number of local training rounds is adjusted to accelerate model convergence.
This reduces the weight difference between the local and global models, improves model accuracy, and makes full use of client computing resources, thereby increasing the convergence speed of federated learning.
Smart Images

Figure CN116259057B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of edge computing technology, and further relates to a method for solving the data heterogeneity problem in federated learning based on alliance game theory in the field of data processing technology. Background Technology
[0002] With smartphones and tablets becoming increasingly prevalent as primary computing devices for many, their powerful sensors (including cameras, microphones, and GPS) generate unprecedented amounts of data. This data is used for machine learning training, but traditional machine learning models that centrally transmit data to servers present numerous challenges: excessive communication overhead, limited server computing resources, and privacy and security concerns. Federated learning frameworks have been proposed to address these issues.
[0003] In traditional machine learning, data is distributed across the same machine and is assumed to be independently sampled from the same distribution, i.e., Independently Identically Distributed (IID). Federated learning is a form of machine learning involving multiple devices. Each client provides a local model using its own dataset, and the server uses these local model parameters to create a hybrid model. The goal is to make the hybrid model perform better than any single client model. Because devices belong to a specific user, enterprise, or scenario, their data distribution is often highly diverse, i.e., non-independent and independently distributed (Non-IID). The nature of individual client data leads to variations in the local model. These variations only apply to the client's own data but not to other datasets, thus harming the performance of the hybrid model. Non-independent and independently distributed data causes significant differences in the direction of parameter updates across different clients, resulting in a substantial difference between the final global model parameters and the local model parameters. The problem of non-independent and independently distributed data causing a significant decrease in the accuracy of federated learning models is the data heterogeneity problem. The difference between the global model parameters obtained from federated learning aggregation and the parameters updated by local models using stochastic gradient descent is defined as weight divergence. The greater the weight divergence, the greater the difference between the global model and the local model, and the worse the federated learning performance.
[0004] In their paper "Communication-Efficient Learning of Deep Networks From Decentralized Data" (Artificial Intelligence and Statistics 54.(2017):1273-1282.), H. Brendan McMahan et al. proposed a method for joint learning of deep networks based on iterative model averaging. The implementation steps are as follows: First, select a certain proportion of clients. Second, calculate the loss gradient of all data held by the selected clients. Third, the selected clients update their local model parameters using gradient descent. Fourth, the server takes the weighted average of the local models of the selected clients to construct the global model. This method achieves relatively good results when dealing with independent and identically distributed (IOD) data. However, a remaining limitation is that it cannot reduce the differences in local model parameters and global model weights caused by data heterogeneity when dealing with non-independent and identically distributed (IOD) data.
[0005] Hangzhou Dianzi University proposed a method for solving the data heterogeneity problem in federated learning based on the second derivative in its patent application "A Method for Solving the Data Imbalance Problem in Federated Learning Based on the Second Derivative" (Application No.: 202110917450.7, Publication No.: CN 113691594 B). The implementation steps of this method are as follows: First, the cloud server initializes the global model and the proxy dataset. Second, when the test accuracy of the first round of global iteration or the current round of iteration is less than a certain threshold compared to the test accuracy of the previous round, the cloud server obtains the global model by calculating the second derivative of the loss function with respect to the global model parameters. Third, the cloud server distributes the global model, the importance weights of the global model parameters, and global data imbalance information to the edge clients. Fourth, the edge client constructs a regularization term based on the received global model, the importance weights of the global model parameters, and global data imbalance information. This regularization term is added to the pre-set optimization objective to form a new optimization objective, thereby reducing the difference between the local model and the global model and decreasing the contribution of large classes to the global model. Then, the edge client performs model training locally using local data and uploads the trained local model to the cloud server. Fifth, the cloud server updates the global model using the received local model. Sixth, the cloud server determines whether the global model accuracy has reached a preset value. If not, it returns to step two; otherwise, training ends. This method addresses the impact of the difference between the local and global models caused by non-independent and identically distributed data on the training of the global model. However, this method still has shortcomings: it does not fully utilize the client's computing resources, resulting in a relatively slow model convergence speed. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies and the challenges of data heterogeneity in edge computing scenarios. It proposes a method based on federated game theory to solve the data heterogeneity problem in federated learning. This method addresses the issue of excessive weight dispersion between the local and global models caused by data heterogeneity in federated learning, improves the performance of federated learning models, and utilizes the differentiation of client computing resources to improve the federated learning algorithm, thereby accelerating the convergence speed of federated learning.
[0007] The idea behind this invention is to use the average earth mover's distance (EMD) to measure the non-IID degree of client data. EMD is the minimum cost of normalizing from one distribution to another. The degree of non-IID refers to the difference between the probability distribution of each class of data in the client dataset and the probability distribution of each class of data in the ideal dataset. Therefore, EMD is defined as the probability distribution distance of each class of data.
[0008] Non-IID data can cause weight differences between the local and global models, thus affecting the accuracy of federated learning models due to data distribution skewness. This invention uses EMD (Earning Data Distributed) to perform federated game theory, grouping clients into several federations. The degree of Non-IID among different clients forming the same federation is calculated iteratively. Federations with high Non-IID degrees are eliminated, resulting in low Non-IID degrees for each federation's dataset at the end of the game. This minimizes the weight differences between the local and global models, improving the accuracy of the federated learning model. Furthermore, this invention employs a grouping strategy based on the differences in client computing resources. Clients are divided into several groups, each with similar computing resources. The number of local training rounds performed by each group in a single training round differs, with groups with more computing resources performing a multiple of the number of local training rounds performed by groups with fewer resources. Therefore, clients with more computing resources can fully utilize their resources without wasting time waiting for clients with fewer resources to complete their local training, accelerating the convergence speed of the federated learning model.
[0009] To achieve the above objectives, the specific implementation steps of the present invention include the following:
[0010] Step 1, Construct a convolutional neural network:
[0011] Step 1.1: Build a convolutional neural network with the same structure for each client. The layers of this network are connected in series, and its structure is as follows: input layer, first convolutional layer, first pooling layer, second convolutional layer, second pooling layer, fully connected layer;
[0012] Step 1.2, set the hyperparameters of the convolutional neural network: set the number of neurons in the input layer to 28×28; set the kernels of the first and second convolutional layers to 5×5 and 3×3 respectively, with 64 kernels in each layer and a stride of 1; set the pooling window size of the first and second pooling layers to 2×2 and a stride of 2; use ReLU as the activation function for all layers; set the number of neurons in the output layer of the fully connected layer to 10, and use Softmax as the activation function.
[0013] Step 2, generate the training set for each client:
[0014] Step 2.1: Compile the handwritten digit images of each client into a sample set for that client; label each handwritten digit image in each client's sample set;
[0015] Step 2.2: Perform mean and variance normalization on each image after labeling each sample set. The processed data conforms to a standard normal distribution. The normalized images of each sample set are used to form the training set for this client.
[0016] Step 3: Each client sends its own set of tag categories and iteration time to the server via base station communication;
[0017] Step 4: The server obtains the optimal alliance partition.
[0018] Step 4.1: Treat each client as an alliance, and all alliances form an alliance partition;
[0019] Step 4.2, generate the benefit for each alliance in the alliance partition according to the following formula:
[0020]
[0021] Among them, V j Let represent the benefit of the j-th consortium in the consortium partition, where log(.) represents the logarithmic operation to base 10, and |.| represents the absolute value operation. m D represents the number of handwritten digit images labeled "m" in the training set of all clients within the j-th consortium in the consortium partition. j This represents the total number of handwritten digit images in the training set of all clients within the j-th consortium in the consortium partition;
[0022] Step 4.3: Using the alliance game formation algorithm, clients are continuously forced to leave their original alliances and join other alliances. When the sum of the benefits of two alliances increases, all alliances form a new alliance partition.
[0023] Step 4.4: When joining any alliance by any client cannot increase the sum of the benefits of the existing alliance and the newly joined alliance, and no new alliance partitions are generated, the alliance game formation algorithm stops iterating; delete the empty alliances in the alliance partitions, and form the optimal alliance partitions with the remaining alliances.
[0024] Step 5, the server groups each federation in the optimal federation partition:
[0025] Step 5.1: The server finds the client with the shortest iteration time in each alliance based on the iteration time uploaded by each client, and appoints it as the alliance leader of each alliance.
[0026] Step 5.2: The server calculates the number of local training rounds for each client;
[0027] Step 5.3: Clients with the same local training rounds within each alliance form a group;
[0028] Step 6: Perform collaborative training of the convolutional neural network using federated learning:
[0029] Step 6.1: The server sends the same convolutional neural network parameter matrix to each client in the optimal consortium partition;
[0030] Step 6.2: Each client updates its own convolutional neural network using the received convolutional neural network parameter matrix;
[0031] Step 6.3: Each client inputs each training set into its corresponding convolutional neural network, uses the SGD gradient descent algorithm to calculate the convolutional neural network parameter matrix of each client after 10 iterations, and uploads the convolutional neural network parameter matrix to the alliance leader.
[0032] Step 6.4: The alliance leader of each alliance receives the convolutional neural network parameter matrix from the client and averages the parameter matrices of the convolutional neural networks with different features that it has received.
[0033] Step 6.5: The leader of each alliance determines whether it has received the parameter matrix of the convolutional neural network from all the clients of the groups. If so, it sends the average value of the parameter matrix of the convolutional neural network to the server and then proceeds to step 6.6; otherwise, it sends the average value of the parameter matrix of the convolutional neural network to the client and then proceeds to step 6.2.
[0034] Step 6.6: The server takes the average of the parameter matrices of all consortia with different features that it receives, and then sends the average value to each consortium leader. Each consortium leader then sends the average value of the parameter matrix to the client of each consortium.
[0035] Step 6.7: Determine if the server has already performed the averaging operation in Step 6.6 500 times. If yes, end the collaborative training, update the server's convolutional neural network with the average value of the parameter matrix, and proceed to Step 7.1; otherwise, proceed to Step 6.2.
[0036] Step 7: Predict the category of the handwritten digit images on the server:
[0037] Step 7.1: Using the same preprocessing method as in Step 2, process the handwritten digit images on the server to obtain the server's test set.
[0038] Step 7.2: Input all images from the server test set into the server's convolutional neural network and output the predicted handwritten digit recognition results.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] First, this invention utilizes EMD to conduct alliance game on clients with high Non-IID levels, thereby reducing the Non-IID level of each alliance. This results in a smaller weight difference between the local and global models of each alliance, overcoming the drawback of large weight differences between local and global models caused by data heterogeneity in existing technologies. This gives the invention the advantage of high accuracy of the alliance learning model.
[0041] Second, this invention utilizes a differentiated computing resource grouping strategy for clients, and determines the local training rounds for each client based on this grouping. This fully utilizes the client's computing resources and overcomes the shortcomings of wasted client computing resources in the prior art, giving this invention the advantage of fast convergence speed of federated learning models. Attached Figure Description
[0042] Figure 1 This is a flowchart of the present invention;
[0043] Figure 2 This is a simulation diagram of the present invention. Detailed Implementation
[0044] The following is in conjunction with the appendix Figure 1 The implementation steps of the present invention will be further described below with reference to the embodiments.
[0045] An embodiment of the present invention has 30 clients and one server. The clients train a convolutional neural network that can recognize all handwritten digits using a training set generated from their own handwritten digit images. Each handwritten digit image contains only one digit. The trained convolutional neural network can not only recognize the handwritten digits in the 30 training sets, but also recognize handwritten digit images outside the 30 training sets.
[0046] Convolutional Neural Networks (CNNs) are particularly well-suited for processing data such as images, videos, audio, and text. Currently, CNNs are the most advantageous neural network architecture in the field of image recognition. By constructing an identical CNN at each client, and then inputting each image from the training set into the CNN to learn its features, the parameters of the CNN are updated. The parameters of the CNN on each client are different. After learning the features of each image in the training set, the CNN on each client performs well. At the server, the learned features from 30 clients are aggregated. Finally, the CNN constructed on the server learns the features of handwritten digit images from all clients' training sets. The server-side CNN can not only recognize the handwritten digits in the 30 training sets but also accurately recognize all handwritten digit images.
[0047] Step 1: Construct a convolutional neural network.
[0048] Step 1.1: Build a convolutional neural network with the same structure on each client. The network consists of layers connected in series, and its structure is as follows: input layer, first convolutional layer, first pooling layer, second convolutional layer, second pooling layer, and fully connected layer.
[0049] Step 1.2, set the hyperparameters of the convolutional neural network: Set the number of neurons in the input layer to 28×28. Set the kernels of the first and second convolutional layers to 5×5 and 3×3 respectively, with 64 kernels in each layer and a stride of 1. Set the pooling window size of the first and second pooling layers to 2×2 and a stride of 2. Use ReLU activation functions for all layers. Set the number of output neurons in the fully connected layers to 10, and use Softmax activation functions. The hyperparameters are the same for each client's network layer (hyperparameters refer to the number of neurons or network size in each layer), but the parameters for each layer differ between clients (parameters refer to the weight matrix of each layer).
[0050] Step 2: Generate the training set for each client.
[0051] Step 2.1: Compile the handwritten digit images of each client into a sample set for that client. In this embodiment, a total of 30 sample sets are formed. Since each client possesses not only handwritten digit images but also other images, such as flower images and portrait images, this invention only selects the handwritten digit images of each client to form its sample set, and each handwritten digit image contains only one handwritten digit. Each handwritten digit image in each client's sample set is labeled. Since the sample set of this invention is composed of handwritten digit images, its image labels are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. For example, a client contains 3 images. The first image contains only one handwritten digit 0, so the label for this image is 0. The second image contains only one handwritten digit 1, so the label for this image is 1. The third image contains only one handwritten digit 2, so the label for this image is 2.
[0052] Step 2.2: Perform mean and variance normalization on each labeled image in each sample set. The processed data conforms to a standard normal distribution. The normalized images in each sample set are used to form the training set for this client.
[0053] Step 3: Each client sends a set of tag categories and iteration time to the server.
[0054] Each client sends its own set of label categories and iteration time to the server via base station communication. The set of label categories refers to the number of handwritten digit images of each category in each training set, and the iteration time refers to the time it takes for each client to execute a convolutional neural network once using each training data point in the training set to obtain the predicted label for that training data. The first client has 300 handwritten digit images, of which 100 are labeled "0", 100 are labeled "1", and 100 are labeled "5". Therefore, the first client's set of label categories is {100,100,0,0,0,100,0,0,0,0}. The second client has 300 handwritten digit images. 100 of these images are labeled "7", 100 are labeled "8", and 100 are labeled "9". Based on this, the label category set of the second client is {0,0,0,0,0,0,0,100,100,100}.
[0055] Step 4: The server obtains the optimal alliance partition.
[0056] Step 4.1: Each client is treated as an alliance, and all alliances form an alliance partition. In this embodiment of the invention, 30 clients form 30 alliances. The first alliance contains the first client, the second alliance contains the second client, and the 30th alliance contains the 30th client. These 30 alliances form an alliance partition.
[0057] Step 4.2, generate the benefit for each alliance in the alliance partition according to the following formula:
[0058]
[0059] Among them, V j Let represent the benefit of the j-th consortium in the consortium partition, where log(.) represents the logarithmic operation to base 10, and |.| represents the absolute value operation. m D represents the number of handwritten digit images labeled "m" in the training set of all clients within the j-th consortium in the consortium partition. j This represents the total number of handwritten digit images in the training set of all clients within the j-th consortium in the consortium partition. In this embodiment of the invention, the benefit of the first consortium is V1≈0.35; the benefit of the second consortium is V2≈0.35.
[0060] Step 4.3: Using a coalition game formation algorithm, clients are continuously forced to leave their original coalitions and join other coalitions. When the sum of the benefits of two coalitions increases, all coalitions form a new coalition partition. In this embodiment, the sum of the benefits of the first coalition and the second coalition is 0.7. When the first client leaves the first coalition and joins the second coalition, the benefit of the first coalition becomes V1≈0, and the benefit of the second coalition becomes V2≈0.88. The sum of the benefits of the first and second coalitions becomes 0.88, and the sum of the benefits of the two coalitions increases, forming a new coalition partition. This coalition partition contains 30 coalitions. The first coalition is an empty set, the second coalition contains the first and second clients, and the 30th coalition contains the 30th client.
[0061] The aforementioned coalition game formation algorithm is based on a coalition game formation algorithm proposed by Hui Yilong et al. in their paper "A Game Theoretic Scheme for Optimal Access Control in Heterogeneous Vehicular Networks" (IEEE transactions on intelligent transportation systems 2019, 20(12): 4590-4603.).
[0062] Step 4.4: When joining any alliance by any client cannot increase the sum of the benefits of the existing alliances and the newly joined alliances, and no new alliance partitions are generated, the alliance game formation algorithm stops iterating. When the alliance game formation algorithm stops, the alliance partitions in this embodiment contain 30 alliances. Second Alliance Includes the first client, the second client, the third client, the fourth client, and the fifth client. The third alliance Includes the 6th client, the 7th client, the 8th client, the 9th client, the 10th client, and the 11th client. The Ninth Alliance This includes the 12th client, the 13th client, the 14th client, the 15th client, the 16th client, the 17th client, the 18th client, the 19th client, the 20th client, and the 21st client. The Tenth Alliance This includes the 22nd client, the 23rd client, the 24th client, the 25th client, the 26th client, the 27th client, the 28th client, the 29th client, and the 30th client. The remaining alliances are empty sets. .
[0063] Step 4.5: Delete empty alliances in the alliance partition and form the optimal alliance partition with the remaining alliances. In this embodiment of the invention, the optimal alliance partition contains four alliances: the second alliance, the third alliance, the ninth alliance, and the tenth alliance.
[0064] Step 5: The server generates each alliance group in the optimal alliance partition.
[0065] Step 5.1: The server finds the client with the shortest iteration time in each alliance based on the iteration time uploaded by each client, and this client becomes the alliance leader of each alliance. In this embodiment of the invention, the iteration time of the first client in the second alliance is 0.2s, the second client's iteration time is 0.25s, the third client's iteration time is 0.3s, the fourth client's iteration time is 0.35s, and the fifth client's iteration time is 0.6s. Therefore, the alliance leader of the second alliance is the first client.
[0066] Step 5.2, the server calculates the number of local training rounds for each client according to the following formula:
[0067]
[0068] Where, μ i This represents the local training round for the i-th client. Represents the floor symbol. This represents the client with the longest iteration time within each alliance. This represents the iteration time of the client with the longest iteration time within each alliance.t i This represents the iteration time of the i-th client. In this embodiment of the invention, the local training rounds of the first client in the second alliance are 30, the local training rounds of the second client are 20, the local training rounds of the third client are 20, the local training rounds of the fourth client are 10, and the local training rounds of the fifth client are 10.
[0069] Step 5.3: Clients with the same local training rounds within each alliance form a group. In this embodiment of the invention, the second alliance forms 3 groups: the first group contains the first client, the second group contains the second and third clients, and the third group contains the fourth and fifth clients.
[0070] Step 6: Use federated learning to collaboratively train the convolutional neural network.
[0071] Step 6.1: The server sends the same convolutional neural network parameter matrix to each client in the optimal consortium partition.
[0072] Step 6.2: Each client updates its own convolutional neural network using the received convolutional neural network parameter matrix.
[0073] Step 6.3: Each client inputs each training set into its corresponding convolutional neural network, uses the SGD gradient descent algorithm to calculate the convolutional neural network parameter matrix of each client after 10 iterations, and uploads the convolutional neural network parameter matrix to the consortium leader.
[0074] Step 6.4: The alliance leader of each alliance receives the convolutional neural network parameter matrix from the client and averages the parameter matrices of the convolutional neural networks with different features that it has received.
[0075] Step 6.5: The leader of each alliance determines whether it has received the parameter matrices of the convolutional neural networks from all the clients of the groups. If so, it sends the average value of the parameter matrices of the convolutional neural networks to the server and executes step 6.6; otherwise, it sends the average value of the parameter matrices of the convolutional neural networks to the client that sent its parameter matrix in step 6.4 and executes step 6.2. In this embodiment of the invention, the leader of the second alliance receives the parameter matrix of the first group in the 2nd second, averages the parameter matrix of the first group, and sends it to the first client. In the 3rd second, it receives the parameter matrix of the second group, averages the parameter matrix of the second group, and sends it to the second and third clients. In the 4th second, it receives the parameter matrix of the first group, averages the parameter matrix of the first group, and sends it to the first client. In the 6th second, it receives the parameter matrices of the first, second, and third groups, averages the parameter matrices of the first, second, and third groups, and sends them to the server.
[0076] Step 6.6: The server averages the parameter matrices of all consortia with different features that it receives, and then sends the average value to each consortium leader. Each consortium leader then sends the average value of the parameter matrix to the client of each consortium.
[0077] Step 6.7: Determine if the server has already performed the averaging operation in Step 6.6 500 times. If yes, end the collaborative training, update the server's convolutional neural network with the average value of the parameter matrix, and proceed to Step 7.1; otherwise, proceed to Step 6.2.
[0078] Step 7: Predict the category of the handwritten digit images on the server:
[0079] Step 7.1: Using the same preprocessing method as in Step 2, process the handwritten digit images on the server to obtain the server's test set.
[0080] Step 7.2: Input all images from the server test set into the server's convolutional neural network and output the predicted handwritten digit recognition results.
[0081] The effects of this invention will be further illustrated below with simulation experiments:
[0082] 1. Simulation experimental conditions:
[0083] The simulation experiment platform for this invention is: Windows 11 operating system and PyCharm 2021.
[0084] The training and test sets used in the simulation experiments of this invention are the training and test sets of the MNIST dataset.
[0085] 2. Simulation content and result analysis:
[0086] The simulation experiment of this invention uses this invention and two existing technologies (federated averaging method and second-derivative federated learning method) to recognize handwritten digit images respectively.
[0087] The two existing technologies used in the simulation experiment are:
[0088] The existing federated averaging method refers to the method of joint learning of deep networks based on iterative model averaging, proposed by H. Brendan McMahan et al. in their paper "Communication-Efficient Learning Of Deep Networks From Decentralized Data" (Artificial Intelligence and Statistics 54.(2017):1273-1282.).
[0089] The existing technology of second-derivative federated learning refers to the method proposed by Hangzhou Dianzi University in its patent application "A method for solving the data imbalance problem in federated learning based on second derivative" (application number: 202110917450.7, application publication number: CN 113691594 B) to solve the data heterogeneity problem in federated learning based on second derivative, abbreviated as second-derivative federated learning method.
[0090] The following combination Figure 2 The simulation diagrams further illustrate the effects of the present invention.
[0091] Figure 2 This is a comparison chart showing the recognition accuracy of the three methods in the simulation experiment of this invention on the handwritten digit images of the test set. The recognition accuracy refers to the percentage of 10,000 handwritten digit images in the test set that are correctly recognized.
[0092] Figure 2 The horizontal axis represents the number of training epochs in which the server and client collaboratively train the convolutional neural network using federated learning, and the vertical axis represents the accuracy of the trained convolutional neural network in recognizing handwritten digit categories on the test set. Figure 2 The solid lines in the figure represent the accuracy curves obtained using the method of this invention for different training rounds. Figure 2 The solid lines in the figure represent the accuracy curves obtained using the federated averaging method for different training rounds. Figure 2 The dashed lines in the figure represent the accuracy curves obtained under different training rounds using the second derivative federated learning method.
[0093] Depend on Figure 2It can be seen that, for any fixed training epoch, the accuracy obtained by this invention can always bring the highest recognition accuracy to the server's convolutional neural network compared to the accuracy obtained by the other two methods. This is mainly because the federated averaging method cannot reduce the differences in local model parameters and global model weights caused by data heterogeneity when facing non-independent and identically distributed data; while for the second derivative federated learning method, the client's computing resources are not fully utilized, and the convergence speed of the model is slow under a fixed training epoch.
[0094] The simulation experiments above show that the method of the present invention can reduce the data heterogeneity among client training sets through federated game theory, solve the problem of excessive weight dispersion between local and global models, improve the performance of federated learning models, and improve the federated learning algorithm by utilizing the differences in client computing resources, thereby accelerating the convergence speed of federated learning. It is a very practical method to solve the data heterogeneity problem in federated learning.
Claims
1. A method for solving the data heterogeneity problem in federated learning based on alliance game theory, characterized in that, Federated learning is used to collaboratively train a convolutional neural network on both the server and client sides; the specific steps of this method include the following: Step 1, Construct a convolutional neural network: Step 1.1: Build a convolutional neural network with the same structure for each client. The layers of this network are connected in series, and its structure is as follows: input layer, first convolutional layer, first pooling layer, second convolutional layer, second pooling layer, fully connected layer; Step 1.2, set the hyperparameters of the convolutional neural network: set the number of neurons in the input layer to 28×28; set the kernels of the first and second convolutional layers to 5×5 and 3×3 respectively, with 64 kernels in each layer and a stride of 1; set the pooling window size of the first and second pooling layers to 2×2 and a stride of 2; use ReLU as the activation function for all layers; set the number of neurons in the output layer of the fully connected layer to 10, and use Softmax as the activation function. Step 2, generate the training set for each client: Step 2.1: Compile each client's own handwritten digit images into a sample set for that client; Label each handwritten digit image in each client sample set; Step 2.2: Perform mean and variance normalization on each image after labeling each sample set. The processed data conforms to a standard normal distribution. The normalized images of each sample set are used to form the training set for this client. Step 3: Each client sends its own set of tag categories and iteration time to the server via base station communication; Step 4: The server obtains the optimal alliance partition. Step 4.1: Treat each client as an alliance, and all alliances form an alliance partition; Step 4.2, calculate the benefit of each alliance in the alliance partition; Step 4.3: Using the alliance game formation algorithm, clients are continuously forced to leave their original alliances and join other alliances. When the sum of the benefits of two alliances increases, all alliances form a new alliance partition. Step 4.4: When joining any alliance by any client cannot increase the sum of the benefits of the existing alliance and the newly joined alliance, and no new alliance partitions are generated, the alliance game formation algorithm stops iterating; delete the empty alliances in the alliance partitions, and form the optimal alliance partitions with the remaining alliances. Step 5, the server groups each federation in the optimal federation partition: Step 5.1: Based on the iteration time uploaded by each client, the server finds the client with the shortest iteration time in each alliance and appoints it as the alliance leader of each alliance. Step 5.2: The server calculates the number of local training rounds for each client; Step 5.3: Group clients with the same local training rounds within each alliance into a group; Step 6: Perform collaborative training of the convolutional neural network using federated learning: Step 6.1: The server sends the same convolutional neural network parameter matrix to each client in the optimal consortium partition; Step 6.2: Each client updates its own convolutional neural network using the received convolutional neural network parameter matrix; Step 6.3: Each client inputs each training set into its corresponding convolutional neural network, uses the SGD gradient descent algorithm to calculate the convolutional neural network parameter matrix of each client after 10 iterations, and uploads the convolutional neural network parameter matrix to the alliance leader. Step 6.4: The alliance leader of each alliance receives the convolutional neural network parameter matrix from the client and averages the parameter matrices of the convolutional neural networks with different features that it has received. Step 6.5: The leader of each alliance determines whether it has received the parameter matrix of the convolutional neural network from all the clients of the groups. If so, it sends the average value of the parameter matrix of the convolutional neural network to the server and then proceeds to step 6.6; otherwise, it sends the average value of the parameter matrix of the convolutional neural network to the client and then proceeds to step 6.
2. Step 6.6: The server takes the average of the parameter matrices of all consortia with different features that it receives, and then sends the average value to each consortium leader. Each consortium leader then sends the average value of the parameter matrix to the client of each consortium. Step 6.7: Determine if the server has already performed the averaging operation in Step 6.6 5000 times. If yes, end the collaborative training, update the server's convolutional neural network with the average value of the parameter matrix, and proceed to Step 7.1; otherwise, proceed to Step 6.
2. Step 7: Predict the category of the handwritten digit images on the server: Step 7.1: Using the same preprocessing method as in Step 2, process the handwritten digit images on the server to obtain the server's test set; Step 7.2: Input all images from the server test set into the server's convolutional neural network and output the predicted handwritten digit recognition results.
2. The method for solving the data heterogeneity problem in federated learning based on alliance game theory according to claim 1, characterized in that, The labels mentioned in step 2.1 include: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
3. The method for solving the data heterogeneity problem in federated learning based on alliance game theory according to claim 1, characterized in that, The calculation of the benefit of each coalition in the coalition partition described in step 5.2 is obtained by the following formula: Among them, V j Let represent the benefit of the j-th consortium in the consortium partition, where log(.) represents the logarithmic operation to base 10, and |.| represents the absolute value operation. m D represents the number of handwritten digit images labeled "m" in the training set of all clients within the j-th consortium in the consortium partition. j This represents the total number of handwritten digit images in the training set of all clients within the j-th consortium in the consortium partition.
4. The method for solving the data heterogeneity problem in federated learning based on alliance game theory according to claim 1, characterized in that, The calculation of the number of local training rounds for each client, as described in step 5.2, is obtained by the following formula: Where, μ i This represents the local training round of the i-th client. This indicates a round-down operation. This represents the client with the longest iteration time within each alliance. t represents the iteration time of the client with the longest iteration time within each alliance. i This represents the iteration time for the i-th client.
Citation Information
Patent Citations
Method for solving data imbalance problem in federated learning based on second derivative
CN113691594A
A method for solving the imbalance problem in federated learning based on second derivatives
CN113691594B