Grokfast
Project description
Grokfast - Pytorch (wip)
Explorations into "Grokfast, Accelerated Grokking by Amplifying Slow Gradients", out of Seoul National University in Korea. In particular, will compare it with NAdam on modular addition as well as a few other tasks, since I am curious why those experiments are left out of the paper. If it holds up, will polish it up into a nice package for quick use.
The official repository can be found here
Install
$ pip install grokfast-pytorch
Usage
import torch
from torch import nn
# toy model
model = nn.Linear(10, 1)
# import GrokFastAdamW and instantiate with parameters
from grokfast_pytorch import GrokFastAdamW
opt = GrokFastAdamW(
model.parameters(),
lr = 1e-4,
weight_decay = 1e-2
)
# forward and backwards
loss = model(torch.randn(10))
loss.backward()
# optimizer step
opt.step()
opt.zero_grad()
Todo
- run all experiments on small transformer
- modular addition
- pathfinder-x
- run against nadam and some other optimizers
- see if
exp_avgcould be repurposed for amplifying slow grads
- add the foreach version only if above experiments turn out well
Citations
@inproceedings{Lee2024GrokfastAG,
title = {Grokfast: Accelerated Grokking by Amplifying Slow Gradients},
author = {Jaerin Lee and Bong Gyun Kang and Kihoon Kim and Kyoung Mu Lee},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:270123846}
}
@misc{kumar2024maintaining,
title={Maintaining Plasticity in Continual Learning via Regenerative Regularization},
author={Saurabh Kumar and Henrik Marklund and Benjamin Van Roy},
year={2024},
url={https://openreview.net/forum?id=lyoOWX0e0O}
}
@inproceedings{anonymous2024the,
title = {The Complexity Dynamics of Grokking},
author = {Anonymous},
booktitle = {Submitted to The Thirteenth International Conference on Learning Representations},
year = {2024},
url = {https://openreview.net/forum?id=07N9jCfIE4},
note = {under review}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grokfast_pytorch-0.0.11.tar.gz.
File metadata
- Download URL: grokfast_pytorch-0.0.11.tar.gz
- Upload date:
- Size: 146.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddd058ec2c0828f3ae26e8c23c0146cd0b8157864c77187368e11e1042abed84
|
|
| MD5 |
5c3ad081c6a1951a4ef5a8cc695e1337
|
|
| BLAKE2b-256 |
b1a1e30d47919b92c71655dec825789a948ebb820a73d2b9986a4ab036f85313
|
File details
Details for the file grokfast_pytorch-0.0.11-py3-none-any.whl.
File metadata
- Download URL: grokfast_pytorch-0.0.11-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0eb6390441c77d6c16145e433043500e774c7f62ccafdcec02af4bd5aa59d01
|
|
| MD5 |
71e1ae60fbc49ba731813b2f39907b70
|
|
| BLAKE2b-256 |
a949432a7718e176528ff7d5eec86690201ff7792a7c203b8fd73c87fc7cbdc4
|