Graph
FP16

🔢FP16

NEW

Also known as: Half Precision, Binary16

A 16-bit floating-point format that accelerates deep learning with reduced memory and compute cost.

DESCRIPTION

FP16 (half-precision) represents floating-point numbers in 16 bits, lowering memory bandwidth and enabling higher throughput on modern GPUs. Mixed precision training combines FP16 computation with selective FP32 accumulation for stability, leveraging specialized hardware (e.g., Tensor Cores). Compared to bfloat16, FP16 has fewer exponent bits, affecting dynamic range. Proper loss scaling mitigates underflow/overflow issues during training.

ALTERNATIVE DEFINITIONS

Wikipedia

In computing, half precision is a binary floating-point computer number format that occupies 16 bits in computer memory.

Concise definition emphasizing memory size.

Source

NVIDIA

Mixed precision training uses both 16-bit and 32-bit floating point types to reduce memory usage and improve performance while maintaining training accuracy.

Positions FP16 in mixed precision workflows for performance.

Source

Mixed Precision Training Quantization Tensor Cores Automatic Mixed Precision IEEE 754

COMPETING TERMS

FP32 BF16

KNOWLEDGE AREAS

AI Infrastructure Mathematics

TARGET AUDIENCE

AI Engineer MLOps Engineer Data Scientist Cloud Architect Software Developer

EXTERNAL SOURCES

  • Wikipedia - Half-precision floating-point format
  • NVIDIA - Mixed precision training guide
  • PyTorch - Automatic Mixed Precision API
  • TensorFlow - TF mixed precision guide

TOP QUESTIONS

Why use FP16 in deep learning?

It reduces memory usage and increases throughput, enabling larger batch sizes and faster training on hardware with FP16 acceleration.

Category: Relevancy

How does FP16 compare to bfloat16?

bfloat16 has a wider exponent and smaller mantissa, improving dynamic range but slightly reducing precision versus FP16.

Category: Example

What is a common mistake when using FP16?

Skipping loss scaling can cause underflow. Use automatic mixed precision to manage scaling and dtype casts safely.

Category: Mistakes

Does FP16 hurt model accuracy?

With mixed precision and correct scaling, accuracy is typically preserved while gaining performance benefits.

Category: Opinion

Which hardware benefits most from FP16?

Modern GPUs with Tensor Cores or equivalent FP16 units deliver significant speedups for matrix operations.

Category: Overview

Can FP16 help inference latency?

Yes, it often improves inference speed and lowers memory bandwidth needs, especially with batch processing.

Category: Example

How to validate FP16 stability?

Compare training curves and final metrics to FP32 baselines. Monitor for NaNs or divergence and adjust scaling.

Category: Testing

Is FP16 suitable for all layers?

Some operations, like reductions or accumulations, often remain FP32 to maintain numerical stability.

Category: BestPractice

What alternatives exist to FP16?

bfloat16 and integer quantization can offer performance or memory gains depending on hardware and accuracy needs.

Category: Alternatives