A method and system for federated learning in unstable scenarios
By selecting a subset of edge nodes for pre-training in federated learning and using a buffer queue and dynamic learning rate, the problem of poor training results caused by unstable edge node communication is solved, achieving a more efficient and stable model training process.
Patent Information
- Application Number
- CN202310154809.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-02-22
AI Technical Summary
In federated learning, the communication instability of edge nodes leads to poor training results and even model non-convergence.
A sampling strategy is used to select M edge nodes for pre-training, and a buffer queue mechanism and dynamic learning rate are used for model aggregation. The global model is initialized by the server and the local model is received within a set time. Top-level nodes are added to replace faulty nodes, and the learning rate is dynamically adjusted to improve training efficiency and robustness.
It improves model training efficiency and system robustness, reduces the impact of communication latency on overall system performance, and ensures effective training and convergence of the model in unstable scenarios.
Smart Images

Figure CN116108933B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and system for federated learning in unstable scenarios. Background Technology
[0002] With the rapid development of artificial intelligence, wireless communication, and the Internet of Things, intelligent applications such as voice recognition, autonomous driving, and smart healthcare have been widely adopted in daily life and industrial scenarios. Traditional centralized machine learning methods transmit user data to cloud servers for centralized training, resulting in intolerable communication costs and latency, and user data will inevitably be subject to privacy leaks during transmission.
[0003] Federated learning can avoid privacy leaks. Federated learning is a training paradigm that allows different edge nodes to jointly learn a global model without sharing their own data. However, in federated learning, edge nodes are typically a large number of mobile or IoT devices with varying computing and communication capabilities. Due to the sheer number and diverse architectures of these edge nodes, there is significant heterogeneity in system resources such as computing power, communication conditions, and the number of data samples on each edge node. This heterogeneity is called system heterogeneity. System heterogeneity can lead to significant differences in training time within the same round of the federated learning process; that is, training throughput is often limited by edge nodes with lower computing power or slower communication speeds. Furthermore, unstable communication among edge nodes during training can also worsen the training results. Even worse, if multiple edge nodes participating in the training have unstable communication, the model may fail to converge. Summary of the Invention
[0004] To address the problem of poor model training performance during federated learning due to unstable communication between edge nodes, this invention provides a method and system for federated learning in unstable scenarios.
[0005] On the one hand, this invention provides a method for federated learning in unstable scenarios, including:
[0006] Step 1: Determine the sampling strategy based on the amount of data, computing power, and network bandwidth required to train the local model;
[0007] Step 2: Select M edge nodes from all candidate edge nodes according to the sampling strategy, and pre-train the selected edge nodes; M = 70% of all candidate edge nodes;
[0008] Step 3: The server initializes the global model;
[0009] Step 4: When the fault node list is not empty, select the top-level node from the fault node list and add it to the M edge nodes participating in the training; the top-level node refers to the edge node that is first added to the fault node list.
[0010] Step 5: The edge node performs local training based on the local data and the received global model to obtain a new local model, and then uploads the local model to the server;
[0011] Step 6: If the server receives a local model from an edge node within a set time period, it will aggregate the local model into the global model; otherwise, the edge node that has not returned a local model will be added to the list of faulty nodes.
[0012] Step 7: Repeat steps 4 to 6 until the termination condition is met, then output the global model at this point.
[0013] Furthermore, in step 1, the sampling strategy S is determined according to formula (1):
[0014]
[0015] Where α is the size of the training model, κ is the memory size required by the training model, N is the network bandwidth required by the training model, C is the computing power required by the training model, and D is the amount of data required by the training model.
[0016] Furthermore, the pre-training in step 2 specifically includes:
[0017] Step 2.1: Server initializes global model w p The global model w p Send to the selected M edge nodes;
[0018] Step 2.2: During the t-th round of training, edge node i performs local training based on local data and the received global model, updates the local model, and returns the local model to the server; i = 1, 2, ..., M;
[0019] Step 2.3: During the t-th round of training, within a set time period T... r Within the system, the server records all local models and aggregates them to obtain a new global model, recording the response time R of edge node i in round t. i,t And update the average response time of edge node i. And add the edge nodes that did not provide feedback to the local model to the list of faulty nodes;
[0020] Step 2.4: Repeat steps 2.2 to 2.3 until the set number of iterations S is reached.
[0021] Furthermore, the server aggregates the local model into the global model according to formula (2):
[0022]
[0023] Where t represents the training round, γ cyc Indicates the dynamic learning rate. As weight, ω represents the updated model parameters returned by edge node i. t+1 This represents the global model parameters after aggregation and updating.
[0024] Furthermore, the dynamic learning rate γ is determined according to formula (3). cyc The possible values of:
[0025]
[0026] Where, γ fix denoted by a, where a represents the fixed learning rate, a represents the amplitude, i represents the edge node, t represents the training epoch, and f represents the frequency.
[0027] On the other hand, the present invention provides a system for federated learning in unstable scenarios, comprising:
[0028] The sampling module, located on the server side, is used to determine the sampling strategy based on the amount of data, computing power, and network bandwidth required for training the local model, and to select M edge nodes from all candidate edge nodes according to the sampling strategy; M = 70% of all candidate edge nodes;
[0029] The pre-training module, located on the server side, is used to pre-train selected edge nodes;
[0030] The server is used to initialize the global model. When the fault node list is not empty, it selects the top-level node from the fault node list and adds it to the M edge nodes participating in training. Within a set time period, if a local model is received from an edge node, the local model is aggregated into the global model; otherwise, the edge node that has not returned a local model is added to the fault node list. The top-level node refers to the edge node that is first added to the fault node list.
[0031] Edge nodes are used to perform local training based on local data and the received global model to obtain a new local model, and then upload the local model to the server.
[0032] The beneficial effects of this invention are:
[0033] This invention is applicable to federated learning environments with significant system heterogeneity. In real-world scenarios, a complete federated learning process may involve millions of participants. Faced with such large-scale distributed machine learning, the differences in system resources, such as computing power and communication status, among different participants are amplified. During federated learning, frequent communication is required between the client and the central server. In each round of training, the client needs to upload its locally updated model parameters to the central server for global training and optimization. The central server also needs to aggregate the model parameters from all participating clients and then send the updated global model back to the clients. In this process, even a small number of client communication delays or disconnections can have a crucial impact on the overall system performance. Compared to traditional federated learning, this invention significantly improves model training efficiency and system robustness by incorporating pre-training, buffer queue mechanisms, and a model aggregation method based on dynamic learning rates. Attached Figure Description
[0034] Figure 1 This is a flowchart illustrating a federated learning method for unstable scenarios provided by an embodiment of the present invention.
[0035] Figure 2 This is a schematic diagram of the pre-training process provided in an embodiment of the present invention;
[0036] Figure 3 This is a schematic diagram illustrating the use of a dynamic learning aggregation model by a server in an embodiment of the present invention. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0038] Example 1
[0039] like Figure 1 As shown, this embodiment of the invention provides a method for federated learning in unstable scenarios, including the following steps:
[0040] S101: Determine the sampling strategy based on the amount of data, computing power, and network bandwidth required to train the local model;
[0041] Specifically, the sampling strategy S is determined according to formula (1):
[0042]
[0043] Where α is the size of the training model, κ is the memory required by the training model, N is the network bandwidth required by the training model, C is the computing power required by the training model, and D is the amount of data required by the training model. α and κ are pre-defined constants. The transmission time of the model. Represents the client's computation time. This represents the training time of the model.
[0044] S102: As Figure 2 As shown, M edge nodes are selected from all candidate edge nodes according to the sampling strategy, and the selected edge nodes are pre-trained; M = 70% of all candidate edge nodes;
[0045] Through research, the inventors concluded that using all candidate edge nodes for training results in comparable convergence speeds for the global model compared to using 70% of all candidate edge nodes. Therefore, to conserve communication resources, this embodiment uses 70% of all candidate edge nodes for training. While random sampling can be used to select edge nodes, in real-world scenarios, different edge nodes have varying storage capacities, computing power, and network bandwidth. Furthermore, the data distribution of each edge node differs. When the heterogeneity among the edge nodes participating in training is sufficiently high, traditional random sampling strategies may lead to extremely slow training performance. Therefore, this embodiment of the invention also designs a new sampling strategy to further improve the training efficiency and accuracy of the global model.
[0046] The pre-training in step 2 specifically includes:
[0047] S1021: Server initializes global model w p The global model w p Send to the selected M edge nodes;
[0048] S1022: During the t-th round of training, edge node i performs local training based on local data and the received global model, updates the local model, and returns the local model to the server; i = 1, 2, ..., M;
[0049] S1023: During the t-th round of training, within a set time period T r Within the system, the server records all local models and aggregates them to obtain a new global model, recording the response time R of edge node i in round t. i,t And update the average response time of edge node i. The edge nodes that do not provide feedback on the local model are added to the list of faulty nodes. This method of receiving the local model is called a buffer queue mechanism.
[0050] S1024: Repeat steps S1022 to S1023 until the set number of iterations S is reached.
[0051] The average response time P of each edge node i,t All of these will be persistently recorded and updated with each round of global model updates to dynamically reflect the computing power of edge nodes and network performance.
[0052] The advantage of the buffer queue mechanism is that in the traditional federated learning process, even a small number of clients experiencing communication delays or disconnections can have a significant impact on the overall system performance. Adding a buffer queue mechanism can mitigate or even eliminate this problem.
[0053] S103: Server initializes global model w0;
[0054] S104: When the fault node list is not empty, select the top-level node from the fault node list and add it to the M edge nodes participating in the training; the top-level node refers to the edge node that is first added to the fault node list;
[0055] S105: Edge nodes perform local training based on local data and the received global model to obtain a new local model, and then upload the local model to the server;
[0056] Taking a certain edge node i as an example, after edge node i receives model w0, it stores data in its local data D. i The local model is then trained for S rounds and updated to obtain the local model. Then Return it to the server.
[0057] S106: During the set time period T r If the server receives a local model from an edge node, it aggregates that local model into the global model; otherwise, it adds the edge node that did not return a local model to the list of faulty nodes.
[0058] Specifically, in existing federated learning methods, the server uses a fixed learning rate when aggregating models, while the embodiment of this invention uses a dynamic learning rate. The server aggregates local models into the global model based on the dynamic learning rate according to formula (2):
[0059]
[0060] Where t represents the training round, γ cyc Indicates the dynamic learning rate. As weight, ω represents the updated model parameters returned by edge node i. t+1 This represents the global model parameters after aggregation and updating.
[0061] In this embodiment, the dynamic learning rate γ is determined according to formula (3). cyc The possible values of:
[0062]
[0063] Where, γ fix denoted by a, where a represents the fixed learning rate, a represents the amplitude, i represents the edge node, t represents the training epoch, and f represents the frequency.
[0064] Compared to a fixed learning rate, a dynamic learning rate can navigate local minima and saddle points using dynamic gradients. While this might have some short-term negative effects in the early stages of training, in a complete federated learning system, it can effectively reduce convergence time and communication frequency while maintaining training effectiveness, without any additional cost. A comparison of dynamic and fixed learning rates can be found in [link to comparison]. Figure 3 .
[0065] S107: Repeat steps S104 to S106 until the termination condition is met, then output the global model at this point.
[0066] Example 2
[0067] Corresponding to the above method, this embodiment of the invention provides a system for federated learning in unstable scenarios, including: a sampling module, a pre-training module, a server, and edge nodes; wherein, both the sampling module and the pre-training module are located on the server side.
[0068] The sampling module determines the sampling strategy based on the required data volume, computing power, and network bandwidth for training the local model, and selects M edge nodes from all candidate edge nodes according to the sampling strategy; M = 70% of all candidate edge nodes. The pre-training module is used to pre-train the selected edge nodes. The server initializes the global model; when the fault node list is not empty, it selects a top-level node from the fault node list and adds it to the M edge nodes participating in training, where the top-level node is the edge node first added to the fault node list; within a set time period, if a local model is received from an edge node, the local model is aggregated into the global model; otherwise, the edge node that has not returned a local model is added to the fault node list. Edge nodes are used to perform local training based on local data and the received global model to obtain a new local model, and then upload the local model to the server.
[0069] It should be noted that the system for federated learning in unstable scenarios provided in this embodiment of the invention is for implementing the above method embodiments. Its specific functions can be referred to the above method embodiments, and will not be repeated here.
[0070] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for federated learning in unstable scenarios, characterized in that, include: Step 1: Determine the sampling strategy based on the amount of data, computing power, and network bandwidth required to train the local model; Step 2: Select M edge nodes from all candidate edge nodes according to the sampling strategy, and pre-train the selected edge nodes; M = 70% of all candidate edge nodes; Step 3: The server initializes the global model; Step 4: When the fault node list is not empty, select the top-level node from the fault node list and add it to the M edge nodes participating in the training; the top-level node refers to the edge node that is first added to the fault node list. Step 5: The edge node performs local training based on the local data and the received global model to obtain a new local model, and then uploads the local model to the server; Step 6: If the server receives a local model from an edge node within a set time period, it will aggregate the local model into the global model. Conversely, edge nodes that do not return to the local model are added to the list of faulty nodes; Step 7: Repeat steps 4 to 6 until the termination condition is met, then output the global model at this point.
2. The method for federated learning in unstable scenarios according to claim 1, characterized in that, In step 1, the sampling strategy S is determined according to formula (1): Where α is the size of the training model, κ is the memory size required by the training model, N is the network bandwidth required by the training model, C is the computing power required by the training model, and D is the amount of data required by the training model.
3. The method for federated learning in unstable scenarios according to claim 2, characterized in that, The pre-training in step 2 specifically includes: Step 2.1: Server initializes global model w p The global model w p Send to the selected M edge nodes; Step 2.2: During the t-th round of training, edge node i performs local training based on local data and the received global model, updates the local model, and returns the local model to the server; i = 1, 2, ..., M; Step 2.3: During the t-th round of training, within a set time period T... r Within the system, the server records all local models and aggregates them to obtain a new global model, recording the response time R of edge node i in round t. i,t And update the average response time of edge node i. And add the edge nodes that did not provide feedback to the local model to the list of faulty nodes; Step 2.4: Repeat steps 2.2 to 2.3 until the set number of iterations S is reached.
4. The method for federated learning in unstable scenarios according to claim 1, characterized in that, In step 6, the server aggregates the local model into the global model according to formula (2): Where t represents the training round, γ cyc Indicates the dynamic learning rate. As weight, ω represents the updated model parameters returned by edge node i. t+1 This represents the global model parameters after aggregation and updating.
5. The method for federated learning in unstable scenarios according to claim 4, characterized in that, Determine the dynamic learning rate γ according to formula (3). cyc The possible values of: Where, γ fix denoted by a, where a represents the fixed learning rate, a represents the amplitude, i represents the edge node, t represents the training epoch, and f represents the frequency.
6. A system for federated learning in unstable scenarios, characterized in that, include: The sampling module, located on the server side, is used to determine the sampling strategy based on the amount of data, computing power, and network bandwidth required for training the local model, and to select M edge nodes from all candidate edge nodes according to the sampling strategy; M = 70% of all candidate edge nodes; The pre-training module, located on the server side, is used to pre-train selected edge nodes; The server is used to initialize the global model; when the list of faulty nodes is not empty, it selects the top-level node from the list of faulty nodes and adds it to the M edge nodes participating in training; within a set time period, if a local model of an edge node is received, it aggregates the local model into the global model. Conversely, edge nodes that do not return to the local model are added to the list of faulty nodes; the top-level node refers to the edge node that was first added to the list of faulty nodes. Edge nodes are used to perform local training based on local data and the received global model to obtain a new local model, and then upload the local model to the server.
Citation Information
Patent Citations
Distributed data processing method and device, computer equipment and storage medium
CN111784002A
Network fault prediction method and device based on self-supervised target perception neural network
CN115051929A