Federal learning method for non-independent identically distributed data in edge intelligent controller
By selecting a subset of nodes that are conducive to global model training in the edge intelligent controller, and frequency component analysis and reconstruction of node model weights, and global aggregation is carried out in combination with the attention mechanism, the problem of inefficient federated learning training on non-independent homogeneous data samples is solved, and more efficient model training and faster convergence speed is achieved.
Patent Information
- Application Number
- CN202411686244.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In the non-independent homogeneous data samples, traditional federated learning has problems such as low model training efficiency and slow convergence speed, and the existing research methods have limited results.
A federated learning method for non-independent and homogeneous data in edge intelligent controllers is proposed. By selecting a subset of nodes that pre-participate in global aggregation, the contribution of each node to the convergence of the global model is calculated, the subset of nodes that truly participate in this round of global aggregation is selected, and the node model weights are analyzed and reconstructed, and the global aggregation is carried out in combination with the attention mechanism.
This improves the training efficiency of federated learning when facing non-independent homogeneous data samples, enhances the utilization efficiency of computing resources, and improves the convergence speed and training effect of the global model.
Smart Images

Figure CN119623671A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of federated learning optimization, and in particular relates to a federated learning method for non-independent and identically distributed data in an edge intelligent controller. Background Art
[0002] Edge intelligent controllers (EICs) are widely used to monitor and control smart manufacturing processes in the Industrial Internet of Things (IIOT). In IIOT, a large amount of industrial sensor data is continuously generated, and this data often contains sensitive information. For network bandwidth and data privacy protection considerations, it is impractical and usually unnecessary to send all the data to the edge server (ES). The emerging technology of mobile edge computing (MEC) makes local data storage and processing with global coordination possible, where edge nodes, such as sensors, home gateways, microservers, and small units, 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 local model weights are sent to servers instead of sending raw data to servers. This variant of distributed machine learning is called federated learning. This approach not only protects user privacy, but also reduces the overhead of data transmission. When applying federated learning in IIOT, EIC plays the role of an edge node with storage and computing capabilities, and ES plays the role of a server. To comply with the general description of federated learning and ensure the consistency of the text, edge nodes or nodes are used to refer to EIC, and servers are used to refer to ES. In real-world scenarios, the data on each node participating in federated learning is usually not extracted from the same distribution. This is different from the independent and identically distributed (IID) data assumption of traditional centralized machine learning. However, when faced with non-independent and identically distributed (Non-IID) data samples, traditional federated learning has problems such as low model training efficiency and slow convergence.
[0003] At present, some progress has been made in the research on the application of federated learning training models on non-IID data samples at home and abroad, but there are still some problems. The main problems include: (1) Traditional federated learning selects all nodes in the node space to participate in global aggregation. When the distribution of data samples of each node is non-IID, some nodes are not conducive to the training of the global model, which will make the model training inefficient and slow. (2) When training models on non-IID samples, each local model is easily affected by different noises, resulting in redundant components in the model weights. The redundant parts of the model weights of each node also participate in the global aggregation of the model. Too many redundant components that are useless for model training occupy limited edge computing resources to a large extent, making the global model training inefficient. (3) Some existing studies combine the attention mechanism in global aggregation to improve the training efficiency of the model. 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-IID data samples.
[0004] As mentioned above, the application of federated learning on non-IID data samples has the problem of low model training efficiency, and the existing research methods have achieved very limited results on this issue. However, in practical applications, data samples on different edge nodes are often non-IID. 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-IID data samples.
[0005] In deep learning, it is a common research method to convert data sample features into the frequency domain to extract important features. Inspired by this, it is worthwhile to analyze the frequency components of node model weights and reconstruct node model weights in federated learning to improve model training results. At the same time, existing studies have shown that it is feasible to improve training efficiency by adjusting the global aggregation strategy based on the contribution of nodes to global model training, but the effect of existing methods is limited. Therefore, how to better characterize the contribution of nodes to global model training to better improve training results is also one of the research focuses. Summary of the invention
[0006] In view of the above-mentioned defects of the prior art, the present invention proposes a federated learning method for non-independent and identically distributed data in an edge intelligent controller. The technical solution steps designed by the present invention include:
[0007] S10: Select a subset of nodes S that pre-participate in global aggregation t ;
[0008] S20: In the node subset S t Select nodes to perform local training of the model, and send the model weights and gradients of the loss function to the server;
[0009] S30: Calculate the contribution of each node to the convergence of the global model and select the node subset that actually participates in this round of global aggregation
[0010] S40: In the node subset Select nodes and reconstruct the model weights of the nodes;
[0011] S50: Based on node subset The contribution values of the midpoint nodes are used to assign points to the nodes and globally aggregated 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 includes:
[0014] The server selects nodes based on the probability adjusted in the previous round of training. Select the node subset S that pre-participates in the global aggregation in this round t , the initial probability of each node being selected in the first round of training Defined as the number of nodes in the node space concentration The reciprocal of
[0015] Preferably, the S30 includes:
[0016] The server receives the model weights and gradients of the loss function sent by each node. The server calculates the global loss function and solves the gradient. It finds 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. Nodes with a contribution less than zero are considered to be unfavorable to global aggregation and are marked by the server. The marked nodes are tested and the marked nodes that are not conducive to global aggregation are excluded to obtain the set of nodes that truly participate in global aggregation.
[0017] Preferably, the global loss function is calculated as follows:
[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, w t is the model weight.
[0020] Preferably, the contribution of the node to the convergence of the global model is represented by the following formula:
[0021]
[0022] In the formula, is the gradient of the loss function 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: using a federated average algorithm to calculate the global model weights of the marked nodes and the global weights of the marked nodes;
[0025] S3002: using the global model weights without excluding the marked nodes and the global weights excluding the marked nodes, respectively updating the model weights and respectively testing on the same test set, and obtaining the loss function loss_all for global aggregation without excluding the marked nodes and the loss function loss_part for global aggregation excluding the marked nodes;
[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 includes:
[0028] The server confirms the set of nodes that actually participate in the global aggregation Node Set The model weights of the middle nodes are subjected to fast Fourier transform, the amplitude of each frequency component is calculated, and the frequency components with amplitudes greater than the threshold are regarded as the main components. After retaining the main components, the inverse fast Fourier transform is performed to reconstruct the model weights of the nodes;
[0029] The node set The model weights of the mid-nodes are fast Fourier transformed, and the formula is as follows:
[0030]
[0031] In the formula, is the model weight of node i;
[0032] The formula for calculating the amplitude of each frequency component is as follows:
[0033]
[0034] The model weight of the node reconstructed by inverse fast Fourier transform is as follows:
[0035]
[0036] Preferably, the S50 includes:
[0037] The node subset The contribution value of the midpoint is represented by the inner product of the node loss function gradient and the global loss function gradient, and the formula is as follows:
[0038]
[0039] Combine the contribution of each node and the softmax function to assign points to each node. The formula is as follows:
[0040]
[0041] The server reconstructs the model weights of each node according to the scoring results. Perform attention aggregation to obtain the global weight w t , the formula is as follows:
[0042]
[0043] The global model weight w t Sent to each node as the initial model weight of each node in the next round of learning.
[0044] Preferably, the S60 includes:
[0045] For nodes whose contribution is less than zero, the adjustment formula is as follows:
[0046]
[0047] In the formula, is the probability of node i being selected in this round of global aggregation, is the probability of node i being selected in the next round of global aggregation, x is the ratio of the number of times node i is marked to the number of times it is selected, and α and β are hyperparameters;
[0048] The server adjusts the nodes whose contribution is greater than zero and the nodes that are not selected in this round with the following formula:
[0049]
[0050] Beneficial effects:
[0051] 1. The federated learning algorithm proposed in this application challenges the aggregation method of selecting all nodes to participate in global aggregation in the traditional federated learning algorithm. The proposed algorithm selectively selects nodes that are conducive to global model training to participate in global aggregation instead of all nodes participating in global aggregation based on the characteristics of non-independent and identically distributed data;
[0052] 2. This 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 removes the components with small 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. This application proposes to combine the inner product of the node loss function gradient and the global loss function gradient with the attention mechanism, based on which an attention aggregation optimization algorithm is formed, which is more efficient and more conducive to the aggregation of the global model than the traditional federated average aggregation method. At the same time, the proposed attention mechanism has better effects than the traditional attention mechanism;
[0054] 4. The algorithm of the present application will dynamically adjust the probability of each node being selected to participate in the global aggregation in the next round of global aggregation according to whether the node is conducive to the global model training after each round of global aggregation. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of a preferred embodiment of the present invention;
[0056] Figure 2 It is a flowchart of the marked node test exclusion according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0057] The embodiments of the present invention are described in detail below. The following embodiments are implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operation processes are given, but the protection scope of the present invention is not limited to the following embodiments.
[0058] The present invention designs a federated learning method for non-independent and identically distributed data in an edge intelligent controller. Aiming at the problem of slow model convergence encountered when applying federated learning on non-independent and 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 the global aggregation and reconstructs the weights. Finally, the weights of the nodes participating in the global aggregation are scored according to the contribution of different nodes to the global convergence, and attention aggregation is performed according to the scoring results to obtain the global weight of the model, so as to improve the training efficiency of federated learning when facing non-independent and identically distributed data samples. The technical solution includes the following steps, such as Figure 1 As shown, specifically including:
[0059] S10: Select a subset of nodes S that pre-participate in global aggregation t ;
[0060] S20: In the node subset S t Select nodes to perform local training of the model, and send the model weights and gradients of the loss function to the server;
[0061] S30: Calculate the contribution of each node to the convergence of the global model and select the node subset that actually participates in this round of global aggregation
[0062] S40: In the node subset Select nodes and reconstruct the model weights of the nodes;
[0063] S50: Based on node subset The contribution values of the midpoint nodes are used to assign points to the nodes and globally aggregated to obtain the global model weight;
[0064] S60: Adjust the probability of each node being selected in the next round of training.
[0065] Preferably, S10 includes:
[0066] The server selects nodes based on the probability adjusted in the previous round of training. Select the node subset S that pre-participates in the global aggregation in this round t , the initial probability of each node being selected in the first round of training Defined as the number of nodes in the node space concentration The reciprocal of
[0067] Preferably, S30 includes:
[0068] The server receives the model weights and gradients of the loss function sent by each node. The server calculates the global loss function and solves the gradient. It finds 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. Nodes with a contribution less than zero are considered to be unfavorable to global aggregation and are marked by the server. The marked nodes are tested and the marked nodes that are not conducive to global aggregation are excluded to obtain the set of nodes that truly participate in global aggregation.
[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 of node i, w t is the model weight.
[0072] Preferably, the contribution of a node to the convergence of the global model is represented by the following formula:
[0073]
[0074] In the formula, is the gradient of the loss function of node i, is the global loss function gradient.
[0075] Preferably, if Figure 2 As shown, testing the marked nodes and excluding the marked nodes that are not conducive to global aggregation includes the following steps:
[0076] S3001: using a federated average algorithm to calculate the global model weights of the marked nodes and the global weights of the marked nodes;
[0077] S3002: using the global model weights without excluding the marked nodes and the global weights excluding the marked nodes, respectively updating the model weights and respectively testing on the same test set, and obtaining the loss function loss_all for global aggregation without excluding the marked nodes and the loss function loss_part for global aggregation excluding the marked nodes;
[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 set of nodes that actually participate in the global aggregation Node Set The model weights of the middle nodes are subjected to fast Fourier transform, the amplitude of each frequency component is calculated, and the frequency components with amplitudes greater than the threshold are regarded as the main components. After retaining the main components, the inverse fast Fourier transform is performed to reconstruct the model weights of the nodes;
[0081] Node Set The model weights of the mid-nodes are fast Fourier transformed, and the formula is as follows:
[0082]
[0083] In the formula, is the model weight of node i;
[0084] Calculate the amplitude of each frequency component using the following formula:
[0085]
[0086] Perform inverse fast Fourier transform to reconstruct the model weight of the node. The formula is as follows:
[0087]
[0088] Specifically, the threshold is defined as 0.00001 times the average amplitude (a near optimal value after experimental exploration):
[0089]
[0090] Filter out frequency components with amplitudes less than the threshold, retain the main frequency components and perform inverse fast Fourier transform to obtain new weights
[0091] Preferably, S50 includes:
[0092] Node Subset The contribution value of the midpoint is represented by the inner product of the node loss function gradient and the global loss function gradient, and the formula is as follows:
[0093]
[0094] Combine the contribution of each node and the softmax function to assign points to each node. The formula is as follows:
[0095]
[0096] The server reconstructs the model weights of each node according to the scoring results. Perform attention aggregation to obtain the global weight w t , the formula is as follows:
[0097]
[0098] The global model weight w t Sent to each node as the initial model weight of each node in the next round of learning.
[0099] Preferably, S60 includes:
[0100] For nodes whose contribution is less than zero, the adjustment formula is as follows:
[0101]
[0102] In the formula, is the probability of node i being selected in this round of global aggregation, is the probability of node i being selected in the next round of global aggregation, x is the ratio of the number of times node i is marked to the number of times it is selected, and α and β are hyperparameters;
[0103] The server adjusts the nodes whose contribution is greater than zero and the nodes that are not selected in this round with the following formula:
[0104]
[0105] Specifically, the final probability adjustment plan is unified as follows:
[0106]
[0107] And in the next round of global aggregation, the server selects a set of nodes to pre-participate in the next round of global aggregation according to the adjusted selection probability of each node.
[0108] The preferred specific embodiments of the present invention are described in detail above. It should be understood that ordinary technicians in the field can make many modifications and changes based on the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by technicians in the technical field based on the concept of the present invention through logical analysis, reasoning or limited experiments on the basis of the prior art should be within the scope of protection 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: The following steps are involved: S10: Select a subset of nodes S that pre-participate in global aggregation t ; S20: In the node subset S t Select nodes to perform local training of the model 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 node subset that actually participates in this round of global aggregation S40: In the node subset Select nodes and reconstruct the model weights of the nodes; S50: Based on node subset The contribution values of the midpoint nodes are used to assign points to the nodes and globally aggregated to obtain the global model weight; S60: Adjust the probability of each node being selected in the next round of training.
2. According to claim 1, a federated learning method for non-independent and identically distributed data in an edge intelligent controller is characterized in that: The S10 includes: The server selects nodes based on the probability adjusted in the previous round of training. Select the node subset S that pre-participates in the global aggregation in this round t , the initial probability of each node being selected in the first round of training Defined as the number of nodes in the node space concentration The reciprocal of 3. According to claim 1, a federated learning method for non-independent and identically distributed data in an edge intelligent controller is characterized in that: The S30 includes: The server receives the model weights and gradients of the loss function sent by each node. The server calculates the global loss function and solves the gradient. It finds 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. Nodes with a contribution less than zero are considered to be unfavorable to global aggregation and are marked by the server. The marked nodes are tested and the marked nodes that are not conducive to global aggregation are excluded to obtain the set of nodes that truly participate in global aggregation.
4. According to claim 3, a federated learning method for non-independent and identically distributed data in an edge intelligent controller is characterized in that: The global loss function is calculated as follows: 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, w t is the model weight.
5. The method for federated learning of non-independent and identically distributed data in an edge intelligent controller according to claim 4, characterized in that: The contribution of the node to the convergence of the global model is expressed as follows: In the formula, is the gradient of the loss function of node i, is the global loss function gradient.
6. The method for federated learning of non-independent and identically distributed data in an edge intelligent controller according to claim 3, characterized in that: The step of testing the marked nodes and excluding the marked nodes that are not conducive to global aggregation includes the following steps: S3001: using a federated average algorithm to calculate the global model weights of the marked nodes and the global weights of the marked nodes; S3002: using the global model weights without excluding the marked nodes and the global weights excluding the marked nodes, respectively updating the model weights and respectively testing on the same test set, and obtaining the loss function loss_all for global aggregation without excluding the marked nodes and the loss function loss_part for global aggregation excluding the marked nodes; 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.
7. The method for federated learning of non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that: The S40 includes: The server confirms the set of nodes that actually participate in the global aggregation Node Set The model weights of the middle nodes are subjected to fast Fourier transform, the amplitude of each frequency component is calculated, and the frequency components with amplitudes greater than the threshold are regarded as the main components. After retaining the main components, the inverse fast Fourier transform is performed to reconstruct the model weights of the nodes; The node set The model weights of the mid-nodes are fast Fourier transformed, and the formula is as follows: In the formula, is the model weight of node i; The formula for calculating the amplitude of each frequency component is as follows: The model weight of the node reconstructed by inverse fast Fourier transform is as follows:
8. The method for federated learning of non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that: The S50 includes: The node subset The contribution value of the midpoint is represented by the inner product of the node loss function gradient and the global loss function gradient, and the formula is as follows: Combine the contribution of each node and the softmax function to assign points to each node. The formula is as follows: The server reconstructs the model weights of each node according to the scoring results. Perform attention aggregation to obtain the global weight w t , the formula is as follows: The global model weight w t Sent to each node as the initial model weight of each node in the next round of learning.
9. The method for federated learning of non-independent and identically distributed data in an edge intelligent controller according to claim 1, characterized in that: The S60 includes: For nodes whose contribution is less than zero, the adjustment formula is as follows: In the formula, is the probability of node i being selected in this round of global aggregation, is the probability of node i being selected in the next round of global aggregation, x is the ratio of the number of times node i is marked to the number of times it is selected, α and β are hyperparameters; The server adjusts the nodes whose contribution is greater than zero and the nodes that are not selected in this round with 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
Federal learning method, device and system
CN118709804A
Decentralized federated learning method and system and related equipment
CN118982064A
Cited By
Protected training of private adapter models for a hosted foundation model
US20260006052A1