# US 2024/0005138 A1 · Efficient look-up table based functions for artificial intelligence (ai) accelerator

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

- Number: US 2024/0005138 A1
- Document ID: US20240005138A1
- Status: Published application
- Kind: A1
- Application number: 17/825,868
- Filed: 2022-05-26
- Published: 2024-01-04
- Earliest claimed: 2022-05-26
- Assignees: Synopsys, Inc.
- Applicants: Synopsys, Inc.
- Inventors: Johannes Boonstra
- Web page: https://patentgrep.com/patent/US20240005138A1

## CPC

- G06N 3/065: Analogue means
- G06F 7/49942: {Significance control}
- G06F 9/3001: {Arithmetic instructions}
- G06F 9/3555: {using scaling, e.g. multiplication of index}
- G06N 3/048: Activation functions
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/063: using electronic means
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for approximating an activation function, the method including: receiving an input value of the activation function; determining that the input value is within a range, the range includes a set of non-uniform intervals; determining a selected interval from among the set of non-uniform intervals including the input value; retrieving, by a hardware accelerator, from a look-up table (LUT) associated with a type of the activation function, values of one or more quadratic interpolation parameters associated with the selected interval; performing a quadratic interpolation on the input value to approximate the input value using the values of the one or more quadratic interpolation parameters; and determining a first approximated output of the activation function based on a result of the quadratic interpolation performed on the input value.

## Claims

### Claim 1

A method for approximating an activation function, the method comprising:
receiving an input value of the activation function;
determining that the input value is within a range, the range comprises a set of non-uniform intervals;
determining a selected interval from among the set of non-uniform intervals comprising the input value;
retrieving, by a hardware accelerator, from a look-up table (LUT) associated with a type of the activation function, values of one or more quadratic interpolation parameters associated with the selected interval;
performing a quadratic interpolation on the input value to approximate the input value using the values of the one or more quadratic interpolation parameters; and
determining a first approximated output of the activation function based on a result of the quadratic interpolation performed on the input value.

### Claim 2 (depends on 1)

The method of claim 1, wherein a Remez minimax algorithm is used to determine a non-uniform distribution of the set of non-uniform intervals.

### Claim 3 (depends on 2)

The method of claim 2, wherein the determining the selected interval from the set of non-uniform intervals is based on one or more of most significant bits (MSB) of the input value and two's complement encoded input value.

### Claim 4 (depends on 1)

The method of claim 1, wherein the LUT associated with the activation function comprises the values of the one or more quadratic interpolation parameters for each interval from among the set of non-uniform intervals.

### Claim 5 (depends on 4)

The method of claim 4, wherein the hardware accelerator stores a plurality of LUTs comprising parameters associated with quadratic interpolation ranges of a plurality of activation functions.

### Claim 6 (depends on 5)

The method of claim 5, wherein the plurality of LUTs are implemented as flip-flops in the hardware accelerator.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
determining, by the hardware accelerator, that the input value is within one or more linear extrapolation ranges, the one or more linear extrapolation ranges do not overlap with the range;
determining, by the hardware accelerator, offset values and slopes of the activation function for each of the one or more linear extrapolation ranges;
performing, by the hardware accelerator, a linear extrapolation on the input value to approximate the input value using the offset values and the slopes of the activation function for each of the one or more linear extrapolation ranges; and
determining, by the hardware accelerator, a second approximated output of the activation function based on a result of the linear extrapolation performed on the input value.

### Claim 8 (depends on 7)

The method of claim 7, wherein the input value is shifted by power of two factors within a range of representable values in a fixed point representation of the second approximated output of the activation function.

### Claim 9

A system for approximating an activation function, the system comprising:
a bit shifter configured to receive an input value of the activation function and perform a shift operation on the input value to compute most significant bits (MSBs) of the input value;
a first device configured to determine if the input value is within a range comprising a set of non-uniform intervals, and determine a selected interval from among the set of non-uniform intervals comprising the input value based on the MSBs of the input value;
a second device configured to retrieve from a look-up table (LUT) associated with the activation function, values of one or more quadratic interpolation parameters associated with the selected interval;
one or more multiply-accumulate-scale circuits configured to perform a quadratic interpolation on the input value to approximate the input value using the values of the one or more quadratic interpolation parameters, and to determine a first approximated output of the activation function based on a result of the quadratic interpolation performed on the input value.

### Claim 10 (depends on 9)

The system of claim 9, wherein the system comprises a hardware accelerator and/or an electronic circuit configured by a hard macro intellectual property (IP).

### Claim 11 (depends on 10)

The system of claim 10, wherein the hardware accelerator stores a plurality of LUTs comprising parameters associated with quadratic interpolation ranges of a plurality of activation functions.

### Claim 12 (depends on 11)

The system of claim 11, wherein the plurality of LUTs are implemented as flip-flops in the hardware accelerator.

### Claim 13 (depends on 9)

The system of claim 9, wherein Remez minimax algorithm is used to determine non-uniform distribution of the set of non-uniform intervals.

### Claim 14 (depends on 13)

The system of claim 13, wherein the determining the selected interval from among set of non-uniform intervals is based on one or more of most significant bits (MSB) of the input value and two's complement encoded input value.

### Claim 15 (depends on 9)

The system of claim 9, wherein the LUT associated with the activation function comprises the values of the one or more quadratic interpolation parameters for each interval from among the set of non-uniform intervals.

### Claim 16 (depends on 9)

The system of claim 9, further comprising:
a third device configured to determine offset values and slopes of the activation function for each of one or more linear extrapolation ranges based on the first device determining that the input value is within the one or more linear extrapolation ranges, the one or more linear extrapolation ranges do not overlap with the range, wherein the one or more multiply-accumulate-scale circuits are further configured to perform a linear extrapolation on the input value to approximate the input value using the offset values and the slopes of the activation function for each of the one or more linear extrapolation ranges, and to determine a second approximated output of the activation function based on a result of the linear extrapolation performed on the input value.

### Claim 17 (depends on 16)

The system of claim 16, wherein the input value is shifted by power of two factors within a range of representable values in a fixed point representation of the second approximated output of the activation function.

### Claim 18

A non-transitory computer readable medium comprising stored representation of an accelerator circuit, which when synthesized by a processor, cause the processor to synthesize a structure of an electronic circuit configured to:
receive an input value of an activation function;
determine that the input value is within a range, the range comprises a set of non-uniform intervals;
determine a selected interval from among the set of non-uniform intervals comprising the input value;
retrieve from a look-up table (LUT) associated with the activation function, values of one or more quadratic interpolation parameters associated with the selected interval;
perform a quadratic interpolation on the input value to approximate the input value using the values of the one or more quadratic interpolation parameters; and
determine a first approximated output of the activation function based on a result of the quadratic interpolation performed on the input value.

### Claim 19 (depends on 18)

The non-transitory computer readable medium of claim 18, wherein the input value is shifted by power of two factors within a range of representable values in a fixed point representation of the first approximated output of the activation function.

### Claim 20 (depends on 18)

The non-transitory computer readable medium of claim 18, wherein the electronic circuit is further configured to:
determine that the input value is within one or more linear extrapolation ranges, the one or more linear extrapolation ranges do not overlap with the range;
determine offset values and slopes of the activation function for each of the one or more linear extrapolation ranges;
perform a linear extrapolation on the input value to approximate the input value using the offset values and the slopes of the activation function for each of the one or more linear extrapolation ranges; and
determine a second approximated output of the activation function based on a result of the linear extrapolation performed on the input value.
