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.
- References:
3. Gradient Orthogonalization
Improves model generalization and enhances numerical stability by modifying gradients to be orthogonal to the parameters.
- Reference: "Grokking at the Edge of Numerical Stability"
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.
- Reference: "Lions and Muons: Optimization via Stochastic Frank-Wolfe" (The paper uses a clipping value of 4-5).
Metadata
Release files for adv-lion 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adv_lion-0.1.1.tar.gz | 12.5 kB | Without provenance | Details for adv_lion-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adv_lion-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for adv_lion-0.1.1-py3-none-any.whl |
Total release size: 26.5 kB
Release files / adv_lion-0.1.1.tar.gz
| Download URL | adv_lion-0.1.1.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
214e6b26c84ec502aeb396439d4bde2d908700c44c0f3cd753daaef0fe13b744
|
|
BLAKE2b-256 checksum How to use checksums |
829368d424a66151232316f6a0f4d6fccb67641676f05161c930899e52038d79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / adv_lion-0.1.1-py3-none-any.whl
| Download URL | adv_lion-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
910aa94b15052e516aa25c82a69d1b034e1ff6652de8885e563d89070625d0cb
|
|
BLAKE2b-256 checksum How to use checksums |
038ce9d7a399148114391c9960177ca52db044915d29585b330ea47f53e4e1b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Security for adv-lion 0.1.1
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.