# US 2019/0095777 A1 · Method and apparatus for quantizing artificial neural network

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

- Number: US 2019/0095777 A1
- Document ID: US20190095777A1
- Status: Published application
- Kind: A1
- Application number: 16/008,275
- Filed: 2018-06-14
- Published: 2019-03-28
- Earliest claimed: 2017-09-25
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Do-yun KIM; Han-young YIM; In-yup KANG; Byeoung-su KIM; Nak-woo SUNG; Jong-Han LIM; Sang-hyuck HA
- Web page: https://patentgrep.com/patent/US20190095777A1

## CPC

- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/063: using electronic means
- G06N 3/08: Learning methods
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A method of quantizing an artificial neural network includes dividing an input distribution of the artificial neural network into a plurality of segments, generating an approximated density function by approximating each of the plurality of segments, calculating at least one quantization error corresponding to at least one step size for quantizing the artificial neural network, based on the approximated density function, and determining a final step size for quantizing the artificial neural network based on the at least one quantization error.

## Claims

### Claim 1

A method of quantizing an artificial neural network, the method comprising:
dividing an input distribution of the artificial neural network into a plurality of segments;
generating an approximated density function by approximating each of the plurality of segments;
determining at least one quantization error corresponding to at least one step size for quantizing the artificial neural network, based on the approximated density function; and
determining a final step size for quantizing the artificial neural network, based on the at least one quantization error.

### Claim 2 (depends on 1)

The method of claim 1, wherein the dividing comprises dividing a section including a maximum value and a minimum value of the input distribution into the plurality of segments.

### Claim 3 (depends on 1)

The method of claim 1, further comprising obtaining a number of the plurality of segments as an input parameter,
wherein the dividing comprises dividing the input distribution into the number of the plurality of segments.

### Claim 4 (depends on 1)

The method of claim 1, wherein the dividing comprises dividing the input distribution into the plurality of segments having a uniform width.

### Claim 5 (depends on 1)

The method of claim 1, wherein the dividing comprises dividing the input distribution so that each segment of the plurality of segments has a width proportional to a probability density of the segment.

### Claim 6 (depends on 1)

The method of claim 1, wherein the generating the approximated density function comprises:
approximating the plurality of segments to a plurality of polynomials, respectively; and
combining the plurality of polynomials.

### Claim 7 (depends on 6)

The method of claim 6, further comprising obtaining an order of a polynomial as an input parameter,
wherein the approximating comprises approximating the plurality of segments to the plurality of polynomials of the order, respectively.

### Claim 8 (depends on 6)

The method of claim 6, wherein the generating the approximated density function further comprises generating the approximated density function as a probability density function by normalizing the plurality of polynomials which have been combined.

### Claim 9 (depends on 1)

The method of claim 1, wherein the determining the at least one quantization error comprises determining a sum of an overload distortion and a granular distortion according to the at least one step size.

### Claim 10 (depends on 1)

The method of claim 1, further comprising obtaining a fixed-point artificial neural network based on the final step size.

### Claim 11 (depends on 10)

The method of claim 10, wherein the determining the at least one quantization error comprises:
accessing a fractional length (FL) set including a plurality of fractional lengths; and
sequentially determining quantization errors respectively corresponding to the plurality of fractional lengths from the FL set.

### Claim 12 (depends on 10)

The method of claim 10, wherein the determining the at least one quantization error comprises:
determining a minimum fractional length to prevent a maximum value of the input distribution from being saturated; and
sequentially determining quantization errors for fractional lengths gradually increasing from the minimum fractional length.

### Claim 13 (depends on 12)

The method of claim 12, wherein the sequentially determining the quantization errors is stopped in response to a quantization error being greater than a previously determined quantization error.

### Claim 14 (depends on 1)

The method of claim 1, further comprising obtaining the input distribution in one of units of layers and channels of the artificial neural network.

### Claim 15

An apparatus comprising:
a memory; and
at least one processor configured to execute computer-executable procedures stored in the memory,
wherein the computer-executable procedures comprise:
an approximator configured to generate an approximated density function by approximating each of a plurality of segments divided from an input distribution of an artificial neural network,
a quantizer configured to determine at least one quantization error corresponding to at least one step size for quantizing the artificial neural network based on the approximated density function, and to determine a final step size for quantizing the artificial neural network according to the at least one quantization error.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the approximator is further configured to receive a number of the plurality of segments as an input parameter and to divide the input distribution into the number of the plurality of segments.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the approximator is further configured to receive an order of a polynomial as an input parameter and to approximate the plurality of segments to polynomials of the order, respectively.

### Claim 18 (depends on 15)

The apparatus of claim 15, wherein the quantizer is further configured to determine a sum of an overload distortion and a granular distortion according to the at least one step size.

### Claim 19

(canceled)

### Claim 20 (depends on 15)

The apparatus of claim 15, wherein the quantizer is further configured to determine a minimum fractional length to prevent a maximum value of the input distribution from being saturated, and to sequentially determine quantization errors until a trough is reached, with respect to fractional lengths gradually increasing from the minimum fractional length.

### Claim 21

A method of quantizing a floating-point neural network, the method comprising:
dividing an input distribution of the floating-point neural network into a plurality of segments having a uniform width;
generating an approximated density function by approximating each of the plurality of segments to a polynomial;
determining at least one quantization error corresponding to at least one fractional length, based on the approximated density function; and
determining a final step size for quantizing the floating-point neural network, based on the at least one quantization error.

### Claim at position 22

-27. (canceled)
