# US 2021/0286688 A1 · Neural Network Quantization Parameter Determination Method and Related Products

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0286688 A1
- Document ID: US20210286688A1
- Status: Published application
- Kind: A1
- Application number: 16/622,541
- Filed: 2019-09-19
- Published: 2021-09-16
- Earliest claimed: 2019-06-12
- Assignees: Shanghai Cambricon Information Technology Co., Ltd.
- Applicants: Shanghai Cambricon Information Technology Co., Ltd
- Inventors: Shaoli Liu; Xiaofu Meng; Xishan Zhang; Jiaming Guo
- Web page: https://patentgrep.com/patent/US20210286688A1

## CPC

- G06F 11/1476: {in neural networks}
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/047: Probabilistic or stochastic networks
- G06N 3/048: Activation functions
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/063: using electronic means
- G06N 3/08: Learning methods
- G06N 3/09: Supervised learning
- G06F 2201/81: Threshold
- G06F 2201/865: Monitoring of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The present disclosure relates to a neural network quantization parameter determination method and related products. A board card in the related products includes a memory device, an interface device, a control device, and an artificial intelligence chip, in which the artificial intelligence chip is connected with the memory device, the control device, and the interface device respectively. The memory device is configured to store data, and the interface device is configured to transmit data between the artificial intelligence chip and an external device. The control device is configured to monitor the state of the artificial intelligence chip. The board card can be used to perform an artificial intelligence computation.

## Claims

### Claim 1

A method for determining neural network quantization parameters, comprising:
obtaining an analyzing result of each type of data to be quantized, wherein the data to be quantized includes at least one type of neurons, weights, gradients, and biases of the neural network; and
determining a corresponding quantization parameter according to the analyzing result of each type of the data to be quantized and a data bit width, wherein the quantization parameter is used by an artificial intelligence processor to perform corresponding quantization on data involved in a process of neural network operation.

### Claim at position 2

-3. (canceled)

### Claim 4 (depends on 1)

The method of claim 1, wherein the neural network operation process includes at least one operation of neural network training, neural network inference, and neural network fine-tuning,
wherein the analyzing result includes a maximum value and a minimum value, or includes a maximum absolute value, of each type of data to be quantized,
wherein the maximum absolute value is determined according to the maximum value and the minimum value of each type of data to be quantized, and
wherein the quantization parameter is determined according to the data bit width along with either the maximum value and the minimum value of each type of the data to be quantized or the maximum absolute value of each type of the data to be quantized.

### Claim at position 4

-10. (canceled)

### Claim 11 (depends on 1)

The method of claim 1, wherein the data bit width is adjusted according to a corresponding quantization error by comparing the quantization error with a threshold to obtain a comparison result, and adjusting the data bit width according to the comparison result, wherein the quantization error is determined according to the quantized data and corresponding pre-quantized data, wherein the threshold includes at least one of a first threshold and a second threshold.

### Claim 12

(canceled)

### Claim 13 (depends on 12)

The method of claim 12, wherein the adjusting of the data bit width includes:
increasing the data bit width if the quantization error is greater than or equal to the first threshold, or
reducing the data bit width if the quantization error is less than or equal to the second threshold, or
keeping the data bit width unchanged if the quantization error is between the first threshold and the second threshold.

### Claim 14

(canceled)

### Claim 15

(canceled)

### Claim 16 (depends on 11)

The method of claim 11, wherein a method for obtaining the quantization error includes:
determining a quantization interval according to the data bit width, and
determining the quantization error according to the quantization interval, the number of the quantized data, and the corresponding pre-quantized data.

### Claim 17 (depends on 11)

The method of claim 11, wherein a method for obtaining the quantization error includes:
performing inverse quantization on the quantized data to obtain inverse quantized data, wherein a data format of the inverse quantized data is the same as that of the corresponding pre-quantized data, and
determining the quantization error according to the quantized data and the corresponding inverse quantized data.

### Claim 18

(canceled)

### Claim 19 (depends on 11)

The method of claim 11, wherein the pre-quantized data is data to be quantized involved in weight update iteration within a target iteration interval, wherein the target iteration interval includes at least one weight update iteration, and the same data bit width is used in the quantization process within the same target iteration interval.

### Claim 20 (depends on 19)

The method of claim 19, wherein the determining of the target iteration interval includes:
at a predicted time point, determining a variation trend value of a point position parameter of data to be quantized involved in the weight update iteration, wherein the predicted time point is configured to determine whether the data bit width needs to be adjusted or not, and the predicted time point corresponds to the time point when the weight update iteration is completed, and
determining the corresponding target iteration interval according to the variation trend value of the point position parameter.

### Claim 21 (depends on 19)

The method of claim 19, wherein the determining of the target iteration interval includes:
at a predicted time point, determining a variation trend value of a point position parameter and a variation trend value of data bit width corresponding to the data to be quantized involved in the weight iteration process, wherein the predicted time point is configured to determine whether the data bit width needs to be adjusted, and the predicted time point corresponds to the time point when the weight update iteration is completed, and
determining the corresponding target iteration interval according to the variation trend value of the point position parameter and the variation trend value of the data bit width.

### Claim 22 (depends on 20)

The method of claim 20, wherein the predicted time point includes a first predicted time point, wherein the first predicted time point is determined according to the target iteration interval.

### Claim 23 (depends on 22)

The method of claim 22, wherein the predicted time point further includes a second predicted time point, wherein the second predicted time point is determined according to a curve of data variation range, wherein the curve of data variation range is obtained by analyzing the data variation range in the process of weight update iteration.

### Claim 24 (depends on 20)

The method of claim 20, wherein the variation trend value of the point position parameter is determined according to a moving average value of the point position parameter corresponding to a current predicted time point and a moving average value of the point position parameter corresponding to a previous predicted time point, or is determined according to the point position parameter corresponding to the current predicted time point and the moving average value of the corresponding point position parameter corresponding to the previous predicted time point.

### Claim 25

(canceled)

### Claim 26 (depends on 24)

The method of claim 24, wherein the determining of a moving average value of a point position parameter corresponding to the current predicted time point includes:
determining the point position parameter corresponding to the current predicted time point according to a point position parameter corresponding to a previous predicted time point and an adjusted value of the data bit width,
adjusting a moving average value of a point position parameter corresponding to the previous predicted time point according to the adjusted value of the data bit width to obtain an adjusted result, and
determining the moving average value of the point position parameter corresponding to the current predicted time point according to the point position parameter corresponding to the current predicted time point and the adjusted result.

### Claim 27 (depends on 24)

The method of claim 24, wherein the determining of the moving average value of the point position parameter corresponding to the current predicted time point include:
determining an intermediate result of the moving average value of the point position parameter corresponding to the current predicted time point according to the point position parameter corresponding to the previous predicted time point and the moving average value of the point position parameter corresponding to the previous predicted time point, and
determining the moving average value of the point position parameter corresponding to the current predicted time point according to the intermediate result of the moving average value of the point position parameter corresponding to the current predicted time point and the adjusted value of the data bit width.

### Claim 28 (depends on 21)

The method of claim 21, wherein the variation trend value of the data bit width is determined according to the corresponding quantization error.

### Claim 29 (depends on 20)

The method of claim 20, wherein the determining data bit width used in the quantization process within the target iteration interval includes:
determining a corresponding quantization error, wherein pre-quantized data corresponding to the quantization error is the data to be quantized involved in the weight update iteration corresponding to the predicted time point, and
determining the data bit width used in the quantization process within the target iteration interval according to the corresponding quantization error.

### Claim 30 (depends on 29)

The method of claim 29, wherein the determining data bit width used in the quantization process within the target iteration interval includes:
comparing the quantization error with the threshold to obtain a comparison result, and adjusting the data bit width used in the quantization process within the previous target iteration interval according to the comparison result to obtain an adjusted result, wherein the adjusted result is taken as the data bit width used in the quantization process within a current target iteration interval.

### Claim 31 (depends on 11)

The method of claim 11, wherein the pre-quantized data is the data to be quantized in the weight update iteration within a target iteration interval, wherein the target iteration interval includes at least one weight update iteration and the same quantization parameter is used in the quantization process within the same target iteration interval.

### Claim 32 (depends on 31)

The method of claim 31, wherein the determining the target iteration interval includes:
at a predicted time point, determining a variation trend value of a point position parameters of data to be quantized involved in the weight update iteration, wherein the predicted time point is used to determine whether the quantization parameter needs to be adjusted or not, and the predicted time point corresponds to the time point when the weight update iteration is completed, and
determining the corresponding target iteration interval according to the variation trend value of the point position parameter.

### Claim 33

(canceled)

### Claim 34 (depends on 1)

A neural network quantization parameter determination device comprising a memory and a processor, wherein a computer program that can be run on the processor is stored on the memory, and the processor implements the methods of claim 1 when executing the computer program.

### Claim at position 29

-66. (canceled)

### Claim 67 (depends on 1)

A non-transitory computer readable storage medium, on which a computer program is stored, wherein the method of claim 1 is implemented when the computer program is executed.
