2-3× faster training, 40% less memory, ~free
Mixed precision training uses lower-precision arithmetic (float16 or bfloat16) for compute while keeping float32 for weight storage. Memory savings + throughput improvements on modern GPUs and TPUs with minimal accuracy impact.
Why this works: neural networks are surprisingly tolerant of reduced precision in forward/backward passes. Gradients computed in float16 are accurate enough for the optimizer. But weights stay float32 so small gradient updates (much smaller than float16 epsilon) don't get lost.
| Policy | Compute dtype | Variable dtype | Best for |
|---|---|---|---|
| mixed_float16 | float16 | float32 | NVIDIA GPU (V100, A100, H100) |
| mixed_bfloat16 | bfloat16 | float32 | TPU (all versions) |
| float32 | float32 | float32 | Default; or when stability matters |
Critical detail for mixed_float16: the final activation must be float32 for numerical stability. Always set dtype='float32' on the output Activation layer (e.g., softmax). For TPUs (bfloat16) this isn't needed because bfloat16 has the same exponent range as float32.