Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RAdam caches a learning-rate-dependent step size using only the parameter's step counter. Groups with the same betas can share that cache, so a later group can use the first group's learning rate. A parameter receiving its first gradient after a learning-rate change can also reuse a stale entry. Iterable groups with different betas have the same problem when they bypass the list-only constructor setup.
With learning rates 0.01 and 0.1, the second parameter's first coordinate becomes approximately 0.997 instead of 0.970 for a gradient of 0.3.
Change
Key each cache entry by every scalar that determines its value: step, beta1, beta2, and learning rate. The update equations and cache size are unchanged. Old checkpoints with integer-only keys naturally miss and recompute their entries.
Validation
Native CPU tests with Python 3.12.14 and PyTorch 2.15.0+cpu:
TestOptim::test_optimizer[RAdam_0..6]failures are the saved-state snapshot comparison in_test_state_dictat line 205: loaded moment tensors share storage with the input checkpoint and subsequent steps mutate them. The preceding resumed-parameter comparisons and the three benchmark cases plus neural-network case pass.git diff --check.CPU validation does not cover CUDA or the historical CI matrix. The repository's RAdam deprecation warnings remain unchanged.
The earlier #103 separated buffers for constructor lists with different betas; it did not include learning rates in the cache key or cover generator groups and delayed gradients.