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

StableMax/⊥Grad compatibility #1850

Closed
HydrogenBombaklot opened this issue Feb 9, 2025 · 2 comments
Closed

StableMax/⊥Grad compatibility #1850

HydrogenBombaklot opened this issue Feb 9, 2025 · 2 comments

Comments

@HydrogenBombaklot
Copy link

HydrogenBombaklot commented Feb 9, 2025

StableMax and ⊥Grad are new LLM training algorithms introduced in the Grokking at the Edge of Numerical Stability paper. Here is their repo.

These algorithms significantly boost generalization speed, resulting in faster, more efficient training and fine-tuning.

Can I drop-in these algorithms for MLX training/fine-tuning or do we need to integrate them more formally into MLX?

@angeloskath
Copy link
Member

These look cool! I think the orthograd optimizer would be more suitable as a PR to https://github.com/stockeh/mlx-optimizers . Regarding stable max I think it should be fairly easy to add to any project as follows

@partial(mx.compile, shapeless=True)
def stablemax(x, axis=-1):
    x = mx.where(x < 0, -mx.log1p(-x), mx.log1p(x))
    return mx.softmax(x, axis=axis)

@HydrogenBombaklot
Copy link
Author

Thank you kind stranger!

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

No branches or pull requests

2 participants