Saved in:
Bibliographic Details
Main Authors: Gu, Zihan, Chen, Ruoyu, Zhang, Hua, Hu, Yue, Cao, Xiaochun
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2504.03162
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917983746523136
author Gu, Zihan
Chen, Ruoyu
Zhang, Hua
Hu, Yue
Cao, Xiaochun
author_facet Gu, Zihan
Chen, Ruoyu
Zhang, Hua
Hu, Yue
Cao, Xiaochun
contents Grokking, referring to the abrupt improvement in test accuracy after extended overfitting, offers valuable insights into the mechanisms of model generalization. Existing researches based on progress measures imply that grokking relies on understanding the optimization dynamics when the loss function is dominated solely by the weight decay term. However, we find that this optimization merely leads to token uniformity, which is not a sufficient condition for grokking. In this work, we investigate the grokking mechanism underlying the Transformer in the task of prime number operations. Based on theoretical analysis and experimental validation, we present the following insights: (i) The weight decay term encourages uniformity across all tokens in the embedding space when it is minimized. (ii) The occurrence of grokking is jointly determined by the uniformity of the embedding space and the distribution of the training dataset. Building on these insights, we provide a unified perspective for understanding various previously proposed progress measures and introduce a novel, concise, and effective progress measure that could trace the changes in test loss more accurately. Finally, to demonstrate the versatility of our theoretical framework, we design a dedicated dataset to validate our theory on ResNet-18, successfully showcasing the occurrence of grokking. The code is released at https://github.com/Qihuai27/Grokking-Insight.
format Preprint
id arxiv_https___arxiv_org_abs_2504_03162
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Beyond Progress Measures: Theoretical Insights into the Mechanism of Grokking
Gu, Zihan
Chen, Ruoyu
Zhang, Hua
Hu, Yue
Cao, Xiaochun
Machine Learning
Grokking, referring to the abrupt improvement in test accuracy after extended overfitting, offers valuable insights into the mechanisms of model generalization. Existing researches based on progress measures imply that grokking relies on understanding the optimization dynamics when the loss function is dominated solely by the weight decay term. However, we find that this optimization merely leads to token uniformity, which is not a sufficient condition for grokking. In this work, we investigate the grokking mechanism underlying the Transformer in the task of prime number operations. Based on theoretical analysis and experimental validation, we present the following insights: (i) The weight decay term encourages uniformity across all tokens in the embedding space when it is minimized. (ii) The occurrence of grokking is jointly determined by the uniformity of the embedding space and the distribution of the training dataset. Building on these insights, we provide a unified perspective for understanding various previously proposed progress measures and introduce a novel, concise, and effective progress measure that could trace the changes in test loss more accurately. Finally, to demonstrate the versatility of our theoretical framework, we design a dedicated dataset to validate our theory on ResNet-18, successfully showcasing the occurrence of grokking. The code is released at https://github.com/Qihuai27/Grokking-Insight.
title Beyond Progress Measures: Theoretical Insights into the Mechanism of Grokking
topic Machine Learning
url https://arxiv.org/abs/2504.03162