Skip to main content

D-Adaptation

Downloads Downloads

Learning rate free learning for SGD, AdaGrad and Adam!

by Aaron Defazio and Konstantin Mishchenko (Arxiv)

pip install dadaptation

NEW V3.0 release uses an improved algorithm that may give different results from past versions. The old version is still availiable under experimental/d_adapt_adam_preprint.

NEW: Prodigy

We have recently released the Prodigy method, which grows the adapted learning rate faster than D-Adaptation in theory and practice. Try it out if D-Adaptation is under-estimating the learning rate.

How To Cite

If you use D-Adaptation in a publication, please cite our work as

@ARTICLE{defazio2023dadapt,
author = {Aaron Defazio and Konstantin Mishchenko},
title = {Learning-Rate-Free Learning by D-Adaptation},
journal = {The 40th International Conference on Machine Learning (ICML 2023)},
year = {2023}
}

Details

The provided Pytorch Optimizer classes are drop-in replacements, either copy into your project or use via pip with dadaptation.DAdaptSGD, dadaptation.DAdaptAdam or dadaptation.DAdaptAdaGrad.

  • Set the LR parameter to 1.0. This parameter is not ignored. Setting it larger to smaller will directly scale up or down the D-Adapted learning rate estimate.
  • Different per-layer learning rates can be achieved by setting the layer_scale value in each parameter-group. It defaults to 1.0, and scales each layer's learning rate relative to the other layers.
  • Use the same learning rate scheduler you would normally use on the problem.
  • The Adam variant supports AdamW style weight decay, just set decouple=True. It is not turned on by default, so if you are replacing your adam implementation, make sure you use decoupled if necessary.
  • It may be necessary to use larger weight decay than you would normally use, try a factor of 2 or 4 bigger if you see overfitting. D-Adaptation uses larger learning rates than people typically hand-choose, in some cases that requires more decay.
  • Use the log_every setting to see the learning rate being used (d*lr) and the current D bound.
  • Only the AdaGrad version supports sparse gradients. It does not adapt as efficiently as the other variants and should be considered experimental.

Change Log

Version 3.2

  • Added support for layer-wise scaling to DAdaptAdam.

Version 3.0

  • Major improvements to DAdaptAdam, improving the performance particularly on Transformer models. This variant may behave differently in practice. The old version is availiable under experimental/d_adapt_adam_preprint if you wish to continue to use it.
  • The IP variant is now the main variant of the method.
  • Added Lion. This is highly experimental. Feedback on it's performance is welcome.

Version 2.0

  • Added Adan - should still be considered experimental.
  • Added support for PyTorch's Fully Sharded Data Parallel.
  • Improved support of edge cases such as learning rate zero.
  • Improved logging - uses Python logging rather than print statements

Experimental results

vision vision vision vision vision vision vision vision vision vision

License

See the License file.

Metadata

Release files for dadaptation 3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dadaptation 3.2
File Size Uploaded Provenance Actions
dadaptation-3.2.tar.gz 13.8 kB Without provenance Details for dadaptation-3.2.tar.gz

Release files / dadaptation-3.2.tar.gz

Download URL dadaptation-3.2.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de8e8289d56bfdee0c8e3ca353143295d8a48363bcb02d6868a708354b47ccc0
BLAKE2b-256 checksum
How to use checksums
d646d6fb2546c58a1abdd804ad5c8a1a53314a669fbb64ca97281931942928fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.3

Security for dadaptation 3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page