Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regularization API for preference comparisons #481

Merged
merged 120 commits into from
Sep 14, 2022

Conversation

Rocamonde
Copy link
Member

@Rocamonde Rocamonde commented Jul 20, 2022

Fixes #461.

  • Support seeding via generator
  • Implement base class update params
  • Add regularization param change to logger
  • Add loss_regularize
  • Add weight_regularize
  • Add support for passing general regularization classes in preference_comparisons
  • Add tests

levmckinney and others added 30 commits July 8, 2022 23:05
Co-authored-by: Adam Gleave <adam@gleave.me>
… default when using a reward ensemble with preference comparison it will wrap it in a add std wrapper.
…t the initalizations of the ensemble members are different.
…edict processed. RewardNetWrapper now implments predict_processed to ensure this is the default behavour.
Copy link
Member

@AdamGleave AdamGleave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory approach seems good! It's an easy to use API. The actual implementation is a little trickier to follow over direct instantiation. But overall I think it's the least-bad option.

The main alternative would be to just make the callee to preference comparisons responsible for passing in a non-empty custom_logger and create the optimizer. This isn't crazy -- the scripts are already creating a custom logger, and making the callee create the optimizer does at least give flexibility as to what optimization class to use. But it seems like it's adding a lot of friction for people who want to just programatically use the Python API, whereas the regularization factory is easy to use.

Another approach would have been to just let you instantiate the regularizer without specifying optimizer or logger, and have this be something that's set after instantiation (with some check that they have been set before calling .regularize()). But this seems more error prone: it's nice to have instantiation mean the object is actually ready to use.

There's a few small comments outstanding (e.g. adding tests), but once those addressed I think we should be good to go -- just request a re-review once it's ready to look at again.

@Rocamonde
Copy link
Member Author

Added all the requested changes, except the tests for the .backward(), which I moved off to a new issue, #562 . This is because I read through the tests and I found this is a problem that we should address more generally and probably deserves a separate PR. We only really check for progress in 3 algorithms as far as I could find.

Copy link
Member

@AdamGleave AdamGleave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Note I made a couple of minor comments to adjust phrasing of docstring -- please review those and merge if happy.

@Rocamonde Rocamonde merged commit d453247 into master Sep 14, 2022
@Rocamonde Rocamonde deleted the dynamic-l2-regularization branch September 14, 2022 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Preference Comparison] L2 regularization with dynamic regularization coefficient
4 participants