Parameter training method and device of large model training system and program product

By only transmitting gradient information that meets the threshold conditions in large model training and retaining gradients that do not meet the conditions in the computing nodes, combined with threshold and L2 paradigm processing, the stability and accuracy problems caused by large communication volume in distributed training are solved. Fast convergence and efficient training of the model are achieved.

CN118607608APending Publication Date: 2024-09-06WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410780059.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In large model training, the distributed training system has huge communication volume, which leads to communication congestion and communication failure, affecting the stability and accuracy of model training. Existing interval compression methods cause information loss and gradient dissipation problems.

Method used

By transmitting only the gradient information that meets the threshold condition to the parameter node in each iteration, retaining the gradients that do not meet the threshold condition in the calculation node, the threshold and L2 paradigm are used for gradient reduction and masking to ensure the accuracy and continuity of the gradient information.

Benefits of technology

It effectively reduces the communication volume, improves the stability and accuracy of model training, avoids gradient dissipation and information loss, and ensures rapid convergence of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118607608A
    Figure CN118607608A
Patent Text Reader

Abstract

The invention provides a parameter training method and device of a large model training system and a program product. The method comprises the steps that a first computing node obtains gradient information of n parameters generated by ith iteration training; the first computing node determines the total gradient of the ith iteration according to the gradient information of the n parameters generated by the ith iteration training and the residual gradient sum after the (i-1) th iteration training; the first computing node sends gradient information of m parameters meeting a threshold condition in the ith iteration total gradient to a parameter node; taking m parameters meeting a threshold condition as a transmission gradient; the parameter node updates a weight parameter used by the large model in the (i + 1) th iteration training according to the transmission gradient of the ith iteration training sent by all the computing nodes; and the first computing node obtains a weight parameter used in the (i + 1) th iteration training from the parameter node, and performs the (i + 1) th iteration training. According to the scheme, the accuracy of a large model training result can be maintained under the condition of reducing communication traffic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a parameter training method, device and program product for a large model training system. Background Art

[0002] In the industrial practice of machine learning and deep learning, large data scale and complex data structure derive large models. However, large models have complex structures and many parameters; and the amount of data fed into large models is large and the data dimensions are multi-dimensional. Therefore, the limited resources on a single machine cannot meet the requirements of large model training.

[0003] In the prior art, a distributed training system is designed to solve the problem of large model training. In the distributed training system, a large model training task is split into multiple subtasks, each subtask is distributed to a computing node, and multiple computing nodes perform training in parallel and transmit the generated gradient information to the parameter node. The parameter node updates the weight parameters of the large model according to the gradient information generated by the multiple computing nodes, and the multiple computing nodes then obtain the updated weight parameters from the parameter node for the next round of training.

[0004] In a distributed training system, parameter nodes need to collect the weights of all computing nodes in order to update weight parameters during each iterative training phase. The communication between computing nodes and parameter nodes is frequent and the communication volume is huge, which makes communication blockage and communication failure very likely to occur. Therefore, the communication problem evolves into a large model training problem, which determines whether the large model can be trained successfully. However, communication with a large communication volume is extremely fragile, which makes the training of large models extremely unstable.

[0005] The existing technology uses interval compression method, which compresses the gradient information generated by the computing node from high precision to low precision, thereby reducing the communication volume. However, the information loss caused by the gradient information decreasing from high precision to low precision will make the large model unable to receive high-dimensional data features, affecting the expression ability of the large model; and low-precision gradient information is more likely to change to 0, which is prone to gradient dissipation problems; moreover, the gradient information decreasing from high precision to low precision often contains integer operations, which makes the gradient not continuous, resulting in the large model being undifferentiable and losing the model training ability.

[0006] So, how to maintain the accuracy of large model training results while reducing the amount of communication remains to be solved. Summary of the invention

[0007] The present application provides a parameter training method, device and program product for a large model training system, which can maintain the accuracy of the large model training results while reducing the communication volume.

[0008] In the first aspect, the embodiment of the present application provides a parameter training method for a large model training system, wherein the large model training system includes multiple computing nodes and parameter nodes; the multiple computing nodes are used to perform large model training tasks in parallel; the parameter nodes are used to update the weight parameters of the large model according to the gradient information generated by the multiple computing nodes in each iterative training stage; the method can be executed by a parameter training device of the large model training system, and the parameter training device of the large model training system can be a terminal device or a module for a terminal device, or a server or a module for a server. The present application does not limit the execution subject of the method. The method comprises: a first computing node obtains the gradient information of n parameters generated by the i-th iteration training; wherein the first computing node is any node among the multiple computing nodes; i and n are positive integers; the first computing node determines the i-th iteration total gradient according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient sum after the i-1-th iteration training; wherein the residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iteration trainings; the residual gradient sum is stored in the first computing node; the first computing node sends the gradient information of m parameters that meet the threshold condition in the i-th iteration total gradient to the parameter node; the m parameters that meet the threshold condition are used as transmission gradients; m is a positive integer less than n; the parameter node updates the weight parameters used in the i+1-th iteration training of the large model according to the transmission gradients of the i-th iteration training sent by all computing nodes; the first computing node obtains the weight parameters used in the i+1-th iteration training from the parameter node, and performs the i+1-th iteration training.

[0009] In the above scheme, on the one hand, the gradient of the parameter that meets the threshold condition is transmitted to the parameter node, and the gradient of the parameter that does not meet the threshold condition is retained in the first computing node; that is, in each iteration, only the gradient of part of the parameters is transmitted to the parameter node, so the amount of information communicated between distributed computing nodes can be effectively reduced; communication congestion is reduced, and the stability of large model training is improved. On the other hand, the accuracy of the gradient transmitted to the parameter center does not change, which enables the large model to receive high-dimensional data features, and the gradient information of the model will not easily become 0, reducing the possibility of gradient dissipation, thereby maintaining the accuracy of the large model training results; and because the accuracy of the gradient does not change, there is no integer operation, which will not make the large model undifferentiable. On the other hand, the total gradient of the i-th iteration of the present application includes the gradient information of the n parameters generated by the i-th iteration training and the residual gradient after the i-1-th iteration training, that is, the gradients of all parameters in the iteration process participate in the update of the parameters. Because the gradients of all parameters in the iteration process participate in the update of the parameters, the model can converge quickly.

[0010] In a possible implementation method, the first computing node sorts the gradient information of the n parameters of the total gradient of the i-th iteration, selects the gradient information of the first m parameters with large gradient information and sends them to the parameter node, or the first computing node determines the gradient information of the n parameters of the total gradient of the i-th iteration and compares it with a first gradient threshold, and sends the gradient information corresponding to the parameters greater than the first gradient threshold to the parameter node.

[0011] The above scheme, on the one hand, transmits the gradient of the parameters that meet the threshold condition to the parameter node, and retains the gradient of the parameters that do not meet the threshold condition in the first computing node; that is, in each iteration, only the gradient of part of the parameters is transmitted to the parameter node, thus effectively reducing the amount of information communicated between distributed computing nodes, reducing communication congestion, and improving the stability of large model training. On the other hand, the accuracy of the gradient transmitted to the parameter center does not change, which enables the large model to receive high-dimensional data features, and the gradient information of the model will not easily become 0, reducing the possibility of gradient dissipation, thereby maintaining the accuracy of the large model training results; and because the accuracy of the gradient does not change, there is no integer operation, which will not make the large model non-differentiable.

[0012] In a possible implementation method, the first computing node determines the gradient information in the total gradient of the i-th iteration that does not meet the threshold condition as the residual gradient of the i-th iteration; adds the gradient information of the same parameter in the residual gradient of the i-th iteration and the residual gradient sum of the i-1-th iteration to determine the residual gradient sum of the i-th iteration.

[0013] The above scheme superimposes the residual gradients of each iteration together, so that the gradients of all parameters in the iteration process can participate in the parameter update. Because the gradients of all parameters in the iteration process participate in the parameter update, the model can converge quickly.

[0014] In a possible implementation method, it is determined whether the total gradient of the i-th iteration is greater than a second gradient threshold; if the total gradient of the i-th iteration is greater than the second gradient threshold, the total gradient of the i-th iteration is reduced.

[0015] In the above scheme, since the residual gradient and are always in the superposition process, the value is always increasing, which easily leads to the gradient explosion problem. Reducing the total gradient of the i-th iteration can effectively reduce the gradient explosion problem.

[0016] In a possible implementation method, a conversion value corresponding to the total gradient of the i-th iteration under the L2 norm is determined; a reduction factor is determined according to a ratio of the second gradient threshold and the conversion value; and the total gradient of the i-th iteration is reduced according to the reduction factor.

[0017] The above scheme, on the one hand, can reduce the total gradient of the i-th iteration without changing the gradient accuracy, thereby reducing the gradient explosion problem. On the other hand, the L2 paradigm has the ability of weight decay, which can reduce the weights of different gradients by different proportions without affecting the distribution characteristics of the gradient, and can also reduce its impact on the gradient.

[0018] In a possible implementation method, a global gradient threshold is preset; the second gradient threshold is determined according to the global gradient threshold and the number of computing nodes;

[0019] The calculation method of the second gradient threshold is as follows:

[0020]

[0021] in, is the second gradient threshold, TG is the global gradient threshold, N is the number of computing nodes, is the square root function.

[0022] In the above scheme, for a distributed model with N nodes, the gradients between each node are independent and identically distributed. Based on the characteristics of the L2 paradigm, the second gradient threshold and the global gradient threshold have the above relationship. According to the above relationship, the second gradient threshold can be accurately determined.

[0023] In a possible implementation method, the termination iteration number of the large model training task is set to an integer multiple of the minimum iteration number; the minimum iteration number is the minimum number of residual gradients and the minimum number of times they are sent to the parameter node.

[0024] In the above scheme, the termination iteration number is an integer multiple of the minimum iteration number, which can ensure that the gradients of all parameters will participate in the parameter update, so that the model converges quickly.

[0025] In a possible implementation method, a masking factor is preset; the masking factor is used to control the influence of the residual gradient after the i-1th iterative training on the total gradient of the i-th iteration; the masking gradient is determined according to the product of the masking factor and the residual gradient after the i-1th iterative training; the i-th iteration total gradient is determined according to the sum of the gradient information of n parameters generated by the i-th iterative training and the masking gradient.

[0026] In the above scheme, the residual gradient is the gradient generated by the previous iterations. These gradients are stale and will bring noise to the parameter update of the model. This application masks the stale gradient according to the masking factor, which can maintain the forward direction of the gradient's most recent update, thereby allowing the model to converge quickly.

[0027] In a second aspect, an embodiment of the present application provides a parameter training device for a large model training system, comprising: an acquisition unit, used to acquire the gradient information of n parameters generated by the i-th iterative training; wherein the first computing node is any node among the multiple computing nodes; i and n are positive integers; a determination unit, used to determine the i-th iteration total gradient based on the gradient information of the n parameters generated by the i-th iterative training and the residual gradient sum after the i-1-th iterative training; wherein the residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iterative trainings; the residual gradient sum is stored in the first computing node; a transceiver unit, used to send the gradient information of m parameters that meet the threshold condition in the i-th iteration total gradient to the parameter node; the m parameters that meet the threshold condition are used as transmission gradients; m is a positive integer less than n; obtain the weight parameters used in the i+1-th iterative training from the parameter node, and perform the i+1-th iterative training; an update unit, used to update the weight parameters used by the large model in the i+1-th iterative training according to the transmission gradients of the i-th iterative training sent by all computing nodes.

[0028] In one possible implementation method, the transceiver unit is used for the first computing node to sort the gradient information of the n parameters of the total gradient of the i-th iteration, select the gradient information of the first m parameters with large gradient information and send them to the parameter node, or the first computing node determines the gradient information of the n parameters of the total gradient of the i-th iteration and compares it with a first gradient threshold, and sends the gradient information corresponding to the parameters greater than the first gradient threshold to the parameter node.

[0029] In a possible implementation method, a determination unit is used for the first computing node to determine the gradient information in the total gradient of the i-th iteration that does not meet the threshold condition as the residual gradient of the i-th iteration; and to add the gradient information of the same parameter in the residual gradient of the i-th iteration and the residual gradient sum of the i-1-th iteration to determine the residual gradient sum of the i-th iteration.

[0030] In a possible implementation method, the determination unit is further used to determine whether the total gradient of the i-th iteration is greater than a second gradient threshold; if the total gradient of the i-th iteration is greater than the second gradient threshold, then reducing the total gradient of the i-th iteration.

[0031] In a possible implementation method, a determination unit is used to determine a conversion value corresponding to the total gradient of the i-th iteration under the L2 norm; determine a reduction factor according to a ratio of the second gradient threshold and the conversion value; and reduce the total gradient of the i-th iteration according to the reduction factor.

[0032] In a possible implementation method, the determination unit is further used to preset a global gradient threshold; determine the second gradient threshold according to the global gradient threshold and the number of computing nodes;

[0033] The calculation method of the second gradient threshold is as follows:

[0034]

[0035] in, is the second gradient threshold, TG is the global gradient threshold, N is the number of computing nodes, is the square root function.

[0036] In a possible implementation method, the determination unit is also used to set the termination iteration number of the large model training task to an integer multiple of the minimum iteration number; the minimum iteration number is the minimum number of residual gradients and the minimum number of times they are sent to the parameter node.

[0037] In a possible implementation method, the determination unit is also used to preset a masking factor; the masking factor is used to control the influence of the residual gradient after the i-1th iterative training and the total gradient of the i-th iteration; the masking gradient is determined according to the product of the masking factor and the residual gradient after the i-1th iterative training; the i-th iteration total gradient is determined according to the gradient information of n parameters generated by the i-th iterative training and the sum of the masking gradients.

[0038] In a third aspect, an embodiment of the present application further provides a computing device, including:

[0039] A memory for storing program instructions;

[0040] The processor is used to call the program instructions stored in the memory, and execute any method of implementing the above-mentioned first aspect according to the obtained program instructions.

[0041] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-readable instructions are stored. When a computer reads and executes the computer-readable instructions, any method of the above-mentioned first aspect is implemented.

[0042] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program executable by a computer device, wherein when the program is run on the computer device, the computer device executes any method for implementing the above-mentioned first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of the structure of a large model training system provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of the results of a quantization compression method provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of the structure of a step function provided in an embodiment of the present application;

[0046] Figure 4 A flow chart of a parameter training method for a large model training system provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of a flow chart of a gradient clipping method provided in an embodiment of the present application;

[0048] Figure 6 A flow chart of a parameter training method for a large model training system provided in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of the structure of a parameter training device for a large model training system provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of the structure of a parameter training device for a large model training system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] With the rapid growth of large model parameters and the amount of training data required, the limited resources on a single machine can no longer meet the requirements of large model training. A distributed training system needs to be designed to solve the problem of massive computing and memory resource requirements. Distributed training refers to decomposing machine learning or deep learning model training tasks into multiple subtasks and training them in parallel on multiple computing nodes. Finally, the output of each computing node needs to be merged to obtain a calculation result equivalent to that of a single computing node. Since each computing node is only responsible for subtasks and multiple computing nodes can be executed in parallel, it can complete the overall calculation more quickly and ultimately accelerate the entire computing process.

[0052] Figure 1This is a diagram of a large model distributed training architecture based on a parameter center, including multiple computing nodes and multiple parameter nodes; training tasks and training data are distributed to multiple parallel computing nodes for parallel computing and parallel storage, thereby shortening the execution time of training and horizontally expanding the computing power and storage capacity of the training machine. For large models, the training process is the process of updating the parameters of the neural network model using an optimization algorithm based on the training data and loss function. The core training process involves global gradient aggregation and weight updates. Therefore, a parameter service center needs to be introduced to centrally complete the calculation, storage, and distribution of weight parameter information generated by computing nodes at different training stages.

[0053] The parameter service center has multiple parameter nodes, each of which manages a portion of the model weight parameters. The task computing node communicates and interacts with the parameter service center through two operations: pull and push.

[0054] In each iteration, the computing nodes and the parameter service center complete the pull and push operations of the weight parameters completely through local network communication. In order to determine the communication volume of a single communication between the computing node and the parameter service center, the following variables are defined: the number of computing nodes, denoted as N; the number of layers of the model network, denoted as H; the number of weight parameters of each layer of the network, W, which is determined by the calculation logic of the forward propagation, that is, the feature processing logic; the dimension of the weight parameter, which is determined by the feature dimension of the data and the feature dimension of the network node in the middle layer. The data feature dimension usually determines the dimension of the weight parameter of the input layer, while the feature dimension of the network node in the middle layer determines the dimension of the weight parameter of the middle layer and the input layer. They are not always equal, and their dimension mean is denoted as D. Therefore, the amount of information in a single communication between a single computing node and the service parameter center is: W×D (bit).

[0055] A complete iteration process of a large model usually includes two processes: forward propagation calculation and back propagation calculation. In addition, the parameter service center and the computing nodes communicate with each other. Therefore, in one iteration of a large model, the total amount of information that needs to be communicated is: N×W×D×H×2 (bit). Depending on the complexity of the business scenario, the size of D can reach tens of millions, so the communication cost increases significantly, and the parameter service center and the computing center take a long time to update the weights. In addition, for a single training, the computing nodes need to wait for each other to push the weight parameters, and the start time of the next round of iterative calculation depends on the computing node that completes the training the latest. If a computing node has weak communication capabilities or insufficient computing power, the entire model training time will be greatly extended, which greatly increases the risk of model training failure.

[0056] In order to solve the communication task between the parameter service center and the computing nodes, the current newer mainstream method is to compress the communication content by proportional scaling, and then decompress the communication content during calculation, thereby reducing the amount of communication information without affecting the calculation of model training.

[0057] This method is called quantization compression, and its goal is to map values ​​from a large range to a small range, such as Figure 2 As shown, the large range [-3.4×10e 38 ,+3.4×10e 38 ] is mapped to the small interval [-127,+128] represented by int8.

[0058] This direct conversion of a higher precision value into a lower precision value will directly lead to numerical errors, which are called quantization errors. This error will cause the following problems:

[0059] 1. The information loss caused by the weight reduction from high precision to low precision will make the model unable to receive high-dimensional data features, affecting the model's expressive ability.

[0060] 2. Low-precision fixed-point numbers are directly used for model calculations, which will cause gradient dissipation problems (that is, small gradients become 0 due to changes in precision), reduce prediction accuracy, and even make the model unable to backpropagate gradients.

[0061] 3. Because the compression function converts high-precision weight parameters into low-precision weight parameters, the calculation process contains tail rounding (discarding the digits outside the precision). The tail rounding operation is a step function ( Figure 3 As shown in Figure 2), these functions will make the gradient calculated in the back-propagation process discontinuous, resulting in the model being undifferentiable and losing the model training capability.

[0062] In order to solve the above problems, an embodiment of the present application provides a parameter training method for a large model training system, which can be executed by a parameter training device of the large model training system, and the parameter training device of the large model training system can be a terminal device or a module for a terminal device, or a server or a module for a server. The present application does not limit the execution subject of the method.

[0063] Figure 4 A flow chart of a parameter training method for a large model training system provided in an embodiment of the present application.

[0064] The method comprises the following steps:

[0065] Step 401: The first computing node obtains the gradient information of n parameters generated by the i-th iterative training.

[0066] The first computing node is any node among the multiple computing nodes; i and n are positive integers.

[0067] In one possible implementation method, multiple computing nodes are trained in parallel. This application takes the first computing node as an example to illustrate how the large model training system performs parameter training; other computing nodes also obtain the gradient information of the n parameters generated by the local i-th iterative training in parallel. This application does not describe this in detail.

[0068] Step 402: The first computing node determines the total gradient of the i-th iteration according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient sum after the i-1-th iteration training.

[0069] The residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iterative trainings; and the residual gradient sum is stored in the first computing node.

[0070] Step 403: The first computing node sends the gradient information of the m parameters that meet the threshold condition in the total gradient of the i-th iteration to the parameter node; the m parameters that meet the threshold condition are used as transmission gradients.

[0071] Here, m is a positive integer less than n.

[0072] Step 404: the parameter node updates the weight parameters used by the large model in the (i+1)th iterative training according to the transmission gradients of the i-th iterative training sent by all computing nodes.

[0073] Step 405: The first computing node obtains the weight parameter used in the (i+1)th iterative training from the parameter node, and performs the (i+1)th iterative training.

[0074] During the model training process, it was found that 99% of the gradient values ​​are very small, and these extremely small values ​​approaching 0 mean that they have little effect on the weight parameter update, or even no effect. Therefore, its gradient exchange is actually not necessary, but it will occupy a lot of communication bandwidth and CPU computing resources. Therefore, for some small gradients approaching 0, they can be cached in the task computing node first, delaying the sending to the parameter service center, reducing the amount of information and calculation in a single communication, thereby reducing the bandwidth pressure and computing pressure between the parameter service center and each computing node during the entire model training process.

[0075] In the above scheme, on the one hand, the gradient of the parameter that meets the threshold condition is transmitted to the parameter node, and the gradient of the parameter that does not meet the threshold condition is retained in the first computing node; that is, in each iteration, only the gradient of part of the parameters is transmitted to the parameter node, so the amount of information communicated between distributed computing nodes can be effectively reduced; communication congestion is reduced, and the stability of large model training is improved. On the other hand, the accuracy of the gradient transmitted to the parameter center does not change, which enables the large model to receive high-dimensional data features, and the gradient information of the model will not easily become 0, reducing the possibility of gradient dissipation, thereby maintaining the accuracy of the large model training results; and because the accuracy of the gradient does not change, there is no integer operation, which will not make the large model undifferentiable. On the other hand, the total gradient of the i-th iteration of the present application includes the gradient information of the n parameters generated by the i-th iteration training and the residual gradient after the i-1-th iteration training, that is, the gradients of all parameters in the iteration process participate in the update of the parameters. Because the gradients of all parameters in the iteration process participate in the update of the parameters, the model can converge quickly.

[0076] In one embodiment, in step 403, the first computing node sends the gradient information of the m parameters satisfying the threshold condition in the total gradient of the i-th iteration to the parameter node, including:

[0077] The first computing node sorts the gradient information of the n parameters of the total gradient of the i-th iteration, selects the gradient information of the first m parameters with large gradient information and sends them to the parameter node. Exemplarily, the large model includes 1000 parameters, that is, n is equal to 1000, the 1000 parameters are sorted, and the gradient information of the first 800 parameters with large gradient information is selected and sent to the parameter node, that is, m is 800; this application does not limit the value of m, and it can be set according to actual needs. Of course, each computing node will select the gradient information of the first m parameters with large local gradient information and send it to the parameter node.

[0078] In another embodiment, in step 403, the first computing node sends the gradient information of the m parameters satisfying the threshold condition in the total gradient of the i-th iteration to the parameter node, including:

[0079] The first computing node determines the gradient information of the n parameters of the total gradient of the i-th iteration and compares it with the first gradient threshold, and sends the gradient information corresponding to the parameters greater than the first gradient threshold to the parameter node. Specifically, a first gradient threshold is preset, and the gradient information of the n parameters of the total gradient of the i-th iteration is compared with the first gradient threshold respectively, and the gradient information corresponding to the parameters greater than the first gradient threshold is sent to the parameter node. The present application does not limit the specific value of the first gradient threshold, and the first gradient threshold can be set according to actual needs. The first gradient threshold can also be changed during the iteration process, and the present application does not limit this.

[0080] In one embodiment, in the above step 403, after the first computing node sends the gradient information of the m parameters that meet the threshold condition in the total gradient of the i-th iteration to the parameter node, the step further includes: the first computing node determines the gradient information that does not meet the threshold condition in the total gradient of the i-th iteration as the residual gradient of the i-th iteration; adds the gradient information of the same parameter in the residual gradient of the i-th iteration and the residual gradient sum of the i-1-th iteration to determine the residual gradient sum of the i-th iteration. In the above exemplary embodiment, the gradient information of the first 800 parameters with large gradient information is selected and sent to the parameter node, and the gradient information of 200 parameters is left; the gradient information of these 200 parameters is the residual gradient of the i-th iteration; the gradient information of the same parameter in these 200 parameters and the residual gradient sum of the i-1-th iteration is added to determine the residual gradient sum of the i-th iteration. This scheme superimposes the residual gradients of each iteration together, so that the gradients of all parameters in the iteration process can participate in the parameter update. Because the gradients of all parameters in the iteration process participate in the parameter update, the model can converge quickly.

[0081] The effectiveness of the embodiments of the present application is demonstrated by the following algorithm.

[0082] Assume that the loss function of a single sample is f(θ, x), as shown in the following formula (1); the partial derivative of f(θ, x) with respect to the weight parameter θ is As shown in the following formula (2).

[0083]

[0084] Among them, y i is the true label of the i-th data sample, which is assigned through the data annotation process of data preprocessing. (y i -h θ (x) 2 Represents the true sample label y i and the model predicts the label h θ The squared difference between the differences in (x). X represents the training sample set. is the derivative function.

[0085] The loss function J(θ) of the model is the mean loss of all single samples X. As shown in formula (3).

[0086]

[0087] For the training sample set X, the updated value of the weight parameter θ is the mean of all samples on all computing nodes, as shown in formula (4).

[0088]

[0089] Where N represents the number of computing nodes, X n represents the training sample set on the nth computing node, and γ is the step size of the gradient update.

[0090] Since the gradient information of the parameters that meet the threshold conditions in this application will be sent to the parameter node, the minimum value of the gradient may be temporarily cached in the computing node and will not be transmitted to the parameter service center for gradient update until a certain dynamic threshold is met.

[0091] Assuming that after P iterations, the local accumulated minimum value meets the threshold condition and is applied to the gradient update, the weight parameter update logic of the model of this application is as shown in formula (5):

[0092]

[0093] As can be seen from formula (5), the weight parameter update logic of this application does not change the final value of the parameter update. It only extends the iteration time of parameter θ from N|X| to N|X|P. For every N|X|P iterations, the gradient value update value is equal.

[0094] The P value here is the minimum number of iterations, which is the minimum number of times the residual gradient and s are sent to the parameter node. After a large number of experiments, it is found that after every P iterations, the residual gradient and s can meet the threshold condition, so that they can be sent to the parameter node to participate in the gradient update. Experiments have shown that the P value can be 4; of course, the P value can also be other values, which are not limited in this application.

[0095] In one possible implementation method, the termination iteration number of the large model training task is set to an integer multiple of the minimum iteration number, for example, the termination iteration number is set to 400. In this solution, the termination iteration number is an integer multiple of the minimum iteration number, which can ensure that the gradients of all parameters will participate in the parameter update, so that the model converges quickly.

[0096] When the residual gradient and does not meet the threshold condition, they will be saved in the computing node and will not be sent to the parameter node to participate in the parameter update. When the residual gradient and accumulate to meet the threshold condition, the residual gradient and will be sent to the parameter node to participate in the parameter update; but at this time, the residual gradient and part of the gradient are actually the extremely small gradients generated at the previous moment, and these gradients are stale. If the interval (P) between the rounds that reach the threshold condition is too large, the stale gradient will bring noise to the parameter update of the model. Stale gradients may have a counter-effect on model training, which is reflected in the inconsistency with the optimization direction of model training.

[0097] To alleviate this problem, this application performs a masking operation on the residual gradients of the local computing node to mask the impact of the old gradients on the model parameter update. The main idea is to maintain the direction of the most recent gradient update and clip the old gradients in an appropriate way.

[0098] In a possible implementation method, a masking factor is preset; the masking factor is used to control the influence of the residual gradient after the i-1th iterative training on the total gradient of the i-th iteration; the masking gradient is determined according to the product of the masking factor and the residual gradient after the i-1th iterative training; the i-th iteration total gradient is determined according to the sum of the gradient information of n parameters generated by the i-th iterative training and the masking gradient.

[0099] Specifically, the parameter updating formula is shown in the following formula (6).

[0100]

[0101] In the parameter θ j In the update process, in order to prevent its θ j The update cannot converge and iterates infinitely. It is necessary to introduce a masking factor α to maintain the update's forward direction. Therefore, after adding the masking factor, formula (7) is optimized to the following calculation formula:

[0102]

[0103] Among them, α is the shielding factor, u t-1 is the residual gradient sum after the t-1th iteration training, The gradient generated by the node is calculated after the tth iteration of training.

[0104] In a possible implementation method, α is 0.001. Of course, α may also be other values, which is not limited in this application.

[0105] In the above scheme, the residual gradient is the gradient generated by the previous iterations. These gradients are stale and will bring noise to the parameter update of the model. This application masks the stale gradient according to the masking factor, which can maintain the forward direction of the gradient's most recent update, thereby allowing the model to converge quickly.

[0106] In a possible implementation method, in order to prevent the gradient explosion problem, it is also necessary to perform gradient clipping on the total iteration gradient, and the gradient clipping method includes: judging whether the total gradient of the i-th iteration is greater than the second gradient threshold; if the total gradient of the i-th iteration is greater than the second gradient threshold, reducing the total gradient of the i-th iteration. In this solution, since the residual gradient and the residual gradient are always in the superposition process, the value is always increasing, so the gradient explosion problem is easy to occur. Reducing the total gradient of the i-th iteration can effectively reduce the gradient explosion problem.

[0107] In a possible implementation method, reducing the total gradient of the i-th iteration includes: determining the conversion value corresponding to the total gradient of the i-th iteration under the L2 norm; determining the reduction factor according to the ratio of the second gradient threshold and the conversion value; reducing the total gradient of the i-th iteration according to the reduction factor. The L2 norm has the ability of weight decay, which can reduce different weights of the gradient by different proportions without affecting the distribution characteristics of the gradient, and can also reduce its impact on the gradient. And according to the reduction factor, reducing the total gradient of the i-th iteration does not change the accuracy of the parameter gradient.

[0108] In a possible implementation method, the method for determining the second gradient threshold includes: presetting a global gradient threshold; determining the second gradient threshold according to the global gradient threshold and the number of computing nodes. The second gradient threshold can also use the gradient mean of the computing node as a setting value, and the present application does not limit the method for determining the second gradient threshold. Among them, the global gradient threshold can be set based on experience.

[0109] In a possible implementation method, the calculation method of the second gradient threshold is as follows:

[0110]

[0111] in, is the second gradient threshold, TG is the global gradient threshold, N is the number of computing nodes, is the square root function.

[0112] In the above scheme, for a distributed model with N nodes, the gradients between each node are independent and identically distributed. Based on the characteristics of the L2 paradigm, the second gradient threshold and the global gradient threshold have the above relationship. According to the above relationship, the second gradient threshold can be accurately determined.

[0113] Figure 5 A schematic diagram of a gradient clipping method provided in an embodiment of the present application, the method comprising the following steps:

[0114] Step 501: preset a global gradient threshold TG.

[0115] Step 502, calculate the gradient g of the current computing node in the back propagation, and then calculate the L2 normal form ||g|| of the gradient g.

[0116] Step 503, compare ||g| with TG; if ||g|| is greater than or equal to the global gradient threshold TG, calculate the reduction factor scale factor (SF) = TG / ||g||, otherwise, SF = 1.

[0117] Step 504: The gradient after gradient clipping is SF*||g||.

[0118] Figure 6 A flow chart of a parameter training method for a large model training system provided in an embodiment of the present application, the method comprising the following steps:

[0119] Step 601: The parameter node initializes a parameter set.

[0120] In one possible implementation method, a uniform distribution initializer Glorot with normalized parameters is used to initialize the parameter set θ = (θ0, θ1, .... θ m ).

[0121] In one possible implementation method, after the parameter node initializes the parameter set, the computing node pulls the corresponding initialization parameters from the parameter node.

[0122] In yet another possible implementation method, the computing node itself initializes the parameter set.

[0123] Step 602: The first computing node initializes the computing node gradient with node number N.

[0124] In a possible implementation method, the first computing node initializes the computing node gradient G with node number N n =0.

[0125] Step 603: The first computing node starts the tth model training.

[0126] The number of iterations is recorded as t∈[1,T end ], T end Refers to the iteration parameter at which the model reaches convergence, that is, the number of termination iterations.

[0127] Step 604: The first computing node calculates the gradient value generated at the current moment according to back propagation.

[0128] The gradient value is recorded as

[0129] In a possible implementation method, in the tth iteration, the samples input in the current iteration batch are recorded as B = (X i ,X i+1 ,X i+2 ,....X i+b ), whose sample size b is and B∈X. It is a subset of the total sample X that is shuffled by a random algorithm, and its size b is a hyperparameter.

[0130] Step 605: The first computing node calculates the total gradient on node n at the tth iteration according to the gradient value.

[0131] In a possible implementation method, at the tth iteration, the total gradient on node n is calculated as shown in the following formula (8).

[0132]

[0133] Step 606: The first computing node performs gradient clipping on the total gradient according to the L2 normal form.

[0134]

[0135] Among them, clip is the gradient clipping function.

[0136] Step 607: The first computing node determines the gradient information of m parameters that meet the threshold condition at the t-th iteration.

[0137] In one possible implementation method, the percentage of Gradient information of m parameters that meet the threshold condition. For example, the gradients of 75% of the parameters are transmitted to the parameter node, and the gradients of 25% of the parameters are retained locally in the first computing node; wherein the gradient value of each parameter in the 75% parameters is greater than or equal to the gradient value of each parameter in the 25% parameters.

[0138] Step 608: The first computing node determines the residual gradient sum of the t-th iteration according to the gradient information of the parameters that do not meet the threshold condition in the t-th iteration.

[0139] Step 609: All computing nodes send the gradient information that meets the threshold condition in the t-th iteration to the parameter node to perform a parameter update operation.

[0140] This application does not limit the execution order of step 608 and step 609.

[0141] Step 610: The first computing node obtains the weight parameters used in the t+1th iteration training from the parameter node, and performs the t+1th iteration training.

[0142] Based on the same technical concept, Figure 7 The parameter training device 700 of a large model training system provided by an embodiment of the present application is exemplarily shown. Figure 7 As shown, it includes: an acquisition unit 701, a determination unit 702, a transceiver unit 703 and an update unit 704. An acquisition unit 701 is used to acquire the gradient information of n parameters generated by the i-th iteration training; wherein the first computing node is any node among the multiple computing nodes; i and n are positive integers; a determination unit 702 is used to determine the i-th iteration total gradient according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient sum after the i-1-th iteration training; wherein the residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iteration trainings; the residual gradient sum is stored in the first computing node; a transceiver unit 703 is used to send the gradient information of m parameters that meet the threshold condition in the i-th iteration total gradient to the parameter node; the m parameters that meet the threshold condition are used as transmission gradients; m is a positive integer less than n; the weight parameters used in the i+1-th iteration training are obtained from the parameter node, and the i+1-th iteration training is performed; an update unit 704 is used to update the weight parameters used by the large model in the i+1-th iteration training according to the transmission gradients of the i-th iteration training sent by all computing nodes.

[0143] In one possible implementation method, the transceiver unit 703 is used for the first computing node to sort the gradient information of the n parameters of the total gradient of the i-th iteration, select the gradient information of the first m parameters with large gradient information and send them to the parameter node, or the first computing node determines the gradient information of the n parameters of the total gradient of the i-th iteration and compares it with a first gradient threshold, and sends the gradient information corresponding to the parameters greater than the first gradient threshold to the parameter node.

[0144] In a possible implementation method, the determination unit 702 is used for the first computing node to determine the gradient information in the total gradient of the i-th iteration that does not meet the threshold condition as the residual gradient of the i-th iteration; add the gradient information of the same parameter in the residual gradient of the i-th iteration and the residual gradient sum of the i-1-th iteration to determine the residual gradient sum of the i-th iteration.

[0145] In a possible implementation method, the determination unit 702 is further configured to determine whether the total gradient of the i-th iteration is greater than a second gradient threshold; if the total gradient of the i-th iteration is greater than the second gradient threshold, then reducing the total gradient of the i-th iteration.

[0146] In a possible implementation method, the determination unit 702 is used to determine the conversion value corresponding to the total gradient of the i-th iteration under the L2 norm; determine the reduction factor according to the ratio of the second gradient threshold and the conversion value; and reduce the total gradient of the i-th iteration according to the reduction factor.

[0147] In a possible implementation method, the determination unit 702 is further configured to preset a global gradient threshold; determine the second gradient threshold according to the global gradient threshold and the number of computing nodes;

[0148] The calculation method of the second gradient threshold is as follows:

[0149]

[0150] in, is the second gradient threshold, TG is the global gradient threshold, N is the number of computing nodes, is the square root function.

[0151] In a possible implementation method, the determination unit 702 is also used to set the termination iteration number of the large model training task to an integer multiple of the minimum iteration number; the minimum iteration number is the minimum number of residual gradients and the minimum number of times they are sent to the parameter node.

[0152] In a possible implementation method, the determination unit 702 is also used to preset a masking factor; the masking factor is used to control the influence of the residual gradient after the i-1th iterative training and the total gradient of the i-th iteration; the masking gradient is determined according to the product of the masking factor and the residual gradient after the i-1th iterative training; the i-th iteration total gradient is determined according to the sum of the gradient information of the n parameters generated by the i-th iterative training and the masking gradient.

[0153] Based on the same technical concept, the embodiment of the present application provides a parameter training device 800 of a large model training system, and the parameter training device 800 of the large model training system can be, for example, a computing device. Figure 8 As shown, a parameter training device 800 of a large model training system includes at least one processor 801 and a memory 802 connected to the at least one processor. The specific connection medium between the processor 801 and the memory 802 is not limited in the embodiment of the present application. Figure 8 For example, the processor 801 and the memory 802 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0154] In an embodiment of the present application, the memory 802 stores instructions that can be executed by at least one processor 801. At least one processor 801 can execute the above-mentioned parameter training method of the large model training system by executing the instructions stored in the memory 802.

[0155] Among them, the processor 801 is a control center of a parameter training device 800 of a large model training system, and various interfaces and lines can be used to connect various parts of the computer equipment, and resources can be set by running or executing instructions stored in the memory 802 and calling data stored in the memory 802. Optionally, the processor 801 may include one or more determination units, and the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801. In some embodiments, the processor 801 and the memory 802 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0156] Processor 801 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.

[0157] The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 802 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 802 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0158] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer-executable program. The computer-executable program is used to enable a computer to execute a parameter training method for a large model training system listed in any of the above methods.

[0159] An embodiment of the present application provides a computer program product, including a computer program executable by a computer device. When the program is run on the computer device, the computer device executes a parameter training method for a large model training system listed in any of the above methods.

[0160] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0161] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0164] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A parameter training method for a large model training system, It is characterized in that The large model training system includes multiple computing nodes and parameter nodes; the multiple computing nodes are used to execute large model training tasks in parallel; The parameter node is used to update the weight parameters of the large model according to the gradient information generated by the multiple computing nodes in each iterative training stage; The method comprises: The first computing node obtains the gradient information of n parameters generated by the i-th iterative training; wherein the first computing node is any node among the multiple computing nodes; i and n are positive integers; The first computing node determines the total gradient of the i-th iteration according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient sum after the i-1-th iteration training; wherein the residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iteration trainings; and the residual gradient sum is stored in the first computing node; The first computing node sends the gradient information of the m parameters satisfying the threshold condition in the total gradient of the i-th iteration to the parameter node; the m parameters satisfying the threshold condition are used as the transmission gradient; m is a positive integer less than n; The parameter node updates the weight parameters used by the large model in the (i+1)th iterative training according to the transmission gradients of the i-th iterative training sent by all computing nodes; The first computing node obtains the weight parameter used in the i+1th iterative training from the parameter node, and performs the i+1th iterative training.

2. The method according to claim 1, It is characterized in that The first computing node sends the gradient information of the m parameters satisfying the threshold condition in the total gradient of the i-th iteration to the parameter node, including: The first computing node sorts the gradient information of the n parameters of the total gradient of the i-th iteration, selects the gradient information of the first m parameters with the largest gradient information and sends them to the parameter node, or The first computing node determines the gradient information of the n parameters of the total gradient of the i-th iteration and compares it with a first gradient threshold, and sends the gradient information corresponding to the parameters greater than the first gradient threshold to the parameter node.

3. The method according to claim 1, It is characterized in that After the first computing node sends the gradients of the m parameters that meet the threshold condition in the total gradient of the i-th iteration to the parameter node, the method further includes: The first computing node determines the gradient information that does not meet the threshold condition in the total gradient of the i-th iteration as the residual gradient of the i-th iteration; The residual gradient of the i-th iteration and the residual gradient of the i-1-th iteration are added together to determine the residual gradient of the i-th iteration.

4. The method according to claim 1, It is characterized in that After determining the total gradient of the i-th iteration, the method further includes: Determine whether the total gradient of the i-th iteration is greater than a second gradient threshold; If the total gradient of the i-th iteration is greater than the second gradient threshold, the total gradient of the i-th iteration is reduced.

5. The method according to claim 4, It is characterized in that The reducing the total gradient of the i-th iteration includes: Determine the conversion value corresponding to the total gradient of the i-th iteration under the L2 norm; determining a reduction factor according to a ratio of the second gradient threshold and the conversion value; The total gradient of the i-th iteration is reduced according to the reduction factor.

6. The method according to claim 4, It is characterized in that Before determining whether the total gradient of the i-th iteration is greater than the second gradient threshold, the method further includes: Preset global gradient threshold; Determine the second gradient threshold according to the global gradient threshold and the number of computing nodes; The calculation method of the second gradient threshold is as follows: in, is the second gradient threshold, TG is the global gradient threshold, N is the number of computing nodes, is the square root function.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: The termination iteration number of the large model training task is set to an integer multiple of the minimum iteration number; the minimum iteration number is the minimum number of residual gradients and the minimum number of times they are sent to the parameter node.

8. The method according to any one of claims 1 to 6, It is characterized in that The first computing node determines the total gradient of the i-th iteration according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient after the i-1-th iteration training, including: A preset masking factor; the masking factor is used to control the residual gradient after the i-1th iteration training and the degree of influence on the total gradient of the i-th iteration; Determine a masking gradient according to the product of the masking factor and the residual gradient sum after the i-1th iterative training; The total gradient of the i-th iteration is determined according to the sum of the gradient information of the n parameters generated by the i-th iteration training and the masking gradient.

9. A parameter training device for a large model training system, It is characterized in that include: An acquisition unit, used to acquire the gradient information of n parameters generated by the i-th iterative training; wherein the first computing node is any node among the multiple computing nodes; i and n are positive integers; A determination unit, configured to determine the total gradient of the i-th iteration according to the gradient information of the n parameters generated by the i-th iteration training and the residual gradient sum after the i-1-th iteration training; wherein the residual gradient sum is obtained by accumulating the gradient information of the same parameter that does not meet the threshold condition in previous iteration trainings; and the residual gradient sum is stored in the first computing node; A transceiver unit, configured to send the gradient information of the m parameters satisfying the threshold condition in the total gradient of the i-th iteration to the parameter node; the m parameters satisfying the threshold condition are used as the transmission gradient; m is a positive integer less than n; obtain the weight parameter used in the i+1-th iteration training from the parameter node, and perform the i+1-th iteration training; The updating unit is used to update the weight parameters used by the large model in the (i+1)th iteration training according to the transmission gradients of the i-th iteration training sent by all computing nodes.

10. A computer program product, It is characterized in that The invention comprises a computer program executable by a computer device, and when the program is run on the computer device, the computer device is caused to execute the steps of the method according to any one of claims 1 to 8.