Multi-task learning method, device, medium and equipment based on edge node
By performing sample balance processing and node scheduling on edge nodes, the problem of uneven sample distribution of edge nodes is solved, the efficiency and accuracy of federated learning are improved, and resource consumption is reduced.
Patent Information
- Application Number
- CN202111321824.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-09
AI Technical Summary
Uneven distribution of edge node samples leads to reduced federated learning accuracy and unbalanced load, resulting in waste of resources.
By balancing the sample number of edge nodes, node schedulers are used to allocate learning model parameters for multi-task learning, reducing redundant calculations and improving federated learning efficiency.
It effectively avoids load imbalance between edge nodes, improves federated learning accuracy, expands application scenarios, and reduces resource consumption.
Smart Images

Figure CN114020469B_ABST
Abstract
Description
Background Art
[0002] Federated learning is a framework for multiple parties to jointly train learning models. Due to its privacy protection characteristics and cross-disciplinary machine learning capabilities, it has gradually become a key technology to break down data barriers. However, due to the problem of uneven distribution of node samples on edge nodes, not only will the accuracy of the learning model decrease, but it will also cause an imbalance in the load of edge nodes, resulting in a waste of resources.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The present disclosure provides a multi-task learning method based on edge nodes, a multi-task learning device based on edge nodes, a computer-readable storage medium and an electronic device, thereby at least to a certain extent solving the problems of unbalanced load and resource waste of edge nodes in the related art.
[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0006] According to a first aspect of the present disclosure, a multi-task learning method based on edge nodes is provided, including: performing sample balancing processing on each edge node according to a sample quantity set of each edge node, and sending the sample balancing processing results of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing results; obtaining learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node allocated to the node scheduler from among the edge nodes; and using the learning model parameters corresponding to each node scheduler to perform multi-task learning on the preset learning model.
[0007] In an exemplary embodiment of the present disclosure, the sample balancing processing of each edge node according to the sample quantity set of each edge node includes: determining the mean and variance of the sample quantity set according to the sample quantity set of each edge node; determining the Z value corresponding to the sample quantity of each edge node according to the mean and the variance; and performing sample balancing processing on each edge node based on the Z value corresponding to the sample quantity of each edge node.
[0008] In an exemplary embodiment of the present disclosure, the sample balancing processing of each edge node based on the Z value corresponding to the number of samples of each edge node includes: when the Z value corresponding to the number of samples of the edge node exceeds a first preset threshold, the edge node is used as a downsampling edge node so that the downsampling edge node performs sample downsampling; when the Z value corresponding to the number of samples of the edge node is lower than a second preset threshold, the edge node is used as an upsampling edge node so that the upsampling edge node performs sample upsampling; wherein the first preset threshold is greater than the second preset threshold.
[0009] In an exemplary embodiment of the present disclosure, the method further includes: determining a downsampling scale of the downsampling edge node according to the number of samples of the downsampling edge node, a Z value corresponding to the number of samples of the downsampling edge node, the first preset threshold, the mean, and the variance, so that the downsampling edge node performs sample downsampling according to the downsampling scale; determining an upsampling scale of the upsampling edge node according to the number of samples of the upsampling edge node, a Z value corresponding to the number of samples of the upsampling edge node, the second preset threshold, the mean, and the variance, so that the upsampling edge node performs sample upsampling according to the upsampling scale.
[0010] In an exemplary embodiment of the present disclosure, the learning model parameters corresponding to each node scheduler are used to perform multi-task learning on the preset learning model, including: using the learning model parameters corresponding to each node scheduler to construct a model matrix and a model relationship matrix corresponding to the model matrix, and updating the model matrix based on the model relationship matrix to obtain a target model matrix.
[0011] In an exemplary embodiment of the present disclosure, the model matrix is updated based on the model relationship matrix to obtain a target model matrix, including: using the model matrix and the model relationship matrix to construct the target optimization function of the multi-task learning; by updating the model matrix, the model matrix when the objective function reaches the optimal value is used as the target model matrix.
[0012] In an exemplary embodiment of the present disclosure, updating the model matrix includes: taking a single node scheduler as a unit, performing a round of updating on the model matrix to obtain a new model matrix, so that the target edge nodes corresponding to each node scheduler perform a new round of iterative training on the preset learning model based on the new model matrix.
[0013] In an exemplary embodiment of the present disclosure, the model matrix is updated in a round based on a single node scheduler, including: updating the sub-problem parameters corresponding to the multi-task learning in sequence based on a single node scheduler, and updating the model relationship matrix based on the updated sub-problem parameters, and updating the model matrix based on the updated model relationship matrix.
[0014] In an exemplary embodiment of the present disclosure, the target edge node is a node determined from the edge nodes according to the KL divergence of the node scheduler.
[0015] According to a second aspect of the present disclosure, a multi-task learning device based on edge nodes is provided, including: a sample balancing processing module, used to perform sample balancing processing on each edge node according to a sample quantity set of each edge node, and send the sample balancing processing results of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing results; a model parameter acquisition module, used to obtain the learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node allocated to the node scheduler from among the edge nodes; a multi-task learning module, used to use the learning model parameters corresponding to each node scheduler to perform multi-task learning on the preset learning model.
[0016] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the multi-task learning method based on edge nodes is implemented.
[0017] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the above-mentioned edge node-based multi-task learning method by executing the executable instructions.
[0018] The technical solution disclosed in this disclosure has the following beneficial effects:
[0019] In the above-mentioned multi-task learning process based on edge nodes, sample balancing is performed on each edge node according to the sample quantity set of each edge node, and the sample balancing results of each edge node are sent to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing results; the learning model parameters corresponding to each node scheduler are obtained, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training the preset learning model according to the samples of the target edge node, and the target edge node is the node assigned to the node scheduler from each edge node; the learning model parameters corresponding to each node scheduler are used to perform multi-task learning on the preset learning model. By pre-performing sample balancing on the edge nodes, the impact caused by the global scale imbalance and class imbalance of the samples can be reduced, thereby avoiding the load imbalance of the edge nodes. Furthermore, using the node scheduling method, the edge nodes are assigned to multiple node schedulers, and the node schedulers are used as units to participate in multi-task learning, which can greatly reduce the redundant calculation of multi-task learning, thereby improving the efficiency of federated learning, reducing resource consumption, and reducing costs. In addition, applying the node scheduler to multi-task federated learning can also avoid the impact caused by the highly non-independent and identically distributed samples of edge nodes, thereby improving the accuracy of federated learning and helping to expand the applicable application scenarios.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 The following is a diagram showing the architecture of a multi-task learning model building system according to the exemplary embodiment;
[0023] Figure 2 A flowchart of a multi-task learning method based on edge nodes in this exemplary embodiment is shown;
[0024] Figure 3 A flow chart of performing sample balancing processing on each edge node in this exemplary embodiment is shown;
[0025] Figure 4 A flowchart of a multi-task learning based on Z value in this exemplary embodiment is shown;
[0026] Figure 5A structural block diagram of a multi-task learning system for allocating edge nodes to a node scheduler in this exemplary embodiment is shown;
[0027] Figure 6 A structural block diagram of a multi-task learning device based on edge nodes in this exemplary embodiment is shown;
[0028] Figure 7 An electronic device for implementing an edge node-based multi-task learning method in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0030] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0031] Herein, “first”, “second”, etc. are labels for specific objects, but do not limit the number or order of the objects.
[0032] In related technologies, the imbalanced distribution of samples on edge nodes may lead to statistical heterogeneity in federated learning, which can be divided into three types: imbalanced distribution in scale, imbalanced distribution in categories, and non-independent and identically distributed on edge nodes. The existing multi-task learning method requires iterating the sample data of each edge node to solve the problem of uneven sample distribution, which will lead to computational redundancy and will not fundamentally change the distribution of sample data.
[0033] In addition, the node scheduler is currently used to solve the problem of uneven sample distribution. However, in the existing node scheduling method, after the edge nodes assigned by the node scheduler are trained, the scheduler is used as a unit to participate in the federation average, which cannot avoid the impact caused by the non-independent and identically distributed characteristics of the edge node sample data.
[0034] In view of one or more of the above problems, an exemplary embodiment of the present disclosure provides a multi-task learning method based on edge nodes, which can be applied in scenarios including but not limited to: message and task delay prediction based on federated learning; smart city and smart community systems based on the Internet of Things; 5G smart medical care; and distribution systems based on mobile phone behavior information.
[0035] For the message and task delay prediction scenarios based on federated learning: In the process of task scheduling for edge computing, some tasks of edge nodes may be lost due to communication delays, untimely task unloading, etc., and the central server of data such as message logs of edge nodes is usually inaccessible. At the same time, the delay data of different types of edge nodes and different types of tasks also differ in statistical characteristics. The multi-task learning method based on edge nodes in this disclosure is applied to the message and task delay prediction scenarios based on federated learning. Through the message log data of edge nodes, a machine learning model for predicting node messages and task delays is trained, which can improve the task scheduling efficiency of the edge platform to a certain extent and prevent task loss.
[0036] For scenarios of smart cities and smart community systems based on the Internet of Things: The construction of smart city systems often requires the collection of multi-dimensional and highly complex data. For example, when smart community systems conduct community monitoring networks, they often need to train models through third parties based on a large amount of personal information of residents. Applying the multi-task learning method based on edge nodes in this disclosure to smart cities and smart community systems based on the Internet of Things can complete personalized model training under the conditions of large data scale and high data statistical heterogeneity without disclosing edge node data to the central server, and ensure the privacy of personal information.
[0037] For 5G smart medical scenarios: Using machine learning for smart medical care often faces problems such as large sample data differences, high privacy, and data barriers in joint diagnosis data samples. Federated learning can solve these data barrier problems. The multi-task learning method based on edge nodes in this disclosure can train a more accurate model for data samples with large differences to achieve more accurate and personalized diagnosis.
[0038] For the distribution system scenario based on mobile phone behavior information: Sometimes it is necessary to build a model based on the behavior information reflected by the private traffic of some mobile phone users to distribute recommendation strategies. The huge amount of private traffic data and the complexity of data types make model training difficult. The multi-task learning method based on edge nodes in this disclosure can well avoid privacy issues and eliminate the impact of data statistical heterogeneity on model training.
[0039] See also Figure 1 , Figure 1 It is a multi-task learning model construction system architecture diagram provided by an embodiment of the present invention, including: edge node 110, node scheduler 120 and central server 130. Among them, edge node 110 refers to a business platform built on the edge side of the network close to the user, providing storage, computing, network and other resources, sinking some key business applications to the edge of the access network to reduce the width and delay loss caused by network transmission and multi-level forwarding. It can be a computer room or a physical device, edge gateway, home gateway, IoT gateway, mobile phone, computer and other devices. Node scheduler 120 is mainly responsible for the edge nodes assigned to it, and one or more edge nodes can be assigned to a node scheduler. Figure 1 The number of edge nodes 110 and node schedulers 120 is only illustrative, and any number can be set according to implementation needs. The central server 130 can be a server cluster composed of multiple computing devices, which can provide computing or application services, have high-speed CPU computing power, long-term reliable operation, strong I / O external data throughput capacity and better scalability. The communication network in the system architecture can be a wide area network or a local area network, or a combination of the two.
[0040] Figure 2 The schematic flow chart of a multi-task learning method based on edge nodes in this exemplary embodiment is shown, which is executed by a central server and includes the following steps S210 to S230:
[0041] Step S210, performing sample balancing processing on each edge node according to the sample quantity set of each edge node, and sending the sample balancing processing result of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing result;
[0042] Step S220, obtaining learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node allocated to the node scheduler from each edge node;
[0043] Step S230, using the learning model parameters corresponding to each node scheduler to perform multi-task learning on the preset learning model.
[0044] In the above-mentioned multi-task learning process based on edge nodes, the edge nodes are pre-balanced by sample balancing to reduce the impact of global scale imbalance and class imbalance of samples, thereby avoiding load imbalance of edge nodes. Furthermore, by using the node scheduling method, edge nodes are assigned to multiple node schedulers, and node schedulers are used as units to participate in multi-task learning, which can greatly reduce the redundant calculation of multi-task learning, thereby improving the efficiency of federated learning, reducing resource consumption, and reducing costs. In addition, applying the node scheduler to multi-task federated learning can also avoid the impact caused by the high non-independent and identically distributed samples of edge nodes, thereby improving the accuracy of federated learning and helping to expand the applicable application scenarios.
[0045] The following are Figure 2 Each step in the procedure is described in detail.
[0046] Step S210 , performing sample balancing processing on each edge node according to the sample quantity set of each edge node, and sending the sample balancing processing result of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing result.
[0047] The sample quantity of an edge node refers to the number of sample elements in the sample data set of the edge node, which can represent the sample size of the edge node.
[0048] The central server can collect the number of samples of each edge node and construct a set of sample numbers of each edge node, for example, C = [C1, C2, ..., C N ], where C is the sample number set of N edge nodes, C1, C2, …, C N Represent the number of samples of each edge node.
[0049] In an optional implementation, the sample balancing process for each edge node according to the sample quantity set of each edge node may be performed as follows: Figure 3 The steps shown in the figure are implemented, specifically including the following steps S310 to S330:
[0050] Step S310, determining the mean and variance of the sample quantity set according to the sample quantity set of each edge node;
[0051] Step S320, determining the Z value corresponding to the number of samples of each edge node according to the mean and variance;
[0052] Step S330 , performing sample balancing processing on each edge node based on the Z value corresponding to the number of samples of each edge node.
[0053] Taking the sample quantity set C of each edge node as an example, the Z value set corresponding to the sample quantity of each edge node can be obtained by calculating Z = (C-μ) / σ. Where Z represents the Z value set corresponding to the sample quantity of each edge node, μ represents the mean of the sample quantity set, and σ represents the variance of the sample quantity set.
[0054] In the above process, by calculating the Z value of the sample quantity and performing sample balancing processing on the edge nodes in advance, the global scale imbalance and class imbalance problems caused by the diverse data types of the edge nodes can be solved.
[0055] In an optional implementation, in step S330, sample balancing processing is performed on each edge node based on the Z value corresponding to the number of samples of each edge node, which can be further implemented in the following manner: when the Z value corresponding to the number of samples of the edge node exceeds a first preset threshold, the edge node is used as a downsampling edge node so that the downsampling edge node performs sample downsampling; when the Z value corresponding to the number of samples of the edge node is lower than a second preset threshold, the edge node is used as an upsampling edge node so that the upsampling edge node performs sample upsampling; wherein the first preset threshold is greater than the second preset threshold.
[0056] The first preset threshold and the second preset threshold may have the following relationship: a =-(1 / τ d ), where τ a represents the second preset threshold, τ d Indicates the first preset threshold.
[0057] It should be noted that when an edge node does not meet the comparison conditions of the first preset threshold and the second preset threshold, the edge node is neither an upsampling node nor a downsampling node, and the samples of the edge node are not balanced.
[0058] In the above, by determining whether the edge node is an upsampling node or a downsampling node, the type of samples to be processed of the edge node is clarified, and the edge node performs corresponding downsampling or upsampling processing according to the type of samples to be processed, which solves the imbalance problem of edge node samples to a certain extent.
[0059] In an optional implementation, the sampling scales of the up-sampling edge nodes and the down-sampling edge nodes may also be determined in the following manner: determining the down-sampling scale of the down-sampling edge node according to the number of samples of the down-sampling edge node, the Z value corresponding to the number of samples of the down-sampling edge node, the first preset threshold, the mean, and the variance, so that the down-sampling edge node downsamples the samples according to the down-sampling scale; determining the up-sampling scale of the up-sampling edge node according to the number of samples of the up-sampling edge node, the Z value corresponding to the number of samples of the up-sampling edge node, the second preset threshold, the mean, and the variance, so that the up-sampling edge node upsamples the samples according to the up-sampling scale.
[0060] The central server can pre-initialize a zero vector of length N to represent the sampling scale R of each edge node ad =[0]*N, where N represents the number of edge nodes. When the yth edge node is a downsampled edge node, the downsampling scale of the edge node can be The edge node can scale its samples to R ad [y] downsampling; when the yth edge node is an upsampled edge node, the upsampling scale of the upsampled edge node can be The edge node can scale its samples to R ad [y] is upsampled to expand the samples of the edge node. The expansion can be performed by random displacement, rotation and shearing. y is the number of samples of the edge node, Z y is the Z value corresponding to the number of samples of the edge node, τ d is the first preset threshold, τ a is the second preset threshold, μ is the mean, and σ is the variance.
[0061] In the above process, the scale parameters of upsampling or downsampling are provided for the sample balancing operation of the edge nodes to achieve more accurate regulation of the node samples.
[0062] It should be noted that after the synchronous balancing process is completed, the sample data of each edge node may be shuffled to achieve further balancing of the sample data.
[0063] Step S220, obtaining the learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model based on samples of the target edge node, and the target edge node is a node allocated to the node scheduler from each edge node.
[0064] After balancing the sample data of all edge nodes, the updated sample data of the edge nodes can participate in the subsequent process. First, each edge node is assigned to several node schedulers. The allocation principle can be that the internal nodes of each node scheduler do not exceed the upper limit of the volume, and the sample data distribution of the internal nodes of the node scheduler is closest to the uniform distribution to the greatest extent.
[0065] When allocating each edge node to several node schedulers, a node scheduler may be selected first, and then all edge nodes may be traversed until the node scheduler is allocated. The edge node allocated to a node scheduler, i.e., the target edge node, may be used as an internal node of the node scheduler.
[0066] The target edge node may be a node determined from each edge node according to the KL divergence of the node scheduler. KL divergence is also known as Kullback-Leibler divergence, which is an asymmetric measure of the difference between two probability distributions. Specifically, the target edge node may be assigned to the node scheduler in the following manner.
[0067] First, a node scheduler S can be initialized mediator And the set of edge nodes to be allocated S client If the node scheduler S mediato% The number of currently allocated edge nodes |m|<γ, where γ is the maximum capacity of the node scheduler, then for S client For each edge node i, calculate the KL divergence and find the edge node k that minimizes the KL divergence, that is, k←min i D KL ((P m +P i )||P u ), and assign edge node k to node scheduler S mediator , until |m|=γ. Among them, P m is the node scheduler S mediato% Current sample data distribution, P i is the sample data distribution of edge node i, P u is the uniform distribution of sample data. Next, initialize a new node scheduler and repeat the above steps until all edge nodes have completed the node scheduler allocation.
[0068] It should be noted that when allocating edge nodes to the node scheduler based on the KL divergence, a greedy algorithm can also be used, that is, as long as the KL divergence is less than a large value (such as positive infinity), the edge node k is allocated to the node scheduler to significantly reduce the computational cost required for the allocation.
[0069] After nodes are assigned to the node scheduler, the preset learning model can be iteratively trained based on samples of the target edge nodes of each node scheduler.
[0070] It should be noted that for each node scheduler here, the initialized preset learning model can be used to iterate the target edge nodes in turn, that is, a gradient descent. After γ times of SGD (stochastic gradient descent), the node scheduler can obtain the latest learning model parameters as the learning model parameters for subsequent multi-task learning.
[0071] Step S230, using the learning model parameters corresponding to each node scheduler to perform multi-task learning on the preset learning model.
[0072] The node scheduling method is applied to multi-task federated learning, which solves the problem that federated learning using a node scheduler cannot effectively solve the highly non-independent and identically distributed characteristics of node sample data, and greatly improves the performance of federated learning results in scenarios with unbalanced node samples.
[0073] In an optional implementation, the above-mentioned use of the learning model corresponding to each node scheduler to perform multi-task learning on the preset learning model can be specifically achieved through the following steps: using the learning model parameters corresponding to each node scheduler, constructing a model matrix and a model relationship matrix corresponding to the model matrix, and updating the model matrix based on the model relationship matrix to obtain the target model matrix.
[0074] In the above process, the target model matrix is obtained by updating the model matrix, thus realizing multi-task learning of the learning model. Since the node scheduling integrates the samples of each edge node, the model matrix is constructed by the learning model parameters corresponding to each node scheduler, which can significantly reduce redundant calculations compared to the traditional construction for each edge node.
[0075] In an optional implementation, the above-mentioned updating of the model matrix based on the model relationship matrix to obtain the target model matrix can be achieved in the following way: using the model matrix and the model relationship matrix to construct the target optimization function of multi-task learning; by updating the model matrix, taking the model matrix when the objective function reaches the optimal value as the target model matrix.
[0076] Multi-task learning is the process of optimizing and solving the target optimization function based on the continuously iterated model matrix and model relationship matrix. The constructed target optimization function can be: Here W is the d*m model matrix, W=(w1,w2,…,w m );Ω is an m*m relationship matrix, which represents the relationship between m models; wt is the model parameter of node scheduler t, whose parameter dimension is d; x t and t They are the data samples corresponding to the node scheduler t and the corresponding related data label information, and their length is n t ; l t () represents the loss function. Among them, is the L2 regularization expression, which aims to control the parameter range and prevent the model from overfitting. λ1 and λ2 are regularization parameters, λ1>0, λ2>0.
[0077] Usually, the update of W requires the support of the model relationship matrix, and the update of Ω requires the support of W. Here, the update can be performed by alternately fixing W and Ω.
[0078] The above process constructs a target optimization function and optimizes the optimization target function to obtain a target model matrix that meets the solution conditions of the target optimization function, completes multi-task learning, and thus improves the accuracy of the learning model.
[0079] In an optional implementation, when updating the model matrix, the above can be specifically implemented in the following manner: taking a single node scheduler as a unit, a round of updating of the model matrix is performed to obtain a new model matrix, so that the target edge nodes corresponding to each node scheduler perform a new round of iterative training on the preset learning model based on the new model matrix.
[0080] The edge nodes inside the node scheduler will first be trained to achieve local balance, thereby reducing the size of the model matrix. The model matrix is updated in units of node schedulers, which can greatly reduce the scale of calculations in a single round.
[0081] In an optional implementation, a round of updating is performed on the model matrix based on a single node scheduler, including: updating the sub-problem parameters corresponding to the multi-task learning in sequence based on a single node scheduler, and updating the model relationship matrix based on the updated sub-problem parameters, and updating the model matrix based on the updated model relationship matrix.
[0082] When performing the first matrix optimization, the sub-problem parameters of multi-task learning can be initialized. By repeatedly executing the model matrix update process with a single node scheduler as a unit, a round of updates is completed so that the sample converges or the number of iterations reaches the maximum value. The updated new model matrix obtained can be returned to each node scheduler as the result of a round of learning, and the target edge node corresponding to the node scheduler performs a new round of iterative training.
[0083] In addition, when performing the first matrix optimization, the dual problem variable α corresponding to the subproblem parameters can be pre-initialized. By calculating the multi-task learning subproblems, the dual problem variables corresponding to the subproblem parameters are updated in units of a single node scheduler. Let the dual problem variable of node scheduler t be α t , by calculating the dual problem variable α t The optimization amount Δα t , get the dual problem variable α corresponding to the updated sub-problem parameter t ′, where α t ′=α t +Δα t , and then returns the same value as α to the node scheduler t. t The corresponding update information v t , where v t Satisfy v t =X t Δα t , where X t The above x t and t The node scheduler t obtains v t Afterwards, based on the data vector X t After obtaining the updated α′, the latest learning model w(α′) can be obtained through the local learning model w of each node scheduler. When all participating node schedulers complete this step and upload the new model, a round of update is completed, and the central server can obtain the new model matrix.
[0084] After a round of updates, the central server returns the updated model matrix to the target edge nodes under each node scheduler. Each node scheduler iterates the target edge nodes it owns in turn and updates the learning model parameters. When all target edge nodes owned by the node scheduler are updated, the latest learning model parameters are obtained and submitted to the central server. The central server performs a new round of model matrix updates and then repeats the above steps until the multi-task learning problem is met and the target optimization function is optimized.
[0085] like Figure 4 As shown, a flowchart of multi-task learning based on Z value is provided, which specifically includes the following steps:
[0086] Step S401: Start;
[0087] Step S402: the central server initializes the global learning model;
[0088] Step S403: the central server initializes the optimizer;
[0089] Step S404: the central server calculates the Z value according to the sample size information submitted by the edge node and performs data balancing;
[0090] Step S405: each node scheduler allocates a target edge node based on KL divergence calculation;
[0091] Step S406: the target edge node inside the node scheduler performs local iteration on the global learning model (scheduler model);
[0092] Step S407: The central server initializes the multi-task learning model matrix W and the relationship matrix Ω;
[0093] Step S408: updating and optimizing W and Ω in sequence with a single node scheduler as a unit;
[0094] Step S409: Determine whether W has converged to the node scheduler sample or whether the number of iterations has reached the maximum value;
[0095] Step S410: the node scheduler distributes the model returned last time to the target edge node, and the target edge node performs local verification on the model;
[0096] Step S411: End.
[0097] like Figure 5 As shown, a block diagram of the multi-task learning system for allocating edge nodes to the node scheduler is provided. Combined with the idea of node scheduling, the original data of the edge nodes is first downsampled / upsampled according to the node sample distribution, and then the edge nodes are rearranged using the node scheduler (such as scheduler 1, scheduler 2 and scheduler 3). The target edge nodes inside each node scheduler perform SGD iterative training in turn to complete the update of the model parameters. Then, the model matrix W and the model relationship matrix Ω are initialized according to the distribution of each node scheduler, and FMTL (Federated Multi-Task Learning) is performed to optimize the W matrix in turn with a single node scheduler as a unit. After completing a round of matrix optimization, the new model matrix is assigned to each node scheduler to enter the next round of learning.
[0098] In addition, the disclosed multi-task learning method based on edge nodes can also enhance the adaptability of the federated learning model to small IoT devices. In some edge computing scenarios based on IoT devices, small IoT devices have the characteristics of many types, non-uniform data scale, and non-independent and identically distributed data. Therefore, the node scheduling and multi-task learning combined in the disclosed method can complete batch-by-batch personalized machine learning model training for a large number of small IoT devices.
[0099] The disclosed multi-task learning method based on edge nodes can also be applied to scenarios such as delay prediction because it can enhance the accuracy of the federated learning model. Due to the influence of statistical heterogeneity, traditional federated learning, that is, federated learning for training universal models, may be difficult to converge, and the final result is that the output model accuracy is low, or the accuracy of the local model is much higher than the global accuracy. In some communication scenarios, the prediction of delay often has a low tolerance for errors, so higher model accuracy is required. The disclosed method uses multi-task learning to achieve model personalization of federated learning, which can greatly improve the model accuracy to meet some design requirements such as delay prediction models.
[0100] The exemplary embodiment of the present disclosure also provides a multi-task learning device based on edge nodes, such as Figure 6 As shown, the edge node-based multi-task learning device 600 may include:
[0101] The sample balancing processing module 610 is used to perform sample balancing processing on each edge node according to the sample quantity set of each edge node, and send the sample balancing processing result of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing result;
[0102] A model parameter acquisition module 620 is used to acquire learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node allocated to the node scheduler from each edge node;
[0103] The multi-task learning module 630 is used to perform multi-task learning on a preset learning model using the learning model parameters corresponding to each node scheduler.
[0104] In an optional embodiment, the sample balancing processing module 610 may include: a mean-variance determination module, used to determine the mean and variance of the sample quantity set based on the sample quantity set of each edge node; a Z value determination module, used to determine the Z value corresponding to the sample quantity of each edge node based on the mean and variance; and a balancing processing submodule, used to perform sample balancing processing on each edge node based on the Z value corresponding to the sample quantity of each edge node.
[0105] In an optional embodiment, the balancing processing submodule can be configured as follows: when the Z value corresponding to the number of samples of the edge node exceeds a first preset threshold, the edge node is used as a downsampling edge node so that the downsampling edge node performs sample downsampling; when the Z value corresponding to the number of samples of the edge node is lower than a second preset threshold, the edge node is used as an upsampling edge node so that the upsampling edge node performs sample upsampling; wherein the first preset threshold is greater than the second preset threshold.
[0106] In an optional implementation, the balancing processing submodule may also be configured to: determine the downsampling scale of the downsampling edge node according to the number of samples of the downsampling edge node, the Z value corresponding to the number of samples of the downsampling edge node, the first preset threshold, the mean and the variance, so that the downsampling edge node performs sample downsampling according to the downsampling scale; determine the upsampling scale of the upsampling edge node according to the number of samples of the upsampling edge node, the Z value corresponding to the number of samples of the upsampling edge node, the second preset threshold, the mean and the variance, so that the upsampling edge node performs sample upsampling according to the upsampling scale.
[0107] In an optional embodiment, the multi-task learning module 630 may include: a target model matrix acquisition module, which is used to use the learning model parameters corresponding to each node scheduler to construct a model matrix and a model relationship matrix corresponding to the model matrix, and update the model matrix based on the model relationship matrix to obtain a target model matrix.
[0108] In an optional embodiment, the target model matrix acquisition module may also include: an optimization function construction module, which is used to use the model matrix and the model relationship matrix to construct the target optimization function of multi-task learning; and a matrix update module, which is used to update the model matrix and use the model matrix when the objective function reaches the optimal value as the target model matrix.
[0109] In an optional embodiment, the matrix update module may also include: an update sub-module, which is used to perform a round of updates on the model matrix based on a single node scheduler to obtain a new model matrix, so that the target edge nodes corresponding to each node scheduler perform a new round of iterative training on the preset learning model based on the new model matrix.
[0110] In an optional embodiment, the update submodule can be configured to: update the sub-problem parameters corresponding to the multi-task learning in sequence based on a single node scheduler, update the model relationship matrix based on the updated sub-problem parameters, and update the model matrix based on the updated model relationship matrix.
[0111] In an optional implementation, the target edge node in the model parameter acquisition module 620 may be a node determined from each edge node according to the KL divergence of the node scheduler.
[0112] The specific details of each part of the above-mentioned edge node-based multi-task learning device 600 have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.
[0113] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the multi-task learning method based on edge nodes described above in this specification is stored. In some possible embodiments, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification. The program product may adopt a portable compact disk read-only memory (CD-ROM) and include a program code, and may be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, an apparatus, or a device or used in combination with it.
[0114] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0115] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0116] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0117] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0118] The exemplary embodiment of the present disclosure also provides an electronic device capable of implementing the above-mentioned multi-task learning method based on edge nodes. Figure 7 hereinafter, an electronic device 700 according to this exemplary embodiment of the present disclosure is described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0119] like Figure 7 As shown, the electronic device 700 may be in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.
[0120] The storage unit 720 stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 710 can execute Figures 2 to 4 Any one or more method steps.
[0121] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 721 and / or a cache memory unit 722 , and may further include a read-only memory unit (ROM) 723 .
[0122] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, such program modules 725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0123] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0124] The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0125] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary implementation of the present disclosure.
[0126] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiment of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0127] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0128] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or implementations combining hardware and software aspects, which may be collectively referred to herein as "circuit", "module" or "system". Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0129] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A multi-task learning method based on edge nodes, characterized in that: Applied to federated learning scenarios, including: Performing sample balancing processing on each edge node according to the sample quantity set of each edge node, and sending the sample balancing processing result of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing result; Obtaining learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node assigned to the node scheduler from among the edge nodes; Using the learning model parameters corresponding to each node scheduler, multi-task learning is performed on the preset learning model; The performing sample balancing processing on each edge node according to the sample quantity set of each edge node includes: Determine the mean and variance of the sample quantity set according to the sample quantity set of each edge node; Determine the Z value corresponding to the number of samples of each edge node according to the mean and the variance; wherein Z=(C-μ) / σ, Z represents the set of Z values corresponding to the number of samples of each edge node, C represents the set of sample numbers of each edge node, μ represents the mean of the set of sample numbers, and σ represents the variance of the set of sample numbers; When the Z value corresponding to the number of samples of the edge node exceeds a first preset threshold, the edge node is used as a downsampling edge node, so that the downsampling edge node performs sample downsampling; When the Z value corresponding to the number of samples of the edge node is lower than a second preset threshold, the edge node is used as an up-sampled edge node, so that the up-sampled edge node performs sample up-sampling; wherein the first preset threshold is greater than the second preset threshold; Determine a downsampling scale of the downsampling edge node according to the number of samples of the downsampling edge node, the Z value corresponding to the number of samples of the downsampling edge node, the first preset threshold, the mean, and the variance, so that the downsampling edge node performs sample downsampling according to the downsampling scale; An upsampling scale of the upsampling edge node is determined according to the number of samples of the upsampling edge node, a Z value corresponding to the number of samples of the upsampling edge node, the second preset threshold, the mean, and the variance, so that the upsampling edge node performs sample upsampling according to the upsampling scale.
2. The method according to claim 1, characterized in that: The adopting the learning model parameters corresponding to each node scheduler to perform multi-task learning on the preset learning model includes: The learning model parameters corresponding to the node schedulers are used to construct a model matrix and a model relationship matrix corresponding to the model matrix, and the model matrix is updated based on the model relationship matrix to obtain a target model matrix.
3. The method according to claim 2, characterized in that The updating of the model matrix based on the model relationship matrix to obtain a target model matrix includes: Using the model matrix and the model relationship matrix to construct a target optimization function for the multi-task learning; By updating the model matrix, the model matrix when the objective function reaches the optimum is used as the target model matrix.
4. The method according to claim 3, characterized in that The updating of the model matrix comprises: Taking a single node scheduler as a unit, the model matrix is updated once to obtain a new model matrix, so that the target edge node corresponding to each node scheduler performs a new round of iterative training on the preset learning model based on the new model matrix.
5. The method according to claim 4, characterized in that The updating of the model matrix in a round with a single node scheduler as a unit includes: Taking a single node scheduler as a unit, the sub-problem parameters corresponding to the multi-task learning are updated in sequence, and the model relationship matrix is updated based on the updated sub-problem parameters, and the model matrix is updated based on the updated model relationship matrix.
6. The method according to claim 1, characterized in that The target edge node is a node determined from the edge nodes according to the KL divergence of the node scheduler.
7. A multi-task learning device based on edge nodes, characterized in that: Applied to federated learning scenarios, including: A sample balancing processing module, configured to perform sample balancing processing on each edge node according to the sample quantity set of each edge node, and send the sample balancing processing result of each edge node to the corresponding edge node, so that each edge node performs upsampling or downsampling according to the sample balancing processing result; A model parameter acquisition module, used to acquire learning model parameters corresponding to each node scheduler, wherein the learning model parameters corresponding to the node scheduler are obtained by iteratively training a preset learning model according to samples of a target edge node, and the target edge node is a node allocated to the node scheduler from among the edge nodes; A multi-task learning module, used to perform multi-task learning on the preset learning model using the learning model parameters corresponding to each node scheduler; The performing sample balancing processing on each edge node according to the sample quantity set of each edge node includes: Determine the mean and variance of the sample quantity set according to the sample quantity set of each edge node; Determine the Z value corresponding to the number of samples of each edge node according to the mean and the variance; wherein Z=(C-μ) / σ, Z represents the set of Z values corresponding to the number of samples of each edge node, C represents the set of sample numbers of each edge node, μ represents the mean of the set of sample numbers, and σ represents the variance of the set of sample numbers; When the Z value corresponding to the number of samples of the edge node exceeds a first preset threshold, the edge node is used as a downsampling edge node, so that the downsampling edge node performs sample downsampling; When the Z value corresponding to the number of samples of the edge node is lower than a second preset threshold, the edge node is used as an up-sampled edge node, so that the up-sampled edge node performs sample up-sampling; wherein the first preset threshold is greater than the second preset threshold; Determine a downsampling scale of the downsampling edge node according to the number of samples of the downsampling edge node, the Z value corresponding to the number of samples of the downsampling edge node, the first preset threshold, the mean, and the variance, so that the downsampling edge node performs sample downsampling according to the downsampling scale; An upsampling scale of the upsampling edge node is determined according to the number of samples of the upsampling edge node, a Z value corresponding to the number of samples of the upsampling edge node, the second preset threshold, the mean, and the variance, so that the upsampling edge node performs sample upsampling according to the upsampling scale.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 6 by executing the executable instructions.
