Floating-Point Dtype Review

A dtype tells the computer how to store numbers.

Deep learning commonly uses floating-point types because model values, gradients, and losses are real-valued approximations.

real numberrounded to stored value
Floating-point numbers store nearby representable values, not every real number.

The dtype affects:

  • memory use
  • speed
  • range of representable values
  • precision between nearby values

More precision is not always faster. Less precision is not always safe. Large models often use lower precision to save memory and compute time, then use stability techniques to avoid failure.

The lesson is not "always use the largest dtype." The lesson is "know what your dtype can represent."

DL-C16-T01-001Exercise: Dtype role

Enter 1 if dtype affects how numbers are stored, or 2 if dtype only changes the model architecture.

Compute it first, then check your number.

DL-C16-T01-002Exercise: Memory direction

Enter 1 if lower precision often uses less memory, or 2 if lower precision always uses more memory.

Compute it first, then check your number.