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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizer "Lion" in Symbolic Discovery of Optimization Algorithms #94904

Open
towzeur opened this issue Feb 15, 2023 · 1 comment
Open

Optimizer "Lion" in Symbolic Discovery of Optimization Algorithms #94904

towzeur opened this issue Feb 15, 2023 · 1 comment
Labels
module: optimizer Related to torch.optim needs research We need to decide whether or not this merits inclusion, based on research world triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@towzeur
Copy link

towzeur commented Feb 15, 2023

馃殌 The feature, motivation and pitch

A new optimizer "Lion" was proposed in Symbolic Discovery of Optimization Algorithms
https://arxiv.org/pdf/2302.06675.pdf

It is simple, memory efficient and have a faster runtime.
I think it can be a great addition to the Pytorch optimizer algorithms' collection as
it directly compares to AdamW which is already available.

the optimizer is a single file
https://github.com/google/automl/blob/master/lion/lion_pytorch.py

Pseudo Code:
$$
\begin{algorithm}
\caption{\name{} Lion}
\begin{algorithmic}
\State \textbf{given} $\beta_1$, $\beta_2$, $\lambda$, $\eta$, $f$
\State \textbf{initialize} $\theta_0$, $m_0\leftarrow 0$
\While{$\theta_t$ not converged}
\State $g_t \leftarrow \nabla_\theta f(\theta_{t-1})$
\State \textbf{update model parameters}
\State $c_t \leftarrow \beta_1 m_{t-1} + (1-\beta_1)g_t$
\State $\theta_t \leftarrow \theta_{t-1} - \eta_t(\text{sign}(c_t) + \lambda\theta_{t-1})$
\State \textbf{update EMA of $g_t$}
\State $m_t \leftarrow \beta_2 m_{t-1} + (1 - \beta_2)g_t$
\EndWhile
\State \textbf{return} $\theta_t$
\end{algorithmic}
\label{alg:ours}
\end{algorithm}
$$

Alternatives

No response

Additional context

No response

cc @vincentqb @jbschlosser @albanD @janeyx99

@ngimel ngimel added module: optimizer Related to torch.optim triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Feb 16, 2023
@albanD albanD added the needs research We need to decide whether or not this merits inclusion, based on research world label Feb 16, 2023
@janeyx99
Copy link
Contributor

Thanks for raising this up! PyTorch Core has some pretty strict rules when it comes to adding a new Optimizer or Module: https://github.com/pytorch/pytorch/wiki/Developer-FAQ#i-have-a-new-function-or-feature-id-like-to-add-to-pytorch-should-it-be-in-pytorch-core-or-a-library-like-torchvision

In particular, this work might be a bit too new to be considered to be added into core just now, and the way to go may be to put it in a separate library. Please don't hesitate to let us know if there is any low level feature that you're missing to implement this though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: optimizer Related to torch.optim needs research We need to decide whether or not this merits inclusion, based on research world triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants