A Federated Learning Resource Management Approach for Battery-Powered IoT Devices
By establishing an energy allocation model in the federated learning of battery-powered devices and using genetic algorithms for resource management, the problems of equipment disconnection and energy limitation are solved, efficient federated learning in the industrial Internet of Things environment is achieved, and learning accuracy is improved and system performance.
Patent Information
- Application Number
- CN202210110563.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-01-29
AI Technical Summary
In the industrial Internet of Things environment, federal learning of battery-powered devices faces problems such as equipment disconnection, wireless channel instability and energy limitation. The existing technology is difficult to optimize delay, cost and accuracy at the same time, and energy allocation of battery-powered devices. and resource management lacks effective methods.
A federated learning resource management method for battery-powered IoT devices is proposed. By establishing a battery energy allocation model, estimating the remaining training rounds in real time and online allocation energy budget, calculating the transmission power and CPU frequency of the shortest delay, and using genetic algorithms Obtain device selection and communication resource block allocation strategies to ensure that the device does not fall behind due to energy exhaustion and improve learning accuracy.
In the environment of limited power and non-independent and homogeneous data, the accuracy and system performance of federated learning are improved, suitable for real wireless environments, reducing equipment disconnection and energy waste, and improving learning efficiency.
Smart Images

Figure CN114423085B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communication technology, and in particular to a federated learning resource management method for battery-powered Internet of Things devices. Background Art
[0002] Federated Learning In the industrial IoT environment, devices may face low resource availability, such as low computing power, limited bandwidth, and battery life. Limited battery life may cause devices to drop offline, limited bandwidth requires device screening, and unstable wireless channels may cause transmission failures.
[0003] Federated learning devices can be divided into charging devices and battery devices. Most of the research on federated learning is based on charging devices, which limits the types of devices that can be selected. If battery-powered devices do not consider energy scheduling, the device may fall due to energy exhaustion.
[0004] Currently, there are few discussions on energy allocation methods, and most of them do not consider the energy allocation problem under battery power constraints. Some studies calculate the available energy per round based on device energy and known training rounds. However, in resource-constrained heterogeneous networks, it is difficult to know the number of training rounds with fixed learning time at the beginning.
[0005] In the prior art, under a known energy budget, federated learning usually considers three optimization directions: latency, cost, and accuracy. However, it is difficult to optimize all three directions at the same time, and it is necessary to weigh multiple optimization directions. The common optimization goal is to achieve maximum accuracy within a fixed training time, but most studies do not consider the impact of battery power and wireless transmission on system performance. Since battery energy is limited and channel instability may cause transmission failures, and the complexity of long-term optimization solutions increases exponentially with time, each round of independent iterative optimization can be adopted. In order to quantitatively analyze the training process, weigh the training time and accuracy goals, and speed up the learning speed, learning efficiency can be used as the optimization goal. Learning efficiency is defined as the ratio of the attenuation of the loss value of a single round of global model to the delay of a single round of training.
[0006] The shortcomings of the prior art mainly include the following points:
[0007] 1. Federated learning usually considers three optimization directions: latency, cost, and accuracy, and needs to weigh multiple optimization directions. Most studies on the trade-off between learning time and accuracy use weighted addition, which requires adjusting parameters and cannot quantitatively analyze the convergence accuracy under a fixed training time.
[0008] 2. Most federated learning research is based on training on charging devices, and there is little research on federated learning on battery-powered devices. In the IoT environment, devices may be powered by batteries. Existing federated learning on battery-powered devices rarely considers the problem of battery energy allocation. Not considering energy scheduling may cause the device battery to run out of energy and fall, reducing system performance.
[0009] 3. Some studies allocate battery energy based on device energy and known training rounds. However, the optimization goal is to maximize learning accuracy with a fixed training time, and it is difficult to determine the number of learning rounds under a fixed training time in resource-constrained heterogeneous networks.
[0010] 4. The duration of federated learning is determined by the slowest device. The useless waiting time causes energy waste, so it is hoped that the training time of the scheduled devices will be close. However, most federated learning studies do not consider energy constraints. The devices always train at the maximum CPU frequency and run at the maximum transmit power. Due to the heterogeneity of devices and different wireless channels, the latency of each round of devices varies greatly, which puts great pressure on battery life.
[0011] 5. Most of the research on federated learning is based on an ideal wireless environment, while the actual wireless environment needs to consider transmission failures caused by unstable channels and the need for device scheduling due to limited bandwidth.
[0012] 6. Under non-IID data distribution, device selection needs to consider data distribution, take into account statistical heterogeneity, and perform data perception. Device selection should select diversity measures based on schedule. If you choose to assign user weights before training, you need to consider the diversity of the data set. If you select users while training, you need to consider model diversity, and generally estimate diversity based on the model norm or gradient norm. However, collecting device information before training violates the important principle of privacy in federated learning, and the device may collect data in real time, causing data changes. Selecting devices by gradient or loss will cause unnecessary delays and waste a lot of energy. This waste needs to be avoided when energy is insufficient. Summary of the invention
[0013] The present invention aims at the problem of device disconnection in federated learning in battery-powered devices in the current industrial Internet of Things, and the problem that the devices participating in the federated learning need to be selected and resources allocated due to the limited number of communication resource blocks (RB) and the unstable wireless channel causing transmission failure. The present invention provides a federated learning resource management method for battery-powered Internet of Things devices. In the battery-powered industrial Internet of Things environment, the method performs online energy allocation according to actual training information, calculates the CPU frequency and transmission power of the best device under the current energy budget, and obtains the device selection and communication resource block allocation strategy under each round of known energy budget by using a genetic algorithm based on the derived mathematical form of learning efficiency, so as to ensure that the device will not fall behind due to energy exhaustion, and improve the federated learning accuracy of heterogeneous devices under non-independent and identically distributed data distribution with fixed training time.
[0014] In order to achieve the above object, the present invention provides the following technical solutions:
[0015] The present invention provides a method for managing federated learning resources for battery-powered Internet of Things devices, comprising the following steps:
[0016] S1. Establish a battery energy allocation model to estimate the remaining training rounds in real time and allocate the energy budget for each training round online;
[0017] S2, calculate the transmission power and CPU frequency with the shortest delay based on the energy budget of each round of training;
[0018] S3. Under Non IID data distribution, based on energy budget, wireless factors and data imbalance are considered to obtain the learning efficiency expression;
[0019] S4. Solve the device selection and communication resource block allocation scheme that maximizes learning efficiency, and adjust the CPU frequency according to the delay of each round of training.
[0020] Furthermore, step S1 estimates the number of learning rounds in the remaining time according to the remaining energy and historical delay, calculates the basic allocated energy for the next round according to the learning rounds, and allocates energy budget to the battery-powered device online in combination with the remaining energy of the previous round.
[0021] Furthermore, according to the device selection and communication resource block allocation scheme in each round, the single-round delay is the maximum delay of the current round allocation scheme. The remaining total training time is divided by the single-round delay to obtain the initial remaining round estimate. The historical round smoothing estimate is combined with the previous round estimate to obtain the final remaining round estimate. The initial energy allocation for the next round is obtained by dividing the user's theoretical remaining energy by the final remaining round estimate.
[0022] Furthermore, the energy of unselected devices or the part of the energy of selected devices that is less than the energy budget will be directly accumulated and superimposed to the next round, and combined with the initial energy allocation of the next round to obtain the final energy allocation of the next round, while the energy of devices that fail to transmit will be wasted.
[0023] Furthermore, step S2 makes a trade-off between transmit power and CPU frequency according to the available energy budget of the device in each round, and uses a genetic algorithm to solve the transmit power and CPU frequency of each device that minimizes the delay under a known energy budget.
[0024] Furthermore, in step S3, energy is allocated to the battery-powered device online under the Non IID data distribution, and a mathematical expression of the learning efficiency is obtained in each round based on the energy budget, taking into account wireless factors and data distribution imbalance.
[0025] Furthermore, step S4 combines the historical gradient estimation method and the genetic algorithm to perform device selection and communication resource block allocation, and adjusts the CPU frequency of the selected device according to the maximum delay of the final selected allocation solution.
[0026] Furthermore, in step S4, the device selection and communication resource block allocation are obtained by maximizing the learning efficiency, and the learning efficiency is obtained according to the packet error rate and delay of the device and communication resource block combination, the size of the gradient norm of different devices under the Non IID data distribution, etc.
[0027] Furthermore, step S4 estimates the subsequent learning rounds online according to the historical delay situation, and adjusts the energy allocated to the device in each round in real time according to the feedback.
[0028] Furthermore, step S4 uses a historical gradient estimation method to estimate the device gradient norm and the global gradient norm.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] The method for managing federated learning resources for battery-powered IoT devices of the present invention is applicable to federated learning on battery-powered devices, and achieves greater accuracy under limited power. Compared with the federated learning algorithm in an ideal wireless environment, the method of the present invention takes into account factors such as limited bandwidth and unstable channels, and is more suitable for real wireless environments. Compared with other federated learning device scheduling algorithms, the method of the present invention considers the imbalanced data distribution and limited power for resource allocation under Non IID data distribution, and has higher learning accuracy within a fixed training time. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0032] Figure 1 The industrial Internet of Things federated learning model structure provided by the embodiment of the present invention.
[0033] Figure 2 A diagram of simulation results of the method provided in an embodiment of the present invention when energy is sufficient, wherein the left side shows the allocation of one slice and the right side shows the allocation of two slices.
[0034] Figure 3 The training simulation result diagram of the method provided in the embodiment of the present invention when the battery energy is 5J, the left side is for allocating one shard, and the right side is for allocating two shards.
[0035] Figure 4 The training simulation result diagram of the method provided in the embodiment of the present invention when the battery energy is 4J, the left side is for allocating one shard, and the right side is for allocating two shards.
[0036] Figure 5 The training simulation result diagram of the method provided in the embodiment of the present invention when the battery energy is 3J, the left side is for allocating one shard, and the right side is for allocating two shards. DETAILED DESCRIPTION
[0037] A resource management optimization algorithm for federated learning under non-IID data distribution in resource-constrained IoT with battery-powered devices is proposed. This method takes the maximum learning convergence accuracy under a fixed training time as the optimization goal, optimizes each round independently, and quantitatively analyzes each round of training with learning efficiency as the metric. The energy budget of each round is allocated online according to the actual training situation. Based on the energy budget, the transmit power and CPU frequency are calculated, and the mathematical form of learning efficiency under Non IID distribution is derived. The genetic algorithm is used to solve the device scheduling and communication resource block allocation scheme, and the CPU frequency is adjusted accordingly to reduce unnecessary energy consumption. A historical gradient estimation method is designed to obtain the current gradient norm based on historical conditions.
[0038] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0039] The method for managing federated learning resources for battery-powered IoT devices of the present invention comprises the following steps:
[0040] S1. Establish a battery energy allocation model to estimate the remaining training rounds in real time and allocate the energy budget for each training round online;
[0041] S2, calculate the transmission power and CPU frequency with the shortest delay based on the energy budget of each round of training;
[0042] S3. Under Non IID data distribution, based on energy budget, wireless factors and data imbalance are considered to obtain the learning efficiency expression;
[0043] S4. Solve the device selection and communication resource block allocation scheme that maximizes learning efficiency, and adjust the CPU frequency according to the final delay.
[0044] Regarding the implementation of the above steps, the present invention first establishes the following model:
[0045] 1. Establish a wireless federated learning model for battery-powered resource-constrained IoT.
[0046] 2. Establish a calculation model for transmit power and CPU frequency.
[0047] 3. Derive the mathematical expression of learning efficiency under Non IID data distribution and design a historical gradient estimation algorithm.
[0048] 4. Establish a learning efficiency maximization solution model, obtain device scheduling and communication resource block allocation solutions, and adjust the CPU frequency.
[0049] 5. Establish a battery energy allocation model to estimate the remaining training rounds in real time and allocate energy online.
[0050] Example 1 Establishing a wireless federated learning model for battery-powered resource-constrained IoT
[0051] Design a federated learning system in an industrial IoT environment, such as Figure 1 As shown in Figure 1, the federated learning system consists of U IIoT devices and a server. The devices and the server communicate uplink and downlink via wireless channels.
[0052] The federated learning uplink transmission uses orthogonal multiple access (OFDMA) technology. The uplink rate at which the training device i in the tth round transmits its local federated learning model parameters to the base station through the communication resource block n is:
[0053]
[0054] Among them B Up is the bandwidth of each communication resource block in the uplink, I nis the interference on communication resource block n, P i,t is the transmission power of device i in the tth round of training, h i is the channel gain from device i to the server, and N0 is the noise power spectral density.
[0055] According to the communication resource block allocation scheme, the uplink rate of device i in round t is where r i,n,t Whether communication resource block n is allocated to device i.
[0056] The corresponding uplink rates are:
[0057]
[0058] Where D(·) is the model gradient size, and the uplink transmission delay of device i in the tth round is
[0059] Since the uplink device allocates resource blocks for transmission, bandwidth resources are tight, while the downlink uses broadcast transmission, bandwidth resource pressure is small, so the downlink delay fluctuation is negligible relative to the uplink. Therefore, it is assumed that the speed of global gradient broadcast is the same for all devices. Define c Down is the downlink rate, and the downlink delay is:
[0060]
[0061] The device uses its resources to train the local model locally. The computational latency of the tth round of training for device i is:
[0062]
[0063] Combining the three delays, the delay of device i in the tth round is:
[0064]
[0065] The duration of each round of federated learning depends on the slowest device being scheduled, so the maximum delay of the tth round is:
[0066]
[0067] Device energy consumption includes device training and transmission energy consumption. The energy loss of the device is defined as:
[0068]
[0069] Due to interference and noise in the wireless channel, transmission errors may occur. Assume that a local federation model uses one packet for transmission. The packet error rate of device i in round t under communication resource block n is:
[0070]
[0071] The success probability of device i transmitting the local model in round t is:
[0072]
[0073] Define a binary variable based on the probability of successful transmission:
[0074]
[0075] Define the client set u = {1, 2, L, U}, and the data collected locally by device i is expressed as The communication resources are expressed as a communication resource block set Ω consisting of M communication resource blocks, and the data set size of device i is defined as K i The sum of the equipment training samples is:
[0076]
[0077] Assume that the data d ik The output is o ik , the output vector of device i after training is O i ={o i1 , o i2 , ..., o i2}, i∈v, the corresponding local federated learning model is w i After the local model is sent to the server, it will be integrated into the global federated model g t , and sent back to the device. Global federation model considering device scheduling and transmission failure t The update expression is:
[0078]
[0079] Define the loss function of each data as f(g t ,d ik ,o ik ), the device local loss function is:
[0080]
[0081] The overall loss function of all devices is:
[0082]
[0083] For simplicity, the loss function f(g t ,d ik ,o ik ) is abbreviated as f i,k (gt ).
[0084] The edge device receives the global model g t Then update the local model:
[0085]
[0086] The update formula of the global federated model for the loss function is:
[0087]
[0088] Define the difference v between the ideal global norm and the actual global gradient t for:
[0089]
[0090] The actual global gradient is defined as:
[0091]
[0092] The learning efficiency is defined as the ratio of the global loss decay per round to the delay, where the global loss decay in round t is defined as the global federated model g trained in round t-1 t-1 Loss value F(g t-1 ) and the loss value F(g t ). The global loss decay in the tth round is expressed as:
[0093] DF t =F(g t-1 )-F(g t )
[0094] The global decay in round 0 is assumed to be the loss value F(g) of the randomly initialized global model g and the loss value F(g t ) difference.
[0095] The optimization problem of the present invention is to maximize the learning accuracy within a fixed training time τ, and W is defined as the maximum number of training rounds within the training time τ. The optimization problem can be expressed as:
[0096] minF(g W )
[0097] To solve the optimization problem, we need to know the training round W, which is difficult to determine before training. Moreover, this problem is a nonlinear programming problem, and the complexity of the solution increases exponentially with the increase of round W. Due to the iterative nature of federated learning, the global model is related to all past rounds of training. In summary, it is difficult to perform long-term optimization. In order to reduce the complexity of the problem, the original optimization problem is transformed into a real-time optimization problem using learning efficiency as a measure, aiming to accelerate federated learning training and quickly minimize the global loss function.
[0098] An approximate local optimal algorithm is used to calculate the optimal device selection and communication resource block allocation scheme under the current maximum learning efficiency in each round. The learning efficiency of the tth round is defined as:
[0099]
[0100] Therefore, the constrained optimization problem is summarized as follows:
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108] The total energy consumption of the equipment meets E i is the total battery energy. The above optimization problem represents the optimization of the communication resource allocation matrix R in the tth round t 、Equipment transmit power vector P t 、CPU frequency vector f t and energy budget allocation vector E t To maximize learning efficiency t Formulas (a)-(c) constrain each device to occupy only one resource block for uplink data transmission, formula (d) constrains the maximum training energy consumption, formula (e) constrains the maximum transmit power, and formula (f) constrains the CPU frequency.
[0109] Example 2 Establishing a calculation model for transmission power and CPU frequency
[0110] According to the definition of success probability, the transmission success probability decreases as the transmission power increases, and has a nonlinear relationship with the transmission power, but has nothing to do with the CPU frequency. According to the definition of delay, the device delay is related to both the CPU frequency and the transmission power, and the calculation delay is positively correlated with the inverse of the CPU frequency. Therefore, under non-extreme wireless channel conditions, the delay in learning efficiency is more sensitive to changes in CPU frequency and transmission power than the global loss attenuation. Therefore, in order to simplify the solution complexity, the problem is converted into solving the transmission power vector P that minimizes the delay. * and the CPU frequency vector f * .
[0111] The problem of solving the transmit power and CPU frequency is:
[0112]
[0113] st(d)–(f)
[0114] Under the energy budget constraint, a trade-off is made between the transmit power and CPU frequency to achieve the minimum latency within the energy budget, thereby obtaining a higher learning efficiency. A genetic algorithm is used to solve the transmit power and CPU frequency that minimize the latency for each device under a known energy budget. It is worth noting that at t = 0, device i does not set an energy budget limit and uses the maximum CPU frequency f i,max and the transmission power P max run.
[0115] Example 3: Derive the mathematical expression of learning efficiency under Non-IID data distribution and design a historical gradient estimation algorithm
[0116] In the theoretical analysis of the federated learning algorithm, it is assumed that the loss function is a convex function that satisfies the L-smoothness condition:
[0117]
[0118] Since the learning efficiency of each round is related to loss attenuation and delay, the loss attenuation size is:
[0119]
[0120] The update formula of the global model loss function is Substituting into the above formula, we can get:
[0121]
[0122] Substituting the assumption λ=1 / L into the above formula, we can obtain:
[0123]
[0124] The norm of the difference between the global gradient and the actual global gradient for:
[0125]
[0126] Derived:
[0127]
[0128] Combination We can get:
[0129]
[0130] The lower limit of loss attenuation can be obtained as:
[0131]
[0132] The learning efficiency inequality is:
[0133]
[0134] Device selection and communication resource block allocation algorithms need to be combined with the global gradient norm With the local gradient norm And L is independent of the device selection and communication resource block allocation algorithm. We can get:
[0135]
[0136] Where A' t To simplify learning efficiency, use A t Divide by
[0137] because therefore We can get:
[0138]
[0139] Due to the limited communication resource blocks, it is impossible to receive the gradients of all devices and obtain the accurate global gradient norm in each round. Due to the energy limitation of the battery, if each device sends the local model norm in each round and then performs device selection, it is equivalent to training the local model for all models. At this time, each device will generate training energy consumption, which will cause huge waste, especially when the number of devices is much larger than the number of communication resource blocks. Therefore, it is not acceptable to train all devices every time, resulting in the local model norm of some devices in the loss attenuation formula being unknown.
[0140] Due to battery energy limitations, it is not possible to train all devices at the same time and then select devices based on their gradient norms. At the same time, due to the limitation of communication resource blocks, it is impossible to know the exact global gradient norm. Only the local gradient norm obtained by the device through previous rounds of training can be used to complete the device selection for the current round. When resources are insufficient, it is necessary to select devices first and then allow the selected devices to be trained. Therefore, the local gradient norm and global gradient norm of this round are unknown at the time of selection.
[0141] In order to estimate the ratio of the global model norm to the local model norm, a historical gradient estimation method is designed to obtain the current gradient norm based on the historical gradient norm, which meets the privacy requirements and saves energy. Since the device is generally not selected in every round, the local gradient norm is estimated using the device's gradient history value:
[0142]
[0143] Since the device is selected before the device gradient is received, the global gradient norm needs to be estimated without receiving the local gradient of this round:
[0144]
[0145] in is the actual global gradient, that is Set the initialization device gradient norm to be consistent with the global gradient norm, that is, set H0 = G0.
[0146] It can be seen that the device selection using the historical gradient estimation method will have a certain hysteresis compared to the device selection obtained when all devices participate in the training when energy is sufficient. However, when the training duration is set to be longer, this hysteresis has less impact on the overall learning accuracy.
[0147] Therefore, the lower limit of learning efficiency is finally:
[0148]
[0149] There is a prerequisite for using the historical gradient estimation method on battery-powered devices: a device cannot be out of training for a long time, otherwise the estimated local gradient norm will have a large error. Therefore, a non-participation threshold t is set. thres When the number of times a device fails to participate in a round reaches the threshold, the device will be selected in this round. After being selected and successfully sending, the number of times the device fails to participate in a round will be cleared. That is, there are mandatory devices and candidate devices. The mandatory devices are those that meet the non-participation threshold conditions, and these devices will be selected.
[0150] Example 4 Establishing a learning efficiency maximization solution model, obtaining device scheduling and communication resource block allocation solutions, and adjusting CPU frequency
[0151] Bringing the derived lower limit of learning efficiency under the Non-IID data distribution into the optimization problem of the embodiment, the new optimization problem is:
[0152]
[0153] st(a)-(c)
[0154] When the energy budget of the equipment in the current round is known, the objective function and constraints are nonlinear, and the optimization variable is an integer. This is a nonlinear 0-1 programming problem. It is difficult to use an efficient and accurate method to search for the optimal solution. As a second best option, this paper uses the genetic algorithm in the heuristic algorithm to solve the approximate optimal solution.
[0155] According to the transmit power and CPU frequency calculation model, the CPU frequency matrix f of all combinations of device resource blocks under a certain energy budget is solved * And the transmit power matrix P * Given the CPU frequency and transmit power, a genetic algorithm is used to solve the optimization problem of nonlinear 0-1 programming.
[0156] Get the optimal device resource block matching solution R in round t * And the corresponding delay of the selected device i The maximum delay required by the solution is T t According to the matching scheme R * And adjust the CPU frequency according to the delay, so that the device delay is as close to the maximum delay as possible, so as to save energy. t Recalculate the CPU frequency f of the selected device i i,t for:
[0157]
[0158] The remaining energy is accumulated to the next round.
[0159] Example 5 Establishing a battery energy allocation model to estimate the remaining training rounds and allocate energy online in real time
[0160] An online energy allocation algorithm is designed to estimate the next learning round online according to the historical delay situation, and adjust the energy allocated to the device in each round in real time based on the feedback.
[0161] When starting the tth round of training, first determine the current training time T sum Is it less than the training time budget τ? If so, continue training, otherwise end training. According to the calculation model of transmit power and CPU frequency, use the energy budget E obtained in the previous round i,t-1 , calculate the transmit power and CPU frequency, where t = 0, the maximum CPU frequency f i,max and the maximum power P i,max Then, the optimal device resource block matching solution R is solved by maximizing the learning efficiency * , get the current delay T t , update T after each round of training sum =T sum +T t The estimated remaining learning rounds are:
[0162]
[0163] Using historical round smoothing to estimate the final remaining rounds is:
[0164]
[0165] Where a is the weight of the historical estimation round.
[0166] The energy of the unselected devices or the selected devices whose energy is less than the energy budget will be directly accumulated and added to the next round, while the energy of the devices whose transmission fails will be wasted. The energy allocation of device i in the next round is:
[0167]
[0168] Where E i The remaining battery power of the device is updated to E after each round of training. i =E i -E i,t , It is the remaining energy from the previous round.
[0169] Unused energy in round t training To allocate energy E i,t The difference with the used energy can be expressed as:
[0170]
[0171] The CPU frequency of the unselected device is f i,t and the transmission power P i,t Set to 0, which means that all energy of unselected devices is accumulated for use in the next round.
[0172] The resource management algorithm process is as follows:
[0173] 1) Initialize running time T sum =0, running round t=0, the number of rounds in which the device failed to participate All are 0
[0174] 2) Input non-participation threshold t thres , input the historical smoothing parameter a
[0175] 3) Use the maximum CPU frequency f i,max and the maximum transmit power P i,max Solve for optimal device selection and communication resource block allocation R * , adjust the CPU frequency, obtain the current delay T0 and the local gradient norm of the device and the global gradient norm Update T sum =T sum +T0, t=t+1, update H i,t / G t ,
[0176] 4) Conduct federated learning training
[0177] 5) Estimate the remaining training rounds
[0178] 6) While T sum ≤τ
[0179] 7) Calculate the equipment energy consumption budget E i,t
[0180] 8) Calculate the optimal CPU frequency f for the device resource block combination i,n,t and the optimal transmission power P i,n,t And the delay T i,n,t , the device does not participate in round t no Greater than the threshold t thres The equipment generates the required equipment set P, and solves the optimal equipment selection and communication resource block allocation R * , adjust the CPU frequency and obtain the current delay T t and the local gradient norm of the successful transmission device and the global gradient norm Update T sum =T sum +T t , t = t + 1, update Update the number of rounds in which the device failed to participate successfully t no , that is, the device is successfully sent on the contrary
[0181] 9) Conduct federated learning training
[0182] 10) Calculate the remaining training rounds
[0183] 11) end while
[0184] For Non-IID data distribution, it is necessary to consider the device gradient and global gradient obtained by the historical estimation method, and derive the upper bound of the loss improvement containing gradient information. Since it is a nonlinear optimization problem, the genetic algorithm is directly used to calculate the approximate optimal device scheduling and communication resource block matching scheme that maximizes learning efficiency according to the optimization goal. The CPU frequency is adjusted according to the matching scheme and the corresponding delay, so that the device delay is as close to the maximum delay as possible, thereby saving energy.
[0185] Example 6 Simulation Verification
[0186] The MNIST dataset is used for training, and the loss function is the cross entropy function. The dataset is sorted by digital labels, and each type of digital label is divided into 100 data shards. There are two types of data allocation, one for each device to allocate one shard, and the other for each device to allocate two shards.
[0187] Three comparison algorithms are adopted: random scheduling algorithm: the device does not control energy, uses maximum power and CPU frequency training, selects devices fairly, and allocates communication resource blocks randomly; maximum attenuation algorithm: the device does not control energy, uses maximum power and CPU frequency training, selects devices and allocates communication resource blocks with the goal of maximizing global attenuation; minimum delay scheduling: the device does not control energy, uses maximum power and CPU frequency training, and selects devices and allocates communication resource blocks with the goal of minimizing delay.
[0188] The simulation results of the proposed federated learning resource management algorithm when energy is sufficient are as follows: Figure 2 As shown, the left side allocates one shard, and the right side allocates two shards. Figure 3 , Figure 4 and Figure 5 They respectively represent the training simulation results of the resource management algorithm of federated learning proposed in the present invention when the battery energy is 5J, 4J, and 3J, respectively. In the figure, the left side allocates one shard and the right side allocates two shards.
[0189] From the simulation results Figure 2 It can be seen that when the battery energy is sufficient, the devices all run at the maximum CPU frequency and maximum transmission power. Since the amount of user data is consistent, the delay difference is small when the energy is sufficient, but the local gradient norm difference is large. At this time, the convergence speed and convergence position of the federated learning resource management algorithm proposed in this patent are closer to the maximum attenuation algorithm, and the final convergence accuracy is greater than the random scheduling algorithm and the minimum delay algorithm.
[0190] From the simulation results Figure 3 , Figure 4 , Figure 5 It can be seen that when energy is insufficient, the three comparison algorithms run at the maximum CPU frequency and maximum power. In the later stage of learning, most devices are offline and only a small number of users participate in training, so the learning accuracy is reduced in the later stage. The resource management algorithm proposed in the present invention learns a little slower in the early stage, but in the later stage, since all users remain online, the learning accuracy can be continuously improved. A better learning accuracy can be obtained at a fixed training time, and the convergence accuracy is less affected by the battery power. The final convergence accuracy is close to the convergence accuracy when there is sufficient energy. It can be seen that the lower the energy, the more obvious the advantage of the algorithm proposed in the present invention.
[0191] The above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the aforementioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the aforementioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical specialties therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for managing federated learning resources for battery-powered IoT devices, characterized in that: The following steps are involved: S1. Establish a battery energy allocation model to estimate the remaining training rounds in real time and allocate the energy budget for each training round online; The specific process of step S1 includes: When starting the tth round of training, first determine the current training time T sum Is it less than the training time budget τ? If so, continue training, otherwise end training; according to the calculation model of transmit power and CPU frequency, use the energy budget E obtained in the previous round i,t-1 , calculate the transmit power and CPU frequency, where t = 0, the maximum CPU frequency f i,max and the maximum power P i,max Then, the optimal device resource block matching solution R is solved by maximizing the learning efficiency * , get the current delay T t , update T after each round of training sum =T sum +T t ; The estimated remaining learning rounds are: Using historical round smoothing to estimate the final remaining rounds is: Where a is the weight of the historical estimation round; The energy of unselected devices or the energy of selected devices that is less than the energy budget will be directly accumulated and added to the next round; the energy allocation of device i in the next round is: Where E i The remaining battery power of the device is updated to E after each round of training. i =E i -E i,t , The remaining energy from the previous round; Unused energy in round t training To allocate energy E i,t The difference with the energy used is expressed as: The CPU frequency of the unselected device is f i,t and the transmission power P i,t Set to 0, that is, the energy of unselected devices is fully accumulated for use in the next round; K i is the data set size of device i, is the uplink transmission delay of device i in round t; S2, calculate the transmission power and CPU frequency with the shortest delay based on the energy budget of each round of training; S3. Under NonIID data distribution, based on energy budget, wireless factors and data distribution imbalance are considered to obtain the learning efficiency expression; Among them, learning efficiency is defined as the ratio of global loss decay per round to delay, where the global loss decay in the tth round is defined as the global federated model g trained in the t-1th round t-1 Loss value F(g t-1 ) and the loss value F(g t ), the global loss attenuation of the tth round is expressed as: DF t =F(g t-1 )-F(g t ) The global decay in round 0 is assumed to be the loss value F(g) of the randomly initialized global model g and the loss value F(g t ) difference; Define the learning efficiency of the tth round as: The constrained optimization problem is as follows: The total energy consumption of the equipment meets E i is the total battery energy; the above optimization problem represents the optimization of the communication resource allocation matrix R in the tth round t 、Equipment transmit power vector P t 、CPU frequency vector f t and energy budget allocation vector E t To maximize learning efficiency t ; Formulas (a)-(c) constrain each device to only occupy one resource block for uplink data transmission, formula (d) constrains the maximum training energy consumption, formula (e) constrains the maximum transmit power, and formula (f) constrains the CPU frequency; r i,n,t Whether the communication resource block n in round t is allocated to device i; S4, solve the device selection and communication resource block allocation scheme that maximizes learning efficiency, and adjust the CPU frequency according to the delay of each round of training; Bringing the derived lower limit of learning efficiency under Non-IID data distribution into the optimization problem, the new optimization problem is: st(a)-(c) Among them, q i,n,t H is the sum of the success probabilities of device i transmitting the local model in round t. i,t is the local gradient norm, G t is the global gradient norm; Get the optimal device resource block matching solution R in round t * And the corresponding delay of the selected device i The maximum delay required by the solution is T t , according to the matching scheme R * And adjust the CPU frequency according to the delay, so that the device delay is as close to the maximum delay as possible, so as to save energy. t Recalculate the CPU frequency f of the selected device i i,t for:
Citation Information
Patent Citations
Equipment evaluation and federated learning importance aggregation method, system and equipment based on edge intelligence and readable storage medium
CN112181666A
Method for improving fire detection effect based on federated learning in intelligent power plant
CN112598150A
Resource allocation method and system for multitask federated learning in 5G network
CN113900796A
Transverse federated learning system optimization method, apparatus and device, and readable storage medium
WO2021219054A1
