Environment-friendly federated learning-based model training method, system and equipment and medium
By introducing carbon emission factors and deep Q network algorithms to select nodes in federated learning, the problems of energy consumption and carbon emissions in artificial intelligence model training are solved, and environmentally friendly and efficient model training is achieved.
Patent Information
- Application Number
- CN202510414502.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-01
AI Technical Summary
The existing technology fails to effectively consider energy consumption and carbon emissions in artificial intelligence model training, resulting in poor environmental protection.
By introducing carbon emission factors, model difference values, training power and training duration as screening criteria in federated learning, some nodes are selected for training using the deep Q network algorithm, and combining iterative update mechanisms to optimize node selection and model training.
It reduces unnecessary resource consumption and carbon emissions, while ensuring the training quality and generalization capabilities of the model, and improving the system's response speed and flexibility.
Smart Images

Figure CN120409893A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of machine learning and low carbon, and particularly relates to a model training method, system, device and medium based on environmentally friendly federated learning. Background Art
[0002] With the rapid development of artificial intelligence technology, federated learning, as an emerging distributed machine learning paradigm, promotes knowledge sharing and model training across devices or organizations while protecting data privacy. In the federated learning framework, a large number of distributed nodes (such as smartphones, Internet of Things devices, data centers, etc.) cooperate to participate in the model training process. Each node holds local data and updates the model locally, and only uploads the updated model parameters or gradient information to the central server for aggregation, thus effectively avoiding the risk of privacy leakage caused by directly transmitting the original data.
[0003] However, with the sharp increase in the number of parameters of artificial intelligence models, the energy consumption required for model training, especially the power consumption, has also increased sharply, resulting in a sharp increase in the carbon emissions required to generate electricity. Currently, the training of artificial intelligence models often only focuses on improving indicators such as model accuracy and precision, lacking consideration of the carbon emissions generated by the electricity consumed during the training process, which is not conducive to the realization of environmental protection. Summary of the Invention
[0004] Aiming at the deficiencies of the prior art, the present application provides a model training method, system, device and medium based on environmentally friendly federated learning, which reduces the carbon emissions generated by the consumed electricity while ensuring the model training accuracy and efficiency.
[0005] To achieve the above object, in a first aspect, the present invention provides a model training method based on environmentally friendly federated learning, which is applicable to a central node and includes:
[0006] Obtain the node models and sampled data of each node; wherein, the sampled data includes the carbon emission factor, training power and training duration of each node;
[0007] Take any one of the node models as the global model;
[0008] Iteratively update the global model of the central node according to the execution model corresponding to the currently selected node until the number of updates reaches a preset threshold, and output the global model of the current iteration;
[0009] Wherein, the execution model is the model returned by the currently selected node after executing the training task on the local data; after each iteration, update the currently selected node according to the current global model, the sampled data of each node and the current node models of each node.
[0010] Compared with the prior art, the embodiments of the present application have the following beneficial effects: Obtaining the node models and sampling data of each node ensures that all nodes participating in federated learning have the opportunity to contribute their data and models. Through the sampling data including carbon emission factors, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes for subsequent training and promotes green computing; Selecting any node model as the initial global model can quickly start the federated learning process, avoiding complex model initialization operations, improving the system's response speed and flexibility. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model; By introducing the model difference value, model training power, training duration, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, reducing unnecessary resource consumption and carbon emissions while ensuring the training quality; Regularly updating the selected nodes can enable the system to dynamically adapt to changes in node status, ensuring that the optimal nodes are always involved in training. The iterative training and model update mechanism ensure that the finally output global model can receive effective information obtained by each node through local data training, guaranteeing the generalization ability and accuracy of the model.
[0011] In some embodiments of the first aspect of the present application, after each iteration, according to the current global model, the sampling data of each node, and the current node model of each node, updating the currently selected nodes includes:
[0012] Calculating the difference value between the current node model of each node and the current global model;
[0013] According to the difference value between the current node model of each node and the current global model, as well as the carbon emission factor, training power, and training duration of each node model, calculating an input vector;
[0014] Processing the input vector according to a preset reinforcement learning algorithm to obtain each selected node.
[0015] Compared with the prior art, the above embodiments have the following beneficial effects: By introducing the model difference value, model training power, training duration, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, reducing unnecessary resource consumption and carbon emissions while ensuring the training quality. Regularly updating the selected nodes can enable the system to dynamically adapt to changes in node status, ensuring that the optimal nodes are always involved in training.
[0016] In some embodiments of the first aspect of the present application, the calculation formula for the difference value between the current node model and the current global model of each node is as follows:
[0017] ∈ i =||θ i -θ ′ ||2, where ∈ i ∈R represents the L2 norm difference between the global model and the node model of node i, θ ′ ∈R d represents the global model, θ i ∈R d represents the model of node i, and R d represents a d-dimensional vector.
[0018] Compared with the prior art, the above embodiments have the following beneficial effects: By calculating the model difference value, it helps to quantitatively compare the similarity between different node models and the global model, and helps to screen representative models.
[0019] In some embodiments of the first aspect of the present application, the expression of the input vector is:
[0020] x = [∈1,...,∈ N ,α1,...,α N ,p1,...p N ,t1,...t N , where N is a positive integer representing the number of each node, α i , p i , t i respectively represent the carbon emission factor, the normalized training power, and the normalized training duration required for one round of local training of node i, and ∈ i represents the difference value between the model of node i and the current global model.
[0021] Compared with the prior art, the above embodiments have the following beneficial effects: Considering the similarity between models, the performance and power consumption of each model, it provides an important input basis for subsequent node selection using the reinforcement learning algorithm, and helps to balance the requirements of model performance and environmental protection.
[0022] In some embodiments of the first aspect of the present application, processing the input vector according to a preset reinforcement learning algorithm to obtain each selected node includes:
[0023] Processing the input vector according to the deep Q-network algorithm to obtain each selected node, where the calculation formula is as follows: where M = {1,...,m} represents the set of each selected node, r is the reward function of the deep Q-network algorithm, Indicates the loss function calculated by the global model based on the partial sampled data of node i α i 、p i 、t i respectively represent the carbon emission factor of node i, the normalized training power, and the normalized training duration required for one round of local training. x represents the input vector.
[0024] Compared with the prior art, the above embodiments have the following beneficial effects: The deep Q-network algorithm can automatically learn the optimal node selection strategy, which not only improves the automation level of the federated learning system, but also can further optimize energy consumption and carbon emissions while ensuring the model training effect.
[0025] In some embodiments of the first aspect of the present application, the obtaining the node models and sampled data of each node includes:
[0026] Obtaining a set of node models of each node, denoted as: θ = {θ1,..., θ N};
[0027] Obtaining the sampled data, denoted as: α i ∈(0,1), p i ∈(0,1), t i ∈(0,1); where is the partial sampled data corresponding to node i, I.I.D() represents independent and identically distributed sampling, represents all the local data of node i.
[0028] Compared with the prior art, the above embodiments have the following beneficial effects: Obtaining the node models and sampled data of each node ensures that all nodes participating in the federated learning have the opportunity to contribute their data and models. Through the sampled data including the carbon emission factor, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes to participate in the training subsequently and promotes green computing.
[0029] In a second aspect, embodiments of the present application further provide a control system for environmentally friendly federated learning, including: a data acquisition module, a global selection module, a node screening module, and a global update module;
[0030] Among them, the data acquisition module is used to obtain the node models and sampled data of each node; among them, the sampled data includes the carbon emission factor, training power, and training duration of each node;
[0031] The global selection module is used to use any one of the node models as the global model;
[0032] The node screening module is used to update the current screened nodes according to the current global model, the sampling data of each node, and the current node models of each node after each iteration of updating the global model.
[0033] The global update module is used to iteratively update the global model of the central node according to the execution model corresponding to the current screened nodes until the number of updates reaches a preset threshold, and output the global model of the current iteration; wherein, the execution model is the model returned after the current screened nodes execute the training task on the local data.
[0034] Compared with the prior art, the embodiments of the present application have the following beneficial effects: Obtaining the node models and sampling data of each node ensures that all nodes participating in federated learning have the opportunity to contribute their data and models. Through the sampling data including carbon emission factors, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes to participate in training in the future and promotes green computing; Selecting any node model as the initial global model can quickly start the federated learning process, avoiding complex model initialization operations, improving the response speed and flexibility of the system. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model; By introducing the model difference value, model training power, training duration, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, which can ensure the training quality while reducing unnecessary resource consumption and carbon emissions; Regularly updating the screened nodes can enable the system to dynamically adapt to changes in node status, ensuring that there are always optimal nodes participating in training. The iterative training and model update mechanism ensure that the finally output global model can receive all the effective information obtained by each node through training on its local data, ensuring the generalization ability and accuracy of the model.
[0035] In some embodiments of the second aspect of the present application, the node screening module includes: a difference value calculation unit, an input vector calculation unit, and a reinforcement learning calculation unit;
[0036] The difference value calculation unit is used to calculate the difference value between the current node model of each node and the current global model.
[0037] The input vector calculation unit is used to calculate an input vector according to the difference value between the current node model of each node and the current global model, as well as the carbon emission factor, training power, and training duration of each node model.
[0038] The reinforcement learning calculation unit is used to process the input vector according to a preset reinforcement learning algorithm to obtain each screened node.
[0039] Compared with the prior art, the embodiments of the present application have the following beneficial effects: By introducing the model difference value, model training power, training duration required, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes being trained simultaneously, which can ensure the training quality while reducing unnecessary resource consumption and carbon emissions; Regularly updating the selected nodes can enable the system to dynamically adapt to changes in node status and ensure that the optimal nodes are always involved in training.
[0040] In a third aspect, the embodiments of the present application further provide an electronic device for model training based on environmentally friendly federated learning, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is loaded into the processor, the steps of the method for model training based on environmentally friendly federated learning are implemented.
[0041] In a fourth aspect, the embodiments of the present application further provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for model training based on environmentally friendly federated learning are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 : It is a schematic flowchart of a method for model training based on environmentally friendly federated learning provided in some embodiments of the present invention.
[0043] Figure 2 : It is a schematic structural diagram of a system for model training based on environmentally friendly federated learning provided in some embodiments of the present invention.
[0044] Figure 3 : It is a structural diagram of a device for model training based on environmentally friendly federated learning provided in some embodiments of the present invention.
[0045] Figure 4 : It is an architecture diagram of a method for model training based on environmentally friendly federated learning provided in some embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0047] Embodiment 1:
[0048] Please refer toFigure 1 , a model training method based on environmentally friendly federated learning provided by an embodiment of the present invention, applicable to a central node, includes steps S1 to S3:
[0049] Step S1: Obtain the node models and sampled data of each node.
[0050] In some embodiments of the present application, step S1 can be implemented by the following preferred implementation:
[0051] S11: Obtain the set of node models of each node, denoted as: θ = {θ1,..., θ N}; where θ i ∈R d represents the model of node i, R d represents a d-dimensional vector, N is a positive integer, representing the number of each node;
[0052] S12: Obtain the sampled data of each node, denoted as: α i ∈(0, 1), p i ∈(0, 1), t i ∈(0, 1); where, is the partial sampled data corresponding to node i, I.I.D() represents independent and identically distributed sampling, represents all the local data of node i, α i , p i , t i respectively represent the carbon emission factor, the normalized training power, and the normalized training duration required for one round of local training of node i.
[0053] In this embodiment, by obtaining the node models and sampled data of each node in step S1, it is ensured that all nodes participating in federated learning have the opportunity to contribute their data and models. Through the sampled data including the carbon emission factor, the impact of each node on the environment can be better understood, which helps to select more environmentally friendly nodes to participate in training in the follow-up and promotes green computing.
[0054] Step S2: Use any one of the node models as the global model.
[0055] In general federated learning, the global model can be obtained through pre-training or by randomly generating initial parameters. In this step S2, directly select one of the node models as the global model, which can quickly start the federated learning process, avoid complex model initialization operations, improve the response speed and flexibility of the system. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model.
[0056] Step S3: Iteratively update the global model of the central node according to the execution model corresponding to the current screening node until the number of updates reaches a preset threshold, and output the global model of the current iteration. After each iteration, update the current screening node according to the current global model, the sampling data of each node, and the current node model of each node; wherein, the execution model is the model returned after the current screening node executes the training task on the local data.
[0057] Preferably, the screening node can be updated through the following preferred implementation:
[0058] S31: Calculate the difference value between the current node model of each node and the current global model;
[0059] Furthermore, the calculation of the difference value can be achieved through the following calculation method:
[0060] ∈ i =||θ i -θ ′ ||2, where ∈ i ∈R represents the L2 norm difference between the global model and the node model of node i, θ ′ ∈R d represents the global model, θ i ∈R d represents the model of node i, and R d represents a d-dimensional vector.
[0061] S32: Calculate the input vector according to the difference value between the current node model of each node and the current global model, as well as the carbon emission factor, training power, and training duration of each node model;
[0062] Furthermore, the input vector can be expressed in the following way:
[0063] x = [∈1,...,∈ N ,α1,...,α N ,p1,...p N ,t1,...t N , where N is a positive integer representing the number of each node, and α i 、p i 、t i respectively represent the carbon emission factor, the normalized training power, and the normalized training duration required for one round of local training of node i.
[0064] S33: Process the input vector according to the preset reinforcement learning algorithm to obtain each screening node.
[0065] Furthermore, the reinforcement algorithm can adopt the deep Q-network algorithm, and the specific implementation is as follows:
[0066] Process the input vector according to the deep Q-network algorithm to obtain each screening node, where the calculation formula is as follows: where M = {1,..., m} represents the set of each screening node, r is the reward function of the deep Q-network algorithm, represents the loss function calculated by the global model based on the partial sampling data of node i calculated.
[0067] In step S3 of this embodiment, by introducing the model difference value, model training power, training duration required, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, which can ensure the training quality while reducing unnecessary resource consumption and carbon emissions; regularly updating the screening nodes can enable the system to dynamically adapt to changes in node states and ensure that there are always optimal nodes participating in training; the iterative training and model update mechanism ensure that the finally output global model can receive all the effective information obtained by each node through local data training, guaranteeing the generalization ability and accuracy of the model.
[0068] For example, as a possible implementation, as Figure 4 shown in the architecture diagram of a model training method for environmentally friendly federated learning:
[0069] Among them, the cloud server, as the central node, is responsible for collecting information such as the models and carbon emission factors of each distributed node, and selecting distributed nodes according to the deep Q-network algorithm during training;
[0070] The substation terminal, as an intermediate node, forwards information such as models and carbon emission factors to distributed nodes such as smart electricity meters;
[0071] In the smart electricity meter, the communication module is responsible for communicating with computing devices (NPU, GPU, etc.) through power line carrier, and the management unit stores information such as the carbon emission factors of this distributed node to provide the input information required for distributed node selection;
[0072] The computing device is responsible for storing and training the models of each distributed node.
[0073] In summary, compared with the prior art, the embodiments of the present application have the following beneficial effects: Obtaining the node models and sampling data of each node ensures that all nodes participating in federated learning have the opportunity to contribute their data and models. Through the sampling data including carbon emission factors, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes for subsequent training and promotes green computing; Selecting any node model as the initial global model can quickly start the federated learning process, avoiding complex model initialization operations, improving the system's response speed and flexibility. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model; By introducing the model difference value, model training power, training duration required, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, which can ensure the training quality while reducing unnecessary resource consumption and carbon emissions; Regularly updating the screened nodes can enable the system to dynamically adapt to changes in node status, ensuring that there are always optimal nodes participating in training. The iterative training and model update mechanism ensure that the finally output global model can receive effective information obtained by each node through local data training, guaranteeing the generalization ability and accuracy of the model.
[0074] Embodiment 2:
[0075] Please refer to Figure 2 , based on the same inventive concept, a control system for federated learning based on environmental protection disclosed in an embodiment of the present invention includes: a data acquisition module M1, a global selection module M2, a node screening module M3, and a global update module M4;
[0076] Among them, the data acquisition module M1 is used to obtain the node models and sampling data of each node.
[0077] The data acquisition module M1 includes: a model acquisition unit and a sampling data acquisition unit; the model acquisition unit is used to obtain a set of node models of each node; the sampling data acquisition unit is used to obtain the sampling data of each node.
[0078] Further, the model acquisition unit can be implemented through the following preferred embodiments:
[0079] Obtain a set of node models of each node, expressed as: θ = {θ1,..., θ N}; where θ i ∈R d represents the model of node i, R d represents a d-dimensional vector, and N is a positive integer representing the number of each node.
[0080] Further, the sampling data acquisition unit can be implemented through the following preferred embodiments:
[0081] Obtain sampling data, expressed as: α i ∈(0,1), p i ∈(0,1), t i ∈(0,1);
[0082] Among them, is the partial sampling data corresponding to node i, I.I.D() represents independent and identically distributed sampling, represents all the local data of node i, α i , p i , t i respectively represent the carbon emission factor, the normalized training power, and the normalized training duration required for one round of local training of node i.
[0083] The data acquisition module M1 in this embodiment ensures that all nodes participating in federated learning have the opportunity to contribute their data and models by obtaining the node models and sampling data of each node. Through the sampling data including the carbon emission factor, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes to participate in training in the subsequent stage and promotes green computing.
[0084] The global selection module M2 is used to take any one node model as the global model.
[0085] The global selection module M2 in this embodiment directly selects one of the node models in each node as the global model, which can quickly start the federated learning process, avoid complex model initialization operations, improve the response speed and flexibility of the system. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model.
[0086] The node screening module M3 is used to update the currently screened nodes according to the current global model, the sampling data of each node, and the current node models of each node after each iteration of updating the global model.
[0087] The node screening module M3 includes: a difference value calculation unit, an input vector calculation unit, and a reinforcement learning calculation unit; the difference value calculation unit is used to calculate the difference value between the current node model of each node and the current global model; the input vector calculation unit is used to calculate the input vector according to the difference value between the current node model of each node and the current global model, as well as the carbon emission factor, training power, and training duration of each node model; the reinforcement learning calculation unit is used to process the input vector according to the preset reinforcement learning algorithm to obtain each screened node.
[0088] Further, the difference value calculation unit can be implemented through the following preferred embodiments:
[0089] The calculation method is as follows: ∈ i = ||θ i - θ ′ ||2, where ∈ i ∈R represents the L2 norm difference between the global model and the node model of node i, and θ ′ ∈R d represents the global model.
[0090] Further, the input vector calculation unit can be implemented through the following preferred embodiments:
[0091] The expression of the input vector is as follows: x = [∈1,..., ∈ N , α1,..., α N , p1,... p N , t1,... t N .
[0092] Further, the reinforcement learning calculation unit can be implemented through the following preferred embodiments:
[0093] According to the deep Q-network algorithm, process the input vector to obtain each screening node, where the calculation formula is as follows: where M = {1,..., m} represents the set of each screening node, r is the reward function of the deep Q-network algorithm, represents the loss function calculated by the global model according to the partial sampling data of node i and the loss function.
[0094] The node screening module M3 of this embodiment screens out some nodes with high representativeness and low environmental burden for single training by introducing the model difference value, model training power, training duration, and environmental factors (such as carbon emission factors) as screening criteria, rather than training all nodes simultaneously, which can ensure the training quality while reducing unnecessary resource consumption and carbon emissions; regularly updating the screening nodes can enable the system to dynamically adapt to changes in node states and ensure that there are always optimal nodes participating in training.
[0095] The global update module M4 is used to iteratively update the global model of the central node according to the execution model corresponding to the current screening node until the number of updates reaches a preset threshold, and output the global model of the current iteration; where the execution model is the model returned after the current screening node executes the training task on the local data.
[0096] The global update module M4 of this embodiment ensures that the finally output global model can receive the effective information obtained by each node through local data training through an iterative training and model update mechanism, ensuring the generalization ability and accuracy of the model.
[0097] In summary, compared with the prior art, the embodiments of the present application have the following beneficial effects: obtaining the node models and sampled data of each node ensures that all nodes participating in federated learning have the opportunity to contribute their data and models. Through the sampled data including carbon emission factors, it is possible to better understand the impact of each node on the environment, which helps to select more environmentally friendly nodes for subsequent training and promotes green computing; selecting any node model as the initial global model can quickly start the federated learning process, avoiding complex model initialization operations, improving the response speed and flexibility of the system. At the same time, random selection helps to introduce diversity and improve the generalization ability of the model; by introducing the model difference value, model training power, training duration required, and environmental factors (such as carbon emission factors) as screening criteria, some nodes with high representativeness and low environmental burden are selected for single training instead of all nodes training simultaneously, ensuring the training quality while reducing unnecessary resource consumption and carbon emissions; regularly updating the selected nodes can enable the system to dynamically adapt to changes in node status, ensuring that the optimal nodes are always involved in training. The iterative training and model update mechanism ensures that the finally output global model can receive the effective information obtained by each node through local data training, ensuring the generalization ability and accuracy of the model.
[0098] The division of the above-described modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules can be combined or integrated into another system.
[0099] Embodiment 3:
[0100] Figure 3 The structure diagram of an electronic device for model training of a federated learning based on environmental protection according to the present application is shown. As Figure 3 shown, the model training device may include: a processor N1, a memory N2, a data interface N3, and a communication bus N4.
[0101] Among them: the processor N1, the memory N2, and the data interface N3 complete mutual communication through the communication bus N4; the data interface N3 is used for data communication with other additional devices; the processor N1 is used to execute the program N5, and specifically can execute the relevant steps in the above-mentioned method embodiment for model training of a federated learning based on environmental protection.
[0102] Specifically, the program N5 may include program code, and the program code includes computer executable instructions.
[0103] Processor N1 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. One or more processors included in the model training device for environmentally friendly federated learning may be of the same type of processor, such as one or more CPUs, or different types of processors, such as one or more CPUs and one or more ASICs.
[0104] Memory N2 is used to store program N5. Memory N2 may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
[0105] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. In addition, the embodiments of the present application are not directed to any particular programming language.
[0106] Embodiment 4:
[0107] The embodiment of the present invention also provides a computer-readable storage medium. The storage medium stores at least one executable instruction. When the executable instruction runs on the model training device / system for environmentally friendly federated learning, the model training device / system for environmentally friendly federated learning is caused to execute a model training method for environmentally friendly federated learning in any of the above method embodiments.
[0108] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present application may be practiced without these specific details. Similarly, in order to streamline the present application and assist in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. Among them, the claims following the specific implementation manners are hereby expressly incorporated into the specific implementation manners, where each claim itself serves as a separate embodiment of the present application.
[0109] Those skilled in the art can understand that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into a module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive.
Claims
1. A model training method based on environmentally friendly federated learning, characterized in that, Applicable to the central node, the training method includes: Obtain the node models and sampling data of each node; wherein, the sampling data includes the carbon emission factors, training power, and training duration of each node; Take any one of the node models as the global model; Iteratively update the global model of the central node according to the execution model corresponding to the currently selected node until the number of updates reaches a preset threshold, and output the global model of the current iteration; Wherein, the execution model is the model returned after the currently selected node executes the training task on the local data; after each iteration, update the currently selected node according to the current global model, the sampling data of each node, and the current node models of each node.
2. The model training method based on environmentally friendly federated learning according to claim 1, characterized in that, After each iteration, updating the currently selected node according to the current global model, the sampling data of each node, and the current node models of each node includes: Calculate the difference value between the current node model of each node and the current global model; Calculate the input vector based on the difference value between the current node model of each node and the current global model, as well as the carbon emission factors, training power, and training duration of each node model; Process the input vector according to a preset reinforcement learning algorithm to obtain each selected node.
3. The model training method based on environmentally friendly federated learning according to claim 2, characterized in that, The calculation formula for calculating the difference value between the current node model of each node and the current global model is: ∈ i = ||θ i - θ ′ ||², where ∈ i ∈ ℝ represents the L2 norm difference between the global model and the node model of node i, θ ′ ∈ ℝ d represents the global model, θ i ∈ ℝ d represents the model of node i, ℝ d represents a d-dimensional vector.
4. The model training method based on environmentally friendly federated learning according to claim 2, characterized in that, The expression of the input vector is: x = [∈1,...,∈ N , α1,..., α N , p1,... p N , t1,... t N , where N is a positive integer representing the number of each node, α i , p i , t i respectively represent the carbon emission factor, the normalized training power, and the normalized training duration required for one round of local training of node i, and ∈ i represents the difference value between the model of node i and the current global model.
5. The model training method based on environmentally friendly federated learning according to claim 2, characterized in that, Processing the input vector according to a preset reinforcement learning algorithm to obtain each selected node includes: Process the input vector according to the deep Q-network algorithm to obtain each screening node, where the calculation formula is as follows: where \(M = \{1, \ldots, m\}\) represents the set of each screening node, \(r\) is the reward function of the deep Q-network algorithm, represents the loss function calculated by the global model according to the partial sampling data of node \(i\), \(\alpha\), i \(p\), i \(t\), i respectively represent the carbon emission factor of node \(i\), the normalized training power, and the normalized training duration required for one round of local training, and \(x\) represents the input vector.
6. A model training method based on environmentally friendly federated learning according to any one of claims 1 to 5, characterized in that The obtaining of the node models and sampling data of each node includes: Obtain a set of node models for each node, expressed as: θ = {θ1,..., θ N}; Obtain the sampled data, expressed as: α i ∈(0,1), p i ∈(0,1), t i ∈(0,1); where is the partial sampled data corresponding to node i, and I.I.D() represents independent and identically distributed sampling, represents all the local data of node i.
7. A model training system based on environmentally friendly federated learning, characterized in that, Includes: A data acquisition module, a global selection module, a node screening module, and a global update module; Wherein, the data acquisition module is used to obtain the node models and sampling data of each node; wherein, the sampling data includes the carbon emission factors, training power, and training duration of each node; The global selection module is used to take any one of the node models as the global model; The node screening module is used to update the currently selected node according to the current global model, the sampling data of each node, and the current node models of each node after each iteration of updating the global model; The global update module is used to iteratively update the global model of the central node according to the execution model corresponding to the currently selected node until the number of updates reaches a preset threshold, and output the global model of the current iteration; wherein, the execution model is the model returned after the currently selected node executes the training task on the local data.
8. A model training system based on environmentally friendly federated learning according to claim 7, characterized in that, The node screening module includes: a difference value calculation unit, an input vector calculation unit, and a reinforcement learning calculation unit; The difference value calculation unit is used to calculate the difference value between the current node model of each node and the current global model; The input vector calculation unit is used to calculate the input vector based on the difference value between the current node model of each node and the current global model, as well as the carbon emission factors, training power, and training duration of each node model; The reinforcement learning calculation unit is used to process the input vector according to a preset reinforcement learning algorithm to obtain each selected node.
9. An electronic device for model training based on environmentally friendly federated learning, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the computer program is loaded into the processor, it implements the steps of a model training method for environmentally friendly federated learning according to any one of claims 1-6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of a model training method for environmentally friendly federated learning according to any one of claims 1-6.
Citation Information
Cited By
Federal learning-based carbon emission management method and system
CN121168833A