Which GradScaler settings matter when choosing float16 over bfloat16 for AMP training?
0 reputation · 06 Oct 2025, 11:52 UTC
0 reputation · 06 Oct 2025, 11:52 UTC
I'm setting up automatic mixed precision training with torch.autocast and torch.cuda.amp.GradScaler and want to make a deliberate choice between two documented configurations: float16 autocast with gradient scaling, or bfloat16 autocast without it. My understanding is that bfloat16's wider exponent range usually makes the scaler unnecessary, while float16 needs scaling to avoid gradient underflow.
What I can't resolve from the documentation alone is how much the scaler's tuning knobs actually matter. GradScaler exposes init_scale, growth_interval, and backoff_factor, and it dynamically raises the scale after successful iterations and backs off when infs or NaNs appear in gradients. The defaults presumably work for common cases, but it's unclear when a model (e.g., one with very small gradients or loss spikes) justifies changing them, and what symptoms indicate the defaults are hurting convergence rather than helping.
Assume a recent PyTorch release on an Ampere-class GPU; I know the AMP API signatures have shifted across versions, so answers should note version assumptions.
Specifically:
init_scale, or is it purely trial and error per model?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.