Add cautious weight decay transformation#1611
Open
tinker495 wants to merge 1 commit intogoogle-deepmind:mainfrom
Open
Add cautious weight decay transformation#1611tinker495 wants to merge 1 commit intogoogle-deepmind:mainfrom
tinker495 wants to merge 1 commit intogoogle-deepmind:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
4a335cb to
cee498b
Compare
Implement `add_cautious_weight_decay`, which applies weight decay only when the sign of the update and parameter are aligned (Chen et al., 2025). Reference: https://arxiv.org/abs/2510.12402
cee498b to
9fe1507
Compare
Collaborator
|
Hey, we really appreciate the contribution! This is a lot of code which might be difficult to maintain with our small team of maintainers and so this might take us a while to merge. I'll try to get to this as soon as possible, thanks! (As I wrote in your other PR) |
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.
Summary
add_cautious_weight_decaytooptax.contrib, implementing Cautious Weight Decay (Chen et al., 2025)sign(update) == sign(param), preventing decay from conflicting with the gradient directionChanges
optax/contrib/_cwd.pyadd_cautious_weight_decaytransformationoptax/contrib/_cwd_test.pyoptax/contrib/__init__.pyadd_cautious_weight_decayoptax/contrib/_common_test.pyTest plan
pytest optax/contrib/_cwd_test.py— dedicated unit testspytest optax/contrib/_common_test.py— shared contrib tests with CWD as wrapperrufflint check passes