Floating-Point Precision Conversion With Stochastic Rounding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In mixed-precision computing scenarios, converting high-precision data to low-precision data results in conversion errors due to rounding operations, particularly in AI training, leading to precision loss and increased hardware overheads.
Innovation Solution
A floating-point data precision conversion method that utilizes a prefix code field to indicate the bit width of the second exponent field, combined with a simple rounding mode, to balance precision and bit width, and performs rounding operations on retained coded values without additional device support, reducing hardware overheads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If rounding operation is performed on high-precision data during format conversion to low-precision data, then conversion from high-precision to low-precision is achieved, but conversion error occurs and mean invariance is reduced
Solution Approach 1:
The patent introduces a stochastic rounding mode that performs preliminary randomization on the discarded bits before final rounding. This preliminary action adds controlled randomness to the conversion process, which prevents systematic bias accumulation and maintains mean invariance across multiple conversions from high-precision to low-precision formats.
Solution Approach 2:
The patent changes the rounding parameter from deterministic to stochastic by introducing a random number generator. The rounding operation uses a probability-based approach where the rounded value depends on both the discarded bits and a random number, transforming the conversion process to maintain statistical properties like mean invariance while achieving the required precision reduction.
2Measurement precision
If complex rounding mode with additional device support is used, then rounding accuracy is improved, but hardware overhead increases
Solution Approach 1:
The patent introduces a random number generator as an intermediary component that feeds into the rounding operation. This intermediary provides the necessary stochastic element for accurate stochastic rounding while keeping the overall hardware architecture simple and modular, avoiding the need for complex rounding logic.
Solution Approach 2:
The rounding operation uses readily available components (random number generator and comparator) to achieve accurate stochastic rounding. The system serves itself by using the discarded bits in combination with a simple random number to determine the rounded value, eliminating the need for complex dedicated rounding hardware.
3Productivity
If multiple conversion operations are performed in AI training, then low-precision computing efficiency is achieved, but error accumulation occurs
Solution Approach 1:
The stochastic rounding mode provides a feedback mechanism through its probability-based rounding behavior. By using a random number generator that produces consistent statistical properties across multiple operations, the system maintains mean invariance over time, preventing error accumulation in iterative AI training processes while preserving computing efficiency.
Data Source
AI summary
The present disclosure relates to floating-point data precision conversion methods and apparatuses. One example method includes determining a first bit width and a first coded value of the prefix code field, a first bit width and a first coded value of the second exponent field, and a first bit width of a second mantissa field based on a first coded value of a first exponent field, determining a to-be-retained coded value and a to-be-discarded coded value in a first mantissa field, where the to-be-retained coded value includes a coded value that starts from a most significant bit in the first mantissa field and whose bit width is the same as the first bit width of the second mantissa field, and performing a rounding operation on the to-be-retained coded value based on the to-be-discarded coded value to obtain a first coded value of the second mantissa field.


