What is the purpose of loss scaling in mixed-precision training?

Quick Overview

Asks what loss scaling does in FP16 mixed-precision training and why training loops include it. Tests understanding of floating-point range limits, the chain rule in backpropagation, dynamic scale adjustment, the order of unscaling and gradient clipping, and how BF16 changes the picture.

What is the purpose of loss scaling in mixed-precision training?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What is the purpose of loss scaling in mixed-precision training? ```hint Look at the number format Compare the smallest positive value FP16 can represent with the size of typical activation gradients deep in a network. ``` ```hint Use the chain rule Ask what happens to every gradient in the backward pass if the loss is multiplied by a constant, and what has to happen before the weights are updated. ``` ### What a Strong Answer Covers - The numeric problem with FP16 gradients that loss scaling addresses - How scaling the loss moves gradients into range, and where unscaling happens relative to gradient clipping and the optimizer step - How the scale factor is chosen and adjusted during training, including what happens on overflow - How loss scaling fits with FP32 master weights, and how BF16 changes the need for it ### Follow-up Questions - Why must gradients be unscaled before gradient clipping? - Late in training, the scaler skips a step every few hundred iterations. What would you check? - Adam's update is roughly unchanged if every gradient is multiplied by a constant. Why is loss scaling still needed with Adam? - How does loss scaling work with gradient accumulation over several micro-batches?

Overview: Asks what loss scaling does in FP16 mixed-precision training and why training loops include it. Tests understanding of floating-point range limits, the chain rule in backpropagation, dynamic scale adjustment, the order of unscaling and gradient clipping, and how BF16 changes the picture.

Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

What is the purpose of loss scaling in mixed-precision training?

What a Strong Answer Covers Guidance

  • The numeric problem with FP16 gradients that loss scaling addresses
  • How scaling the loss moves gradients into range, and where unscaling happens relative to gradient clipping and the optimizer step
  • How the scale factor is chosen and adjusted during training, including what happens on overflow
  • How loss scaling fits with FP32 master weights, and how BF16 changes the need for it

Follow-up Questions Guidance

  • Why must gradients be unscaled before gradient clipping?
  • Late in training, the scaler skips a step every few hundred iterations. What would you check?
  • Adam's update is roughly unchanged if every gradient is multiplied by a constant. Why is loss scaling still needed with Adam?
  • How does loss scaling work with gradient accumulation over several micro-batches?