TF32

Also known as: TensorFloat-32

On this page 7

TF32, short for TensorFloat-32, is a numeric format used inside tensor cores that combines the 8-bit exponent of FP32 with the 10-bit mantissa of FP16, giving 19 significant bits of information in a 32-bit container. It lets matrix multiplications on FP32 data run several times faster while preserving the dynamic range that deep learning training depends on.

In AI hardware, TF32 sits between full single precision and the 16-bit formats such as FP16 and bfloat16. NVIDIA introduced it with the Ampere generation in 2020, and it has since become the default math mode for FP32 matrix operations in several frameworks, which makes it one of the most widely used and least visible forms of low-precision arithmetic in artificial intelligence.

How the TF32 format is built

A TF32 value uses 1 sign bit, 8 exponent bits and 10 explicit mantissa bits. Inputs stay stored in memory as ordinary 32-bit floats, and the tensor core rounds or truncates the FP32 mantissa from 23 bits to 10 bits as it reads the operands, so applications and memory layouts do not change.

The multiply step runs at reduced precision, but the products are accumulated in full FP32, which limits error growth across long dot products. The output tensor is written back as standard FP32, so the reduced-precision step is confined to the inside of the matrix multiply unit. The table below places TF32 among related formats.

FormatExponent bitsMantissa bitsApproximate max valueUnit roundoff
FP328233.4 x 10^38About 6 x 10^-8
TF328103.4 x 10^38About 4.9 x 10^-4
bfloat16873.4 x 10^38About 3.9 x 10^-3
FP1651065,504About 4.9 x 10^-4
FP8 E4M343448About 6.3 x 10^-2
Bit layout of TF32 compared with neighboring formats

The layout explains the name: TF32 keeps the range of a 32-bit float and the precision of a 16-bit float. Because the exponent matches FP32, values that train safely in FP32 rarely overflow or underflow in TF32, which is the main practical advantage over FP16.

Why TF32 speeds up training

TF32 accelerates training because tensor cores can process narrower multipliers far more densely than general FP32 units. A 10-bit mantissa multiplier needs much less silicon area and energy than a 23-bit one, so the same chip area delivers many more operations per clock cycle.

On the NVIDIA A100, the published peak for dense TF32 tensor operations is 156 teraFLOPS, against 19.5 teraFLOPS for standard FP32, a theoretical ratio of eight. Real workloads usually see two to six times faster matrix-heavy training, because memory bandwidth, data loading and non-matrix layers do not benefit.

Support for the format has spread beyond its first generation. NVIDIA Hopper and Blackwell data-center GPUs keep TF32 tensor core paths, and AMD Instinct accelerators from the MI300 series onward also list TF32 throughput, so the format now works as a portable fast path for FP32 code across vendors. Peak figures differ widely by product, cooling and sparsity mode, so comparisons should always use dense throughput on the same workload.

Workload partUses TF32Typical effect
Linear and attention layersYes, when enabledLarge speedup on matrix multiplies
ConvolutionsYes, through cuDNNLarge speedup for compute-bound layers
Element-wise operationsNoLimited by memory bandwidth
Normalization and softmaxNoStill computed in FP32
Optimizer updatesNoWeights updated in FP32
Where TF32 helps and where it does not

TF32 compared with other training precisions

TF32 is best understood as a zero-effort middle ground: it requires no loss scaling, no casting of model weights and no change to data types, but it delivers less speed than true 16-bit mixed precision. FP16 and bfloat16 halve memory traffic as well as speeding up math, while TF32 still moves full 32-bit values through memory.

OptionCode changesMemory savingsMain risk
Pure FP32NoneNoneSlowest training
TF32None or one settingNoneSmall accuracy loss in sensitive math
bfloat16 mixed precisionAutocast setupAbout half for activationsCoarse precision in some layers
FP16 mixed precisionAutocast and loss scalingAbout half for activationsOverflow without loss scaling
FP8 trainingSpecialized librariesLargeRequires careful per-tensor scaling
Choosing between TF32 and alternative precisions

In practice, many teams start with TF32 because it is essentially free, then move to bfloat16 mixed precision when memory or throughput becomes the bottleneck. On newer accelerators such as NVIDIA Hopper and Blackwell, TF32 remains supported, but the largest gains come from bfloat16, FP8 and FP4 paths handled by the Transformer Engine.

Enabling and controlling TF32 in frameworks

Framework defaults differ, so engineers should verify the setting explicitly rather than assume it. TensorFlow enables TF32 by default on supported GPUs, while PyTorch has disabled TF32 for matrix multiplication by default since version 1.12 but kept it enabled for cuDNN convolutions.

  • In PyTorch, torch.set_float32_matmul_precision("high") allows TF32 for matrix multiplication, while the value "highest" keeps full FP32.
  • The flags torch.backends.cuda.matmul.allow_tf32 and torch.backends.cudnn.allow_tf32 control matrix multiply and convolution paths separately.
  • The environment variable NVIDIA_TF32_OVERRIDE=0 disables TF32 globally in NVIDIA libraries, which helps when checking whether an accuracy change comes from TF32.
  • Libraries such as CUTLASS offer a 3xTF32 technique that splits each FP32 operand into two TF32 parts to approach FP32 accuracy at a fraction of the cost.

Accuracy limits and when to avoid TF32

TF32 is safe for most neural network training because stochastic gradient descent already tolerates noise far larger than the relative error of about 0.05 percent per operand. Published training results for image, speech and language models show accuracy matching FP32 when TF32 is used for matrix multiplication.

Problems appear in numerically sensitive computations outside typical deep learning. Scientific simulations, matrix inversions, eigenvalue solvers and iterative refinement may need the full 23-bit mantissa, and reproducibility tests that compare results bit for bit against CPU references will report mismatches when TF32 is active. In these cases, set the precision to highest or use the 3xTF32 approach.

In plain words

Computers store numbers with a fixed number of digits. More digits mean more exact results, but slower math. TF32 is a shortcut that AI chips take when multiplying large tables of numbers.

It keeps the ability to handle very large and very small numbers. It only drops some of the fine detail at the end of each number. For training AI models, that detail rarely matters. The result is much faster training with nearly the same accuracy.

A real-world example

A research group fine-tunes an image segmentation model on eight A100 GPUs, keeping all code in FP32. One epoch takes about 95 minutes, and an engineer notices that PyTorch is running matrix multiplications in full FP32 because TF32 is disabled by default for that path.

After adding a single line that sets float32 matrix multiplication precision to high, the same epoch finishes in about 38 minutes, with no change to batch size or memory use. Validation mean intersection over union differs from the FP32 baseline by less than 0.1 points, within normal run-to-run variation. The group keeps TF32 for training but disables it in a separate numerical test suite that compares outputs against CPU results to a tight tolerance.