Loss scaling for deep neural network training with reduced accuracy

By scaling the loss value and compensating the gradient calculation during the backpropagation process of the deep neural network, the numerical problem in reduced precision training is solved and a stable and efficient training effect on low-precision hardware is achieved.

CN118569342APending Publication Date: 2024-08-30NVIDIA CORP

Patent Information

Application Number
CN202410549903.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2018-05-04
Filing Date
2018-05-07
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

During the training process of deep neural networks, numerical problems are prone to occur when using reduced precision calculations, such as the generation of abnormal values ​​and zero values, resulting in unstable training or failure.

Method used

By scaling the loss value during backpropagation and compensating it after gradient calculation, the gradient value is adjusted to avoid numerical overflow and loss, ensuring the accuracy of weight updates.

Benefits of technology

Effectively perform deep neural network training on reduced-precision hardware, avoiding numerical calculation problems, improving the stability and efficiency of training, and allowing the use of lower-precision calculations without affecting weight updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569342A_ABST
    Figure CN118569342A_ABST
Patent Text Reader

Abstract

When training a deep neural network using reduced accuracy, gradient calculations operate on larger values without affecting the remainder of the training process. A technique for training a deep neural network produces a loss value, scales the loss value, calculates a gradient with reduced accuracy, and reduces the size of the calculated gradient to compensate for the scaling of the loss value. In one exemplary non-limiting arrangement, the training forward transfer scales the loss value by a factor S, and the weight update reduces the weight gradient contribution by 1 / S. Several techniques may be used to select the scaling factor S and adjust the weight update.
Need to check novelty before this filing date? Find Prior Art

Description

This application is a divisional application of Chinese patent application No. 201880004842.0 filed on May 7, 2018. CROSS-REFERENCE TO RELATED APPLICATIONS This application claims the benefit of U.S. Provisional Patent Application Nos. 62 / 502,333, filed May 5, 2017, and 62 / 561,499, filed September 21, 2017; and U.S. Non-Provisional Application No. 15 / 971,884, filed May 4, 2018, all of which are incorporated herein by reference. Technical Field The technology involves deep neural networks ("DNNs") and involves using reduced precision computing power to efficiently train such networks. Background Art In the practice of software development, programmers should learn early and often the importance of using the right tool for the job. This is particularly important in numerical computing, where the trade-offs between precision, accuracy, and performance are very important in choosing the best representation for data. Many technical and high-performance computing applications require high-precision computations using 32-bit (single floating point or FP32) or 64-bit (double floating point or FP64) floating point representations and calculations. But there are many applications where lower precision operations are sufficient. For example, researchers in the rapidly developing field of deep learning have found that deep neural network architectures have natural error resilience due to the back-propagation algorithm used when training them, and some believe that 16-bit floating points (half precision or FP16) are sufficient for training such networks. Storing data represented as FP16 (half precision) reduces memory usage of neural networks compared to the higher precision FP32 (full precision) or FP64 (double precision), potentially allowing larger networks to be trained and deployed. FP16 data transfers take less time than FP32 or FP64 transfers. For many networks, some deep learning inference can even be performed using 8-bit integer calculations without a significant impact on accuracy. The combination of different numerical precisions in a computational method or platform is known as "mixed precision". While different phases or stages of a computational method may use computational hardware of different precisions, many platforms and computing devices now offer mixed precision capabilities as a configuration option. For example, the NVIDIA Pascal architecture provides features designed to provide higher performance for applications that can take advantage of low-precision computations by supplementing higher-precision 32-bit instructions with additional vector instructions that pack multiple low-precision operations into the same 32-bit data channel. Such instructions can, for example, operate on 16-bit floating-point data ("half-precision" or "FP16") or 8-bit and 16-bit integer data (AINTA and INT 16). Therefore, speed advantages can be obtained by using this ability to reduce precision. For example, the NVIDIA Tesla P100 driven by the GP100 GPU can perform FP16 algorithms at twice the throughput of FP32. NVIDIA Tesla P 100 supports bidirectional vector half-precision fused multiply-add (FMA) instructions, which can be issued at the same rate as 32-bit FMA instructions. For example, for implementation information, see, for example, the jointly assigned US20150169289 entitled "Logic Circuit Configurable to Perform 32-Bit or Dual 16-bit Floating-Point Operations", which is incorporated herein by reference. This means that half-precision operations on P100 have twice the throughput of single-precision operations. These instructions are very useful for implementing efficient deep learning reasoning and other applications. While some work has been done in the past on applying reduced precision to machine learning and training, further improvements are possible and desirable. Summary of the invention Embodiments of the present disclosure relate to a system for training a neural network, comprising: at least one numerical computing circuit configured to calculate a gradient based on a loss value; and a reduced-precision selector coupled to the at least one numerical computing circuit, the reduced-precision selector controlling the at least one numerical computing circuit to selectively operate in a reduced-precision computing mode; wherein the at least one numerical computing circuit is further configured to scale the loss value when adjusting a weight based on a gradient calculated using the reduced-precision mode. Embodiments of the present disclosure also relate to a process for training a deep neural network, comprising: (a) forward processing training data through the deep neural network to generate a loss value; (b) scaling the loss value by a scaling factor; (c) backpropagating the scaled loss value through the deep neural network to calculate a gradient; and (d) adjusting the weights of the deep neural network in a manner to compensate for the scaling based on the calculated gradient. Embodiments of the present disclosure also relate to a non-temporary memory storing instructions, which, when executed by at least one processor, control the at least one processor to perform steps, including: (a) processing data using a deep neural network to generate a loss value; (b) scaling the loss value by a scaling factor; (c) backpropagating the scaled loss value through the deep neural network to calculate a gradient; and (d) using the calculated gradient to adjust the weights of the deep neural network. Embodiments of the present disclosure also relate to a computing device, comprising: a computer configured to perform calculations associated with processing data through a deep neural network to generate a loss value, and further configured to perform calculations associated with back-propagating the loss value through the deep neural network to calculate a gradient for weight updating, the computer further configured to scale the loss value and modify the calculated gradient and / or operate on the calculated gradient to take into account at least one process of the scaling factor. Embodiments of the present disclosure also relate to a method for training a deep neural network, comprising: inputting a first hyperparameter specifying a scaling factor for scaling calculated gradients; and inputting a second hyperparameter compensating for weight updates used for the scaling. Embodiments of the present disclosure also relate to a method of modifying a deep neural network training system, the method allowing lower precision gradient calculations while avoiding numerical computation problems associated with zero and abnormal values ​​due to using the lower precision gradient calculations, comprising: inserting one or more first code instructions, the first code instructions scaling at least one value used in the back-propagation calculation of the gradient; and inserting one or more second code instructions, the second code instructions compensating for the scaling for gradient-based weight updates. Embodiments of the present disclosure also relate to a method for controlling a deep neural network training system, the method allowing lower precision gradient calculations while avoiding numerical computation problems associated with zero and abnormal values ​​due to the use of the lower precision gradient calculations, comprising: inputting a first hyperparameter that scales at least one value used in the back-propagation calculation of the gradient; and inputting a second hyperparameter that compensates for the scaling for gradient-based weight updates. Embodiments of the present disclosure also relate to a deep neural network, comprising layers each including at least one artificial neuron, each layer having weights associated therewith, the weights having been trained by performing calculations associated with processing training data through a deep neural network to produce a loss value, and back-propagating the loss value through the deep neural network to calculate gradients for updating the weights with reduced precision, the contribution of the calculated gradients to the trained weights having been adjusted to compensate for a scaling factor used to enable the gradients to be calculated with reduced precision, while normalizing to normal values ​​and restoring zero values ​​that would not otherwise occur due to the reduced precision. An embodiment of the present disclosure also relates to a method, comprising iteratively: training with a first precision to generate a loss value; scaling the loss value; calculating a gradient with a second precision lower than the first precision; and reducing the magnitude of the calculated gradient to compensate for the scaling of the loss value. Embodiments of the present disclosure also relate to a method, comprising iteratively: forward propagating training data through a deep neural network to generate a loss value; back propagating the loss value through the deep neural network to generate a weight gradient; and configuring the back propagation to restore zero values ​​and normalize abnormal values ​​without adversely affecting subsequent weight updates based on the weight gradient. BRIEF DESCRIPTION OF THE DRAWINGS The patent or application file contains at least one drawing executed in color. Copies of this patent or patent application publication with color drawing(s) will be provided by the Office upon request and payment of the necessary fee. The following is a detailed description of exemplary non-limiting illustrative embodiments read in conjunction with the accompanying drawings: Figure 1 is a simplified schematic of an example neuron. Figure 2 is a simplified diagram of an example neural network layers. Figure 3 A simplified schematic diagram showing an example deep neural network (DNN). Figure 4 Simplified diagram showing example DNN training using loss values. Figure 5A (Colored) histograms of example Resnet50 activation gradients showing full and half precision. Figure 5B (Colored) histogram of example Resnet50 weight gradients showing full and half precision. Figure 6 is a simplified flow chart of an exemplary non-limiting implementation using reduced precision, scaling, and scaling compensation. Fig. 6A is a simplified schematic diagram of an exemplary non-limiting implementation using reduced precision, scaling, and scaling compensation. Figure 7 is a flow chart illustrating exemplary scaling and scaling compensation for gradient calculations in multiple iterations. Figure 8 is a schematic diagram of an exemplary, non-limiting software architecture. Fig. 9 is a schematic flow chart of an exemplary non-limiting training process using a user-specified (hyperparameter assigned) scaling factor S. Fig.10 is a schematic flow chart of an exemplary non-limiting training procedure using automatic selection of the scaling factor S. Fig.11 is a schematic flow chart of an exemplary non-limiting training procedure using a default but modifiable scaling factor S. Fig.12is a schematic flow chart of an exemplary non-limiting training procedure using a scaled outcome test. Figures 13A-13D Exemplary different gradient scaling compensation techniques are shown. Fig.14 is a diagram of an example machine learning mixed-precision computing architecture. Fig.15 is a schematic diagram of an example machine learning system. DETAILED DESCRIPTION In the following description, numerous specific details are set forth to provide a more thorough understanding, but it is apparent to one of ordinary skill in the art that the technology herein can be practiced without one or more of these specific details. Well-known features are not described to avoid obscuring the disclosed non-limiting implementations. It is advantageous to be able to efficiently and accurately perform deep neural network machine learning computations on reduced precision hardware. For example, as of this document, typical parallel processing machine learning can be performed on hardware that can perform floating point arithmetic computations at full (e.g., 32-bit) precision. However, for improved efficiency and machine utilization, it may be advantageous to efficiently perform at least some aspects of deep neural network learning using reduced precision computation capabilities such as half precision (i.e., floating point arithmetic with 16-bit precision). Reduced precision hardware does not cover the wide range of values ​​that can be represented as full precision, but such computations are cheaper to implement and perform in hardware. This allows for more parallel computation pipelines on the same area of ​​silicon, and a corresponding increase in parallel processing and machine learning speed. However, certain numerical issues arise when using reduced precision hardware for machine learning. Simplified view of a neuron Figure 1 A simplified view of a machine implementation of an artificial neuron 100 (part of a computer-implemented neural network) is shown. Figure 1 The artificial neuron 100 will take as input the values ​​(x0, x1, x2, ..., x n ) and weights (w0, w1, w2, ..., w n ) and sum the products to produce the output (y o ). The artificial neuron 100 learns the weights (w0, w l ,w2,...,w n ) value. Simplified view of the example DNN like Figure 2As shown, the artificial neuron 100 can be "feed-forward", so the output of one artificial neuron can serve as the input of the next of the m consecutive artificial neurons, where m is any non-negative integer. Such artificial neurons 100 can be organized in layers to form a neural network. There can be any number of interconnections between layer inputs and layer outputs, where the artificial neuron has multiple inputs or provides multiple outputs to other artificial neurons (not shown for simplicity). A deep neural network ("DNN") is a collection of m layers that feed into each other or from one to the next. In general, a deep neural network (DNN) is an artificial neural network (ANN) with multiple hidden layers of units between the input and output layers. Figure 3 An example DNN 200 is shown including m layers 100(1), 100(2), ... 100(m). Figure 2 The type of DNN 200 shown in FIG. 2 is called a deep feedforward neural network or a multilayer perceptron. These networks are called “feedforward” because information flows through a function that starts from x and ends at x. 1 to the intermediate layers (“hidden layers”) that together define the function f, and ultimately to the output y for evaluation. Each layer 100 of the deep neural network 200 has its own weights. For example, the weight w 1 Associated with layer 100(1), weight w 2 Associated with layer 100(2), etc. The purpose of training DNN 200 is to learn the weights w of all layers of the DNN. A simplified view of DNN training Figure 4 An exemplary non-limiting training is shown, where a loss calculation L300 processes the DNN output to provide training. The loss calculation 300 (sometimes called an objective function or criterion, and because it is usually minimized, it is usually called a cost, loss, or error function) compares the output of the network 200 to the output we want it to produce, and assigns a numerical value to the "error". The typical goal is usually to find the weight W that minimizes the negative log-likelihood (or cross entropy), i.e., the "error". To train the DNN 200, training data is applied as input to the DNN. In the forward pass, the DNN 200 propagates the input through all layers 100 to calculate the output and loss. Then, in the backward pass, the network backpropagates the loss, calculating the gradients (derivatives) of all weights w. Thus, backpropagation allows information from the loss to flow backward through the DNN 200 to calculate the gradient. As we all know, the term “gradient” generalizes the concept of a derivative or partial derivative to the case where the derivative is with respect to a vector: for example, the gradient of f is the vector containing all the partial derivatives, denoted Δf x (x) (element i of the gradient is f relative to xi Note that activation gradients (derivatives) are usually calculated before weight gradients (derivatives) because the activation gradients are on the "path" from the loss to the weights. The training then performs a weight update, which updates each weight w according to its corresponding derivative, thereby training the DNN 200. The above steps are repeated with additional training data until the loss is minimized or becomes acceptably low. Depending on the application, a large number (e.g., potentially millions) of records may be used to train DNN200. Each such record, when applied as input to DNN200, will initiate (at least) m activation gradient computations and (at least) m weight gradient computations, where m is arbitrarily large and depends on the depth of DNN 200. Thus, training a typical deep network may involve millions of gradient computations. Such gradient computations typically involve automatic differentiation using the chain rule, where multiplications, sums, and accumulations are typically performed by a hardware-implemented arithmetic logic unit. Such a hardware-implemented arithmetic logic unit may be implemented as a hardware-based accelerator 1004 (see Fig.15 ) is provided as part of the Because training DNN 200 may require potentially large numbers of activation and weight gradient calculations, it may be attractive or efficient to perform those calculations using reduced precision. For example, in some platforms such as mixed-precision hardware accelerators or distributed computing architectures that feature arithmetic computation units with different computational precisions, it may be possible to perform some multiple half-precision (e.g., FP16) calculations compared to full-precision (e.g., FP32) calculations in a given period of time. As an example, some NVIDIA Pascal-based architectures can perform two FP16 calculations for each FP32 calculation using the same width of data channels and improve memory bandwidth utilization. This speed and efficiency performance gain can be an attractive solution when it is desired to reduce the amount of training time, reduce memory bandwidth requirements, increase the size of the DNN, or for other reasons. In other computing platforms, such as cloud-based architectures, which have both higher precision (but more expensive) computing hardware or capabilities and lower precision (but cheaper) computing hardware or capabilities, it may be desirable to use the cheaper or more efficient lower precision computing hardware / capability for portions of the learning process that require extensive computations, and save the more expensive higher precision computing hardware / capability for other portions of the learning process that require more precise computations or comparisons. There are also instances where it is desirable to run legacy software and processes written for a higher precision computing platform on a mixed precision platform to take advantage of the efficiency and speed increases that can be gained by performing some computations using reduced precision. Numerical calculation problems When training DNN 200, reducing precision can have two undesirable numerical effects: Some values ​​become abnormal Certain other values ​​become zero. In particular, when a known DNN 200 is trained from scratch using reduced precision such as FP16, some values ​​will become non-standard values ​​and some other values ​​will become zero compared to the full precision representation. This happens because the representation range of single precision floating points is much wider than half precision floating points. These numerical issues can prevent the DNN 200 from training well or prevent it from training at all. In this context, denormals or denormalized values ​​(sometimes also called "subnormal numbers") fill the underflow gap around zero in floating-point arithmetic. Arithmetic underflow can occur when the true result of a floating-point operation is smaller in magnitude than the smallest value representable as a "normal" floating-point number in the target data type (i.e., close to zero). Underflow can be thought of as a negative overflow of the exponent of the floating-point value. For example, if the exponent portion can represent values ​​between -128 and 127, then a result with a value less than -128 may result in an underflow. Using half-precision FP16 as an example, a denormal is 2 -25 and 2 -15 (the smallest "normal" number that FP16 can represent). Because such abnormal values ​​are the last few values ​​before underflow, they can cause unstable behavior when certain types of operations or calculations are performed on them. These numerical problems can cause instability in DNN 200, training failures, and / or inefficient training. Other small values ​​become zero because they are too small to be represented using the reduced precision representation. As an example, for FP16, any value less than 2 -25 The values ​​of will become zero (which is the same as the 2 for full-precision 32-bit floating point representation). -127 These values ​​are not really "zero", but they are too small to be represented with reduced precision. If there were a way to recover such "zero" using reduced-precision computing hardware, significant efficiency and other improvements could be achieved. These numerical issues are not just theoretical - it turns out that they have very real consequences when training DNN200. For example, when training DNN200 using single-precision (FP32) floating point and looking at histograms to determine where values ​​fall, it can be seen that many values ​​fall into the non-normal and zero ranges of half-precision (FP16) floating point representations and calculations. Figure 5A-5BExample non-limiting histograms showing Resnet50 gradients. These histograms are graphical representations of the distribution of numerical data and provide estimates of the probability distribution of continuous or quantitative variables - in this case, the activation and weight gradients calculated during DNN training. Resnet50 is a well-known neural network for image processing tasks. Some networks exhibit worse behavior than shown in these example histograms. In these Figure 5A / 5B, example histogram of Resnet50 gradients: The FP32 values ​​on the left side of the blue line (the rightmost vertical line) become non-normal values ​​in FP16. The FP32 values ​​to the left of the yellow line (the leftmost vertical) become zero in FP16. It can be seen that a large portion of both activations and weight gradients are affected. In particular, DNN training in FP32 leads to a large number of such zeros and outliers: Recovering these values ​​helps the DNN training procedure. There are cases where the network cannot be trained without this recovery. In more detail, Figure 5A The upper part of the figure shows the activation gradients of full precision (e.g., FP32), while the lower part of the figure shows the gradients of half precision (e.g., FP16). Figure 5A The activation gradient shown in , from which Figure 5B Therefore, if there are numerical problems in the activation gradients, this may cause the network to not train or be worse than not training. Figure 5A The leftmost (yellow) vertical line in the figure represents values ​​that cannot be represented at all in a reduced precision implementation, (i.e., the values ​​discussed above as "zero"), while the values ​​in the band between the two (yellow and blue) vertical lines are non-normal. As can be seen from these non-limiting examples, there are many values ​​to the left of the right-hand (blue) vertical line. Thus, in this non-limiting example, a large portion of the activation gradient values ​​are affected by numerical issues of non-normality and zero. Figure 5A As shown in the lower histogram in , if reduced precision (FP16) is used, a large number of values ​​to the left of the left-hand (yellow) vertical line will be zeroed. Note that the leftmost column in these charts represents the number of zeros. Figure 5B The weight gradients in have fewer problems, but there are still a lot of outliers and a lot of zeros, which will lead to zero values ​​or instability at half precision. Shift / restore numerical representation to avoid numerical problems The exemplary non-limiting techniques herein contemplate dropping as few values ​​as possible to zero and shifting values ​​from a non-normal range to a normal range to provide better arithmetic properties for calculations. One exemplary, non-limiting solution to this problem adjusts gradient values ​​during reduced precision training to provide the advantages of reduced precision training (e.g., speed, power, cost, etc.) without suffering the disadvantages of the numerical issues discussed above. In one exemplary non-limiting implementation, the gradient calculation operates on larger values. In this exemplary non-limiting arrangement, the non-normalization becomes normalization, and some values ​​that would otherwise be lost to zero are restored. In some exemplary non-limiting implementations, several or many processes (e.g., weight decay) are affected by the calculated value of the weight gradient. It is desirable in this context to not affect those processes that use and / or test the weight gradient. Once we use scaling to improve the numerical properties of the gradient calculation during backpropagation, it is desirable in many contexts to undo the scaling effect before further processing occurs. In one exemplary non-limiting implementation, the only reason for this loss value scaling is to improve the numerical properties during the gradient calculation. In such an application, it is desirable to isolate the effect of the loss value scaling so it is limited to the gradient calculation and does not affect any other part of the learning or training process. While reduced precision computations may also be used in other parts of the training and learning process (e.g., inference, forward pass, etc.), because the benefits of scaling are already obtained in providing better numerical computational properties for computing gradients on backpropagation, and allowing the resulting magnitude of the computed gradients to remain scaled may have unintended effects, in certain non-limiting embodiments, the specific scaling applied to a particular backpropagation iteration to compute partial derivatives (gradients) is compensated for or undone after the gradient computation is performed. Therefore, in some applications it is desirable not to affect the rest of the training program. For example, it is desirable for the network layer code and the rest of the training to be unaware and unaffected by scaling adjustments for reduced precision training gradient calculations. By compensating for such adjustments before other processes use the results of the calculations, no further network-based changes need to be made to adjust for reduced precision gradient calculations. Therefore, it is expected that Figure 5A , 5B The magnitude of the gradient values ​​in the histogram is shifted to the right in a way that does not affect network training. Since the network gradients are used to update the network weights, it is desirable in many DNN training applications to compensate for the range adjustment made for the reduced precision gradient calculation so that weight-based calculations or weights performed after the gradient calculation are not affected. This compensation prevents the weight adjustment results from becoming larger even if the gradient values ​​have been scaled up for the purpose of using reduced precision computing hardware for gradient calculations. Exemplary Non-Limiting Architecture with Scaling and Compensation In one exemplary non-limiting implementation, as part of the forward pass of training DNN 200, the system scales the loss value by a factor S (see Figure 6 The frame 680 and Fig. 6A ). This results in scaling the gradient computation on the backward pass ( Figure 6 Box 682; Fig. 6A WG 1 ...WG m ). At the same time, the weight update process ( Figure 6 686) to compensate for scaling ( Figure 6 Box 684; Fig. 6A The division box and "adjustment") prevents gradient scaling from affecting weight calculations. In one exemplary non-limiting implementation, the weight update effectively or actually reduces (divides) the weight gradient contribution S to reverse the effect of scaling after the numerical gradient calculation is completed (see Fig. 6A ). Exemplary Features and Advantages Therefore, the exemplary non-limiting embodiments herein adjust the gradient values ​​so that the following requirements are met during reduced precision training: - Run the gradient calculation on a larger value: Abnormal values ​​become normalized Some lost zero values ​​are restored - The rest of the training program is not affected Specifically, weight updates, learning rate updates, etc. are not affected -Software written for various DNN layers is not affected

[0001] Other features include: - Modify the training method so that: The forward pass scales the loss by a factor S Weight update reduces weight gradient contribution l / S - Various methods are used to: Select the scaling factor S. Adjust weight updates

[0002] Exemplary Method for Selecting Scaling Factor S A constant chosen by the user as another hyperparameter (see Fig. 9 , 11 ) Automatically select the factors for each iteration (see Fig.10 ) - Find the weight gradient with the largest magnitude, x -Calculate the upper limit of the factor: u = log2(2 15 -x) -S=uk k is a small constant (e.g., in the range 2...5) to prevent overflow

[0003] Automatic rollback (see Fig.12 ): - In each iteration, start with a larger value S - Calculate forward and backward passes - Check for Inf (infinity) or NaN (not a number) values ​​in the weight gradients if any are found: Do not update weights, reduce S, and repeat the iteration - Many schemes can be proposed for picking the starting S, and methods for reducing / increasing S as needed during training Exemplary Non-Limiting Methods for Adjusting Weight Updates Adjust weight gradients - Before updating the weights, modify each weight gradient value by l / S (see Fig.13A ) Instead of adjusting weight gradients, adjust other parameters (or in some cases both weight gradients and other parameters) to compensate for the scaled gradient calculation (see Figures 13B-13D ) -Parameters can include: Learning rate, gradient clipping threshold, weight decay parameters, etc. - The potential benefit of adjusting parameters rather than computed weight gradients is that it is usually more Few values ​​are modified O(10) parameter values ​​and possibly up to O(10 7 ) has a relative weight Exemplary Non-Limiting Implementations refer to Fig. 6A , the loss value in one exemplary non-limiting implementation is multiplied by the value S as part of the forward pass. Fig. 6A The additional calculation of the loss value on the right scales the loss value upward by the value S, all the gradients calculated by each calculation box, such as WG 1 ......WG mis scaled up by S. This is because the computed loss value is back-propagated through the network on the backward pass to compute activation and weight gradients. Therefore, in this particular implementation, it is possible to scale all intermediate gradient calculations on the backward pass simply by scaling the loss value. Because each of these various calculations has been scaled up, the zero and non-normal issues discussed above are largely avoided using an efficient modification. Because the gradient calculations are run on larger values, non-normal values ​​become normalized values, and values ​​that we would otherwise lose as zero become recovered. Then, the network weight WG is updated according to the result of the gradient calculation 1 ......WG m Previously, when recalculating weights or otherwise compensating for scaling, the weight gradient contribution WG 1 ......WG m Changes are made to prevent the upward gradient scaling from affecting weight calculations or otherwise affecting the rest of the training procedure. This compensation prevents the network weight update process from, for example, clipping gradients (to avoid the exploding gradient problem) and allows training results to proceed without the rest of the training process being aware that gradient calculations were performed with reduced precision based on the upward scaled values. Figure 7 Shown for two different training iterations Q X and Q Y If desired, the training procedure 400(1) may be entered and used as an iteration Q X Before backpropagation to calculate the gradient (402(x)), the loss value produced by the forward propagation is scaled by S x , and the gradient calculations are performed at a lower precision. After the gradient calculations are completed, they are scaled and compensated, and the compensated values ​​are used for additional training procedures (which may, for example, include higher precision weight adjustments) (400(x)). For training iteration Q y , a similar process can be repeated - possibly with a different scaling factor S y .(402(y), 400(y)). Figure 8An exemplary non-limiting code snippet executed by the training system to perform the above operations is shown. The platform can perform a forward pass based on the training data to calculate the loss value at a higher precision (e.g., FP32) (602), and then execute instructions 604 to scale the loss value by S. The code can then instruct the training system to use lower precision calculations (e.g., by switching the mixed precision hardware to a reduced precision mode (such as FP16) or by scheduling a calculation task to be performed by reduced precision hardware) (605) if it is not already in a reduced precision calculation mode of the forward pass. The reduced precision computing power then performs back propagation on the network 200 to calculate activations and weight gradients at reduced precision (606). The platform then scales the weight gradients by 1 / S or otherwise compensates the calculated weight gradients (or other processes using them) for scaling (608), and switches to higher precision (if necessary) to perform weight adjustments (610) before performing further processing (612) at higher or lower precision. The exemplary non-limiting techniques herein can be used with any implementation of reduced precision, including, for example, fixed-point computing hardware. Some fixed-point implementations include dynamic fixed-point, which includes fixed-point calculations plus another dynamic component. In such an implementation, scaling can be performed by modifying the dynamic component. In such an implementation, each calculation involves a dynamic scaling factor, so this scaling factor can be dynamically changed for each iteration as needed to accommodate the scaling discussed here. The scaling factor may have been used in such a system, but the implementation here can increase the scaling factor to correct for the reduced precision as described above. Therefore, the technology herein can be applied to any method of reducing precision. There are various ways to isolate the rest of the learning process from the scaling, to prevent the upscaling of the gradient calculations from affecting the weight calculations or other subsequent processing. There are also various methods for selecting the scaling factor S and for adjusting the weight updates. Exemplary Method for Selecting Scaling Factor S One exemplary way to select the scaling factor S is to have the user select a constant that is input as a hyperparameter into the machine learning. In this approach, the user can enter a value for S and determine the results. If the results are unacceptable or suboptimal, the user can enter a different S hyperparameter and try the iteration again. Fig. 9 and Fig.11 An example of this method is shown in FIG. 6 . The user may provide input by entering a hyperparameter (block 620). The system obtains a scaling factor S from the hyperparameter (block 622). Fig.11As shown, the system can read a default S, which the user can optionally modify with hyperparameters (650, 652, 654). The system then applies the training data to the network 200 (624) and performs forward propagation through the network to calculate the loss value (box 626, 656). The system scales the loss value by S (box 628, 658) and uses the scaled loss value in the back propagation to calculate the gradient using reduced precision calculation (box 630, 660). If the result is OK (determination box 631), the calculated gradient added to the network weight is compensated (box 632) and (assuming there are no other problems tested by determination box 634) the network weight is adjusted and stored (box 636). If a problem occurs (determination box 631, 634 "No" exit), the user can be asked to enter a different scaling factor S (box 620) through the hyperparameter and repeat the process. In some example implementations, the system may automatically select a scaling factor S for each iteration. Ideally, we should scale by the maximum value we can without overflowing. As mentioned above, the maximum value that a floating point 16 representation can represent is based on the number 2 15 This means that values ​​up to 65535 (2 16 =65536). Scaling up too much can result in higher values, which can lead to pushing values ​​into the representation of infinity. To avoid this, an upper limit on the scaling factor S can be calculated. In one example, the upper limit is: u = log2(2 15 -x) where x is the magnitude of the maximum gradient value seen in the previous iteration ( Fig.10 , blocks 640, 642). In this non-limiting implementation, for each back-propagation performed by the system, it checks all weight gradients at that point and determines from the weight gradients the scaling factor S for the next iteration as S=uk where k is a constant (block 644). By this check, the maximum computed gradient value can be determined directly. An additional back-off constant k can be applied to provide additional anti-overflow protection. Return to reference Figure 5A , 5B , we can observe that the weight gradients tend to have larger values. In the particular example shown, the maximum activation gradient value is 1 / 64 — 0x1p-6, or 2 -6 —The maximum weight gradient is 1 / 8, which is 0x1p-3, which is 2 -3 Because weight gradients tend to have larger values ​​than activation gradients, weight gradients cannot generally be shifted as far to the right as activation gradients. On the other hand, as can be seen in these figures, there is a large range in the upper part of the graph where gradient values ​​can be shifted and still avoid overflow. Different networks can exhibit different behaviors, and different iterations of the same network can exhibit different characteristic behaviors. Figure 5A , the 5B histogram indicates by color (red or blue) that some values ​​(red) appear later in the training period, while other values ​​(blue) appear earlier in the training period. But in general, we can assume that weight gradients tend to have larger values ​​than activation gradients. Since we want to scale activation and weight gradient calculations, but weight gradients may tend to overflow first, we determine the scaled overflow from weight gradients in an exemplary implementation and apply the same scaling factor to activation and weight gradient calculations. It is usually necessary to eventually check all weight gradients in any case to update the weights, so it is not invalid to check weight gradient values. Thus, as described above, in one exemplary non-limiting algorithm, the system determines the maximum weight gradient calculated to determine the scaling limit ( Fig.10 As described above, one may also choose to fall back to a conservative scaling limit in order to calculate S for the next iteration. In this case, k is a small constant (e.g., in the range of 2...5; e.g., by 2 13 Scaling, even though the u calculations show that it can scale up to 2 18 ) to prevent overflow and provide an error margin. This algorithm can be used to automatically determine the scaling factor. Therefore, the automatic calculation provides the greatest benefit without the need for user intervention or other means to determine the value of S for the next iteration. Example non-restricted automatic fallback method Another way to select the scaling factor S is to use automatic fallback. In this case (an example of which is in Fig.12 ), for each iteration, S is set to a large value (box 670). The training system then calculates the forward and backward passes including the gradients (box 672) and tests the results to determine if S is too large (box 674). Specifically, if S is too large, overflow may occur and produce infinite values. After calculating the forward and backward passes of the iteration, the resulting gradient values ​​are checked to determine if any weight gradients have infinite values ​​or NaN (non-number) values ​​(box 674). If any INF or NaN values ​​are found (a "no" exit to determination box 674), the system does not update the weights, but instead decreases S and repeats the iteration (box 676). This example non-limiting method does not know what the appropriate value of S should be at the beginning of the iteration, so it guesses or otherwise sets a relatively large starting value for S and then performs the iteration and tests the result to determine whether there is an infinite value or a non-numeric value in the weight gradient. The algorithm checks the value of the weight gradient after performing the iteration to determine whether such an unacceptable result has occurred. If such a value is found to have occurred, the exemplary non-limiting system infers that the scaling factor is too high, discards the results of the specific iteration, does not perform weight updates and repeats the iteration with a lower value S. The process can occur iteratively with a series of back-off values ​​of S until no problem is observed, in which case the results of the successful iteration are used to update the weights. This automated trial and error method can be used to determine the best or at least reasonably large value of S for a specific iteration relatively quickly. Then the automatic back-off process is performed again using a new high starting value of S for the next iteration to reach a similar best large value of S for the iteration, and the affected iteration can therefore use a different scaling value S. The automatic backoff technique can be combined with another technique, such as automatically selecting the factor for each iteration (i.e., combining Fig.10 and 12 ).like Fig.10 A potential weakness of the automatic selection of factors for each iteration based on the upper bound calculated from the previous iteration as shown is that the last iteration may not be representative of the next iteration. Fig.12 An automatic backoff process is performed to provide verification and possible backoff and scaling factor reduction before deciding to use the computed weight gradients for upgrading weights. Can be adjusted according to the application Fig.12 The backoff amount of S in block 676 of . Thus, many schemes can be used to pick a starting S and ways to reduce / increase S as needed during training. As an example, if the automatic backoff technique is used in conjunction with automatic selection of the scaling factor S for the next iteration based on the results of the previous iteration, it can be sufficiently guaranteed that the automatic selection of the backoff amount for the S value can be relatively small and will succeed. Exemplary Non-Limiting Methods for Adjusting Weight Updates As discussed above, in exemplary non-limiting implementations it may be desirable to "undo" scaling factors after weight gradients are calculated so they do not affect weight updates. In many exemplary implementations, it may be desirable to completely reverse the scaling performed at the beginning of an iteration before weight updates to prevent errors from combining multiple iterations. This reversal may be performed on the weight gradients themselves, or on the weight gradients as or after they are combined with other objects. In such non-limiting implementations, it may be desirable to completely undo the scaling. As an example, if S=1000, then the weight gradient will be a thousand times larger than it should be, and using such a weight gradient to update the weight will cause the weight update to be a thousand times larger than it should be. Solving this problem is useful to prevent neural training from failing or becoming inaccurate. In addition, because neural network training is iterative, inaccuracies in earlier iterations have the ability to affect all subsequent iterations, and systematically introduced errors can be compounded. Because weight gradients have the potential to affect many different things that vary from neural network framework to framework, you may need to choose a specific way to compensate for the scaling of weight gradients based on your particular framework. Fig.13A In one exemplary non-limiting implementation shown in , before each iterative weight update, the system can modify each weight gradient to reduce it by multiplying it by 1 / S (block 690). Since the process begins by multiplying the loss factor by S to increase the weight gradient by a factor of S, a way to undo this transformation is to modify each resulting calculated weight gradient value by 1 / S before using it for weight update or any other purpose. To perform this modification, the system checks and recalculates each weight gradient before applying it during the weight update process. A conservative technique is to reverse the scale of each weight gradient by 1 / S immediately after computing the weight gradients and before they are used in any other process. This method requires division for each calculated weight gradient, and depending on the depth of the network 200, a large number of divisions may be required. Therefore, one approach is to perform a forward pass, scale, back propagate, rescale the gradients, and then continue with the normal algorithm that is not affected by the scaling, as above Figure 6 discussed in . In other exemplary non-limiting implementations, a particular method for adjusting weight updates may be the algebraic equivalent of modifying each weight gradient value by 1 / S. For example, if a particular neural network framework or a system implemented using a framework performs a multiplication of (weight gradient * learning rate), then subtracting the weight gradient value by 1 / S is algebraically equivalent to reducing the learning rate value by 1 / S before combining the current weights. As an analogy, this approach is like a dance floor where the caller tells the dancer to step left or right. The additional parameters, processes, and calculations applied / performed after the weight gradients are calculated and before the weight update (or as part of the weight update) are like taking three steps to the right on the dance floor. If the weight gradient modification suggested for overscaling is like taking a step to the left, then combining the weight level modification with a modified version of the additional process or calculation that operates on the heavy gradient (i.e., performed regardless of scaling) may result in a minimum overall operation of only needing to take two steps to the right. This may be more efficient than requiring everyone on the dance floor to take one step to the left and then three steps to the right. Thus, in some non-limiting examples, it is possible to compensate for the previous scaling while performing less computation. For example, in certain frameworks, it may be more efficient to adjust another parameter (e.g., learning rate, gradient clipping threshold, weight decay parameter, or other parameter) to reduce the number of values ​​being modified. The number of these other parameters is typically smaller than the number of weight gradients. In particular, for some DNN training contexts, the number of other parameters may be on the order of 10, while the number of weight gradient values ​​may be on the order of a million (10 7 ) of the order of magnitude. For example, in some cases it may be possible to reduce the learning rate by the same amount (1 / S), which will have the same overall effect on the algebra, since the weight gradients are multiplied by the learning rate during weight updates (see Fig. 13B 692). This may vary from neural network training framework to framework. For example, some neural network learning frameworks have a learning rate per weight gradient, in which case there may be no advantage to adjusting the learning rate rather than the weight gradient. In addition to the learning rate, other factors affected by the weight gradient can include the gradient clipping threshold ( Fig. 13C Box 694), weight decay parameter ( Fig.13D Box 696) etc. Sometimes, such as Fig.13D The weight decay shown is applied to the loss added to the loss function itself, as this prevents the network from learning weights that are too large and causing overfitting. Therefore, some neural network frameworks and / or learning algorithms penalize weights via a weight decay parameter to prevent weights from becoming too large. This results in complex functions that are difficult to analyze to determine what may be wrong if there are many weights whose values ​​are allowed to vary widely. Increasing the weight decay parameter has the effect of weakening training to avoid overfitting errors. This allows the network to work well on the data it has seen while still allowing it to work well on data it has not yet seen. In this example, forward propagation, backpropagation, and weight updates occur with appropriate parameters and / or modifications or adjustments to the weight gradients to compensate for the S scaling performed on the loss factor before calculating the gradients for the iteration. In other implementations, it may not be strictly necessary to completely "undo" the results of the scaling, but instead may be sufficient to compensate for the scaling without completely reversing the scaling. Therefore, it is possible to influence the weight gradient values ​​to compensate for the scaling performed at the beginning of the iteration through other parameters and / or processes used for weight updates. In a simple explanation, at the end of the iteration, we have some weight gradients that are equal to their expected calculated values ​​plus some modifications due to the scaling. It is possible to compensate for the scaling factor in a variety of different ways to prevent the scaling factor from undesirably affecting the weight gradients for the weight updates performed. In general, the modifications at the end before the weight update mainly or completely compensate for the scaling applied earlier in the iteration. The compensation does not need to be perfect, but in most applications, if not completely compensate for the earlier scaling, it is also necessary to compensate to a large extent. For example, undoing 20% ​​of the modifications due to the earlier scaling will not be sufficient in most applications, but in many applications, undoing 90% of the scaling may be sufficient - especially if hyperparameter tuning is also used in combination. The more perfect the compensation, the less visible the scaling is to other training functions, algorithms, parameters, and other parts of the training process. Example Non-Limiting Detailed Implementation Many different implementations of the above are possible. In some implementations, the neural network learning code can remain the same and only the input hyperparameters are changed. In other implementations, some code changes are helpful. For example, in some environments, when reduced precision mode is enabled, scaling of the loss is automatically enabled (with just a few lines of code), which is usually a modification of a single scalar value generated to indicate the loss value (see Fig. 6A ). The backward pass is then performed using the reduced precision. This approach therefore minimizes the number of changes required to achieve the desired result. Before the weight update occurs, additional code can test whether the scaling factor was modified and, if so, perform compensation (see Fig. 6A ). Such additional code can also calculate the scaling factor for the next iteration. A more significant modification of the code can be achieved using Fig.12 . After starting with some scaling factor S (702), the value of S is evaluated at each training iteration by checking the gradient values ​​(704, 706). If overflow or NaN is detected ("yes" exit to decision box 706), the weight update is skipped (710) and S is decreased (708). Conversely, if no overflow or NaN is detected for a certain number of iterations ("no" exit to decision box 706), S is increased (714). An optional method is to adjust the scaling factor S by checking the gradient value statistics and calculating their distribution - S is selected to ensure that the probability of overflow in any iteration is below a selected threshold. exist Fig.11In a more basic, non-limiting implementation shown in , the system can select a constant for scaling (box 650) and provide a way for the user to modify the constant by changing the hyperparameters (boxes 652, 654) while providing a default value. The same value is then used to scale each iteration (boxes 656-662). The implementation can also include functionally multiplying each calculated weight gradient by the inverse of the scaling factor to undo the scaling previously performed based on the default (or user-modified) scaling factor constant (box 662). The scaling factor can be declared as a separate hyperparameter, or it can contain modifications to existing hyperparameters. For example, if the algorithm does not use gradient clipping, any number of hyperparameters can be modified, including, for example, learning rate and loss weight. Different frameworks can have different hyperparameters for different loss values. In other exemplary non-limiting implementations, no code changes are required at all, and scaling and scaling compensation are accomplished only by modifying hyperparameters ( Fig. 9 Depending on the type of machine learning and the particular framework, hyperparameter modification may be all that is needed - the compensation of block 632 is performed based on additional hyperparameters entered by the user to define, for example, the learning rate (the user modifies the learning rate hyperparameter before entering it to account for the scaling factor S). Example Non-Limiting Computing Platforms Fig.14 and 15 A high-level conceptual diagram of an example platform for performing the above-described training procedure is shown. Fig.15 The platform 1000 is shown to include one or more accelerators 1004 and one or more associated memories 1006, one or more CPUs 1008 and one or more associated memories 1006', one or more additional memories 1010, one or more input devices 1012, one or more secondary storage devices(s) 1014, one or more output devices 1016, and other components. These components may be co-located, distributed, or both, and may communicate with each other via a local bus and / or network 1002. In one implementation, the platform 1000 may provide a large number of parallel processing accelerators 1004 (which may include graphics processing units (GPUs) in some implementations), each controlled by one or more central processing units (CPUs) 1008 executing software instructions stored in memories 1006', 1010, 1014 and / or provided over a bus or network 1002. The NVIDIA Pascal architecture is particularly well suited for this arrangement. In an exemplary non-limiting implementation, each of accelerators 1004 includes Fig.15. The numerical computation circuit 500 shown in . The numerical computation circuit in some implementations may include mixed precision arithmetic logic units 502 (1), 502 (2), 502 (N) coupled to respective accelerators 504 and output circuits 506 shown conceptually. An exemplary more detailed mixed precision arithmetic logic unit 502 circuit and its associated operation with memory and instruction format are described in detail in US20150169289, which is incorporated herein by reference. Each such ALU 502 has a selection input that controls it to operate with full precision or half precision. The training state machine / controller 508 (which may constitute a CPU 1008 executing instructions stored in a non-temporary memory device 510, but may also include a gate array or any other implementation) may provide a scaling factor S as an input operand of the ALU 502 to perform the above-mentioned loss value scaling and weight gradient (or other) calculations. The training state machine / controller 508 may also switch the ALU 502 to a reduced precision mode to perform back propagation gradient calculations in other training calculations. Such control may be provided as part of a packed instruction format sent over a parallel bus. Computer programs or computer control logic algorithms may be stored in the main memory 1010 and / or the secondary storage device 1014. Such computer programs, when executed, enable the system 1000 to perform various functions. The memory 1010, storage device 1014 and / or any other storage device are possible examples of computer-readable media. System 1000 may include secondary storage devices 1014, such as hard disk drives and / or removable storage drives, representing floppy disk drives, tape drives, optical disk drives, digital versatile disk (DVD) drives, recording devices, and universal serial bus (USB) flash memory. The removable storage drive reads from and / or writes to a removable storage unit in a well-known manner. In one embodiment, the architecture and / or functionality of the various previous figures may be implemented in the context of a central processing unit 1008, a graphics processor 1004, an integrated circuit (not shown) capable of having at least a portion of the capabilities of both the central processing unit 1008 and the graphics processor 1004, a chipset (i.e., a group of integrated circuits designed to operate and marketed as a unit that performs related functions, etc.), and / or any other integrated circuit for the subject matter. In this specification, a single semiconductor platform may refer to a single integrated circuit or chip based on a single semiconductor. It should be noted that the term single semiconductor platform may also refer to a multi-chip module with increased connectivity, which simulates on-chip operation and is a substantial improvement over the use of a traditional central processing unit (CPU) and bus implementation. Of course, various modules may also be provided separately or in various combinations of semiconductor platforms, depending on the user's expectations. Furthermore, the architecture and / or functionality of the various previous figures may be implemented in the context of a general purpose computer system, a circuit board system, a console system dedicated to entertainment purposes, an application specific system, and / or any other desired system. For example, the system 1000 may take the form of a desktop computer, a laptop computer, a server, a workstation, a game console, an embedded system, and / or any other type of logic. Furthermore, the system 1000 may take the form of a variety of other devices, including, but not limited to, a personal digital assistant (PDA) device, a mobile phone device, a television, and the like. Furthermore, although not shown, system 1000 may be coupled to a network for communication purposes (eg, a telecommunications network, a local area network (LAN), a wireless network, a wide area network (WAN) such as the Internet, a peer-to-peer network, a wired network, etc.). System 1000 and the techniques disclosed herein may be used in any of a variety of applications including, but not limited to, autonomous or assisted vehicle control (e.g., vehicle, pedestrian, and landmark recognition for driver assistance and / or autonomous vehicle pattern recognition and decision making), computer vision, image recognition, speech recognition and / or translation, natural language processing, life sciences such as medical diagnostic support and personalized treatment at the cellular level, medical imaging and genomics, smart cities or other large-scale multi-image environments such as warehouses and other enterprise management, video analysis, multi-target classification, facial recognition, behavioral analysis, network security, archiving, emergency response, fighting global poverty, virtual reality, robotics, object tracking, fashion assistance, architecture, education, product design, travel management such as airplane tracking, music composition, and many other applications in a variety of fields. Although the present invention has been shown and described with reference to particular embodiments, it will be appreciated by those skilled in the art that various changes may be made in form and detail without departing from the scope of the invention as defined by the appended claims. It will be appreciated by those skilled in the art that other and further additions, deletions, substitutions and modifications may be made to the described embodiments.

Claims

1. A system for training a neural network, comprising: at least one numerical calculation circuit configured to calculate a gradient based on the loss value; as well as a reduced-precision selector, the reduced-precision selector being coupled to the at least one numerical calculation circuit, the reduced-precision selector controlling the at least one numerical calculation circuit to selectively operate in a reduced-precision calculation mode; Wherein the at least one numerical computation circuit is further configured to scale the loss value when adjusting weights based on gradients computed using the reduced precision mode.

2. A process for training a deep neural network, comprising: (a) Forward processing of training data through a deep neural network to produce a loss value; (b) scaling the loss value by a scaling factor; (c) back-propagating the scaled loss value through the deep neural network to calculate the gradient; as well as (d) The weights of the deep neural network are adjusted in a way that compensates for scaling based on the computed gradients.

3. A non-transitory memory storing instructions that, when executed by at least one processor, control the at least one processor to perform steps comprising: (a) Processing data using a deep neural network to generate a loss value; (b) scaling the loss value by a scaling factor; (c) back-propagating the scaled loss value through the deep neural network to compute gradients; (d) Using the calculated gradients to adjust the weights of the deep neural network.

4. A computing device, comprising: a computer configured to perform computations associated with processing data through a deep neural network to produce a loss value, and further configured to perform computations associated with back-propagating the loss value through the deep neural network to calculate gradients for weight updates, The computer is also configured to scale the loss value and modify the calculated gradient and / or operate on the calculated gradient to take into account at least one process of the scaling factor.

5. A method for training a deep neural network, comprising: Input a first hyperparameter, the first hyperparameter specifying a scaling factor for scaling the calculated gradients; as well as A second hyperparameter is input, the second hyperparameter compensating for a weight update for the scaling.

6. A method of modifying a deep neural network training system to allow lower precision gradient computation while avoiding numerical computation problems associated with zero and outlier values ​​resulting from using the lower precision gradient computation, comprising: inserting one or more first code instructions that scale at least one value used in a back-propagation calculation of the gradient; as well as One or more second code instructions are inserted that compensate for gradient-based weight updates for the scaling.

7. A method of controlling a deep neural network training system, the method allowing lower precision gradient computation while avoiding numerical computation problems associated with zero and outlier values ​​due to using the lower precision gradient computation, comprising: inputting a first hyperparameter, the first hyperparameter scaling at least one value used in a back-propagation calculation of the gradient; as well as A second hyperparameter is input, the second hyperparameter compensating for the scaling for a gradient based weight update.

8. A deep neural network comprising layers each comprising at least one artificial neuron, each layer having a weight associated therewith, The weights have been trained by performing computations associated with processing training data through a deep neural network to produce loss values, and back-propagating the loss values ​​through the deep neural network to compute gradients with reduced precision for updating the weights, The contribution of the computed gradients to the trained weights has been adjusted to compensate for the scaling factors used to enable the gradients to be computed at reduced precision, while normalizing to normal values ​​and restoring zero values ​​that would not otherwise occur due to the reduced precision.

9. A method comprising iteratively: Train with first precision to produce loss values; scaling the loss value; calculating the gradient at a second precision lower than the first precision; and The magnitude of the computed gradient is reduced to compensate for the scaling of the loss value.

10. A method comprising iteratively: Forward propagating the training data through the deep neural network to produce the loss value; Back-propagating the loss value through the deep neural network to generate weight gradients; and The back-propagation is configured to restore zero values ​​and normalize outliers without adversely affecting subsequent weight updates based on the weight gradients.

Citation Information

Patent Citations

  • Logic circuitry configurable to perform 32-bit or dual 16-bit floating-point operations

    US20150169289A1

  • Loss-scaling for deep neural network training with reduced precision

    US20180322391A1

Cited By

  • Data processing method, electronic device, storage medium and program product

    CN121166074A