Grokfast: Accelerated Grokking by Amplifying Slow Gradients

Jaerin Lee, Bong Gyun Kang, Kihoon Kim, Kyoung Mu Lee
5/30/2024
cs.LGcs.AI

Official code: ironjr/grokfast (582 stars, MIT, last commit 2024-06-28). 1 more implementation below.

Abstract

One puzzling artifact in machine learning dubbed grokking is where delayed generalization is achieved tenfolds of iterations after near perfect overfitting to the training data. Focusing on the long delay itself on behalf of machine learning practitioners, our goal is to accelerate generalization of a model under grokking phenomenon. By regarding a series of gradients of a parameter over training iterations as a random signal over time, we can spectrally decompose the parameter trajectories under gradient descent into two components: the fast-varying, overfitting-yielding component and the slow-varying, generalization-inducing component. This analysis allows us to accelerate the grokking phenomenon more than $\times 50$ with only a few lines of code that amplifies the slow-varying components of gradients. The experiments show that our algorithm applies to diverse tasks involving images, languages, and graphs, enabling practical availability of this peculiar artifact of sudden generalization. Our code is available at https://github.com/ironjr/grokfast.

View on arXivView PDF

Code Implementations(2)

ironjr/grokfastOfficial100%
MIT

Official repository for the paper "Grokfast: Accelerated Grokking by Amplifying Slow Gradients"

58251PythonMay 30, 20242 years agoMIT
deep-learninggrokkingmachine-learningoptimizationsignal-processing
MIT

Explorations into the proposal from the paper "Grokfast, Accelerated Grokking by Amplifying Slow Gradients"

1049PythonJun 15, 20241 years agoMIT
artificial-intelligencedeep-learninggrokking

Similar Papers

Cite this paper

@article{lee2024grokfast,
  title  = {Grokfast: Accelerated Grokking by Amplifying Slow Gradients},
  author = {Jaerin Lee and Bong Gyun Kang and Kihoon Kim and Kyoung Mu Lee},
  year   = {2024},
  eprint = {2405.20233},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.20233v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.20233.svg)](https://codeofpaper.com/paper/2405.20233)

Discussion