Mixed precision and multi-GPU training basics
What fp32, fp16 and bf16 can represent, why fp16 training needs loss scaling and why bf16 usually does not, why optimizers keep fp32 master weights, and the four ways to spread training over GPUs (data, tensor, pipeline and sequence parallelism, plus sharded data parallelism), with a runnable precision demo.
By Sandip Maity, Applied AI Engineer
The tiny GPT trains in 64-bit floats on one CPU. Real training runs in 16-bit formats on many GPUs. This lesson explains what changes when you drop precision, why, and how work is split across GPUs, so the PyTorch mapping and any training framework's settings make sense.
Pro content
Keep reading with Inference Academy Pro
Unlock the rest of this lesson, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.
Still to come in this lesson
- Number formats
- Where precision is kept high
- Splitting training across GPUs
- Gradient accumulation
- What to measure
- Exercises
You will be able to answer
- Why is bf16 usually preferred over fp16 for training?
- What does loss scaling do in fp16 training?
- Why keep fp32 master weights when computing in bf16?
- Which parallelism splits each layer's matrices across GPUs, needing very fast interconnect?
- Pipeline parallelism puts different layers on different GPUs. What is its main inefficiency?