Inferensys

Glossary

Mixed Precision Training

Mixed precision training is a computational technique that uses lower-precision data types like FP16 or BF16 for most operations to accelerate training and reduce memory usage, while maintaining higher precision (FP32) for critical parts like weight updates to ensure numerical stability.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
INSTRUCTION TUNING METHODOLOGIES

What is Mixed Precision Training?

Mixed precision training is a computational technique that uses lower-precision data types for most operations and higher precision for critical parts to accelerate training and reduce memory usage.

Mixed precision training is a computational technique that uses both lower-precision (e.g., 16-bit floating-point, FP16 or BF16) and higher-precision (32-bit floating-point, FP32) numerical formats during neural network training to accelerate computation and reduce memory consumption. It leverages specialized hardware like NVIDIA Tensor Cores to perform operations faster on the lower-precision tensors, while maintaining a master copy of weights in FP32 to preserve numerical stability for critical steps like gradient accumulation and weight updates.

The technique employs loss scaling to prevent underflow of small gradient values when using FP16. Gradients computed in FP16 are scaled up before the optimizer step, then unscaled when applied to the FP32 master weights. This approach, central to frameworks like PyTorch's Automatic Mixed Precision (AMP), can double training speed and halve GPU memory usage, enabling the training of larger models or the use of bigger batch sizes without sacrificing final model accuracy.

COMPUTATIONAL OPTIMIZATION

Key Features and Benefits

Mixed precision training accelerates neural network training by strategically using lower-precision (e.g., FP16, BF16) and higher-precision (FP32) data types for different operations, balancing speed, memory, and numerical stability.

01

Memory Footprint Reduction

Using 16-bit floating-point (FP16) or Brain Floating Point (BF16) halves the memory required per parameter compared to standard 32-bit (FP32). This enables:

  • Training larger models or using larger batch sizes on the same GPU hardware.
  • Storing more optimizer states and activations in memory.
  • A direct reduction in GPU memory bandwidth pressure, which is often a training bottleneck.
02

Increased Computational Throughput

Modern AI accelerators like NVIDIA Tensor Cores and Google TPUs are optimized for lower-precision matrix operations. Using FP16/BF16 allows these specialized units to perform many more FLOPS (Floating Point Operations Per Second). This results in:

  • Faster forward and backward passes during training.
  • Significant reductions in per-iteration training time.
  • More efficient utilization of expensive hardware.
03

Maintained Numerical Stability

A pure lower-precision training can fail due to numerical underflow (values rounding to zero) and overflow (values exceeding range). Mixed precision maintains stability via:

  • Master Weights: Keeping a master copy of weights in FP32 for precision.
  • Loss Scaling: Automatically scaling the loss value before backward pass to preserve small gradients.
  • Precision Casting: Performing sensitive operations (e.g., weight updates, normalization layers) in FP32.
05

BF16 for Enhanced Stability

BF16 (bfloat16) is an alternative 16-bit format that preserves the same exponent range as FP32 (8 bits) while reducing mantissa bits (7 bits). This design offers a key advantage:

  • Greatly reduces the risk of overflow/underflow compared to FP16.
  • Often requires less or no loss scaling.
  • Becoming the preferred format on hardware that supports it (e.g., TPUs, NVIDIA Ampere+ GPUs).
06

Synergy with Other Optimizations

Mixed precision training is a foundational technique that combines effectively with other scaling methods:

  • Gradient Checkpointing: Saves memory on activations, which are now stored in lower precision.
  • Model Parallelism & ZeRO: Further reduces memory footprint when partitioned weights are in lower precision.
  • Quantization-Aware Training (QAT): Serves as a precursor for deploying quantized models for inference.
NUMERICAL REPRESENTATION

Precision Data Types: Comparison

A comparison of floating-point and integer formats used in mixed precision training, detailing their bit-width, dynamic range, memory footprint, and primary use cases.

FeatureFP32 (Single)FP16 (Half)BF16 (Brain Float)INT8

Full Name

32-bit Floating Point

16-bit Floating Point

Brain Floating Point 16

8-bit Integer

Total Bits

32

16

16

8

Sign Bits

1

1

1

1

Exponent Bits

8

5

8

N/A

Mantissa/Significand Bits

23

10

7

7

Dynamic Range (approx.)

~1e-38 to ~3e38

~5.96e-8 to ~65504

~1.18e-38 to ~3.39e38

-128 to 127

Memory per Parameter

4 bytes

2 bytes

2 bytes

1 byte

Primary Use in Mixed Precision

Master Weights & Gradients

Forward/Backward Activations

Forward/Backward Activations & Gradients

Quantized Inference / Weights

Resilience to Underflow

Hardware Support (Modern GPUs/TPUs)

Typical Speedup vs. FP32

1x (Baseline)

2-3x

2-3x

4x (Inference)

MIXED PRECISION TRAINING

Frequently Asked Questions

Mixed precision training is a computational technique that uses lower-precision data types (like FP16 or BF16) for most operations and higher precision (FP32) for critical parts like weight updates to accelerate training and reduce memory usage.

Mixed precision training is a computational technique that uses lower-precision numerical formats (primarily 16-bit floating-point, or FP16/BF16) for most operations during neural network training, while maintaining higher precision (32-bit floating-point, or FP32) for a small subset of critical operations to preserve numerical stability and model accuracy. This hybrid approach leverages the speed and memory efficiency of lower-precision arithmetic on modern hardware accelerators like GPUs and TPUs, which are optimized for such computations, while using FP32 as a 'master copy' for weights and for operations vulnerable to underflow, such as gradient accumulation and weight updates. The technique is a cornerstone of modern large language model (LLM) training, enabling the training of models that would otherwise exceed available GPU memory.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.