Skip to main content

Pytorch Lion optimizer with updated and advanced features.

Project description

Advanced Lion Optimizer

This repository provides an enhanced implementation of the Lion optimizer, incorporating several state-of-the-art techniques to improve performance, stability, and memory efficiency. It includes two base variants: the original Lion and D-Adapt-Lion.


Features

1. Fused Backward Pass

Reduces memory overhead by hooking gradients as they become available during the backward pass, eliminating the need to store them explicitly via the step_parameter method.


2. Stochastic Rounding for BF16 Training

Achieves FP32-level performance in BF16 training by implementing stochastic rounding for the final update. This allows for faster training with lower-precision data types without sacrificing accuracy.


3. Gradient Orthogonalization

Improves model generalization and enhances numerical stability by modifying gradients to be orthogonal to the parameters.


4. Variance Reduction

Theoretically accelerates the convergence speed of Lion by 33.33% while making training more stable in noisy, small-batch environments. The main trade-off is the requirement of an additional state to store gradients from the previous step.


5. Cautious Lion Variant

Includes the "Cautious" variant of Lion, an approach introduced to refine the optimization process and improve training outcomes.


6. Per-Parameter Gradient Norm Clipping

Enhances training stability by applying gradient norm clipping on a per-parameter basis, preventing erratic updates from large gradients.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adv_lion-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adv_lion-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file adv_lion-0.1.0.tar.gz.

File metadata

  • Download URL: adv_lion-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for adv_lion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 338e2d37f297668397bd4c2dd02c644eaad9d2cfe62011262363d3330f1c9964
MD5 5ee6e0a19519cdae469f58c5be92d701
BLAKE2b-256 214d56007bd13e6d025342fe9a048b3a1bf9d1f922625f1212feb6ef6e099c82

See more details on using hashes here.

File details

Details for the file adv_lion-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: adv_lion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for adv_lion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a65c2c648d1f87ccb68bd33f600cff1a1344e1bfa253f0b2b553865183855c1
MD5 2ad26cf422487ec42e538c85cb94cd66
BLAKE2b-256 8f76b9adec36f53f824b5959690f5e323dcdfb61c6764e68ba3c51dd0f7222f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page