Skip to content

Keep Schedule-Free iterates finite during zero-rate warmup - #282

Open
DiadkoShmek wants to merge 1 commit into
facebookresearch:mainfrom
DiadkoShmek:lezo3-schedule-free-zero-lr
Open

DiadkoShmek wants to merge 1 commit into
facebookresearch:mainfrom
DiadkoShmek:lezo3-schedule-free-zero-lr

Conversation

@DiadkoShmek

Copy link
Copy Markdown

An initial zero learning rate makes Schedule-Free Shampoo's cumulative averaging weight zero. The current lr_power / lr_sum calculation then produces NaN, which propagates into model parameters on the first optimizer step. A scheduler whose warmup starts at zero can trigger this with the supported CPU optimizer.

Keep the previous averaged iterate when the total weight is zero, then use the existing weighting formula once the first positive weight arrives. The coefficient remains a tensor and uses no host/device synchronization. Positive weights are not clamped to an epsilon.

The regression checks the public optimizer against explicit x/y/z recurrences from equations (3)–(5) and (23) of The Road Less Scheduled. It covers initial and later zero rates, powers 0/1/2, tiny positive rates, train/eval transitions, and a default-Shampoo checkpoint taken before the first nonzero rate.

Validation on CPU (Python 3.13.7, PyTorch 2.10.0):

  • Exact-base regression: 2 tests fail in 9 subcases; fixed regression passes, including the torch.compile(backend="eager") update path.
  • 216 native optimizer, state, config, and iterate-averaging tests pass with no skips.
  • Ruff 0.8.0 lint and usort 1.0.8 pass. The new test passes formatting; four pre-existing Ruff formatting hunks in the optimizer file are unchanged.
  • Seven paired CPU timing rounds put the tested 16x16 default-Shampoo update within noisy variation. The reduced identity-preconditioner path was about 24 microseconds (10%) slower, so this is a numerical correctness fix, with some overhead in that small case.

CUDA and the Inductor backend were not tested.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant