# US 2023/0267301 A1 · Neural network inference quantization

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

- Number: US 2023/0267301 A1
- Document ID: US20230267301A1
- Status: Published application
- Kind: A1
- Application number: 17/652,102
- Filed: 2022-02-23
- Published: 2023-08-24
- Earliest claimed: 2022-02-23
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: YOUSEF EL-KURDI; Jerome L Quinn; Robert Todd Ward
- Web page: https://patentgrep.com/patent/US20230267301A1

## CPC

- G06N 3/04: Architecture, e.g. interconnection topology
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06N 3/045: Combinations of networks
- G06N 3/048: Activation functions
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/08: Learning methods
- G06N 3/10: Interfaces, programming languages or software development kits, e.g. for simulating neural networks
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

One or more computer processors responsive to neural network run-time, reduce one or more sets of maximum activations along a hidden dimension respectively associated with one or more activation tensors and one or more layers of a neural network. The one or more computer processors compute an interquartile range (IQR) clip threshold for each reduced set for each sequence dimension in the neural network. The one or more computer processors clip one or more activations based on respective computed IQR clip thresholds. The one or more computer processors quantize the clipped activations.

## Claims

### Claim 1

A computer-implemented method comprising:
responsive to neural network run-time, reducing, by one or more computer processors, one or more sets of maximum activations along a hidden dimension respectively associated with one or more activation tensors and one or more layers of a neural network;
computing, by one or more computer processors, an interquartile range (IQR) clip threshold for each reduced set for each sequence dimension in the neural network;
clipping, by one or more computer processors, one or more activations based on respective computed IQR clip thresholds; and
quantizing, by one or more computer processors, the clipped activations.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein computing IQR clip threshold for each reduced set for each sequence dimension in the neural network, further comprises:
row-sorting, by one or more computer processors, the one or more reduced sets of activation based on row-based maximum activations; and
computing, by one or more computer processors, the IQR clip threshold as q3+1.5(q3−q1), wherein q3 is a median value of 75% of row-wise outlier activations and q1 is a median value of 25% of row-wise outlier activations.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, further comprising:
isolating, by one or more computer processors, activation outlier values and rows comprised in an activation matrix into a plurality of partitions utilizing the computed IQR clip threshold, wherein each partition in the plurality of partitions is quantized utilizing separate 8-bit quantization reducing sensitivity of quantization scale conforming with outlier activations.

### Claim 4 (depends on 3)

The computer-implemented method of claim 3, further comprising:
computing, by one or more computer processors, outlier activation rows in quantized partitions utilizing factored matrix-multiplication.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein clipping the one or more activations based on respective computed IQR clip thresholds, comprises:
applying, by one or more computer processors, TM-IQR clipping to the input activations of a second feed-forward general matrix multiplication operation.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, further comprising:
minimizing, by one or more computer processors, a difference between quantized and unquantized matrix-multiplication outputs utilizing the IQR threshold.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, further comprising:
initiating, by one or more computer processors, one or more natural language tasks utilizing the quantized neural network.

### Claim 8

A computer program product comprising:
one or more computer readable storage media and program instructions stored on the one or more computer readable storage media, the stored program instructions comprising:
program instructions to responsive to neural network run-time, reduce one or more sets of maximum activations along a hidden dimension respectively associated with one or more activation tensors and one or more layers of a neural network;
program instructions to compute an interquartile range (IQR) clip threshold for each reduced set for each sequence dimension in the neural network;
program instructions to clip one or more activations based on respective computed IQR clip thresholds; and
program instructions to quantize the clipped activations.

### Claim 9 (depends on 8)

The computer program product of claim 8, wherein the program instructions, to compute IQR clip threshold for each reduced set for each sequence dimension in the neural network, comprise:
program instructions to row-sort the one or more reduced sets of activation based on row-based maximum activations; and
program instructions to compute the IQR clip threshold as q3+1.5(q3−q1), wherein q3 is a median value of 75% of row-wise outlier activations and q1 is a median value of 25% of row-wise outlier activations.

### Claim 10 (depends on 9)

The computer program product of claim 9, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to isolate activation outlier values and rows comprised in an activation matrix into a plurality of partitions utilizing the computed IQR clip threshold, wherein each partition in the plurality of partitions is quantized utilizing separate 8-bit quantization reducing sensitivity of quantization scale conforming with outlier activations.

### Claim 11 (depends on 8)

The computer program product of claim 8, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to compute outlier activation rows in quantized partitions utilizing factored matrix-multiplication.

### Claim 12 (depends on 8)

The computer program product of claim 8, wherein the program instructions, to clip the one or more activations based on respective computed IQR clip thresholds, comprise:
program instructions to apply TM-IQR clipping to the input activations of a second feed-forward general matrix multiplication operation.

### Claim 13 (depends on 8)

The computer program product of claim 8, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to minimize a difference between quantized and unquantized matrix-multiplication outputs utilizing the IQR threshold.

### Claim 14 (depends on 8)

The computer program product of claim 8, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to initiate one or more natural language tasks utilizing the quantized neural network.

### Claim 15

A computer system comprising:
one or more computer processors;
one or more computer readable storage media; and
program instructions stored on the computer readable storage media for execution by at least one of the one or more processors, the stored program instructions comprising:
program instructions to responsive to neural network run-time, reduce one or more sets of maximum activations along a hidden dimension respectively associated with one or more activation tensors and one or more layers of a neural network;
program instructions to compute an interquartile range (IQR) clip threshold for each reduced set for each sequence dimension in the neural network;
program instructions to clip one or more activations based on respective computed IQR clip thresholds; and
program instructions to quantize the clipped activations.

### Claim 16 (depends on 15)

The computer system of claim 15, wherein the program instructions, to compute IQR clip threshold for each reduced set for each sequence dimension in the neural network, comprise:
program instructions to row-sort the one or more reduced sets of activation based on row-based maximum activations; and
program instructions to compute the IQR clip threshold as q3+1.5(q3−q1), wherein q3 is a median value of 75% of row-wise outlier activations and q1 is a median value of 25% of row-wise outlier activations.

### Claim 17 (depends on 16)

The computer system of claim 16, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to isolate activation outlier values and rows comprised in an activation matrix into a plurality of partitions utilizing the computed IQR clip threshold, wherein each partition in the plurality of partitions is quantized utilizing separate 8-bit quantization reducing sensitivity of quantization scale conforming with outlier activations.

### Claim 18 (depends on 17)

The computer system of claim 17, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to compute outlier activation rows in quantized partitions utilizing factored matrix-multiplication.

### Claim 19 (depends on 15)

The computer system of claim 15, wherein the program instructions, to clip the one or more activations based on respective computed IQR clip thresholds, comprise:
program instructions to apply TM-IQR clipping to the input activations of a second feed-forward general matrix multiplication operation.

### Claim 20 (depends on 15)

The computer system of claim 15, wherein the program instructions, stored on the one or more computer readable storage media, further comprise:
program instructions to minimize a difference between quantized and unquantized matrix-multiplication outputs utilizing the IQR threshold.
