---
title: "AMP Training: A Completed Backward Pass Can Still Skip the Update"
description: "Leviathan Systems — Technical content Published 2026-10-21; updated 2026-10-21."
canonical: "https://www.leviathansystems.co/articles/pytorch-amp-gradient-scaling-skipped-optimizer-update"
last-updated: "2026-10-21"
---

# AMP Training: A Completed Backward Pass Can Still Skip the Update

Leviathan Systems — Technical content
Published 2026-10-21; updated 2026-10-21.

A completed forward-and-backward attempt does not establish that the optimizer updated the parameters. In PyTorch 2.14's ordinary enabled GradScaler path, a nonfinite-gradient check can prevent that update. Compare mixed-precision training offers by the numerical path, the optimizer decisions and the required training outcome. AMP-18 shows three completed attempts producing one allowed update, even though the parameter and its retained gradient buffer are FP32.

## Follow the gradient through its actual representations

A gradient describes how the loss changes with a trained parameter. Some backward operations produce FP16 values, whose small magnitudes can underflow to zero. Once a contribution becomes zero in that representation, a later wider buffer cannot reconstruct its original value. PyTorch 2.14 explains gradient scaling as multiplying the loss by a scale factor so that the gradients flowing backward have larger magnitudes.

Before an ordinary optimizer uses the resulting parameter gradients, unscaling divides out that factor. In an ideal finite linear illustration, a derivative g becomes s × g during scaled backward computation and returns to g after division by s. The scale protects representation along the path; retaining the scaled gradient at the optimizer would instead change the intended update.

The representations along that path need separate names. An FP32 learned parameter can receive its gradient through an FP16 intermediate and retain the resulting gradient in an FP32 buffer. The wider final buffer does not give the earlier intermediate an FP32 range. Conversely, a large loss value stored in FP32 does not overflow merely because its magnitude exceeds the largest finite FP16 value.

Autocast chooses numerical types for eligible operations. GradScaler handles scaling, gradient checks and the ordinary update decision. PyTorch documents them as separate mechanisms; the phrase AMP enabled leaves their actual use and operation coverage to be established.

References: [AMP](https://docs.pytorch.org/docs/2.14/amp.html#gradient-scaling), [EXAMPLES](https://docs.pytorch.org/docs/2.14/notes/amp_examples.html)

## The scaler can finish its step without invoking the optimizer

The standard GradScaler path documented for PyTorch 2.14 checks the optimizer's parameter gradients for infinities and NaNs while unscaling them. When these nonfinite values are found, the underlying optimizer step is skipped. Finite gradients allow that ordinary optimizer invocation to proceed.

The tagged v2.14.0 implementation makes the decision explicit in _maybe_opt_step: it invokes the optimizer only when the recorded nonfinite checks sum to zero. The scaler can therefore return from its own step while the optimizer was never called. A count of scaler-step calls cannot be substituted for a count of underlying optimizer invocations.

The subsequent scale update responds to the recorded checks. With the backoff factor used in AMP-18, a detected nonfinite value halves the scale for the next attempt. This changes a later backward computation; it does not repair the gradients from the attempt just skipped. The implementation also supports scale growth after an applicable run of unskipped attempts. No growth occurs within the three attempts stipulated below.

This explanation concerns the enabled scaler's ordinary optimizer branch. The same source has a separate path for optimizers with custom AMP scale handling, including fused implementations. Their behavior needs its own applicable contract rather than being inferred from the ordinary branch.

References: [EXAMPLES](https://docs.pytorch.org/docs/2.14/notes/amp_examples.html), [SCALER](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py)

## AMP-18: two overflows leave the parameter at 5

AMP-18 is a fictional scalar illustration, with no model or GPU run. Stipulate one FP32 parameter initially equal to 5 and an FP32 retained parameter-gradient buffer. Use the enabled GradScaler's standard path and plain minimizing SGD, with no momentum, weight decay, custom or fused scale handling, gradient accumulation, or other parameter mutation. Each attempt starts with cleared earlier gradients and has an ideal unscaled derivative of 2.

The stipulated backward path contains an FP16 intermediate whose exact scaled derivative would be 2s, where s is that attempt's scale. Round that intermediate to FP16 using round-to-nearest, ties-to-even. In the first two attempts, its infinity propagates to the parameter-gradient buffer; in the third, the finite value reaches that buffer unchanged. These are explicit path assumptions, not predictions for an arbitrary network.

Begin at scale 65,536, with a backoff factor of 0.5 and no growth during these attempts. At the first scale, the exact intermediate would be 2 × 65,536 = 131,072. It overflows the stipulated FP16 conversion, so the nonfinite check prevents the ordinary optimizer invocation. The parameter remains 5 and the next scale is 32,768.

At scale 32,768, the next exact intermediate would be 65,536. This also rounds to infinity in the stipulated FP16 path. The ordinary optimizer is again skipped, the parameter remains 5 and the next scale is 16,384. PyTorch's documented largest finite FP16 value is 65,504; the example specifically uses the stated rounding rule, rather than assuming every real number slightly above that finite maximum must round to infinity.

References: [AMP](https://docs.pytorch.org/docs/2.14/amp.html#gradient-scaling), [SCALER](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py)

AMP-18: stipulated attempts and the ordinary optimizer decision
| Attempt | Scale | Ideal scaled FP16 intermediate | Check and ordinary optimizer | Parameter after | Source |
| --- | --- | --- | --- | --- | --- |
| 1 | 65,536 | 131,072 | Nonfinite; skipped | 5 | AMP, SCALER |
| 2 | 32,768 | 65,536 | Nonfinite; skipped | 5 | AMP, SCALER |
| 3 | 16,384 | 32,768 | Finite; invoked | 3 | SCALER, SGD |
Invented numerical premises, not execution results or recommended settings. Attempt 3 uses the separate learning-rate premise explained below.

## The third attempt unscales to 2 and updates to 3

At scale 16,384, the exact scaled intermediate is 32,768, an exactly representable finite FP16 value. Under the stipulated path, it reaches the FP32 parameter-gradient buffer. Unscaling gives 32,768 ÷ 16,384 = 2. With no nonfinite gradient found, the standard optimizer invocation proceeds.

For this illustration only, stipulate a learning rate of 1. Plain minimizing SGD without momentum or weight decay subtracts learning rate × gradient from the parameter. The update is therefore 5 − 1 × 2 = 3. These exact powers of two and small integer values keep the arithmetic transparent. The learning rate, initial scale and three-attempt behavior are explanatory premises, not settings selected for a real training job.

The first two attempts cannot obtain that finite derivative by dividing their already infinite gradients by the scale. Infinity divided by either positive finite scale remains infinity. Moving it into FP32 preserves the infinity, not the finite value that overflowed earlier. Backoff matters because a new computation at a different scale can stay finite, as the third attempt is stipulated to do.

The example contains three completed forward-and-backward attempts, two skipped ordinary optimizer invocations and one invocation that changes this scalar parameter. It does not establish that lower scales are universally safe: the purpose of scaling also includes preserving small gradients against underflow. PyTorch explicitly permits the scale to fall below 1 and warns that FP16 AMP is not compatible with every model. No universally suitable scale follows from AMP-18.

References: [AMP](https://docs.pytorch.org/docs/2.14/amp.html#gradient-scaling), [SCALER](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py), [SGD](https://docs.pytorch.org/docs/2.14/generated/torch.optim.SGD.html)

## Compare the work behind three reported iterations

Suppose two fictional training offers both report three completed forward-and-backward attempts for an agreed workload. Offer A supplies that count and an AMP label. Offer B also identifies the enabled standard scaler path, the relevant intermediate and retained-gradient representations, the scales and check outcomes, and the underlying optimizer decisions represented by its evidence.

A's description leaves the amount of optimizer work unresolved. It could not substantiate three parameter updates merely by reporting three backward completions. B makes the distinction inspectable: if its supplied evidence follows AMP-18, it represents one ordinary update and a final scalar value of 3. The detail in the proposal must still correspond to the computation actually delivered; a more detailed description alone is not evidence of a performed run.

For the purchase comparison, keep the software and model revision, optimizer contract, data and loss definition, intended update boundary, numerical path and supplied outcomes connected. Have the evaluating software team explain which reported attempts reached that boundary and which underlying optimizer invocations proceeded. This resolves the specific missing meaning in an iteration count without selecting an operating method or a preferred scale.

An invocation count still does not establish training quality. A finite optimizer step can leave some parameters unchanged, and useful progress depends on the actual model, objective and accepted outcome. AMP-18 contains no convergence, accuracy, timing, energy or cost result. A throughput comparison must therefore retain the required outcome and the complete work represented by its numerator and elapsed interval. Three attempts per second would be a different quantity from three useful accepted updates per second.

References: [EXAMPLES](https://docs.pytorch.org/docs/2.14/notes/amp_examples.html), [SCALER](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py)

## Keep accumulation, multiple optimizers and return values specific

Gradient accumulation deliberately combines contributions from several microbatches before a planned update boundary. A nonfinite-gradient skip is a different event: a scheduled ordinary optimizer invocation does not proceed because its check failed. The related microbatch guide explains the effective-batch population and weighting; AMP-18 has no accumulation and does not repeat that counting example.

PyTorch's AMP examples also distinguish multiple optimizers: each checks its own gradients and can make an independent skip decision. One optimizer proceeding does not establish that another proceeded. AMP-18 uses one optimizer so that its three decisions refer to the same parameter and update boundary.

A step's return value supplies no universal Boolean confirmation. In the standard implementation, a skipped path returns None; an invoked optimizer supplies its own return value, which can also be None. Interpret any claimed update evidence using the applicable optimizer/scaler contract. A return alone cannot establish that every parameter changed.

The related FP8 guide separates operands, accumulators and retained arrays; the evaluation-mode guide separates module behavior from gradient recording. Those explanations complement this decision without establishing whether an ordinary optimizer invocation survived its nonfinite check. Keep numerical acceptance with the appointed model and software owners.

References: [EXAMPLES](https://docs.pytorch.org/docs/2.14/notes/amp_examples.html), [SCALER](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py)

## Connect selected equipment to its physical deployment scope

If the selected training equipment also needs receiving, rack integration, onsite installation or IT cabling, Leviathan's Complete Physical Infrastructure Deployment service provides a route to discuss those physical stages and their handoff records. Use the related service and project inquiry with a nonconfidential equipment list, quantities, destination, rack arrangement, required stages and target window to confirm scope, requirements and availability.

Model operation, numerical policy and training acceptance remain with their appointed software teams. The physical deployment discussion does not offer AMP tuning or establish that a training implementation meets its required outcome.

## Primary sources

- [AMP — PyTorch 2.14: Automatic Mixed Precision, Gradient Scaling](https://docs.pytorch.org/docs/2.14/amp.html#gradient-scaling). Checked 2026-10-21. The Gradient Scaling section explains small FP16 gradient underflow, scaling/unscaling, the finite FP16 maximum and model/scale limits. It supplies no workload-specific safe scale or result.
- [EXAMPLES — PyTorch 2.14: Automatic Mixed Precision examples](https://docs.pytorch.org/docs/2.14/notes/amp_examples.html). Checked 2026-10-21. Typical Mixed Precision Training, Gradient accumulation and Working with Multiple Models, Losses, and Optimizers define the ordinary nonfinite skip and the scope of update decisions. Their operational examples are not prescribed here.
- [SCALER — PyTorch v2.14.0: torch/amp/grad_scaler.py](https://github.com/pytorch/pytorch/blob/v2.14.0/torch/amp/grad_scaler.py). Checked 2026-10-21. GradScaler docstring, _unscale_grads_, unscale_, _maybe_opt_step, step and update distinguish the standard gate, custom scale-aware branch, backoff and return values. AMP-18 is an original stipulated illustration, not execution of this code.
- [SGD — PyTorch 2.14: torch.optim.SGD](https://docs.pytorch.org/docs/2.14/generated/torch.optim.SGD.html). Checked 2026-10-21. The documented minimizing update reduces to parameter minus learning rate times gradient under the example's no-momentum, no-weight-decay premises. The chosen values are not recommendations.

## Related Leviathan resources

- [Gradient accumulation and effective training batches](/articles/gpu-training-microbatch-gradient-accumulation)
- [FP8 operands, accumulators and retained training arrays](/articles/fp8-hardware-support-versus-mixed-precision-execution)
- [Evaluation behavior and autograd recording](/articles/pytorch-evaluation-mode-versus-autograd-recording)
- [Complete Physical Infrastructure Deployment](/services/turnkey-gpu-deployment)
- [Discuss physical deployment of selected equipment](/contact?service=turnkey-gpu-deployment&from=%2Farticles%2Fpytorch-amp-gradient-scaling-skipped-optimizer-update)

## Does selected training equipment need physical deployment?

Share a nonconfidential equipment, destination, receiving or installation scope and physical handoff outline to discuss requirements and availability.

[Discuss the scope](/contact?service=turnkey-gpu-deployment&from=/articles/pytorch-amp-gradient-scaling-skipped-optimizer-update)
