Model training method, device, electronic device and storage medium
By allocating and aggregating subtasks based on the state information of edge nodes in model training, the interrupt problems caused by idle edge devices and device joining and exiting under centralized architecture are solved, and efficient distributed model training and flexible utilization of edge devices are realized.
Patent Information
- Application Number
- CN202410140920.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-01-31
AI Technical Summary
In the prior art, centralized model training architecture causes edge devices to be idle, increasing computing costs, and the joining or exiting of devices will cause model training to be interrupted, affecting the training speed.
By determining the target edge node based on the current state and historical task information of the edge node, assigning subtasks and aggregating, ensuring the flexibility and efficiency of model training, avoiding interrupts caused by device joining and exiting.
It realizes efficient distributed model training, rationally utilizes edge equipment computing power, reduces training costs, ensures the convenience and flexibility of edge equipment hot plugging during model training, and improves training speed.
Smart Images

Figure CN117992223B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a model training method, device, electronic device and storage medium. Background Art
[0002] Machine learning and deep learning model training systems mainly use a centralized architecture, which concentrates all model training tasks on the server cluster in the data center. However, as the scale of the model continues to increase, this centralized computing resource has become increasingly stretched. At the same time, a large number of devices distributed at the edge of the network also have powerful computing power. However, in the centralized model training architecture, edge devices are idle most of the time, and model training can only be performed through high-computing and high-cost servers. In the distributed model training process, the addition of new devices and the withdrawal of old devices often lead to interruptions in model training, affecting the speed of model training.
[0003] At present, there is an urgent need for a model training method that can rationally utilize network edge devices, reduce computing costs, and increase training speed. Summary of the invention
[0004] The embodiments of the present application provide a model training method, device, electronic device and storage medium, which not only utilize the registered target edge nodes to achieve efficient distributed model training, reasonably utilize the computing power of edge devices, reduce training costs, but also avoid the problem of model training interruption caused by device joining and exiting, which affects the model training speed, and ensure the convenience and flexibility of hot plugging of edge devices during model training. The above technical solutions are as follows:
[0005] In a first aspect, an embodiment of the present application provides a model training method, which is applied to a server and includes:
[0006] Determine a target edge node among the plurality of edge nodes based on the current status information and historical task execution status information corresponding to each of the plurality of edge nodes; the edge node includes a device registered in the server; the target edge node is used to represent the edge node currently participating in the training task corresponding to the target model; the training task includes a plurality of subtasks, and the subtasks include parameter items and training data corresponding to the target model;
[0007] Allocate the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, so that the target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask, and obtains the execution result corresponding to the first subtask;
[0008] Receiving the execution result corresponding to the first subtask sent by the target edge node;
[0009] According to preset rules, the execution results corresponding to the above multiple subtasks are aggregated to obtain the training results corresponding to the above target model;
[0010] The target model is updated based on the training results.
[0011] In a possible implementation, before aggregating the execution results corresponding to the plurality of subtasks according to a preset rule to obtain the training result corresponding to the target model, the method further includes:
[0012] If there is a second subtask among the above-mentioned multiple subtasks, the parameter items corresponding to the above-mentioned second subtask are trained based on the training data corresponding to the above-mentioned second subtask to obtain the execution result corresponding to the above-mentioned second subtask; the above-mentioned second subtask includes the subtasks among the above-mentioned multiple subtasks that are not assigned to the above-mentioned target edge node, and / or the subtasks among the above-mentioned multiple subtasks that fail to be executed by the above-mentioned target edge node.
[0013] In a possible implementation, before allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the method further includes:
[0014] According to the above preset rules, the training task corresponding to the above target model is split to obtain the above multiple subtasks; the attributes of the corresponding parameter items of the above multiple subtasks are different.
[0015] In a possible implementation, the attribute of the parameter item includes the network level at which the parameter item is located in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data;
[0016] According to the above preset rules, the training task corresponding to the above target model is split into the above multiple subtasks, including:
[0017] The target model is split according to the network level of the target model to obtain multiple sub-models; the sub-models include at least one network layer of the target model and parameter items corresponding to the at least one network layer;
[0018] The multiple subtasks are determined based on the multiple sub-models and the training data set.
[0019] In a possible implementation, the parameter item carries a network level identifier corresponding to the at least one network layer; the network level identifier is used to represent the training order of the parameter item corresponding to the network level in the target model;
[0020] The above-mentioned multiple subtasks are trained in sequence according to the training order of their corresponding parameter items, and the execution results of the above-mentioned subtasks are obtained by training the parameter items corresponding to the above-mentioned subtasks based on the execution results of the previous subtasks and the training data corresponding to the above-mentioned subtasks; the first training order of the parameter items corresponding to the above-mentioned previous subtask is located before the second training order of the parameter items corresponding to the above-mentioned subtasks, and the above-mentioned first training order is continuous with the above-mentioned second training order.
[0021] In a possible implementation, the attribute of the parameter item includes a dimension corresponding to the parameter item in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data;
[0022] According to the above preset rules, the training task corresponding to the above target model is split into the above multiple subtasks, including:
[0023] The parameters of the target model are split according to the parameter dimensions of the target model to obtain a plurality of parameter items; the parameter items include target parameters of at least one dimension of the target model, and the parameter items carry dimension identifiers corresponding to the target parameters;
[0024] The multiple subtasks are determined based on the multiple parameter items and the training data set.
[0025] In a possible implementation, the determining of the plurality of subtasks based on the plurality of parameter items and the training data set includes:
[0026] If the training data set is larger than the threshold, the training data set is split to obtain multiple training data subsets; the training data subsets include at least one training data;
[0027] The plurality of subtasks are determined based on the plurality of parameter items and the plurality of training data subsets.
[0028] In a possible implementation, the current status information includes the current network status and current computing power information of the edge node, and the historical task execution status information includes the historical task execution status corresponding to the edge node and / or the historical task execution success rate corresponding to the edge node;
[0029] Before allocating the first subtask among the plurality of subtasks to the target edge node according to the target allocation strategy, the method further includes:
[0030] Based on the current status information and historical task execution status information corresponding to the above-mentioned multiple edge nodes, the target allocation strategy corresponding to the above-mentioned multiple subtasks is determined; the above-mentioned target allocation strategy includes the number of subtasks to be allocated corresponding to the above-mentioned target edge nodes and / or the computing power required for the subtasks; the above-mentioned target allocation strategy and the target edge nodes among the above-mentioned multiple edge nodes change with the changes in the current status information corresponding to the above-mentioned multiple edge nodes.
[0031] In a possible implementation, after allocating the first subtask among the plurality of subtasks to the target edge node according to the target allocation strategy, the method further includes:
[0032] If the target edge node changes from an online state to an offline state, or the execution state corresponding to the first subtask sent by the target edge node is execution failure, or the execution result corresponding to the first subtask sent by the target edge node is not obtained within the preset time, the first subtask is reallocated to another target edge node, or the parameter items corresponding to the first subtask are trained based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask.
[0033] In a second aspect, an embodiment of the present application provides another model training method, which is applied to a target edge node among multiple edge nodes, and the target edge node is determined by a server based on current status information and historical task execution status information corresponding to each of the multiple edge nodes; the edge node includes a device registered in the server, and the target edge node is used to characterize the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtask includes parameter items and training data corresponding to the target model; the method includes:
[0034] Receiving a first subtask among the plurality of subtasks allocated by the server according to the target allocation strategy;
[0035] Based on the training data corresponding to the first subtask, the parameter item corresponding to the first subtask is trained to obtain the execution result corresponding to the first subtask;
[0036] The execution result corresponding to the first subtask is sent to the server, so that the server aggregates the execution results corresponding to the multiple subtasks according to preset rules, obtains the training result corresponding to the target model, and updates the target model based on the training result.
[0037] In a possible implementation, if there is a second subtask among the above-mentioned multiple subtasks, the execution result corresponding to the above-mentioned second subtask is obtained by the above-mentioned server training the parameter items corresponding to the above-mentioned second subtask based on the training data corresponding to the above-mentioned second subtask; the above-mentioned second subtask includes the subtasks among the above-mentioned multiple subtasks that are not assigned to the above-mentioned target edge node, and / or the subtasks among the above-mentioned multiple subtasks that fail to be executed by the above-mentioned target edge node.
[0038] In a third aspect, an embodiment of the present application provides a server, the server comprising:
[0039] A first determination module is used to determine a target edge node among the plurality of edge nodes based on the current state information and historical task execution state information corresponding to each of the plurality of edge nodes; the edge node includes a device registered in the server; the target edge node is used to represent an edge node currently participating in a training task corresponding to a target model; the training task includes a plurality of subtasks, and the subtasks include parameter items and training data corresponding to the target model;
[0040] A task allocation module, used to allocate the first subtask among the above-mentioned multiple subtasks to the above-mentioned target edge node according to the target allocation strategy, so that the above-mentioned target edge node trains the parameter item corresponding to the above-mentioned first subtask based on the training data corresponding to the above-mentioned first subtask, and obtains the execution result corresponding to the above-mentioned first subtask;
[0041] A first receiving module, used to receive the execution result corresponding to the first subtask sent by the target edge node;
[0042] An aggregation module is used to aggregate the execution results corresponding to the above-mentioned multiple subtasks according to preset rules to obtain the training results corresponding to the above-mentioned target model;
[0043] The model updating module is used to update the target model based on the training results.
[0044] In a fourth aspect, an embodiment of the present application provides a target edge node, wherein the target edge node is determined by a server based on current state information and historical task execution state information corresponding to each of a plurality of edge nodes; the edge node includes a device registered in the server, and the target edge node is used to characterize an edge node currently participating in a training task corresponding to a target model; the training task includes a plurality of subtasks, and the subtasks include parameter items and training data corresponding to the target model; the target edge node includes:
[0045] A second receiving module is used to receive the first subtask among the multiple subtasks allocated by the server according to the target allocation strategy;
[0046] A second training module is used to train the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask;
[0047] The first sending module is used to send the execution result corresponding to the above-mentioned first subtask to the above-mentioned server, so that the above-mentioned server aggregates the execution results corresponding to the above-mentioned multiple subtasks according to preset rules, obtains the training result corresponding to the above-mentioned target model, and updates the above-mentioned target model based on the above-mentioned training result.
[0048] In the fifth aspect, an embodiment of the present application provides a model training system, which includes: a server and a target edge node; the server is used to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect; the target edge node is used to execute the method provided by the second aspect of the embodiment of this specification or any possible implementation of the second aspect.
[0049] In a sixth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
[0050] The processor is connected to the memory;
[0051] The above-mentioned memory is used to store executable program code;
[0052] The above-mentioned processor runs the program corresponding to the above-mentioned executable program code by reading the executable program code stored in the above-mentioned memory, so as to execute the method provided by the first aspect or any possible implementation of the first aspect or the second aspect or any possible implementation of the second aspect of the embodiment of this specification.
[0053] In the seventh aspect, an embodiment of the present specification provides a computer storage medium, wherein the computer storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor and executing the method provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect or the second aspect or any possible implementation of the second aspect.
[0054] In one or more embodiments of the present application, the server determines the target edge node based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; allocates the first subtask of the multiple subtasks corresponding to the target model to the target edge node according to the target allocation strategy, so that the target edge node trains the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the corresponding execution result; aggregates the execution results corresponding to the multiple subtasks to obtain the training result of the target model, and updates the target model based on the training result, so as to realize efficient distributed model training by utilizing the registered target edge nodes, reasonably utilize the computing power of the edge devices, reduce the training cost, and avoid the problem that the model training is interrupted due to the joining and exiting of the devices and the impact on the model training speed, so as to ensure the convenience and flexibility of hot-swapping of the edge devices during the model training process.
[0055] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 A schematic diagram of the architecture of a model training system provided for an exemplary embodiment of the present application;
[0058] Figure 2 A flowchart of a model training method provided for an exemplary embodiment of the present application;
[0059] Figure 3 A schematic diagram of a training task splitting process provided for an exemplary embodiment of the present application;
[0060] Figure 4 A schematic diagram of another training task splitting process provided for an exemplary embodiment of the present application;
[0061] Figure 5 A schematic diagram of the structure of a server provided for an exemplary embodiment of the present application;
[0062] Figure 6 A schematic diagram of the structure of a target edge node provided by an exemplary embodiment of the present application;
[0063] Figure 7A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0065] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0066] Please refer to the following Figure 1 , which is a schematic diagram of the architecture of a model training system provided by an exemplary embodiment of this specification. Figure 1 As shown, the model training system may include: a server 110 and multiple edge nodes 120. Among them:
[0067] The server 110 may be a server that can provide multiple model trainings, and may receive data such as training tasks of target models sent by any user terminal in the terminal through the network, and obtain data such as current status information and historical task execution status information corresponding to each of the multiple registered edge nodes 120. The server 110 may also determine the target edge node among the multiple edge nodes 120 based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes 120, and the edge node 120 includes the device registered in the server 110; the above-mentioned target edge node is used to characterize the edge node currently participating in the training task corresponding to the target model, and the training task includes multiple subtasks, and the subtask includes parameter items and training data corresponding to the target model; the first subtask among the multiple subtasks is allocated to the target edge node according to the target allocation strategy, so that the target edge node trains the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask, and obtains the execution result corresponding to the first subtask; the execution result corresponding to the first subtask sent by the target edge node is received; according to the preset rules, the execution results corresponding to each of the multiple subtasks are aggregated to obtain the training result corresponding to the target model; the target model is updated based on the training result.
[0068] It can be understood that the server 110 can be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.
[0069] The edge node 120 may be a device connected to the server 110 at the edge of the network, and may be, but not limited to, a mobile phone, tablet computer, laptop computer, or other device installed with a user version software. The user may, but not limited to, input the information of the server 110 through the user version software, so that the edge node 120 establishes a connection with the server 110 based on the information of the server 110, and registers the device information corresponding to the edge node 120 in the server 120. The target edge node among the above-mentioned multiple edge nodes 120 may receive the first subtask among the multiple subtasks assigned by the server 110 according to the target allocation strategy, and train the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask, and send the execution result corresponding to the first subtask to the server 110, so that the server 110 aggregates the execution results corresponding to the multiple subtasks according to the preset rules, obtains the training result corresponding to the target model, and updates the target model based on the training result.
[0070] The network can be a medium that provides a communication link between a server and any edge node, between any two edge nodes, or the Internet including network devices and transmission media, but is not limited thereto. The transmission medium can be a wired link, such as but not limited to coaxial cable, optical fiber, and digital subscriber line (DSL), or a wireless link, such as but not limited to wireless fidelity (WIFI), Bluetooth, and mobile device networks.
[0071] Understandably, Figure 1 The number of servers 110 and edge nodes 120 in the model training system shown is only an example. In a specific implementation, the model training system may include any number of servers 110 and edge nodes 120. This specification embodiment does not specifically limit this. For example, but not limited to, the server 110 may be a server cluster composed of multiple servers, and the edge node 120 may be an edge node cluster composed of multiple edge nodes.
[0072] Please refer to the following Figure 2 , which exemplarily shows a flow chart of a model training method provided in an embodiment of the present application. Figure 2 As shown, the model training method includes the following steps:
[0073] S201, the server determines a target edge node among multiple edge nodes based on current status information and historical task execution status information corresponding to each of the multiple edge nodes.
[0074] Specifically, after the server receives the training task corresponding to the target model sent by the user's corresponding terminal or the training task corresponding to the target model input by the user, it can first obtain the current status information and historical task execution status information corresponding to each of the multiple edge nodes, and then can, but is not limited to, determine the currently online target edge node and / or at least one target edge node that is currently online and has the highest historical task execution success rate from the multiple edge nodes based on the current status information and historical task execution status information corresponding to each of the above multiple edge nodes. The above edge nodes include devices registered in the server, and the above target edge nodes are used to characterize the edge nodes currently participating in the training task corresponding to the target model. The above training task includes multiple subtasks, and the above subtasks include parameter items and training data corresponding to the target model.
[0075] It can be understood that the number of the above-mentioned target edge nodes may include one or more, and can be determined based on but not limited to the number of subtasks of the training task corresponding to the target model and / or the actual training situation of the training task corresponding to the target model. For example, but not limited to, when the training task includes 3 subtasks, it can be determined based on but not limited to the current status information and historical task execution status information corresponding to each of the multiple edge nodes. The three target edge nodes that are currently online and have the highest historical task execution success rate or the highest current computing power can be determined.
[0076] Optionally, the above-mentioned current status information includes the current network status and current computing power information of the edge node, and the above-mentioned historical task execution status information includes the historical task execution status corresponding to the edge node and / or the historical task execution success rate corresponding to the edge node. The above-mentioned current network status includes an online status and an offline status. In order to ensure that the server will automatically assign training tasks to the new edge node after it comes online to join the model training, and to avoid the problem of model training interruption caused by edge node offline or insufficient computing power of the edge node due to human operation or equipment damage, the server can monitor the current network status of each edge node in real time during the model training process. When the current network status of the edge node is monitored to be online, it can be determined, but not limited to, based on the current computing power information and / or historical task execution status and / or historical task execution success rate of the edge node whether to select the edge node as the target edge node participating in the model training, for example, but not limited to selecting the edge node with the highest current computing power value and / or the historical task execution status of successful execution and / or the historical task execution success rate. One or more edge nodes with the highest task execution success rate are used as the target edge nodes currently participating in the model training. By real-time monitoring the current status information and historical task execution status information corresponding to multiple edge nodes registered in the server, the target edge nodes currently participating in the training are determined, ensuring that the server can automatically assign subtasks to newly registered devices, and automatically kick out edge nodes that have been offline or have failed to execute multiple tasks from the model training process, avoiding the problem of model training interruptions caused by the addition and exit of devices or insufficient computing power of devices, affecting the model training speed. That is, it is ensured that model training will not be interrupted during the hot plugging of edge nodes, ensuring the speed of model training and the convenience and flexibility of using network edge devices.
[0077] S202: The server allocates a first subtask among the multiple subtasks to a target edge node according to a target allocation strategy.
[0078] Specifically, the first subtask is used to represent the subtask to be assigned to the target edge node for execution among the multiple subtasks. The server may, but is not limited to, assign one or more first subtasks within its load tolerance range according to the load situation corresponding to the target edge node (for example, but not limited to the current computing power value).
[0079] Optionally, in the above S202, before the server allocates the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the above method may also include: determining the target allocation strategy corresponding to the above multiple subtasks based on the current state information and historical task execution state information corresponding to each of the above multiple edge nodes. The above target allocation strategy may include, but is not limited to, the number of subtasks to be allocated and / or the computing power required for the subtasks corresponding to the target edge node, that is, it may include, but is not limited to, first determining the target edge node of the multiple edge nodes according to the current state information and historical task execution state information corresponding to each of the multiple edge nodes, and then determining the number of subtasks to be allocated and / or the computing power required for the subtasks corresponding to each target edge node according to the current computing power information corresponding to each target edge node, and then determining the specific first subtask to be allocated to each target edge node according to the computing power required for each first subtask among the multiple subtasks, for example, but not limited to, the computing power required for the first subtask allocated by the server to each target edge node should be less than or equal to the current computing power value of the target edge node, so as to ensure that the target edge node can successfully complete the first subtask allocated by the server, avoid the situation where the first subtask fails to execute and needs to be reallocated, and ensure the efficiency of model training. The number of subtasks to be assigned corresponding to the above-mentioned target edge node may include one or more, which can be specifically determined based on the current computing power corresponding to the target edge node and the computing power required for each subtask. The embodiment of the present application does not limit this.
[0080] It can be understood that the above target allocation strategy and the target edge node among the multiple edge nodes change with the change of the current state information corresponding to each of the multiple edge nodes.
[0081] Optionally, if the historical task execution status information of the target edge node indicates that the target edge node always times out to complete the historical tasks assigned to it (for example, but not limited to, the percentage of historical tasks completed in timeout is 100% or greater than 90%, etc.) or it is difficult to complete the historical tasks assigned to it due to insufficient computing power, it means that the historical tasks assigned to the target edge node are relatively heavy for the target edge node. Then, when determining the target allocation strategy, the total computing power of the subtasks currently to be allocated to the target edge node can be reduced, that is, the target edge node is allocated a second subtask with a computing power smaller than that required for the historical tasks previously executed by it, so as to avoid the problem that the target edge node always times out to complete the subtasks assigned by the server, resulting in a decrease in the overall training speed of the model training.
[0082] In some possible embodiments, in the above S202, before the server allocates the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, it can also first split the training task corresponding to the target model according to the preset rules to obtain the above multiple subtasks, thereby both pre-splitting the training task corresponding to the target model into a large number of fine-grained small tasks (subtasks) and allocating them to the target edge node in an idle state at the edge of the server network for training, avoiding the problem that the training task corresponding to the target model requires too much computing power, resulting in the need for extremely high-cost servers to participate in the training, which increases the cost of model training, and reduces the overall computing cost of model training. It can also combine the computing power of the registered and sufficiently online target edge node at the edge of the server network to achieve efficient distributed training of the target model and improve the model training speed. At the same time, during the model training process, when there is a new device joining the model training (online registration), the server does not need to re-split the training task, and can directly allocate the unsuccessfully executed or unallocated subtasks to the new device (new target edge node), ensuring the efficiency and flexibility of the devices at the edge of the server network participating in the model training.
[0083] Furthermore, the attributes of the parameter items corresponding to the above-mentioned multiple subtasks are different (for example, but not limited to the dimensions corresponding to the parameter items or the network layers at which the parameter items correspond to the target model, etc.), that is, the training task of the target model can be split according to the attributes of each parameter of the target model to obtain multiple subtasks. The attributes of all parameters to be trained in the parameter items corresponding to each subtask are the same.
[0084] Optionally, the attribute of the parameter item may include the network level of the parameter item in the target model; the training task of the target model includes the target model and a training data set corresponding to the target model, and the training data set includes multiple training data. Figure 3 As shown, the above-mentioned splitting of the training task corresponding to the target model according to the preset rules to obtain multiple subtasks may include: first splitting the target model according to the network layer of the target model to obtain multiple submodels; then, determining multiple subtasks based on the multiple submodels and the training data set. The above-mentioned submodel includes at least one network layer of the target model and parameter items corresponding to at least one network layer.
[0085] It can be understood that when the sub-model includes a multi-layer network, the multi-layer network should be a continuous network. Since there is a certain correlation between the training of two adjacent sub-models in the multiple sub-models, for example, the training of the second sub-model needs to obtain the training results of the first sub-model based on the training data before it can be carried out, and in order to ensure the accuracy of the training, for the same round of training, the training data corresponding to each sub-model should be the same. Therefore, for the same round of training, the training data corresponding to each of the above multiple sub-tasks should be the same, for example but not limited to the training data sets corresponding to the target model.
[0086] Exemplarily, if the target model is a target question and answer model with a total of 5 layers of networks, the 5 layers of networks of the target question and answer model can be directly split in sequence to obtain sub-models corresponding to each layer of the network. It can also be split directly according to the function or importance of the network. For example, but not limited to, according to the function of each network layer, the first layer of the network that plays an access role in the target question and answer model is split into the first sub-model, the second layer of the network that plays a convergence role in the target question and answer model is split into the second sub-model, and the third to fifth layers of the network that play a core question and answer role in the target question and answer model are split into the third sub-model.
[0087] Optionally, the attribute of the parameter item may include the dimension corresponding to the parameter item in the target model; the training task of the target model includes the target model and a training data set corresponding to the target model, and the training data set includes multiple training data. Figure 4 As shown, the above-mentioned splitting of the training task corresponding to the target model according to the preset rules to obtain multiple subtasks may include: first splitting the parameters of the target model according to the parameter dimensions of the target model to obtain multiple parameter items; then, determining multiple subtasks based on the multiple parameter items and the training data set; the above parameter items include the target parameters of at least one dimension of the target model. The above parameter items may, but are not limited to, carry the dimension identifier corresponding to the target parameter, so that the subsequent server aggregates the training results corresponding to each parameter item uploaded by each target edge node (the execution results corresponding to the first subtask) based on the dimension identifier corresponding to each parameter item.
[0088] It is understandable that the parameter dimensions corresponding to the above multiple parameter items are different. Parameter items of different dimensions can be trained independently, or they can be combined in pairs or multiple combinations for training together. Therefore, for different parameter items, the training data corresponding to the subtasks can be different or the same, and the embodiments of the present application do not limit this.
[0089] For example, if each layer of tensors (parameters) in the target model is 3-dimensional, the parameters of each layer can be split into a 2D matrix (target parameter) and a 1D parameter (target parameter) to obtain two parameter items of different dimensions corresponding to each layer, and assign them to separate target edge nodes for training.
[0090] Furthermore, the above-mentioned determination of multiple subtasks based on multiple parameter items and training data sets may include but is not limited to: if the training data set is greater than a threshold value, it means that the training data set corresponding to the target model is too large, and the computing power of each target edge node may not be sufficient to support the one-time training of all the training data in the training data set, then the training data set can be split first to obtain multiple training data subsets, and the above-mentioned training data subset includes at least one training data; then, multiple subtasks are determined based on multiple parameter items and multiple training data subsets, that is, at least one training data subset is allocated to multiple parameter items for training, thereby avoiding the problem of model training interruption or slow model training speed caused by insufficient computing power of the target edge node. In order to further ensure the efficiency of executing the first subtask at the target edge node, that is, the target edge node trains the parameter items, the above-mentioned training data subset should be less than the above-mentioned threshold value. The training data subsets corresponding to different parameter items may be the same or different, and the embodiments of the present application are not limited to this.
[0091] It can be understood that when the training data set is too large, in order to speed up training, no matter how the training tasks corresponding to the target model are split, the training data set of the target model can be sent to the target edge node in batches for training. Different target edge nodes can train different training data or the same training data when training different parameter items (first subtask). The specific training data can be determined according to the actual training situation, and the embodiments of the present application are not limited to this.
[0092] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S202, after the server allocates the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the above model training method further includes:
[0093] S203: The target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask.
[0094] Specifically, after the target edge node receives the first subtask assigned by the server according to the target allocation strategy, it can directly train the parameter items corresponding to the first subtask according to the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask. The above-mentioned execution result corresponding to the first subtask may include but is not limited to the difference value that needs to be modified for the parameter item corresponding to the first subtask or the target parameter item obtained after the training of the first subtask.
[0095] Optionally, when the target model is split according to the network level of the target model, the subtasks include at least one network layer of the target model and parameter items corresponding to at least one network layer, and the parameter items carry the network level identifier corresponding to at least one network layer; the network level identifier is used to characterize the training order of the parameter items corresponding to the network level in the target model. The above-mentioned multiple subtasks are trained in sequence according to the training order of their corresponding parameter items, and the execution results of the above-mentioned subtasks are obtained by training the parameter items corresponding to the subtasks based on the execution results of the corresponding previous subtasks and the training data corresponding to the subtasks; the first training order of the parameter items corresponding to the above-mentioned previous subtask is located before the second training order of the parameter items corresponding to the above-mentioned subtasks, and the above-mentioned first training order is continuous with the above-mentioned second training order.
[0096] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S203, the target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask, and after obtaining the execution result corresponding to the first subtask, the above model training method further includes:
[0097] S204: The target edge node sends the execution result corresponding to the first subtask to the server.
[0098] Specifically, after executing the first subtask assigned by the server, the target edge node will send the corresponding execution result to the server so that the server can subsequently aggregate the execution of all subtasks of the target model to obtain the corresponding training results, thereby achieving efficient distributed training of the model by utilizing the target edge nodes that have registered and participated in the training tasks in the server, rationally utilizing the computing power of the server network edge devices, and reducing the cost of model training.
[0099] Optionally, the target edge node and the server can communicate through a customized communication protocol (such as but not limited to 5G communication, etc.), standardizing the data content, authentication rules, and data packet organization rules to be transmitted between devices, so as to reduce the communication overhead during the distributed model training process.
[0100] S205: The server aggregates the execution results corresponding to the multiple subtasks according to preset rules to obtain the training results corresponding to the target model.
[0101] Specifically, if multiple subtasks are assigned to the target edge node as the first subtask for training, then after the server receives the execution results corresponding to the first subtask sent by each target edge node, it can directly aggregate the execution results corresponding to the multiple subtasks according to the preset rules when the target model training task is split, and obtain the training results corresponding to the target model; the above training results include the difference values that need to be modified for each parameter item of the target model or the target parameter items obtained after training.
[0102] Optionally, in the above S205, according to preset rules, the execution results corresponding to each of the multiple subtasks are aggregated to obtain the training results corresponding to the target model. If there is a second subtask among the multiple subtasks, the server can directly train the parameter items corresponding to the second subtask based on the training data corresponding to the second subtask to obtain the execution results corresponding to the second subtask. The above second subtask includes subtasks among the multiple subtasks that are not assigned to the target edge node, and / or subtasks among the multiple subtasks that fail to execute at the target edge node.
[0103] In an embodiment of the present application, the server may, but is not limited to, not assign a subtask with greater computing power or more importance to the target edge node as the second subtask and train it by itself, so as to ensure the execution success rate and efficiency of the second subtask as much as possible, and further ensure the overall training speed of the model training; at the same time, the server may also train the subtask that failed to execute the target edge node as the second subtask by itself, which not only avoids the problem that the target edge node needs to re-find other target edge nodes for assignment of the subtask that failed to execute, but also ensures that the subtask that failed to execute the target edge node can obtain the computing power support of the server to complete the training, and avoids the problem that the subtask has been staying at the target edge node in a failed execution state, resulting in the server always lacking the execution result corresponding to the subtask, causing the model training to be interrupted or failed.
[0104] S206: The server updates the target model based on the training results.
[0105] Specifically, after the server aggregates the training results corresponding to the target model, it can, but is not limited to, directly replace each parameter item in the target model with the corresponding target parameter item obtained after training in the training results, or directly update each parameter item in the target model according to the difference value that needs to be modified for each parameter item of the target model in the training results to obtain the trained target model.
[0106] Exemplarily, the model training method described in the embodiments of the present application can be applied to the training of any model such as a recognition model, a large language model, etc., but is not limited to the large language model. The large language model refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. The large language model can handle a variety of natural language tasks, such as text classification, question and answer, dialogue, etc. The target model is, for example but not limited to, a text classification model, the training data set may include multiple training texts of known actual categories, and the training results may include, but are not limited to, aggregating the execution results corresponding to multiple subtasks and predicting the difference between the predicted category and the actual category corresponding to each training text.
[0107] In an embodiment of the present application, the server determines the target edge node based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; allocates the first subtask of the multiple subtasks corresponding to the target model to the target edge node according to the target allocation strategy, so that the target edge node trains the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the corresponding execution result; aggregates the execution results corresponding to the multiple subtasks to obtain the training result of the target model, and updates the target model based on the training result, thereby utilizing the registered target edge nodes to achieve efficient distributed model training, reasonably utilize the computing power of edge devices, reduce training costs, and avoid the problem of model training interruption caused by device joining and exiting that affects the model training speed, thereby ensuring the convenience and flexibility of hot-plugging edge devices during model training.
[0108] Exemplarily, the number of the target edge nodes is at least two; the subtask includes at least one submodel; the training task includes M subtasks, and the training data set includes N training data subsets; both M and N are positive integers greater than 1; in S202, after the server allocates the first subtask of the multiple subtasks to the target edge node according to the target allocation strategy, it can also first obtain the j-th round execution status corresponding to the ith subtask, where i is a positive integer less than or equal to M, and j is a positive integer less than or equal to N; if the j-th round execution status corresponding to the ith subtask If the execution status is successful, and the i-th subtask and the i+1-th subtask are both the first subtask, the device information of the i+1-th target edge node executing the i-th subtask is sent to the i-th target edge node executing the i-th subtask, so that the i-th target edge node sends the j-th round execution result corresponding to the i-th subtask to the i+1-th target edge node based on the device information, and sends the j+1-th training data subset corresponding to the target model to the i-th target edge node, so that the i-th target edge node can perform the j-th round execution of the i-th subtask based on the device information. The j+1th training data subset is used to train the sub-model in the ith sub-task to obtain the j+1th round execution result corresponding to the ith sub-task; the jth round execution result of the ith sub-task is obtained by the ith target edge node training the sub-model in the ith sub-task based on the jth round execution result corresponding to the i-1th sub-task and the jth training data subset of the ith sub-task; the above i is updated to i+1, and the step of obtaining the jth round execution status corresponding to the ith sub-task is performed again, until the jth round execution status corresponding to each of the M sub-tasks is obtained. After the j-round execution statuses are all successful, the j-round training result corresponding to the above-mentioned target model is determined based on the j-round execution results corresponding to the above-mentioned M subtasks; if the j-round execution status of the above-mentioned i-th subtask corresponding to the above-mentioned i-th target edge node is successful, then j is updated to j+1, and the above-mentioned step of obtaining the j-round execution status corresponding to the i-th subtask is executed again, until the N-round execution statuses of the above-mentioned M subtasks corresponding to the above-mentioned N training data subsets are all successful, then the training result corresponding to the above-mentioned target model is determined based on the N-round training results corresponding to the above-mentioned target model.
[0109] In an embodiment of the present application, through a pipelined training data transmission and training process, when the front target edge node is training the current batch of training data, the rear target edge node is actually still training the content of the previous batch. After the front target edge node transmits the current training result (execution result) to the next node (the rear target edge node), the front target edge node will immediately perform training for the next batch without waiting for the rear target edge node to complete training. This can accelerate the synchronization of model parameters during training and improve the model training speed.
[0110] In some possible embodiments, in the above S202, after the server assigns the first subtask among multiple subtasks to the target edge node according to the target allocation strategy, if the target edge node changes from an online state to an offline state, or the execution state corresponding to the first subtask sent by the target edge node is execution failure, or the execution result corresponding to the first subtask sent by the target edge node is not obtained within a preset time (for example but not limited to 3 minutes or 10 minutes, etc.), it can be assumed that the target edge node is currently unable to complete the first subtask assigned to it, then the first subtask can be reallocated to another target edge node for training, or the server directly trains the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask, thereby avoiding the problem that the target edge node currently participating in the model training is offline due to human operation or equipment damage, or the target edge node currently participating in the model training is interrupted because its current computing power is insufficient to support the execution of the subtask assigned to it.
[0111] It can be understood that if the target edge node is offline on the server due to equipment damage or network interruption, the edge node will be skipped in the next round of task allocation. If an edge node is newly registered, subtasks will be reassigned to it in the next round of task allocation. If a target edge node has been assigned a subtask, but the corresponding execution result is not returned after a preset period of time, the subtask is considered to have failed, and the subtask that has been assigned and has not yet returned the execution result will be reallocated to other target edge nodes for execution. This supports the flexible and dynamic plug-in and unplugging of each edge device on the server. Even if the device corresponding to the edge node is damaged or suddenly offline during model training, it will not affect the overall model training process. While achieving efficient distributed model training by combining edge devices, it can also improve the flexibility of server edge devices to participate in and exit model training.
[0112] Please refer to the following Figure 5 , which is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. Figure 5 As shown, the server 500 includes:
[0113] The first determination module 510 is used to determine a target edge node among the plurality of edge nodes based on the current state information and historical task execution state information corresponding to each of the plurality of edge nodes; the edge node includes a device registered in the server; the target edge node is used to represent an edge node currently participating in a training task corresponding to a target model; the training task includes a plurality of subtasks, and the subtasks include parameter items and training data corresponding to the target model;
[0114] A task allocation module 520 is used to allocate the first subtask among the plurality of subtasks to the target edge node according to the target allocation strategy, so that the target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask;
[0115] A first receiving module 530 is used to receive the execution result corresponding to the first subtask sent by the target edge node;
[0116] Aggregation module 540, used to aggregate the execution results corresponding to the above-mentioned multiple subtasks according to preset rules to obtain the training result corresponding to the above-mentioned target model;
[0117] The model updating module 550 is used to update the target model based on the training results.
[0118] In a possible implementation, the server 500 further includes:
[0119] The first training module is used to train the parameter items corresponding to the second subtask based on the training data corresponding to the second subtask if there is a second subtask among the above-mentioned multiple subtasks, so as to obtain the execution result corresponding to the second subtask; the above-mentioned second subtask includes the subtasks among the above-mentioned multiple subtasks that are not assigned to the above-mentioned target edge node, and / or the subtasks among the above-mentioned multiple subtasks that fail to be executed by the above-mentioned target edge node.
[0120] In a possible implementation, the server 500 further includes:
[0121] The task splitting module is used to split the training task corresponding to the above-mentioned target model according to the above-mentioned preset rules to obtain the above-mentioned multiple subtasks; the attributes of the corresponding parameter items of the above-mentioned multiple subtasks are different.
[0122] In a possible implementation, the attributes of the parameter item include the network level at which the parameter item is located in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data; and the task splitting module includes:
[0123] A first task splitting unit is used to split the target model according to the network level of the target model to obtain multiple sub-models; the sub-models include at least one network layer of the target model and parameter items corresponding to the at least one network layer;
[0124] The first determination unit is used to determine the multiple subtasks based on the multiple sub-models and the training data set.
[0125] In a possible implementation, the parameter item carries a network level identifier corresponding to the at least one network layer; the network level identifier is used to represent the training order of the parameter item corresponding to the network level in the target model;
[0126] The above-mentioned multiple subtasks are trained in sequence according to the training order of their corresponding parameter items, and the execution results of the above-mentioned subtasks are obtained by training the parameter items corresponding to the above-mentioned subtasks based on the execution results of the previous subtasks and the training data corresponding to the above-mentioned subtasks; the first training order of the parameter items corresponding to the above-mentioned previous subtask is located before the second training order of the parameter items corresponding to the above-mentioned subtasks, and the above-mentioned first training order is continuous with the above-mentioned second training order.
[0127] In a possible implementation, the attributes of the parameter items include the dimensions corresponding to the parameter items in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data; and the task splitting module includes:
[0128] A second task splitting unit is used to split the parameters of the target model according to the parameter dimensions of the target model to obtain multiple parameter items; the parameter items include target parameters of at least one dimension of the target model, and the parameter items carry dimension identifiers corresponding to the target parameters;
[0129] The second determining unit is used to determine the plurality of subtasks based on the plurality of parameter items and the training data set.
[0130] In a possible implementation manner, the second determining unit is specifically configured to:
[0131] If the training data set is larger than a threshold, the training data set is split to obtain a plurality of training data subsets; the training data subsets include at least one training data; and the plurality of subtasks are determined based on the plurality of parameter items and the plurality of training data subsets.
[0132] In a possible implementation, the current status information includes the current network status and current computing power information of the edge node, and the historical task execution status information includes the historical task execution status corresponding to the edge node and / or the historical task execution success rate corresponding to the edge node;
[0133] The above server also includes:
[0134] The second determination module is used to determine the target allocation strategy corresponding to the above-mentioned multiple subtasks based on the current status information and historical task execution status information corresponding to the above-mentioned multiple edge nodes; the above-mentioned target allocation strategy includes the number of subtasks to be allocated corresponding to the above-mentioned target edge nodes and / or the computing power required for the subtasks; the above-mentioned target allocation strategy and the target edge nodes among the above-mentioned multiple edge nodes change with the changes in the current status information corresponding to the above-mentioned multiple edge nodes.
[0135] In a possible implementation, the server 500 further includes:
[0136] A reallocation module is used to reallocate the first subtask to another target edge node, or to train the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask, to obtain the execution result corresponding to the first subtask, if the target edge node changes from an online state to an offline state, or the execution state corresponding to the first subtask sent by the target edge node is execution failure, or the execution result corresponding to the first subtask sent by the target edge node is not obtained within a preset time.
[0137] The division of the modules in the above-mentioned server is only for illustration. In other embodiments, the server can be divided into different modules as needed to complete all or part of the functions of the above-mentioned server. The implementation of each module in the server provided in the embodiment of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the model training method described in the embodiment of this specification are implemented.
[0138] Please refer to the following Figure 6, which is a schematic diagram of the structure of a target edge node provided by an exemplary embodiment of the present application. The target edge node is determined by the server based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; the edge node includes a device registered in the server, and the target edge node is used to represent the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtasks include parameter items and training data corresponding to the target model; Figure 6 As shown, the target edge node 600 includes:
[0139] The second receiving module 610 is used to receive the first subtask among the multiple subtasks allocated by the server according to the target allocation strategy;
[0140] A second training module 620 is used to train the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask;
[0141] The first sending module 630 is used to send the execution result corresponding to the above-mentioned first subtask to the above-mentioned server, so that the above-mentioned server aggregates the execution results corresponding to the above-mentioned multiple subtasks according to preset rules, obtains the training result corresponding to the above-mentioned target model, and updates the above-mentioned target model based on the above-mentioned training result.
[0142] In a possible implementation, if there is a second subtask among the above-mentioned multiple subtasks, the execution result corresponding to the above-mentioned second subtask is obtained by the above-mentioned server training the parameter items corresponding to the above-mentioned second subtask based on the training data corresponding to the above-mentioned second subtask; the above-mentioned second subtask includes the subtasks among the above-mentioned multiple subtasks that are not assigned to the above-mentioned target edge node, and / or the subtasks among the above-mentioned multiple subtasks that fail to be executed by the above-mentioned target edge node.
[0143] The division of each module in the above-mentioned target edge node is only for illustration. In other embodiments, the target edge node can be divided into different modules as needed to complete all or part of the functions of the above-mentioned target edge node. The implementation of each module in the target edge node provided in the embodiment of this specification may be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the model training method described in the embodiment of this specification are implemented.
[0144] See next Figure 7 , which is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Figure 7As shown, the electronic device 700 may include: at least one processor 710 , at least one communication bus 720 , a user interface 730 , at least one network interface 740 , and a memory 750 .
[0145] The communication bus 720 may be used to realize the connection and communication among the above-mentioned components.
[0146] The user interface 730 may include a display screen (Display) and a camera (Camera), and the optional user interface 730 may also include a standard wired interface and a wireless interface.
[0147] The network interface 740 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, and the like.
[0148] Among them, the processor 710 may include one or more processing cores. The processor 710 uses various interfaces and lines to connect various parts within the entire electronic device 700, and executes various functions and processes data of the routing electronic device 700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 750, and calling data stored in the memory 750. Optionally, the processor 710 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 710 can integrate one or a combination of a processor (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 710, and it can be implemented separately through a chip.
[0149] Among them, the memory 750 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory, ROM). Optionally, the memory 750 includes a non-transitory computer-readable medium. The memory 750 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 750 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a task allocation function, a sending function, a model training function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 750 may also be optionally at least one storage device located away from the aforementioned processor 710. As Figure 7 As shown, the memory 750 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0150] In some possible embodiments, the electronic device 700 may be the aforementioned Figure 5 In the server shown, the processor 710 can be used to call the program instructions stored in the memory 750 and specifically perform the following operations:
[0151] Based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes, the target edge node among the above-mentioned multiple edge nodes is determined; the above-mentioned edge node includes a device registered in the above-mentioned server; the above-mentioned target edge node is used to characterize the edge node currently participating in the training task corresponding to the target model; the above-mentioned training task includes multiple subtasks, and the above-mentioned subtask includes parameter items and training data corresponding to the above-mentioned target model; the first subtask among the above-mentioned multiple subtasks is allocated to the above-mentioned target edge node according to the target allocation strategy, so that the above-mentioned target edge node trains the parameter items corresponding to the above-mentioned first subtask based on the training data corresponding to the above-mentioned first subtask, and obtains the execution result corresponding to the above-mentioned first subtask; the execution result corresponding to the first subtask sent by the target edge node is received; according to the preset rules, the execution results corresponding to each of the multiple subtasks are aggregated to obtain the training result corresponding to the target model; the above-mentioned target model is updated based on the above-mentioned training result.
[0152] In some possible embodiments, the processor 710 executes according to preset rules to aggregate the execution results corresponding to the multiple subtasks respectively to obtain the training results corresponding to the target model, and is also used to execute: if there is a second subtask among the multiple subtasks, the parameter items corresponding to the second subtask are trained based on the training data corresponding to the second subtask to obtain the execution results corresponding to the second subtask; the second subtask includes the subtasks among the multiple subtasks that are not assigned to the target edge node, and / or the subtasks among the multiple subtasks that fail to execute at the target edge node.
[0153] In some possible embodiments, before the processor 710 executes allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, it is further configured to execute:
[0154] According to the above preset rules, the training task corresponding to the above target model is split to obtain the above multiple subtasks; the attributes of the corresponding parameter items of the above multiple subtasks are different.
[0155] In some possible embodiments, the attribute of the parameter item includes the network level at which the parameter item is located in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data;
[0156] The processor 710 executes according to preset rules to split the training task corresponding to the target model to obtain multiple subtasks, and is specifically used to execute: splitting the target model according to the network level of the target model to obtain multiple sub-models; the sub-models include at least one layer of network of the target model and parameter items corresponding to at least one layer of network; determining the multiple sub-tasks based on multiple sub-models and training data sets.
[0157] In some possible embodiments, the parameter items carry network level identifiers corresponding to the at least one network layer; the network level identifiers are used to characterize the training order of the parameter items corresponding to the network levels in the target model; the multiple subtasks are trained in sequence according to the training order of their corresponding parameter items, and the execution results of the subtasks are obtained by training the parameter items corresponding to the subtasks based on the execution results of the previous subtasks and the training data corresponding to the subtasks; the first training order of the parameter items corresponding to the previous subtask is before the second training order of the parameter items corresponding to the subtasks, and the first training order is continuous with the second training order.
[0158] In some possible embodiments, the attribute of the parameter item includes a dimension corresponding to the parameter item in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data;
[0159] The processor 710 executes the following steps: splitting the training task corresponding to the target model according to the preset rules to obtain the multiple subtasks; the processor 710 is specifically used to execute: splitting the parameters of the target model according to the parameter dimensions of the target model to obtain multiple parameter items; the parameter items include the target parameters of at least one dimension of the target model, and the parameter items carry the dimension identifiers corresponding to the target parameters; and determining the multiple subtasks based on the multiple parameter items and the training data set.
[0160] In some possible embodiments, when the processor 710 determines the multiple subtasks based on the multiple parameter items and the training data set, it is specifically used to execute: if the training data set is greater than a threshold, split the training data set to obtain multiple training data subsets; the training data subset includes at least one training data; and determine multiple subtasks based on multiple parameter items and multiple training data subsets.
[0161] In some possible embodiments, the current status information includes the current network status and current computing power information of the edge node, and the historical task execution status information includes the historical task execution status corresponding to the edge node and / or the historical task execution success rate corresponding to the edge node;
[0162] Before the processor 710 executes allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, it is also used to execute: determining the target allocation strategy corresponding to the multiple subtasks based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; the target allocation strategy includes the number of subtasks to be allocated and / or the computing power required for the subtasks corresponding to the target edge node; the target allocation strategy and the target edge nodes among the multiple edge nodes change with the change of the current status information corresponding to each of the multiple edge nodes.
[0163] In some possible embodiments, after the processor 710 allocates the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, it is also used to execute: if the target edge node changes from an online state to an offline state, or the execution state corresponding to the first subtask sent by the target edge node is execution failure, or the execution result corresponding to the first subtask sent by the target edge node is not obtained within a preset time, then the first subtask is reallocated to another target edge node, or the parameter items corresponding to the first subtask are trained based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask.
[0164] In some possible embodiments, the electronic device 700 may be the aforementioned Figure 6 The target edge node shown is determined by the server based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; the edge node includes a device registered in the server, and the target edge node is used to characterize the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtasks include parameter items and training data corresponding to the target model; the processor 710 can be used to call the program instructions stored in the memory 750, and specifically perform the following operations: receive the first subtask of the multiple subtasks allocated by the server according to the target allocation strategy; train the parameter items corresponding to the first subtask based on the training data corresponding to the first subtask, and obtain the execution result corresponding to the first subtask; send the execution result corresponding to the first subtask to the server, so that the server aggregates the execution results corresponding to the multiple subtasks according to the preset rules, obtains the training result corresponding to the target model, and updates the target model based on the training result.
[0165] In a possible implementation, if there is a second subtask among the above-mentioned multiple subtasks, the execution result corresponding to the above-mentioned second subtask is obtained by the above-mentioned server training the parameter items corresponding to the above-mentioned second subtask based on the training data corresponding to the above-mentioned second subtask; the above-mentioned second subtask includes the subtasks among the above-mentioned multiple subtasks that are not assigned to the above-mentioned target edge node, and / or the subtasks among the above-mentioned multiple subtasks that fail to be executed by the above-mentioned target edge node.
[0166] The embodiment of the present application also provides a computer storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in any of the above methods. If the components of the above server and the target edge node are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above storage medium.
[0167] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The above computer program product includes one or more computer instructions. When the above computer program instructions are loaded and executed on a computer, the above process or function according to the embodiment of the present application is generated in whole or in part. The above computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above computer instructions can be stored in a computer-readable storage medium or transmitted by the above computer-readable storage medium. The above computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The above computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The above available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0168] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.
[0169] The above-mentioned embodiments are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Without departing from the design spirit of the present application, various modifications and improvements made to the technical solutions of the present application by ordinary technicians in this field should fall within the protection scope determined by the claims of the present application.
Claims
1. A model training method, characterized in that: The method is applied to a server, and the method comprises: Determine a target edge node among the multiple edge nodes based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes; the edge node is a device connected to the server at the edge of the network, and the edge node includes a device registered in the server; the target edge node is used to represent the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtasks include parameter items and training data corresponding to the target model, and the attributes of the corresponding parameter items of the multiple subtasks are different; Allocate a first subtask among the multiple subtasks to the target edge node according to a target allocation strategy, so that the target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask, and obtains an execution result corresponding to the first subtask, wherein the first subtask is used to represent a subtask to be allocated to the target edge node for execution among the multiple subtasks; Receiving an execution result corresponding to the first subtask sent by the target edge node; If there is a second subtask among the multiple subtasks, the parameter item corresponding to the second subtask is trained based on the training data corresponding to the second subtask to obtain the execution result corresponding to the second subtask; the second subtask includes the subtasks among the multiple subtasks that are not assigned to the target edge node and the subtasks among the multiple subtasks that fail to be executed by the target edge node; According to preset rules, the execution results corresponding to the multiple subtasks are aggregated to obtain the training result corresponding to the target model; The target model is updated based on the training results.
2. The method according to claim 1, characterized in that Before allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the method further includes: According to the preset rules, the training task corresponding to the target model is split to obtain the multiple subtasks.
3. The method according to claim 2, characterized in that The attribute of the parameter item includes the network level at which the parameter item is located in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data; The step of splitting the training task corresponding to the target model according to the preset rule to obtain the multiple subtasks includes: The target model is split according to the network level of the target model to obtain multiple sub-models; the sub-models include at least one network layer of the target model and parameter items corresponding to the at least one network layer; The plurality of subtasks are determined based on the plurality of sub-models and the training data set.
4. The method according to claim 3, characterized in that The parameter item carries a network level identifier corresponding to the at least one network layer; the network level identifier is used to represent the training order of the parameter item corresponding to the network level in the target model; The multiple subtasks are trained in sequence according to the training order of their corresponding parameter items, and the execution result of the subtask is obtained by training the parameter item corresponding to the subtask based on the execution result of the previous subtask and the training data corresponding to the subtask; The first training sequence of the parameter items corresponding to the previous subtask is located before the second training sequence of the parameter items corresponding to the subtask, and the first training sequence is continuous with the second training sequence.
5. The method according to claim 2, characterized in that: The attribute of the parameter item includes the dimension corresponding to the parameter item in the target model; the training task includes the target model and a training data set corresponding to the target model, and the training data set includes a plurality of training data; The step of splitting the training task corresponding to the target model according to the preset rule to obtain the multiple subtasks includes: Splitting the parameters of the target model according to the parameter dimensions of the target model to obtain a plurality of parameter items; the parameter items include target parameters of at least one dimension of the target model; The plurality of subtasks are determined based on the plurality of parameter items and the training data set.
6. The method according to claim 5, characterized in that The determining the plurality of subtasks based on the plurality of parameter items and the training data set comprises: If the training data set is larger than the threshold, splitting the training data set to obtain multiple training data subsets; the training data subsets include at least one training data; The plurality of subtasks are determined based on the plurality of parameter items and the plurality of training data subsets.
7. The method according to claim 1, characterized in that The current status information includes the current network status and current computing power information of the edge node, and the historical task execution status information includes the historical task execution status corresponding to the edge node and / or the historical task execution success rate corresponding to the edge node; Before allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the method further includes: Based on the current status information and historical task execution status information corresponding to each of the multiple edge nodes, the target allocation strategy corresponding to the multiple subtasks is determined; the target allocation strategy includes the number of subtasks to be allocated to the target edge node and / or the computing power required for the subtasks; the target allocation strategy and the target edge nodes among the multiple edge nodes change with the change of the current status information corresponding to each of the multiple edge nodes.
8. The method according to claim 1, characterized in that After allocating the first subtask among the multiple subtasks to the target edge node according to the target allocation strategy, the method further includes: If the target edge node changes from an online state to an offline state, or the execution state corresponding to the first subtask sent by the target edge node is execution failure, or the execution result corresponding to the first subtask sent by the target edge node is not obtained within a preset time, the first subtask is reallocated to another target edge node, or the parameter items corresponding to the first subtask are trained based on the training data corresponding to the first subtask to obtain the execution result corresponding to the first subtask.
9. A model training method, characterized in that: The method is applied to a target edge node among multiple edge nodes, the target edge node is determined by a server based on current status information and historical task execution status information corresponding to each of the multiple edge nodes; the edge node is a device connected to the server at the edge of the network, the edge node includes a device registered in the server, and the target edge node is used to represent an edge node currently participating in a training task corresponding to a target model; the training task includes multiple subtasks, the subtasks include parameter items and training data corresponding to the target model, and the attributes of the corresponding parameter items of each of the multiple subtasks are different; the method includes: Receiving a first subtask from among the plurality of subtasks allocated by the server according to the target allocation strategy, wherein the first subtask is used to represent a subtask from among the plurality of subtasks to be allocated to a target edge node for execution; Training the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask to obtain an execution result corresponding to the first subtask; If there is a second subtask among the multiple subtasks, the execution result corresponding to the second subtask is obtained by the server training the parameter item corresponding to the second subtask based on the training data corresponding to the second subtask; the second subtask includes the subtasks among the multiple subtasks that are not assigned to the target edge node and the subtasks among the multiple subtasks that fail to be executed by the target edge node; The execution result corresponding to the first subtask is sent to the server, so that the server aggregates the execution results corresponding to the multiple subtasks according to a preset rule, obtains the training result corresponding to the target model, and updates the target model based on the training result.
10. A server, characterized in that: The server comprises: A first determination module is used to determine a target edge node among the multiple edge nodes based on the current state information and historical task execution state information corresponding to each of the multiple edge nodes; the edge node is a device connected to the server at the edge of the network, and the edge node includes a device registered in the server; the target edge node is used to represent the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtasks include parameter items and training data corresponding to the target model, and the attributes of the corresponding parameter items of the multiple subtasks are different; A task allocation module, used to allocate a first subtask among the multiple subtasks to the target edge node according to a target allocation strategy, so that the target edge node trains the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask, and obtains an execution result corresponding to the first subtask, wherein the first subtask is used to represent a subtask to be allocated to the target edge node for execution among the multiple subtasks; A first receiving module, configured to receive an execution result corresponding to the first subtask sent by the target edge node; A first training module is used for training the parameter items corresponding to the second subtask based on the training data corresponding to the second subtask if there is a second subtask among the multiple subtasks, so as to obtain the execution result corresponding to the second subtask; the second subtask includes the subtasks among the multiple subtasks that are not assigned to the target edge node and the subtasks among the multiple subtasks that fail to be executed by the target edge node; An aggregation module, used to aggregate the execution results corresponding to the multiple subtasks according to preset rules to obtain the training result corresponding to the target model; A model updating module is used to update the target model based on the training result.
11. A target edge node, characterized in that: The target edge node is determined by the server based on the current state information and historical task execution state information corresponding to each of the multiple edge nodes; the edge node is a device connected to the server at the edge of the network, and the edge node includes a device registered in the server. The target edge node is used to represent the edge node currently participating in the training task corresponding to the target model; the training task includes multiple subtasks, and the subtasks include parameter items and training data corresponding to the target model, and the attributes of the corresponding parameter items of the multiple subtasks are different; The target edge node includes: A second receiving module is used to receive a first subtask among the multiple subtasks allocated by the server according to the target allocation strategy, where the first subtask is used to represent a subtask to be allocated to a target edge node for execution among the multiple subtasks; A second training module, used to train the parameter item corresponding to the first subtask based on the training data corresponding to the first subtask, to obtain an execution result corresponding to the first subtask; A third training module is used for, if there is a second subtask among the multiple subtasks, then the execution result corresponding to the second subtask is obtained by the server training the parameter item corresponding to the second subtask based on the training data corresponding to the second subtask; the second subtask includes the subtasks among the multiple subtasks that are not assigned to the target edge node and the subtasks among the multiple subtasks that fail to be executed by the target edge node; The first sending module is used to send the execution result corresponding to the first subtask to the server, so that the server aggregates the execution results corresponding to the multiple subtasks according to preset rules, obtains the training result corresponding to the target model, and updates the target model based on the training result.
12. An electronic device, characterized in that: include: processor and memory; wherein, The processor is connected to the memory; the memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method steps according to any one of claims 1 to 9.
13. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 9.
