A structured dynamic quantization method for neural networks applied to power edge computing
By adopting a structured dynamic quantization method in power edge computing to divide and optimize the computational workload of the neural network, the problem of low utilization of computing units caused by uneven distribution of important areas in the existing technology is solved, and efficient neural network acceleration and Performance is maintained.
Patent Information
- Application Number
- CN202210131162.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-14
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-02-14
AI Technical Summary
Due to the uneven distribution of important areas in power edge computing, existing area-based quantization methods result in low utilization of accelerator computing units and cannot effectively adjust quantization accuracy to optimize computing efficiency.
The structured dynamic quantization method is used to quantize the full-precision 32-bit floating-point number network to an 8-bit integer fixed-point number, and divide the group operations according to the proportion of the non-zero activation function to limit the amount of operation of each group. By splitting the high 4 bits Perform multiplication operations with the lower 4-digit fixed-point numbers, and select the values used for calculation to ensure the minimum mean square error and ensure a balanced amount of calculations between groups.
It significantly improves the utilization of computing units and achieves acceleration and performance maintenance of neural networks on edge devices. For example, the classification performance of ResNet-18 on the ImageNet dataset is maintained at 69.74%.
Smart Images

Figure CN114528101B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of compression acceleration of machine learning neural networks; in particular, it relates to a structured dynamic quantization method of neural networks applied to power edge computing. Background Art
[0002] Edge computing refers to the use of an open platform that integrates network, computing, storage, and application core capabilities to provide the nearest service on the side close to the object or data source. For the power system, the number of connected devices and users is very large, so some calculations need to be completed at the edge. At present, neural networks have become a powerful algorithm in the fields of artificial intelligence and computer vision, and the applications involved are becoming more and more extensive. The deployment platforms of neural networks are also becoming more and more extensive, including cloud servers, terminal mobile devices, and edge embedded devices. Neural networks have huge demands for computing power and storage space, and edge devices are limited in performance and power consumption, so it is very challenging to install them on edge devices.
[0003] Quantization is a common method for compressing and accelerating neural network models and is widely used in various deployment processes. However, traditional quantization methods use the same quantization accuracy for all layers, while the importance of different input feature maps is actually different. Using the same quantization accuracy for all feature maps is obviously a waste. Especially after the linear rectification ReLU activation function, all negative values will be converted to 0. The paper Zhuoran Song, Bangqi Fu, Feiyang Wu, Zhaoming Jiang, Li Jiang, Naifeng Jing, Xiaoyao Liang: DRQ: Dynamic Region-based Quantization for Deep Neural Network Acceleration. ISCA 2020:1010-1021 proposes a dynamic region-based quantization method that can adjust the quantization accuracy according to the importance of different regions. However, due to the uneven distribution of important regions, the utilization rate of the computing units in the accelerator is not high. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a structured dynamic quantization method for neural networks applied to power edge computing, so as to solve the technical problem that the existing region-based quantization method adjusts the quantization accuracy according to the importance of different regions. However, due to the uneven distribution of important regions, the utilization rate of the computing units in the accelerator is not high.
[0005] Technical solution of the present invention:
[0006] A structured dynamic quantization method for neural networks applied to power edge computing first quantizes the full-precision 32-bit floating-point network to 8-bit integer fixed-point numbers; divides the input feature map into groups along the input channel, and the number of feature map pixels contained in each group is defined as group size (GS); and maps operations of different groups to different computing units in the accelerator.
[0007] In order to avoid imbalance between computing units during grouping, the amount of computing for each group should be limited.
[0008] The method for determining the amount of computation for each group is as follows: the sparsity is calculated based on the proportion of non-zero activation functions, and the group budget, that is, the maximum number of multiplications for each group, is obtained based on the sparsity.
[0009] The 8-bit integer fixed-point number is split into two 4-bit fixed-point numbers, namely the upper 4 bits H4 and the lower 4 bits L4.
[0010] H4 and L4 perform multiplication in the same way, shifting the high 4 bits of the multiplication result 4 bits left to align before the final accumulation.
[0011] When selecting 4-digit numbers from the group that are less than or equal to the group budget GB for calculation, the mean square error must be minimized.
[0012] The specific selection method is: first select non-zero items from H4 from large to small. If the number of non-zero items in H4 is less than the group budget GB, continue to select the maximum value from L4 until the group budget is met.
[0013] During the implementation process, the experimental environment for verifying this method is Pytorch, the dataset used is the ImageNet database, and the deep neural network models used include ResNet-18 / 50, vgg16, and MobileNetV2.
[0014] Beneficial effects of the present invention:
[0015] The present invention divides the neural network input feature map into groups along the input channel, and the number of feature map pixels contained in each group is defined as group size (GS). The operations of different groups will be mapped to different computing units in the accelerator. In order to avoid imbalance between computing units, the present invention limits the amount of operations of each group. The present invention proposes a structured dynamic quantization method, which greatly improves the utilization rate of computing units and accelerates network reasoning.
[0016] The existing region-based quantization method is solved, and the quantization accuracy is adjusted according to the importance of different regions. However, due to the uneven distribution of important regions, the utilization rate of the computing unit in the accelerator is not high. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a dynamic quantification flow chart of the present invention;
[0018] Figure 2 It is a schematic diagram of the cost and error of dynamic quantization according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0019] by Figure 1 Taking this as an example, the neural network structured dynamic quantization method proposed in the present invention is introduced in detail.
[0020] First, the full-precision 32-bit floating-point network is quantized to 8-bit integer fixed-point numbers. This step is very common in the deployment of neural networks and does not require additional training to maintain good network classification performance.
[0021] Furthermore, the present invention divides the input feature map into groups along the input channel, and the number of feature map pixels contained in each group is defined as group size (GS). The operations of different groups will be mapped to different computing units in the accelerator. In order to avoid imbalance between computing units, the present invention limits the amount of operations of each group.
[0022] Specifically, the present invention can calculate the sparsity according to the proportion of non-zero activation functions, and then obtain the group budget groupbudget (GB), that is, the maximum number of multiplications for each group, according to the sparsity.
[0023] Because the eigenvalues of the neural network will show a bell-shaped distribution, that is, most of the values will be concentrated near 0, and the high positions are all 0.
[0024] Furthermore, the present invention splits the 8-bit integer fixed-point number into two 4-bit fixed-point numbers, namely the upper 4-bit H4 and the lower 4-bit L4. There is no difference between H4 and L4 when performing multiplication operations, except that the upper 4-bit multiplication result needs to be shifted 4 bits to the left for alignment before the final accumulation.
[0025] This example takes the group size as 4 and the group budget as 3, where the four 8-bit fixed-point numbers are 0, 5, 32, and 82 respectively.
[0026] Further, a 4-digit number less than or equal to the group budget GB is selected from the group for calculation.
[0027] The selection steps must ensure that the mean square error is minimized, so first select non-zero items from H4 from large to small.
[0028] If the number of non-zero items in H4 is 2, which is less than the group budget GB of 3, then the maximum value can be continuously selected from L4 until the group budget is met.
[0029] It can be seen that in this example, the original 82 is changed to 80 after dynamic quantization due to the limitation of group budget. Figure 2 From the comparison with other quantization methods, it can also be seen that the method of the present invention can also achieve good quantization results at a lower cost.
[0030] Through such regularization, the amount of computation between groups is the same, and there is no waste of computing resources.
[0031] During the implementation process, the experimental environment for verifying this method is Pytorch, the dataset used is the ImageNet database, and the deep neural network models used include ResNet-18 / 50, vgg16, and MobileNetV2.
[0032] Taking the results of ResNet18 under the ImageNet dataset as an example and comparing it with uniform quantization, the classification performance of network training is 66.14% accuracy after the activation value is uniformly quantized to 4 bits. The method of the present invention can not only quantize the activation value to an average of 3.1 bits, but also maintain the network performance at 69.74% accuracy.
Claims
1. A structured dynamic quantization method for neural networks applied to power edge computing, characterized by: First, the full-precision 32-bit floating-point network is quantized to 8-bit integer fixed-point numbers; the input feature map is divided into groups along the input channel, and the number of feature map pixels contained in each group is defined as the group size groupsize (GS); the operations of different groups are mapped to different computing units in the accelerator; in order to avoid imbalance between computing units during grouping, the amount of operations of each group should be limited; the method for determining the amount of operations of each group is: the sparsity is calculated according to the proportion of non-zero activation functions, and the group budget, that is, the maximum number of multiplications of each group, is obtained according to the sparsity; the 8-bit integer fixed-point number is split into two 4-bit fixed-point numbers, which are the upper 4 bits H4 and the lower 4 bits L4 respectively; when selecting a 4-bit number for calculation that is less than or equal to the group budget GB from the group, the mean square error must be minimized; the specific selection method is: first select non-zero items from H4 from large to small, if the number of non-zero items in H4 is less than the group budget GB, then continue to select the maximum value from L4 until the group budget is met.
2. According to claim 1, a structured dynamic quantization method of a neural network applied to power edge computing is characterized in that: H4 and L4 perform multiplication in the same way, shifting the high 4 bits of the multiplication result 4 bits left to align before the final accumulation.
3. According to claim 1, a structured dynamic quantization method of a neural network applied to power edge computing is characterized in that: During the implementation process, the experimental environment for verifying this method is Pytorch, the dataset used is the ImageNet database, and the deep neural network models used include ResNet-18 / 50, vgg16, and MobileNetV2.
