NEW
Also known as: AMP
Automatic Mixed Precision accelerates training by casting operations to lower precision where safe while preserving accuracy using scaling and selective high-precision math.
DESCRIPTION
Automatic Mixed Precision (AMP) speeds up deep learning training by running many operations in FP16 or BF16 and keeping numerically sensitive parts in FP32. Frameworks like PyTorch and TensorFlow automate casting and scaling to prevent underflow/overflow. AMP reduces memory usage and increases throughput on GPUs with tensor cores, enabling larger batch sizes. Proper loss scaling and validation are necessary to avoid instability. AMP is widely supported and often yields substantial speedups with minimal code changes.
ALTERNATIVE DEFINITIONS
PyTorch Documentation
PyTorch supports Automatic Mixed Precision training with torch.cuda.amp, allowing most operations to run in float16 or bfloat16 for improved performance on capable GPUs.
Highlights the PyTorch mechanism (torch.cuda.amp) and performance gains.
TensorFlow
Mixed precision uses both 16-bit and 32-bit floating point types in a model to make the model run faster and use less memory.
Emphasizes speed and memory benefits of mixed precision in TensorFlow.
NVIDIA
Mixed precision training uses half-precision floating point to reduce memory usage and increase training throughput while maintaining accuracy using loss scaling.
Focuses on GPU performance and the role of loss scaling to maintain accuracy.
RELATED TERMS
Mixed Precision FP16 BF16 Tensor Cores Loss Scaling Gradient Scaling CUDA XLA Distributed Training Graphics Processing Unit
COMPETING TERMS
Full Precision (FP32) Training
RELATIONS
- Broader: Mixed Precision
KNOWLEDGE AREAS
AI MLOps Infrastructure Mathematics
TARGET AUDIENCE
AI Engineer MLOps Engineer Hardware Engineer Data Scientist
EXTERNAL SOURCES
- Wikipedia - Single-precision floating-point format#Mixed precision
- PyTorch - Official AMP documentation
- TensorFlow - Mixed precision guide
- NVIDIA - Blog on mixed precision training
TOP QUESTIONS
Why is Automatic Mixed Precision useful for deep learning?
It improves throughput and reduces memory use by leveraging lower precision where safe, enabling larger batch sizes and faster experiments.
Category: Relevancy
What is loss scaling in Automatic Mixed Precision?
Loss scaling multiplies the loss to avoid underflow when using low-precision floats; gradients are rescaled back after computation.
Category: Concept
What risks exist when using Automatic Mixed Precision?
Numerical instability and silent accuracy degradation can occur if sensitive operations are cast incorrectly or scaling is mismanaged.
Category: Risk
What are common mistakes with Automatic Mixed Precision?
Manually casting sensitive ops, forgetting to disable autocast for certain layers, and skipping validation against FP32 baselines are typical errors.
Category: Mistakes
How do you enable Automatic Mixed Precision in PyTorch?
Use torch.cuda.amp.autocast during forward pass and GradScaler for scaling; test performance and accuracy against FP32.
Category: HowTo
What hardware benefits Automatic Mixed Precision?
GPUs with tensor cores (e.g., NVIDIA) accelerate FP16/BF16 operations, providing substantial speedups.
Category: Infrastructure
What is a competing approach to Automatic Mixed Precision?
Full precision (FP32) training avoids numerical risks but sacrifices performance and memory efficiency.
Category: Alternatives
How to validate model quality under Automatic Mixed Precision?
Compare metrics to FP32 baselines, monitor for divergence, and run stress tests on edge cases.
Category: Testing
What hot topic exists around Automatic Mixed Precision?
Wider adoption of BF16, automatic selective precision policies, and compiler-level optimizations are evolving rapidly.
Category: Topic