# US 2022/0044114 A1 · Hybrid quantization of neural networks for edge computing applications

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

- Number: US 2022/0044114 A1
- Document ID: US20220044114A1
- Status: Published application
- Kind: A1
- Application number: 17/343,512
- Filed: 2021-06-09
- Published: 2022-02-10
- Earliest claimed: 2020-08-04
- Assignees: NVIDIA Corporation
- Applicants: NVIDIA Corporation
- Inventors: Parthasarathy Sriram; Varun Praveen; Farzin Aghdasi
- Web page: https://patentgrep.com/patent/US20220044114A1

## CPC

- G06N 3/08: Learning methods
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/063: using electronic means
- G06N 3/082: modifying the architecture, e.g. adding, deleting or silencing nodes or connections
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/09: Supervised learning
- G06N 3/096: Transfer learning
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Apparatuses, systems, and techniques to use low precision quantization to train a neural network. In at least one embodiment, one or more weights of a trained model are represented by low bit integer numbers instead of using full floating point precision. Changing precision of the one or more weights is performed by first quantizing all weights and activations of a neural network except for layers that require finer granularity in representation than an 8 bit quantization can provide to generate a first trained model. Subsequently, precision of the one or more weights of the first trained model is changed again to generate a second trained model. For the second trained model, the precision of one or more weights of at least one additional layer is changed in addition to the layers that previously had precision values changed while training the neural network to generate the first trained model.

## Claims

### Claim 1

A method, comprising:
changing precision of one or more weights and one or more activation values of a portion of a neural network to generate a first trained model, wherein the portion of the neural network comprises a subset of layers of the neural network; and
changing precision of the one or more weights and the one or more activation values of the first trained model of at least one additional layer in addition to the subset of layers of the neural network to generate a second trained model.

### Claim 2 (depends on 1)

The method of claim 1, wherein the precision of the one or more weights and the one or more activation values are changed while training the portion of the neural network during a forward pass by using an absolute maximum value of the one or more weights and a running average of absolute maximum values of the one or more activation values over the training.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
calculating gradients for the one or more weights and the one or more activation values using a straight-through estimation (STE).

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
updating the portion of the neural network, during training, by using the calculated gradients in a backward-propagation pass.

### Claim 5 (depends on 1)

The method of claim 1, wherein the first trained model is a mixed-precision deep neural network (DNN) model.

### Claim 6 (depends on 1)

The method of claim 1, wherein the second trained model comprises 8-bit integer numbers representing the one or more weights and the one or more activation values.

### Claim 7 (depends on 1)

The method of claim 1, wherein the at least one additional layer of the neural network is outside of the subset of layers of the neural network and includes weights and activation values having finer granularity in representation than 8-bit quantization.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
using the second trained model to perform object detection or image classification.

### Claim 9 (depends on 1)

The method of claim 1, wherein changing precision of the one or more weights and one or more activation values to generate the first trained model is performed by applying quantization aware training (QAT), and wherein changing precision of the one or more weights and the one or more activation values to generate the second trained model is performed by applying post-training quantization (PTQ).

### Claim 10

A processor, comprising:
one or more circuits to:
change precision of one or more weights and one or more activation values, while training a neural network, to generate an intermediate trained model; and
change precision of one or more weights and one or more activation values of the intermediate trained model during the training of at least one additional layer in addition to layers previously trained in the intermediate trained model to generate a trained model.

### Claim 11 (depends on 10)

The processor of claim 10, wherein the one or more circuits are further to change the precision of one or more weights and one or more activation values using quantization aware training (QAT), wherein QAT comprises quantizing the one or more weights and one or more activation values for all layers of the neural network except for the last layer of the neural network.

### Claim 12 (depends on 11)

The processor of claim 11, wherein the one or more circuits are further to change precision of one or more weights and one or more activation values of the intermediate trained model using post-training quantization (PTQ), wherein PTQ comprises quantizing the one or more weights and the one or more activation values for all layers of the neural network and the last layer of the neural network.

### Claim 13 (depends on 12)

The processor of claim 12, wherein PTQ performs quantization on the one or more weights and one or more activation values of the intermediate trained model by ignoring the one or more activation values of the intermediate trained model and re-quantizing the one or more weights and the one or more activation values based, at least in part, on statistics against a calibration dataset.

### Claim 14 (depends on 13)

The processor of claim 13, wherein the one or more circuits are further to apply PTQ by recalibrating at least one of: one or more ranges of the activation values or one or more scale factors for the activation values.

### Claim 15 (depends on 10)

The processor of claim 10, wherein the one or more weights and one or more activation values of the trained model are represented using fewer bits than single-precision floating point representation, double-precision floating point representation, or half-precision floating point representation.

### Claim 16

A system, comprising:
one or more processors to:
initiate a training of a machine-learning model with one or more parameters for training by quantizing a subset of the one or more parameters of one or more layers of a neural network;
generate a first trained machine-learning model from the training; and
generate a second trained machine-learning model by quantizing the subset of the one or more parameters and at least one additional parameter outside of the subset.

### Claim 17 (depends on 16)

The system of claim 16, wherein the one or more parameters comprise one or more weights and one or more activation values calculated during training.

### Claim 18 (depends on 17)

The system of claim 17, wherein the one or more processors are further to:
quantize the one or more parameters of the one or more layers of the neural network during a forward pass by using an absolute maximum value of the one or more weights and a running average of absolute maximum values of the one or more activation values over the training.

### Claim 19 (depends on 18)

The system of claim 18, wherein the one or more processors are further to:
calculate gradients for the one or more weights and the one or more activation values by determining gradients based, at least in part, on a threshold function.

### Claim 20 (depends on 19)

The system of claim 19, wherein the one or more processors are further to:
update the neural network, during training, by using the calculated gradients in a backward-propagation pass.

### Claim 21 (depends on 19)

The system of claim 19, wherein the one or more weights or the one or more activation values have finer granularity in representation than 8-bit quantization.

### Claim 22 (depends on 16)

The system of claim 16, wherein parameters of the second trained machine-learning model is represented using less bits than full precision floating point representation.

### Claim 23 (depends on 16)

The system of claim 16, wherein the first trained machine-learning model is a mixed-precision deep neural network (DNN) model and the second trained machine-learning model is an 8-bit DNN model for implementation on one or more deep learning accelerators (DLAs).

### Claim 24 (depends on 23)

The system of claim 23, wherein the one or more processors are further to: use the second trained machine-learning model to perform object detection, image classification, speech recognition, instance segmentation, or semantic segmentation on the one or more DLAs.

### Claim 25 (depends on 16)

The system of claim 16, wherein the one or more processors are further to deploy the second trained machine-learning model, over a network, to one or more computing devices to perform inferencing.
