Softmax Computation Decomposition for Transformer Efficiency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional Softmax computation in neural networks is computationally expensive and inefficient, particularly in deep learning applications like transformer neural networks, due to high memory utilization and complex design overhead, which hinders performance in conversational AI and other applications.

Innovation Solution

The implementation of an efficient Softmax computation method that decomposes the process into separate UnNormalized and Normalization operations, using reduced precision and integer max computations, and a distributed, tile-based architecture with multi-level dataflows to improve data locality and energy efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If conventional Softmax computation is used, then accuracy is maintained, but computational complexity and energy consumption increase

Engineering Contradiction:
ImproveSoftmax computation accuracyVSAvoidcomputational complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The Softmax computation is divided into two separate operations: Unnormalized Softmax (computing 2^(x_i - max(x)) for each element) and Normalization (dividing by the sum of all unnormalized values). This segmentation allows each operation to be optimized independently, reducing overall computational complexity while maintaining accuracy.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent changes the computational parameter from standard exponential function e^x to power of two function 2^x. This parameter change enables the use of integer arithmetic and bit-shift operations instead of floating-point exponentiation, significantly reducing computational complexity and energy consumption while preserving the relative ordering and normalization properties needed for Softmax accuracy.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If conventional Softmax computation is used, then correctness is ensured, but energy consumption increases

Engineering Contradiction:
Improvecomputation correctnessVSAvoidenergy consumption
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent substitutes expensive floating-point exponential operations with simpler integer arithmetic operations (subtraction, power of two computation, and normalization). This mechanical substitution replaces energy-intensive computational mechanisms with more efficient ones, reducing energy consumption while maintaining computation correctness through the mathematical equivalence of the transformed operations.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Measurement precision

If high precision floating-point operations are used, then accuracy is maintained, but memory utilization efficiency decreases

Engineering Contradiction:
Improvefloating-point precisionVSAvoidmemory utilization
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent changes the numerical representation parameter from high-precision floating-point to lower-precision integer arithmetic. By computing 2^(x_i - max(x)) using integer operations and storing intermediate results in compact integer formats, the method reduces memory utilization while maintaining sufficient precision for the normalization process, as the relative differences between values are preserved.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20220067513A1Efficient softmax computation
Publication Date: 2022.03.03 NVIDIA CORP
  • US20220067513A1 patent drawing
  • US20220067513A1 patent drawing
  • US20220067513A1 patent drawing

AI summary

Solutions improving efficiency of Softmax computation applied for efficient deep learning inference in transformers and other neural networks. The solutions utilize a reduced-precision implementation of various operations in Softmax, replacing ex with 2x to reduce instruction overhead associated with computing ex, and replacing floating point max computation with integer max computation. Further described is a scalable implementation that decomposes Softmax into UnNormalized Softmax and Normalization operations.