A federated learning method for non-identically distributed data in edge intelligent controller
By selectively choosing nodes for global aggregation in the edge intelligent controller and performing frequency component analysis and reconstruction of model weights, combined with node contribution and attention mechanisms, the problem of low training efficiency of federated learning on non-independent and identically distributed data is solved, achieving faster model convergence and improved resource utilization efficiency.
Patent Information
- Application Number
- CN202411686244.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-11-22
AI Technical Summary
When applying federated learning to non-independent and identically distributed data samples, traditional methods suffer from low model training efficiency, slow convergence speed, and the inability of existing attention mechanisms to correctly distinguish the contribution of nodes, resulting in wasted resources and poor training effects.
By selectively choosing nodes for global aggregation, frequency component analysis and reconstruction of model weights are performed. Combined with node contribution and attention mechanisms, the probability of node participation is dynamically adjusted to optimize the generation of global model weights.
It improves model training efficiency, enhances the convergence speed and computational resource utilization efficiency of the global model, and strengthens the adaptability to non-independent and identically distributed data.
Smart Images

Figure CN119623671B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of federated learning optimization, and particularly relates to a federated learning method for non-independent and identically distributed data in an edge intelligent controller. BACKGROUND
[0002] Edge intelligent controllers (EICs) are widely used in industrial internet of things (IIOT) for monitoring and controlling intelligent manufacturing processes. In IIOT, a large amount of industrial perception data is continuously generated, and these data often contain sensitive information. For the consideration of network bandwidth and data privacy protection, it is impractical and unnecessary to send all data to an edge server (ES). The emerging technology of mobile edge computing (MEC) makes it possible to have locally coordinated data storage and processing, in which edge nodes, such as sensors, home gateways, micro servers and small cells, are equipped with storage and computing capabilities. Multiple edge nodes work together with servers to perform large-scale distributed tasks involving local processing and remote coordination / execution. Raw data is collected and stored on multiple edge nodes, and machine learning models are trained on local nodes and send local model weights to the server without sending raw data to the server. This variant of distributed machine learning is called federated learning. This method not only protects user privacy, but also reduces the overhead of data transmission. In the application of federated learning in IIOT, the EIC acts as an edge node with storage and computing capabilities, and the ES acts as a server. In order to conform to the general description of federated learning and ensure the uniformity of the entire text, the edge node or node refers to the EIC, and the server refers to the ES. In real scenarios, the data on each node participating in federated learning is usually not drawn from the same distribution. This is different from the assumption of independent and identically distributed (IID) data in traditional centralized machine learning. However, when facing non-independent and identically distributed (Non-IID) data samples, the traditional federated learning has problems such as low model training efficiency and slow convergence speed.
[0003] At present, some progress has been made in the research on applying federated learning to train models on non-identically distributed data samples at home and abroad, but there are still some problems. The main problems include: (1) The traditional federated learning selects all nodes in the node space to participate in global aggregation. However, when the distribution of data samples of each node is non-identically distributed, some nodes are not conducive to the training of the global model, which will lead to inefficient and slow model training. (2) When training a model on non-identically distributed samples, each local model is easily affected by different noises, resulting in redundant components in the model weight. The redundant parts of the model weight of each node participate in the global aggregation of the model at the same time. Too many useless redundant components in the model training occupy a large amount of limited edge computing resources, making the global model training inefficient. (3) Some existing research combines attention mechanisms in global aggregation to improve model training efficiency. In these studies, the norm of the node model weight and the global model weight is used to represent the importance of different nodes. This representation method cannot correctly distinguish the contribution of different nodes to the global model training and cannot identify nodes that are not conducive to the global model training, resulting in poor performance when facing non-identically distributed data samples.
[0004] As mentioned above, there are problems of low model training efficiency when applying federated learning to non-identically distributed data samples. The existing research methods have very limited effect on this problem. However, in practical applications, the data samples on different edge nodes are often non-identically distributed. There is a contradiction between the limitations of existing technologies and the needs of practical applications. Therefore, it is of great practical significance to study how to efficiently train models based on federated learning on non-identically distributed data samples.
[0005] In deep learning, it is a common research method to convert data sample features to the frequency domain for important feature extraction. Inspired by this, it is worth studying to analyze the frequency components of node model weights and reconstruct node model weights in federated learning to improve model training efficiency. At the same time, existing research shows that it is feasible to adjust the global aggregation strategy based on the contribution of nodes to the global model training to improve training efficiency. However, the effect of existing methods is limited, so how to better represent the contribution of nodes to the global model training to better improve the training effect is also one of the research focuses. SUMMARY
[0006] In view of the above defects of the prior art, the present application proposes a federated learning method for non-identically distributed data in an edge intelligent controller. The technical solution designed by the present application comprises the following steps:
[0007] S10: Selecting a node subset S for pre-participating in global aggregation t ;
[0008] S20: Select nodes in the node subset S t to perform local training of the model, and send the model weight and the gradient of the loss function to the server;
[0009] S30: Calculate the contribution of each node to the convergence of the global model, and select a node subset that truly participates in the global aggregation of this round
[0010] S40: Select nodes in the node subset and reconstruct the model weight of the nodes;
[0011] S50: Score the nodes according to the contribution value of the node subset , and globally aggregate to obtain the global model weight;
[0012] S60: Adjust the probability of each node being selected in the next round of training.
[0013] Preferably, the S10 comprises:
[0014] The server selects the node subset S that pre-participates in the global aggregation of this round according to the adjusted node selection probability in the last round of training t , the initial probability of each node being selected in the first round of training is defined as the reciprocal of the number of nodes in the node space set ,
[0015] Preferably, the S30 comprises:
[0016] The server receives the model weight and the gradient of the loss function sent by each node, the server calculates the global loss function and solves the gradient, calculates the inner product of the loss function gradient of each node and the global loss function gradient, the inner product represents the contribution of the node to the convergence of the global model, the nodes with a contribution less than zero are regarded as nodes that are not conducive to global aggregation and are marked by the server, the marked nodes are tested and excluded, and a node set that truly participates in the global aggregation is obtained
[0017] Preferably, the global loss function has the following calculation formula:
[0018]
[0019] In the formula, F i (w t ) is the loss function of node i, D i is the size of the local data set of node i, and w t is the model weight.
[0020] Preferably, the contribution of the node to the global model convergence is characterized by the following formula:
[0021]
[0022] In the formula, is the loss function gradient of node i, is the global loss function gradient.
[0023] Preferably, the step of testing the marked nodes and excluding the marked nodes that are not conducive to global aggregation comprises the following steps:
[0024] S3001: The federated average algorithm is used to calculate the global model weight of the non-excluded marked nodes and the global weight of the excluded marked nodes, respectively;
[0025] S3002: The global model weight of the non-excluded marked nodes and the global weight of the excluded marked nodes are used to update the model weight and test on the same test set, respectively, to obtain the loss function loss_all of the non-excluded marked nodes for global aggregation and the loss function loss_part of the excluded marked nodes for global aggregation, respectively;
[0026] S3003: If loss_all is greater than loss_part, it is considered that the marked node is not conducive to the training of the global model, and the node does not participate in the global aggregation of this round, otherwise, it participates in the global aggregation of this round.
[0027] Preferably, the S40 comprises:
[0028] The server confirms the node set that truly participates in the global aggregation The model weight of the nodes in the node set is subjected to fast Fourier transform, the amplitudes of the frequency components are calculated, and the frequency components with amplitudes greater than a threshold value are regarded as main components, and after the main components are retained, inverse fast Fourier transform is performed to reconstruct the model weight of the nodes;
[0029] The model weight of the nodes in the node set is subjected to fast Fourier transform, and the formula is as follows:
[0030]
[0031] In the formula, is the model weight of node i;
[0032] The amplitude of each frequency component is calculated, and the formula is as follows:
[0033]
[0034] The model weights for reconstructing nodes using the inverse fast Fourier transform are calculated using the following formula:
[0035]
[0036] Preferably, S50 includes:
[0037] The node subset The contribution of a node is represented by the inner product of the node's loss function gradient and the global loss function gradient, as shown in the following formula:
[0038]
[0039] Each node is scored by combining its contribution and the softmax function, as shown in the following formula:
[0040]
[0041] The server assigns model weights to each node after reconstruction based on the scoring results. Attention aggregation is performed to obtain the global weight w t The formula is as follows:
[0042]
[0043] The global model weights w t The weights are sent to each node as the initial model weights for each node in the next round of learning.
[0044] Preferably, S60 includes:
[0045] For nodes with a contribution of less than zero, the server adjusts the formula as follows:
[0046]
[0047] In the formula, Let be the probability that node i is selected in this round of global aggregation. Let α be the reduced probability of node i being selected in the next round of global aggregation, x be the ratio of the number of times node i is marked to the number of times it is selected, and α and β be hyperparameters.
[0048] The server adjusts the parameters for nodes with a contribution greater than zero and nodes not selected in this round using the following formula:
[0049]
[0050] Beneficial effects:
[0051] 1. The federated learning algorithm proposed in the application challenges the aggregation mode of selecting all nodes to participate in global aggregation in traditional federated learning algorithms. The algorithm proposed in the application selectively selects nodes that are conducive to global model training to participate in global aggregation instead of all nodes participating in global aggregation.
[0052] 2. The application proposes to perform component analysis on the weights of each node, retain the main frequency components, and reconstruct the weights of each node. This strategy eliminates the components that have little influence in the weights, which may contain noise components that are not conducive to model training, improves the utilization efficiency of computing resources, and thus improves the convergence speed and training effect of the global model.
[0053] 3. The application combines the inner product of the node loss function gradient and the global loss function gradient with the attention mechanism, and forms an attention aggregation optimization algorithm based on this. Compared with the traditional federated average aggregation mode, the attention aggregation optimization algorithm is more efficient and more conducive to the aggregation of the global model. At the same time, the attention mechanism proposed in the application has better effect than the traditional attention mechanism.
[0054] 4. The algorithm of the application dynamically adjusts the probability of each node being selected to participate in global aggregation in the next round of global aggregation according to whether the node is conducive to the training of the global model after each round of global aggregation. BRIEF DESCRIPTION OF DRAWINGS
[0055] Figure 1 is a flowchart of a preferred embodiment of the application;
[0056] Figure 2 is a flowchart of a preferred embodiment of the application. DETAILED DESCRIPTION
[0057] The embodiments of the application will be described in detail below. The embodiments described below are implemented on the premise of the technical solution of the application, and detailed implementation methods and specific operation processes are given, but the protection scope of the application is not limited to the embodiments described below.
[0058] The application designs a federated learning method for non-identically distributed data in an edge intelligent controller. In order to solve the problem of slow model convergence encountered when applying federated learning to non-identically distributed data samples, a novel federated learning algorithm is proposed. In the algorithm, the server selectively selects nodes for global aggregation, and performs component analysis on the model weights of the nodes participating in global aggregation and reconstructs the weights. Finally, the weights of the nodes participating in global aggregation are assigned according to the contribution of different nodes to global convergence, and the global weights of the model are obtained by attention aggregation according to the assignment results, so as to improve the training efficiency of federated learning when facing non-identically distributed data samples. The technical solution includes the following steps, as shown in Figure 1 specifically includes:
[0059] S10: Selecting a subset S of nodes to participate in the global aggregation t ;
[0060] S20: Selecting nodes in the subset S t to perform local training of the model and sending the model weights and the gradient of the loss function to the server
[0061] S30: Calculating the contribution of each node to the convergence of the global model and selecting a subset of nodes to participate in the global aggregation
[0062] S40: Selecting nodes in the subset S and reconstructing the model weights of the nodes
[0063] S50: Scoring the nodes in the subset S according to their contribution values and globally aggregating to obtain the global model weights
[0064] S60: Adjusting the probability of each node being selected in the next round of training
[0065] Preferably, S10 comprises:
[0066] The server selects the subset S of nodes to participate in the global aggregation in the current round according to the adjusted node selection probability in the last round of training t The initial probability of each node being selected in the first round of training is defined as the reciprocal of the number of nodes in the node space
[0067] Preferably, S30 comprises:
[0068] The server receives the model weights and the gradient of the loss function sent by each node, the server calculates the global loss function and solves the gradient, calculates the inner product of the gradient of the loss function of each node and the gradient of the global loss function, the inner product represents the contribution of the node to the convergence of the global model, the nodes with a contribution less than zero are considered to be nodes that are not conducive to global aggregation and are marked by the server, the marked nodes are tested and excluded from the nodes that are not conducive to global aggregation, and a set of nodes that truly participate in the global aggregation is obtained
[0069] Preferably, the global loss function is calculated as follows:
[0070]
[0071] In the formula, F i (w t ) is the loss function of node i, Di is the size of the local data set for node i, w t is the model weight.
[0072] Preferably, the contribution of the node to the global model convergence is represented by the formula:
[0073]
[0074] wherein, is the loss function gradient of node i, is the global loss function gradient.
[0075] Preferably, as shown in Figure 2 , the marked nodes are tested and the marked nodes that are not conducive to global aggregation are excluded, including the following steps:
[0076] S3001: The global model weight of the non-excluded marked nodes and the global weight of the excluded marked nodes are calculated respectively using the federated average algorithm;
[0077] S3002: The model weight is updated respectively using the global model weight of the non-excluded marked nodes and the global weight of the excluded marked nodes, and the test is performed on the same test set respectively, and the loss function loss_all of the non-excluded marked nodes for global aggregation and the loss function loss_part of the excluded marked nodes for global aggregation are obtained respectively;
[0078] S3003: If loss_all is greater than loss_part, it is considered that the marked node is not conducive to the training of the global model, and the node does not participate in the global aggregation of this round, otherwise it participates in the global aggregation of this round.
[0079] Preferably, S40 includes:
[0080] The server confirms the node set that truly participates in the global aggregation The model weight of the nodes in the node set is subjected to fast Fourier transform, the amplitudes of the frequency components are calculated, and the frequency components with amplitudes greater than a threshold value are regarded as main components, and after retaining the main components, inverse fast Fourier transform is performed to reconstruct the model weight of the nodes;
[0081] The model weight of the nodes in the node set is subjected to fast Fourier transform, and the formula is as follows:
[0082]
[0083] wherein, is the model weight of node i;
[0084] The amplitudes of the frequency components are calculated, and the formula is as follows:
[0085]
[0086] The model weights for reconstructing nodes using the inverse fast Fourier transform are given by the following formula:
[0087]
[0088] Specifically, the threshold is defined as 0.00001 times the average amplitude (a near-optimal value determined through experimental exploration):
[0089]
[0090] Filter out frequency components with amplitudes less than a threshold, retain the main frequency components, and perform an inverse fast Fourier transform to obtain new weights.
[0091] Preferably, S50 includes:
[0092] Node subset The contribution of a node is represented by the inner product of the node's loss function gradient and the global loss function gradient, as shown in the following formula:
[0093]
[0094] Each node is scored by combining its contribution and the softmax function, as shown in the following formula:
[0095]
[0096] The server assigns model weights to each node after reconstruction based on the scoring results. Attention aggregation is performed to obtain the global weight w t The formula is as follows:
[0097]
[0098] The global model weights w t The weights are sent to each node as the initial model weights for each node in the next round of learning.
[0099] Preferably, S60 includes:
[0100] For nodes with a contribution of less than zero, the server adjusts the formula as follows:
[0101]
[0102] In the formula, Let be the probability that node i is selected in this round of global aggregation. Let α be the reduced probability of node i being selected in the next round of global aggregation, x be the ratio of the number of times node i is marked to the number of times it is selected, and α and β be hyperparameters.
[0103] The server adjusts the formula for the nodes with contribution greater than zero and not selected in the current round as follows:
[0104]
[0105] Specifically, the last probability adjustment scheme is unified as follows:
[0106]
[0107] And in the next round of global aggregation, the server selects the node set participating in the next round of global aggregation according to the adjusted node selection probability.
[0108] The preferred embodiments of the present application are described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and changes without creative work based on the concept of the present application. Therefore, any technical solutions obtained by logical analysis, reasoning or limited experiments based on the existing technology within the scope of the concept of the present application should be within the protection scope determined by the claims.
Claims
1. A federated learning method for non-independent and identically distributed data in an edge intelligent controller, characterized in that, Includes the following steps: S10: Select a subset of nodes to participate in the global aggregation. ; S20: In the node subset Select nodes in the local training module to train the model locally, and send the model weights and gradients of the loss function to the server. S30: Calculate the contribution of each node to the convergence of the global model, and select the set of nodes that truly participate in this round of global aggregation. ; S40: In the node set Select nodes and reconstruct the model weights of the nodes; S50: Based on the node set The contribution value of each node is used to assign scores to the nodes and then globally aggregated to obtain the global model weights; S60: Adjust the probability of each node being selected in the next round of training; S30 includes: The server receives the model weights and gradients of the loss function from each node. It calculates the global loss function and its gradient, then calculates the inner product of the gradients of each node's loss function and the global loss function. This inner product represents the node's contribution to the global model convergence. Nodes with a contribution less than zero are considered detrimental to global aggregation and are marked by the server. The marked nodes are then tested, and detrimental nodes are excluded, resulting in the set of nodes that truly participate in global aggregation. ; S40 includes: The server confirms the set of nodes that actually participate in the global aggregation. For node set The model weights of the nodes are subjected to Fast Fourier Transform (FFT) to calculate the amplitude of each frequency component. Frequency components with amplitudes greater than a threshold are considered as principal components. After retaining the principal components, the node model weights are reconstructed by Inverse Fast Fourier Transform (IFFT).
2. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that, S10 includes: The server selects nodes based on the adjusted node selection probabilities from the previous training round. Select a subset of nodes to participate in the global aggregation in this round. The initial probability of each node being selected in the first round of training. Defined as the number of nodes in the node space set The reciprocal, .
3. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that, The global loss function is calculated using the following formula: In the formula, For nodes loss function, For nodes In terms of the size of the local dataset, These are the model weights.
4. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 3, characterized in that, The contribution of each node to the convergence of the global model is represented by the following formula: In the formula, For nodes The gradient of the loss function, This is the gradient of the global loss function.
5. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that, The process of testing and excluding marked nodes that are detrimental to global aggregation includes the following steps: S3001: The federated average algorithm is used to calculate the global model weights without excluding labeled nodes and the global weights excluding labeled nodes, respectively. S3002: Using the global model weights that do not exclude labeled nodes and the global weights that exclude labeled nodes, update the model weights separately and test them on the same test set to obtain the loss functions for global aggregation without excluding labeled nodes. loss_all Loss function for global aggregation excluding labeled nodes loss_part ; S3003: If loss_all Greater than loss_part If the marked node is not conducive to the training of the global model, then the node will not participate in the global aggregation in this round; otherwise, it will participate in the global aggregation in this round.
6. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that, The set of nodes The model weights of the middle nodes are subjected to Fast Fourier Transform, as shown in the following formula: In the formula, For nodes Model weights; The formula for calculating the amplitude of each frequency component is as follows: The model weights for reconstructing nodes using the inverse fast Fourier transform are calculated using the following formula:
7. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 4, characterized in that, The S50 includes: The node set The contribution of a node is represented by the inner product of the node's loss function gradient and the global loss function gradient, as shown in the following formula: Combining the contribution of each node and softmax The function assigns scores to each node, as shown in the following formula: The server assigns model weights to each node after reconstruction based on the scoring results. Attention aggregation is performed to obtain the global weights. The formula is as follows: global model weights The weights are sent to each node as the initial model weights for each node in the next round of learning.
8. The federated learning method for non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that, The S60 includes: For nodes with a contribution of less than zero, the server adjusts the formula as follows: In the formula, For nodes in this round of global aggregation i The probability of being selected. For nodes i The magnitude of the reduced selection probability in the next round of global aggregation It is a node i The ratio of the number of times something was marked to the number of times it was selected. Hyperparameters; The server adjusts the parameters for nodes with a contribution greater than zero and nodes not selected in this round using the following formula:
Citation Information
Patent Citations
Multi-device gastritis image federated learning method based on TopN queue and weight FFT transformation
CN116029984A
Federal learning method based on Shapley value
CN116205311A