The GradScaler implosion: how filtered-out NaN gradients became NaN weights
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
The author traces why PyTorch's GradScaler, which is documented as skipping optimizer steps when gradients contain inf or NaN, instead ended up turning a weight-tied model's weights into NaNs during mixed-precision training. Their logged parameter norms stayed finite until one step, then all went NaN at once.