What is Mixed precision?
Using different numeric precisions for different parts of a computation, such as multiplying in FP16 and accumulating in FP32, to balance speed and accuracy.
Japanese name: 混合精度
Using different numeric precisions for different parts of a computation, such as multiplying in FP16 and accumulating in FP32, to balance speed and accuracy.
Japanese name: 混合精度
Higher numeric precision reduces error but costs more memory and computation. FP16 (half precision) is 16 bits, half the size of FP32 (single precision). For the same number of values, both the memory used and the data moved are halved. In exchange it holds fewer digits, so errors appear more easily. Mixed precision computes the error-tolerant parts in low precision and the error-sensitive parts in high precision.
The fraction field of FP16 is 10 bits, which gives 11 bits of precision counting the leading 1. Since 2 to the 11th power is 2048, values from 2048 to 4096 can be represented only in steps of 2. Adding 1 to 2048 gives 2049, which cannot be represented, and under the standard rounding rule the result stays 2048. When many products are summed, as in a matrix product, small values stop being added to a total that has grown large, and error builds up. The multiplications are therefore done in low precision and only the running total is kept in FP32. NVIDIA tensor cores have instructions that multiply FP16 matrices and accumulate into FP32.
In neural network training, a known method keeps a master copy of the weights in FP32 and uses FP16 for the forward and backward computations. This keeps in high precision the step where small updates are added into the weights. In FP16, very small gradients can become 0. To prevent this, the loss is multiplied by a scale factor before the backward computation, and the gradients are divided by the same factor before the weights are updated. Frameworks such as PyTorch provide features that do this automatically.
Answer: A. When small updates are added to weights, a low-precision format would lose them to absorption
Training repeatedly adds very small amounts, learning rate × gradient, to the weights. FP16 and bfloat16 have short significands, so if an update is too small relative to the weight, the rounded sum equals the old weight and the update vanishes (absorption). Weights are therefore kept in FP32 so updates accumulate correctly, while lower-precision copies are used for the forward and backward passes. On hardware that supports it, lower precision computes faster, and low-precision values can be stored in memory.
Answer: B. Summing many products in low precision accumulates rounding error and loses small values, so accumulation alone uses higher precision
FP16 has only a 10-bit significand, so adding a small product to a large running sum can round the product away. A matrix product sums thousands of products, so such errors accumulate and skew the result. So the input values being multiplied are kept in low precision to cut memory use and arithmetic cost, while the sum of the products (the accumulation) is done in FP32. Most tensor cores perform this kind of multiply-accumulate in a single instruction.
Mixed precision is the technique for keeping that effect small. Computations where error accumulates, such as summation and weight updates, are done in FP32. This is what distinguishes it from running everything in low precision.
The range of representable values widens. BF16 has the same 8-bit exponent as FP32, so small gradients are less likely to become 0 and loss scaling is usually unnecessary. In exchange, its fraction field is 7 bits, coarser than the 10 bits of FP16.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.