﻿# Mixed-precision training: why loss scaling acts on gradients

Loss scaling protects small gradients in mixed-precision training. Learn scaling, unscaling, overflow handling and the distinction from changing the training objective.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/mixed-precision-loss-scaling-gradients/
Language: en

Mixed-precision training uses numerical formats with different representable ranges and precision. Some gradients can become too small for a chosen low-precision path. Loss scaling addresses that representation problem by multiplying the loss before backpropagation and accounting for the multiplier before the optimizer update. The order of operations is central to the mechanism.

## A multiplier propagates through differentiation

Multiplying a scalar loss by a positive scale multiplies its gradients by that scale in exact arithmetic. Larger intermediate gradient magnitudes can avoid losing some small values in a limited-range representation. This does not increase the information contained in the data or make the mathematical objective better. It changes the numerical path used to approximate its derivatives. The scale must be known so that the intended unscaled gradient can be recovered before an optimizer interprets its magnitude, rather than silently turning scaling into a learning-rate modification.

## Unscaling restores the intended magnitude

Imagine a gradient component that would be multiplied by a large declared factor during backward. Dividing the resulting accumulated gradient by that factor restores its intended magnitude in ideal arithmetic. The benefit lies in which intermediate operations avoided representational loss, so exact recovery of values already rounded away is not promised. Operations such as norm clipping must be placed according to the framework’s unscaling contract. Clipping a scaled gradient at an unscaled threshold would inadvertently impose a different effective limit on the true gradient.

## Overflow requires a separate decision

A factor that protects small values can make other values too large for the numerical range. Dynamic scaling mechanisms can inspect non-finite gradients, adjust the scale and avoid applying an invalid update according to their documented policy. This is an execution-control mechanism, not a proof that every non-finite value originates from scaling. Undefined model arithmetic, malformed inputs or an unstable objective can create their own problems. Record the decision to skip or apply an update so that training progress and scheduler behavior are interpretable.

## Match the policy to the actual numeric path

Different formats and autocast policies have different range properties; a scaling requirement should not be inferred from the phrase mixed precision alone. Establish which operations use which format, where master parameters and optimizer state live, and when gradients are converted. A controlled fixture comparing an unscaled high-precision path with the scaled path can expose a scaling mistake under a declared tolerance. Monitoring both the multiplier and valid optimizer updates explains the numerical policy more clearly than reporting a single precision label for the whole training run.

## Primary research and implementation references

- [Mixed Precision Training](https://arxiv.org/abs/1710.03740).

- [PyTorch: Autograd Mechanics](https://docs.pytorch.org/docs/2.15/notes/autograd.html).

- [PyTorch: Automatic Mixed Precision Examples](https://docs.pytorch.org/docs/2.15/notes/amp_examples.html).

## Related engineering context

[Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/).
