Method, device, equipment and storage medium for accelerating training of neural network model
By selectively updating the parameters of the hidden layer in large neural network models, using weight norms and AdamW optimization strategy, the problem of high resource occupation during training is solved, and training efficiency and resource utilization efficiency are improved. It is especially suitable for autonomous driving and Robot navigation and other fields.
Patent Information
- Application Number
- CN202411081946.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-08
AI Technical Summary
During the training process, large neural network models have extremely high demand for computing resources, especially video memory resources, which leads to increased training efficiency and cost. How to selectively update model parameters to reduce resource occupation has become a key technical issue.
By obtaining the weight norm of the hidden layer in the path planning model to be trained, the sampling probability is determined, and the training layer is selected based on this probability, the training layer is iteratively optimized using the AdamW optimization strategy, and only the parameters that are most critical to improving the model's performance are updated.
Significantly reduce the number of parameters that need to be processed in each iteration, reduce computational complexity and training time, improve resource usage efficiency, and is suitable for large-scale path planning problems such as autonomous driving and robot navigation.
Smart Images

Figure CN118607610B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, in particular to the field of autonomous driving technology, and specifically to a method, device, equipment and storage medium for accelerating the training of a neural network model. Background Art
[0002] In the field of artificial intelligence, especially in the development of deep learning technology, large neural network models have received great attention due to their excellent performance and wide application prospects. However, as the scale of the model continues to expand, the demand for computing resources during its training process is also increasing. The traditional full parameter fine-tuning method requires a large amount of computing resources, especially video memory resources, which greatly limits the training efficiency and application scope of large models.
[0003] In full parameter fine-tuning, each iteration requires updating almost all parameters in the network, which not only leads to a huge amount of computation, but also because the model parameters usually need to be stored in the video memory, the demand for video memory is also very high. As the model size increases, the demand for video memory grows exponentially. Taking the H100 GPU server as an example, the price of the basic model is 2.4 million yuan, which is only the entry-level configuration. When larger models need to be processed, the demand for video memory increases rapidly, resulting in the need to use more GPUs or higher-configuration servers. Due to the exponential growth in hardware costs, this increase in demand makes training large models extremely expensive.
[0004] Therefore, how to selectively sample the model parameter updates during model training and only update the parameters that are most critical to improving model performance to reduce resource usage has become a key technical problem that needs to be solved at present. Summary of the invention
[0005] The main purpose of this application is to provide a method, device, equipment and storage medium for accelerating the training of neural network models, aiming to solve the technical problem of how to selectively sample the parameter updates of the model during the model training process and only update the parameters that are most critical to improving the model performance to reduce resource usage.
[0006] To achieve the above objectives, the present application provides a method for accelerating the training of a neural network model, the method comprising the following steps:
[0007] Obtain the weight norm of the hidden layer in the path planning model to be trained;
[0008] Determining the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer;
[0009] Determining a training layer according to the sampling probability;
[0010] Iteratively optimize the model parameters of the training layer through the AdamW optimization strategy;
[0011] The path planning result is obtained through the trained path planning model.
[0012] Optionally, obtaining a weight norm of a hidden layer in the path planning model to be trained includes:
[0013] Obtaining model architecture information of the path planning model to be trained;
[0014] Determine the hidden layer and the corresponding weight matrix according to the model architecture information;
[0015] According to the hidden layer weight matrix, a weight norm of the hidden layer is obtained, and the weight norm type is an L2 norm.
[0016] Optionally, determining the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer includes:
[0017] Calculating the sampling probability mapping results of each hidden layer according to the weight norm of the hidden layer and the sampling probability mapping function, wherein the weight norm and the sampling probability mapping result are in a fuzzy inverse relationship;
[0018] The sampling probability mapping results of each hidden layer are normalized to obtain the sampling probability of each hidden layer.
[0019] Optionally, determining a training layer according to the sampling probability includes:
[0020] Before each round of iterative training, generate random sampling numbers for that round;
[0021] The hidden layer whose sampling probability is higher than that corresponding to the sampling random number is used as a training layer, and the remaining hidden layers are used as parameter freezing layers. The parameter freezing layers participate in model training, and the model parameters of the parameter freezing layers do not participate in the iterative optimization of the training process.
[0022] Optionally, the iterative optimization of the model parameters of the training layer by using the AdamW optimization strategy includes:
[0023] In each iteration, the loss function is used to calculate the loss value of this round of iterative training;
[0024] Based on the back propagation algorithm, the gradient value of the trainable parameter in the training layer is calculated;
[0025] According to the loss value, the trainable parameter gradient value and the AdamW optimization strategy, the iterative optimization result of the model parameters of the training layer is obtained.
[0026] Optionally, after obtaining the iterative optimization result of the model parameters of the training layer according to the loss value, the weight matrix gradient value of the training layer and the AdamW optimization strategy, the method further includes:
[0027] After the path planning model to be trained starts training, recording the number of iterations of the path planning model to be trained;
[0028] When the number of iterations reaches a preset adjustment threshold, a convergence evaluation is performed on the path planning model to be trained to obtain a convergence evaluation result;
[0029] According to the convergence evaluation result, adjusting the total number of training layers;
[0030] Update the sampling probability of the retained training layer and start the next round of training.
[0031] Optionally, before obtaining the weight norm of the hidden layer in the path planning model to be trained, the method further includes:
[0032] According to the path planning model to be trained, obtaining a loss function of the path planning model to be trained;
[0033] Performing mathematical analysis on the loss function to obtain geometric characteristics of the loss function;
[0034] When the geometric characteristics of the loss function satisfy both curve convexity and smoothness, the path planning model to be trained is deemed to meet the accelerated training implementation conditions;
[0035] After the path planning model to be trained meets the accelerated training implementation conditions, the step of obtaining the weight norm of the hidden layer in the path planning model to be trained is performed.
[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a device for accelerating the training of a neural network model, and the device for accelerating the training of a neural network model includes:
[0037] A model parameter processing module is used to obtain the weight norm of the hidden layer in the path planning model to be trained;
[0038] The model parameter processing module is further used to determine the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer;
[0039] The model parameter processing module is further used to determine the training layer according to the sampling probability;
[0040] Model parameter update module, used to iteratively optimize the model parameters of the training layer through the AdamW optimization strategy;
[0041] The model parameter processing module is also used to obtain a path planning result through the trained path planning model.
[0042] In addition, to achieve the above-mentioned purpose, the present application also provides an accelerated training neural network model device, the device comprising: a memory, a processor, and an accelerated training neural network model program stored in the memory and executable on the processor, the accelerated training neural network model program being configured to implement the steps of the accelerated training neural network model method as described above.
[0043] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, on which is stored an accelerated training neural network model program, and when the accelerated training neural network model program is executed by a processor, the steps of the accelerated training neural network model method described above are implemented.
[0044] The present application obtains the weight norm of the hidden layer in the path planning model to be trained; determines the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer; determines the training layer according to the sampling probability; iteratively optimizes the model parameters of the training layer through the AdamW optimization strategy; and obtains the path planning result through the trained path planning model.
[0045] In summary, this application can significantly reduce the number of parameters that need to be processed in each iteration by selectively updating only a part of the hidden layer parameters, thereby reducing computational complexity and training time, and can concentrate computing resources to optimize more important parts of the model, thereby improving resource efficiency. This method is particularly suitable for solving large-scale path planning problems, such as autonomous driving and robot navigation, which usually require processing large amounts of data and complex decision-making processes. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0048] Figure 1 A schematic diagram of the flow chart of the first embodiment of the method for accelerating the training of a neural network model of the present application;
[0049] Figure 2 A schematic diagram of the flow chart of the second embodiment of the method for accelerating the training of a neural network model of the present application;
[0050] Figure 3 A schematic diagram of the functional modules of the device for accelerating the training of a neural network model for this application;
[0051] Figure 4 It is a structural diagram of a terminal device in the hardware operating environment involved in the embodiment of the present application.
[0052] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0054] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0055] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an accelerated training neural network model device, etc. The following takes the accelerated training neural network model device as an example to illustrate this embodiment and the following embodiments.
[0056] The present application embodiment provides a method for accelerating the training of a neural network model. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the present application.
[0057] In this embodiment, the method for accelerating the training of a neural network model includes:
[0058] Step S10: Obtain the weight norm of the hidden layer in the path planning model to be trained.
[0059] It should be noted that the method for accelerating the training of neural network models in this embodiment is not applicable to all types of neural network models, but has certain applicable conditions. Prior to this, it is necessary to first introduce the principle of the method for accelerating the training of neural network models in this embodiment.
[0060] It is understandable that the purpose of the present invention is to propose a new neural network fine-tuning method. The inventor was inspired by the "grandmother cell" theory in brain science. The brain is a highly complex and efficient information processing system that uses distributed processing to perform tasks. In this process, different brain regions and neural networks assume different functions. The present invention aims to achieve the effect of full parameter tuning in the process of training (or fine-tuning) a large language model, but avoid the defects of low-rank training methods and local parameter representation capabilities, and improve convergence speed and memory efficiency. The present invention controls the update of different layers through importance sampling, thereby improving the efficiency and effect of training and fine-tuning. Simply put, this method is to freeze a part (60% or even more) of the model parameters during the training of the model. The frozen parameters can be read and participate in the calculation, but compared with full parameter training, the frozen parameters cannot be rewritten, so that only 40% or even less parameters face rewriting, and the calculation amount of back propagation is also saved, but from the calculation sum of the overall matrix, the final calculation result has only a small error. From the perspective of the loss function of this type of model, the loss function is convex and smooth, that is, the model that satisfies this type of training method needs to meet the following conditions: the model to be trained needs to run in a bounded convex set, and its stochastic gradient is bounded, then the sequence generated by the model is subject to the following convergence rate constraints:
[0061]
[0062] It should be noted that this formula describes that as the number of iterations T increases, the regularized loss function The average value and optimal regularization loss The gap between.
[0063] Among them, W t represents the parameter (weight) vector at the tth iteration, is the regularized loss function at the tth iteration, is the optimal value of the regularized loss function (possibly the global minimum), T is the number of iterations, and the left side of the formula Represents the average of the regularized loss function values in all iteration steps after T iterations.
[0064] In addition, it is shown that as T increases, the convergence rate is the inverse of the square root of T, which is a common convergence rate, indicating that as the number of iterations increases, the performance of the algorithm will slow down, but will eventually tend to the optimal solution. This formula is often used to analyze the convergence behavior of stochastic gradient descent (SGD) or other optimization algorithms. It shows that as the iterations proceed, the algorithm can The rate of approaching the optimal solution. This convergence rate indicates that the convergence of the algorithm is sublinear, that is, it takes many iterations to significantly reduce the gap between the loss function and the optimal loss.
[0065] It should be understood that not all path planning problems can naturally meet these conditions. The reason why the path planning model in this embodiment can meet the above conditions (the model runs in a bounded convex set, the random gradient is bounded, and the loss function is convex and smooth) is that the model is implemented under specific simplifications or assumptions. For example, the path planned by the model is limited to the physical area of the map, and the area is static as a whole, then all possible paths constitute a bounded convex set, that is, there is a global optimal solution. Conversely, for example, mixed integer programming (Mixed Integer Programming, MIP) is usually non-convex, but certain specific types of MIP problems can be solved by methods such as branch and bound, which can ensure that the global optimal solution is found during the solution process.
[0066] In some embodiments, based on the path planning model to be trained, the loss function of the path planning model to be trained is obtained; the loss function is mathematically analyzed to obtain the geometric properties of the loss function; when the geometric properties of the loss function simultaneously satisfy the curve convexity and smoothness, the path planning model to be trained is deemed to meet the conditions for implementing accelerated training; after the path planning model to be trained meets the conditions for implementing accelerated training, the step of obtaining the weight norm of the hidden layer in the path planning model to be trained is executed.
[0067] It should be noted that in a neural network, the hidden layer is the layer between the input layer and the output layer, and they do not interact directly with the outside world. The hidden layer is responsible for extracting features from the input data and converting it into a form that the output layer can use to make decisions. Weights are parameters in the model, and they represent the importance of the input features to the predicted results. The weights are continuously updated during the training process to minimize the loss function of the model. Norm is a mathematical concept used to measure the size or length of a vector. In machine learning and mathematical optimization, norms are often used for regularization, that is, as part of the loss function to control the complexity of the model and prevent overfitting. Common norms include L1 norm (Manhattan distance), L2 norm (Euclidean distance), and L∞ norm (maximum norm).
[0068] In one embodiment, obtaining the weight norm of the hidden layer in the path planning model to be trained includes: obtaining model architecture information of the path planning model to be trained; determining the hidden layer and the corresponding weight matrix based on the model architecture information; and obtaining the weight norm of the hidden layer based on the hidden layer weight matrix, wherein the weight norm type is the L2 norm.
[0069] It is understandable that, first of all, it is necessary to understand in detail the structure of the path planning model to be trained, including the type and number of layers and the configuration parameters of each layer, etc. After obtaining the model architecture information, the hidden layers in the model are identified next. The hidden layers are layers in the neural network that are not directly connected to the input or output layer. They are responsible for extracting features and learning data representations. Then, the weight matrices of these hidden layers are determined. The weight matrices contain the weights of all neurons in the layer. Finally, based on these weight matrices, the weight norms of the hidden layers are calculated. In this embodiment, the L2 norm, that is, the Euclidean norm, is used. The L2 norm is a smooth function that has defined derivatives in the entire parameter space. This makes it very useful in optimization problems because gradient descent and other gradient-based optimization algorithms can be applied smoothly.
[0070] Step S20: Determine the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer.
[0071] It can be understood that the sampling probability is a probability value determined according to the weight norm, which is used to decide which hidden layers will be selected for parameter updating during the training process.
[0072] It should be noted that some technologies such as Low-Rank Adaptation reduce the demand for video memory and computing resources by reducing the number of parameters that need to be updated. However, these methods often lead to model performance degradation due to problems such as error accumulation of matrix approximation and inaccurate matrix decomposition of low-rank training methods. Therefore, although these methods have alleviated the pressure on resources to a certain extent, they have not completely solved the problem of training large models with limited resources. In order to overcome the defects of low-rank training methods and local parameter representation capabilities, and to improve convergence speed and memory efficiency. The sampling probability is inversely proportional to the weight norm of the corresponding layer in the low-rank training method, so as to simulate the hierarchical update mode of the low-rank training method.
[0073] In one embodiment, the sampling probability mapping results of each hidden layer are calculated according to the weight norm of the hidden layer and the sampling probability mapping function, and the weight norm and the sampling probability mapping result are in a fuzzy inverse proportional relationship; the sampling probability mapping results of each hidden layer are normalized to obtain the sampling probability of each hidden layer.
[0074] It should be noted that in the path planning model, the hidden layer is responsible for learning and extracting useful features from the input data (such as map layout, traffic information, obstacle location, etc.). These features include road connectivity, traffic flow patterns or expected delays, etc. In addition, since path planning is a highly nonlinear problem, the hidden layer handles these complexities through nonlinear activation functions, enabling the model to capture nonlinear relationships in the data.
[0075] It should be understood that this approach does not simply reduce the number of parameter updates, but rather selectively updates parameters in a smarter way to maintain model performance while reducing resource consumption. The determination of sampling probability is a dynamic process that adjusts according to the changes in the weight norm during model training to ensure that the model can flexibly adapt to different training stages.
[0076] Step S30: Determine the training layer according to the sampling probability.
[0077] In one embodiment, determining the training layer according to the sampling probability includes: before each round of iterative training, generating a sampling random number for that round; using the hidden layer corresponding to the sampling probability higher than the sampling random number as the training layer, and the remaining hidden layers as parameter freezing layers, the parameter freezing layers participate in model training, and the model parameters of the parameter freezing layers do not participate in the iterative optimization of the training process.
[0078] It should be noted that the pre-iteration sampling is before each round of iterative training starts. The system will generate a random number for comparison with the sampling probability of the hidden layer. Since the sampling probability has been normalized in the previous section, the range of the random number is between 0 and 1. All hidden layers with a sampling probability higher than this random number will be selected as training layers, which means that these layers will participate in parameter updates in the next iteration. On the other hand, hidden layers with a sampling probability not higher than the random number will be regarded as parameter frozen layers. Although these layers participate in model training (that is, they still perform forward propagation based on the input data), their parameters remain unchanged during the iterative optimization process.
[0079] It is understandable that this method allows the model to concentrate resources on updating the most important layers in each iteration, thereby improving training efficiency, and different layers may be selected as training layers in each training iteration, depending on the random numbers generated before each iteration. By freezing the parameters of some layers, the amount of calculation can be reduced, and the memory and video memory requirements during training can be reduced.
[0080] It should be understood that although the parameter freezing layer does not participate in parameter updating, the frozen parameters can be read and participate in calculations. However, compared with full parameter training, the frozen parameters cannot be rewritten.
[0081] Step S40: Iteratively optimize the model parameters of the training layer using the AdamW optimization strategy.
[0082] It should be noted that AdamW is an algorithm that combines the Adam optimizer and weight decay (L2 regularization), which aims to solve the problem of vanishing weight decay terms in the original Adam algorithm. This step can be used to update the model parameters selected as the training layer to minimize the loss function of the model and improve the accuracy of path planning. In each iteration, the AdamW algorithm not only uses the gradient information of the loss function to update the parameters, but also needs to calculate the exponentially weighted average of the gradient, which is equivalent to calculating the first-order moment of the gradient, which is used to estimate the long-term average trend of the gradient. The exponentially weighted average of the square of the gradient, that is, the second-order moment of the gradient, is also calculated to estimate the variance of the gradient. For each parameter, the AdamW algorithm adjusts the learning rate according to the estimated values of the first-order moment and the second-order moment. Specifically, the learning rate is determined by the first-order moment estimate divided by the square root of the second-order moment estimate, and multiplied by a preset learning rate hyperparameter.
[0083] It should be understood that, unlike the standard Adam algorithm, AdamW adds a weight decay term to the parameter update rule, which multiplies (1 - learning rate * weight decay coefficient) when updating the parameters, thereby achieving a regularization effect and helping to reduce overfitting. Using the adjusted learning rate calculated above, the algorithm updates the model parameters of each training layer. The direction of the parameter update is along the negative direction of the gradient, with the goal of reducing the value of the loss function. In the first few iterations, the estimates of the first and second order moments may not be stable enough. Therefore, the AdamW algorithm performs bias correction on these moments in the first few iterations to ensure more accurate estimates.
[0084] Step S50: Obtaining a path planning result through the trained path planning model.
[0085] It is understandable that in the above steps, the model has been fully trained, including weight initialization, iterative update of the optimization algorithm, and possible hyperparameter adjustment. The output of the model is one or more paths, which are the optimal or feasible solutions determined based on the knowledge learned by the model.
[0086] It should be understood that in actual applications, the path generated by the model may be affected by factors such as environmental changes, sensor errors, dynamic obstacles, etc. The generated path planning results need to be evaluated through actual testing or simulation to evaluate their effectiveness, safety and efficiency.
[0087] The present embodiment provides a method for accelerating the training of a neural network model. The present embodiment first obtains the weight norm of the hidden layer in the path planning model to be trained; determines the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer; determines the training layer according to the sampling probability; iteratively optimizes the model parameters of the training layer through the AdamW optimization strategy; and obtains the path planning result through the trained path planning model.
[0088] In summary, this application can significantly reduce the number of parameters that need to be processed in each iteration by selectively updating only a part of the hidden layer parameters, thereby reducing computational complexity and training time, and can concentrate computing resources to optimize more important parts of the model, thereby improving resource efficiency. This method is particularly suitable for solving large-scale path planning problems, such as autonomous driving and robot navigation, which usually require processing large amounts of data and complex decision-making processes.
[0089] Reference Figure 2 , Figure 2 This is a flow chart of the second embodiment of the method for accelerating the training of a neural network model of the present application. Based on the above-mentioned first embodiment, the second embodiment of the method for accelerating the training of a neural network model of the present application is proposed.
[0090] In this embodiment, the step S40 includes:
[0091] Step S401: In each iteration, the loss value of this round of iterative training is calculated using the loss function.
[0092] It should be noted that the loss function is a function used in machine learning and statistics to measure the difference between the model prediction value and the actual observation value. For the same neural network model, there is a wide range of applicable loss functions, but not all loss functions can meet the aforementioned prerequisite that the loss function is convex and smooth. Therefore, the optional loss function can only be determined based on the specific situation of the applied neural network model itself, and the loss value of this round of iterative training can be calculated.
[0093] Step S402: Based on the back propagation algorithm, the gradient values of the trainable parameters in the training layer are calculated.
[0094] It should be noted that the backpropagation algorithm is an algorithm for calculating gradients in a neural network, which uses the chain rule to efficiently calculate the gradient of each parameter. The backpropagation algorithm is used to calculate the gradient of the loss function with respect to the network parameters. These gradients indicate the direction in which the loss function grows fastest in the parameter space, that is, how the parameters should be adjusted to reduce the loss. The algorithm uses the chain rule to recursively calculate the derivatives of complex functions, starting at the output layer in the neural network and going backwards through each layer of the network until the input layer. The calculation of the gradient starts with the loss function of the output layer and then propagates backwards through the network until the gradients of all layers are calculated. The calculated gradients are used to update the weights and biases of the network through gradient descent or other optimization algorithms.
[0095] It can be understood that in each training iteration, a forward propagation is performed to calculate the loss, and then a backpropagation is performed to calculate the gradients, and the parameters are updated based on these gradients.
[0096] Step S403: Obtain the iterative optimization result of the model parameters of the training layer according to the loss value, the trainable parameter gradient value and the AdamW optimization strategy.
[0097] It should be noted that the AdamW optimization strategy is used to iteratively optimize the model parameters of the training layer by combining the loss value and the gradient value of the trainable parameters. First, the loss function evaluates the difference between the model prediction and the actual observation value, providing a quantitative measure of the current model performance. Then, through the back-propagation algorithm, the gradient of the loss function with respect to the network parameters is calculated. These gradients indicate the direction in which the loss function grows fastest in the parameter space. Next, the AdamW algorithm updates each parameter based on these gradients and the exponentially weighted average of past gradients (momentum and adaptive learning rate adjustment), while introducing a weight decay term to prevent overfitting. This process involves bias correction of the first-order moment and second-order moment estimates, ensuring stability in the initial few iterations. Finally, the model parameter updates of the training layer are obtained in this way, with the goal of reducing the value of the loss function and improving the prediction accuracy of the model. This process is repeated in each iteration until the model converges or the preset number of iterations is reached.
[0098] It can be understood that the process of updating the weights of the activation layer using the AdamW optimizer in the path planning model to be trained is a key step in optimizing and fine-tuning the model to better perform the path planning task. In this process, the loss function is first used to measure the difference between the model's prediction (i.e., the planned path) and the actual optimal path, thereby providing a quantitative performance indicator. Subsequently, the backpropagation algorithm is applied to calculate the gradient of the loss function relative to the trainable parameters of the activation layer in the network. These gradients indicate the direction in the parameter space that can reduce the loss the fastest. The AdamW optimization strategy then uses this gradient information, as well as the exponentially weighted average of past gradients (momentum and adaptive learning rate adjustment) to update the weights of the activation layer. In the first few iterations, the bias correction of the first-order and second-order moment estimates ensures the stability of the algorithm, making the parameter update more accurate and reliable. In this way, each iteration can accurately adjust the weights of the activation layer to gradually reduce the value of the loss function and improve the prediction accuracy of the model. This process is repeated during model training until the model achieves satisfactory performance on the path planning task or a sufficient number of iterations have been performed, at which point the model is considered to have converged. In this way, the AdamW algorithm adaptively adjusts the learning rate for each parameter, which helps to converge faster, thereby reducing the number of iterations required to achieve the desired performance, saving training time and resources, and enabling the path planning model to learn how to efficiently plan the optimal or near-optimal path.
[0099] Step S411: after the path planning model to be trained starts training, the number of iterations of the path planning model to be trained is recorded.
[0100] It should be noted that the number of iterations is recorded to track the progress of model training. During the training process, parameter adjustments are not made after each iteration, but evaluation and adjustment are performed every few iteration cycles. The specific number of cycles is determined according to needs, which can avoid the computational overhead caused by frequent adjustments. At the end of each evaluation cycle, the convergence of the model is checked. This is usually achieved by observing whether the value of the loss function is stable or whether the reduction is less than a certain threshold.
[0101] Step S412: When the number of iterations reaches a preset adjustment threshold, a convergence evaluation is performed on the path planning model to be trained to obtain a convergence evaluation result.
[0102] It should be noted that convergence evaluation is an important checkpoint to determine whether the model is close to or has reached the optimal state. This evaluation is usually based on the performance of the model on the validation set, rather than relying solely on the loss value on the training set. Convergence evaluation may involve multiple indicators, such as loss value, accuracy, precision, and recall, to comprehensively evaluate model performance.
[0103] It is understandable that the purpose of convergence assessment is to determine whether the model needs more training or whether it has been trained enough. The purpose of evaluating when the preset adjustment threshold is reached is to make performance-based decisions at a critical stage of model training. If the model has converged, continuing training may lead to overfitting, and the evaluation results help determine whether this situation occurs.
[0104] It should be understood that convergence evaluation is part of the dynamic training process, which is used to determine whether the training strategy needs to be adjusted, such as the learning rate, the number of training layers, etc. Interpretation of the evaluation results requires expertise to ensure that the right decisions are made, such as whether a more complex model or stricter regularization is needed. Convergence evaluation is not only related to model performance, but also directly affects the effective use of training resources and the generalization ability of the final model.
[0105] Step S413: According to the convergence evaluation result, the total number of training layers is adjusted, the sampling probability of the retained training layers is updated and the next round of training is started.
[0106] It should be noted that the convergence evaluation results guide the adjustment of the model structure and training strategy. If the evaluation shows that the model still has room for improvement, it may be necessary to increase the number of training layers or adjust the sampling strategy to more finely optimize the network parameters. Adjustments based on the convergence evaluation results are made to make model training more efficient and ensure that resources are used where they are needed. Adjustments include increasing or decreasing the depth of the network (the number of training layers) or changing the focus of parameter updates (sampling probability) to achieve more refined learning in key areas.
[0107] It is understandable that adjusting training layers and sampling probabilities is an advanced strategy in model training, which needs to be based on sufficient experimental evidence and a deep understanding of model behavior.
[0108] This embodiment provides a method for accelerating the training of a neural network model. This embodiment calculates the loss value of this round of iterative training through a loss function in each iteration; calculates the gradient value of the trainable parameters in the training layer based on the back propagation algorithm; obtains the iterative optimization result of the model parameters of the training layer according to the loss value, the gradient value of the trainable parameters and the AdamW optimization strategy. After the training of the path planning model to be trained begins, the number of iterations of the path planning model to be trained is recorded; when the number of iterations reaches a preset adjustment threshold, the convergence evaluation of the path planning model to be trained is performed to obtain a convergence evaluation result; according to the convergence evaluation result, the total number of training layers is adjusted; the sampling probability of the retained training layer is updated and the next round of training is started.
[0109] In summary, in each iteration, the loss function is used to evaluate the difference between the model prediction and the actual observation value, and the back-propagation algorithm is used to calculate the gradient to guide the parameter update. In particular, the introduction of the AdamW algorithm not only accelerates the convergence process, but also effectively prevents overfitting through weight decay. In addition, the scheme also includes periodic convergence evaluation, and dynamically adjusts the number of training layers and sampling probability according to the evaluation results, further improving the training efficiency and model performance. The beneficial effects include significantly reducing the number of iterations required to achieve the predetermined performance, saving training time and computing resources, while ensuring the excellent performance of the model in terms of convergence, generalization ability and adaptability. This method is particularly suitable for complex path planning tasks, enabling the model to learn how to efficiently plan the optimal or near-optimal path, and has important application value in the fields of autonomous driving and robot navigation.
[0110] Reference Figure 3 The present application also provides a device for accelerating the training of a neural network model, the device for accelerating the training of a neural network model comprising:
[0111] A model parameter processing module 10 is used to obtain the weight norm of the hidden layer in the path planning model to be trained;
[0112] The model parameter processing module 10 is further used to determine the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer;
[0113] The model parameter processing module 10 is further used to determine the training layer according to the sampling probability;
[0114] A model parameter updating module 20 is used to iteratively optimize the model parameters of the training layer through the AdamW optimization strategy;
[0115] The model parameter processing module 20 is also used to obtain a path planning result through the trained path planning model.
[0116] In one embodiment, the model parameter processing module 10 is also used to obtain the model architecture information of the path planning model to be trained; determine the hidden layer and the corresponding weight matrix according to the model architecture information; and obtain the weight norm of the hidden layer according to the hidden layer weight matrix, and the weight norm type is the L2 norm.
[0117] In one embodiment, the model parameter processing module 10 is also used to calculate the sampling probability mapping results of each hidden layer based on the weight norm of the hidden layer and the sampling probability mapping function, and the weight norm and the sampling probability mapping result are in a fuzzy inverse proportional relationship; the sampling probability mapping results of each hidden layer are normalized to obtain the sampling probability of each hidden layer.
[0118] In one embodiment, the model parameter processing module 10 is also used to generate a sampling random number for each round of iterative training before the round; the hidden layer with a sampling probability higher than that corresponding to the sampling random number is used as a training layer, and the remaining hidden layers are used as parameter freezing layers. The parameter freezing layers participate in model training, and the model parameters of the parameter freezing layers do not participate in the iterative optimization of the training process.
[0119] In one embodiment, the model parameter processing module 10 is also used to calculate the loss value of this round of iterative training through the loss function in each iteration; calculate the gradient value of the trainable parameters in the training layer based on the back propagation algorithm; and obtain the iterative optimization result of the model parameters of the training layer according to the loss value, the gradient value of the trainable parameters and the AdamW optimization strategy.
[0120] In one embodiment, the parameter updating module 20 is also used to record the number of iterations of the path planning model to be trained after the path planning model to be trained starts training; when the number of iterations reaches a preset adjustment threshold, the path planning model to be trained is evaluated for convergence to obtain a convergence evaluation result; according to the convergence evaluation result, the total number of training layers is adjusted; the sampling probability of the retained training layer is updated and the next round of training is started.
[0121] In one embodiment, the model parameter processing module 10 is also used to obtain the loss function of the path planning model to be trained based on the path planning model to be trained; perform mathematical analysis on the loss function to obtain the geometric properties of the loss function; when the geometric properties of the loss function simultaneously satisfy the curve convexity and smoothness, it is deemed that the path planning model to be trained meets the conditions for implementing accelerated training; after the path planning model to be trained meets the conditions for implementing accelerated training, execute the step of obtaining the weight norm of the hidden layer in the path planning model to be trained.
[0122] An embodiment of the present application also provides a device for accelerating the training of a neural network model, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for accelerating the training of a neural network model in the above-mentioned embodiment 1.
[0123] Reference below Figure 4, which shows a schematic diagram of the structure of an accelerated training neural network model device suitable for implementing the embodiment of the present application. The accelerated training neural network model device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players: portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The device for accelerating the training of a neural network model shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present application.
[0124] like Figure 4 As shown, the accelerated training neural network model device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the accelerated training neural network model device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the accelerated training neural network model device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an accelerated training neural network model device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.
[0125] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0126] The accelerated training neural network model device provided by the present application adopts the accelerated training neural network model method in the above embodiment, which can solve the technical problem in the art of how to selectively sample the parameter updates of the model during the model training process, and only update the parameters that are most critical to improving the model performance to reduce resource usage. Compared with the prior art, the beneficial effects of the accelerated training neural network model device provided by the present application are the same as the beneficial effects of the accelerated training neural network model method provided by the above embodiment, and the other technical features in the accelerated training neural network model device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0127] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0128] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0129] The present application also provides a storage medium on which is stored an accelerated training neural network model program, which, when executed by a processor, implements the steps of any one of the accelerated training neural network model methods described above.
[0130] The storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: RandomAccess Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0131] The above-mentioned storage medium may be included in the accelerated training neural network model device; or it may exist independently without being assembled into the accelerated training neural network model device.
[0132] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the accelerated training neural network model device, the accelerated training neural network model device: obtains the gear shift process parameters when receiving the gear shift instruction; identifies the abnormal working condition of the gear shift process according to the gear shift process parameters to obtain the gear shift process abnormality identification result; when an abnormal working condition occurs in the gear shift process, handles the abnormal working condition according to the gear shift stage to which the abnormal working condition belongs.
[0133] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0136] The storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for accelerating the training of neural network models, and can solve the technical problem of how to select and sample the parameter updates of the model during the model training process, and only update the parameters that are most critical to improving the performance of the model to reduce resource usage. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the method for accelerating the training of neural network models provided in the above-mentioned embodiments, and will not be repeated here.
[0137] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for accelerating the training of a neural network model, characterized in that: The method for accelerating training of a neural network model comprises: According to the path planning model to be trained, obtaining a loss function of the path planning model to be trained; Performing mathematical analysis on the loss function to obtain geometric characteristics of the loss function; When the path planning model to be trained runs in a bounded convex set, the stochastic gradient is bounded, and the geometric characteristics of the loss function simultaneously satisfy the curve convexity and smoothness, the path planning model to be trained is considered to meet the accelerated training implementation conditions, wherein the path planned by the model is limited to the physical area of the map, and the area is static as a whole, and all possible paths constitute a bounded convex set; Obtaining a weight norm of a hidden layer in a path planning model to be trained, wherein the hidden layer is used to learn and extract useful features from input data, wherein the input data includes map layout, traffic information, and obstacle locations, and wherein the useful features include road connectivity, traffic flow patterns, and expected delays; Determining the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer; Determining a training layer according to the sampling probability; Iteratively optimize the model parameters of the training layer through the AdamW optimization strategy; The path planning result is obtained through the trained path planning model.
2. The method for accelerating training of a neural network model according to claim 1, characterized in that: The step of obtaining the weight norm of the hidden layer in the path planning model to be trained includes: Obtaining model architecture information of the path planning model to be trained; Determine the hidden layer and the corresponding weight matrix according to the model architecture information; According to the hidden layer weight matrix, a weight norm of the hidden layer is obtained, and the weight norm type is an L2 norm.
3. The method for accelerating training of a neural network model according to claim 1, characterized in that: The step of determining the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer comprises: Calculating the sampling probability mapping results of each hidden layer according to the weight norm of the hidden layer and the sampling probability mapping function, wherein the weight norm and the sampling probability mapping result are in a fuzzy inverse relationship; The sampling probability mapping results of each hidden layer are normalized to obtain the sampling probability of each hidden layer.
4. The method for accelerating training of a neural network model according to claim 1, characterized in that: The step of determining the training layer according to the sampling probability comprises: Before each round of iterative training, generate random sampling numbers for that round; The hidden layer whose sampling probability is higher than that corresponding to the sampling random number is used as a training layer, and the remaining hidden layers are used as parameter freezing layers. The parameter freezing layers participate in model training, and the model parameters of the parameter freezing layers do not participate in the iterative optimization of the training process.
5. The method for accelerating training of a neural network model according to claim 1, characterized in that: The iterative optimization of the model parameters of the training layer by the AdamW optimization strategy includes: In each iteration, the loss function is used to calculate the loss value of this round of iterative training; Based on the back propagation algorithm, the gradient value of the trainable parameter in the training layer is calculated; According to the loss value, the trainable parameter gradient value and the AdamW optimization strategy, the iterative optimization result of the model parameters of the training layer is obtained.
6. The method for accelerating training of a neural network model according to claim 5, characterized in that: After obtaining the iterative optimization result of the model parameters of the training layer according to the loss value, the weight matrix gradient value of the training layer and the AdamW optimization strategy, the method further includes: After the path planning model to be trained starts training, recording the number of iterations of the path planning model to be trained; When the number of iterations reaches a preset adjustment threshold, a convergence evaluation is performed on the path planning model to be trained to obtain a convergence evaluation result; According to the convergence evaluation result, adjusting the total number of training layers; Update the sampling probability of the retained training layer and start the next round of training.
7. A device for accelerating the training of a neural network model, characterized in that: The device for accelerating training of a neural network model comprises: A model parameter processing module, used to obtain a loss function of the path planning model to be trained according to the path planning model to be trained; The model parameter processing module is also used to perform mathematical analysis on the loss function to obtain the geometric characteristics of the loss function; The model parameter processing module is further used to regard the path planning model to be trained as meeting the accelerated training implementation conditions when the path planning model to be trained runs in a bounded convex set, the random gradient is bounded, and the geometric characteristics of the loss function simultaneously satisfy the curve convexity and smoothness, wherein the path planned by the model is limited to the entity area of the map, and the area is static as a whole, and all possible paths constitute a bounded convex set; The model parameter processing module is further used to obtain the weight norm of the hidden layer in the path planning model to be trained, the hidden layer is used to learn and extract useful features from input data, the input data includes map layout, traffic information and obstacle location, and the useful features include road connectivity, traffic flow pattern and expected delay; The model parameter processing module is further used to determine the sampling probability of the corresponding hidden layer according to the weight norm of the hidden layer; The model parameter processing module is further used to determine the training layer according to the sampling probability; Model parameter update module, used to iteratively optimize the model parameters of the training layer through the AdamW optimization strategy; The model parameter processing module is also used to obtain a path planning result through the trained path planning model.
8. A device for accelerating the training of a neural network model, characterized in that: The accelerated training neural network model device includes: a memory, a processor, and an accelerated training neural network model program stored in the memory and executable on the processor, wherein the accelerated training neural network model program is configured to implement the steps of the accelerated training neural network model method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores an accelerated training neural network model program, which, when executed by a processor, implements the steps of the accelerated training neural network model method as described in any one of claims 1 to 6.
