Preprint / Version 1

Grokking and Phase Transitions: A Pedagogical Approach to the Statistical Physics of Machine Learning

##article.authors##

  • João Pedro Sansão Federal University of São João del-Rei image/svg+xml https://orcid.org/0000-0003-0095-2629
    • Conceptualization
    • Data Curation
    • Formal Analysis
    • Investigation
    • Methodology
    • Validation
    • Visualization
    • Writing – Original Draft Preparation
    • Writing – Review & Editing

DOI:

https://doi.org/10.1590/SciELOPreprints.16570

Keywords:

Grokking, Statistical Physics, Neural Networks, Phase Transition, Deep Learning, Machine Learning

Abstract

The phenomenon of grokking in artificial neural networks describes the counter-intuitive situation in which a model, after completely overfitting the training data for a long period, suddenly achieves perfect generalization on unseen test data. In this work, we present a pedagogical review of this phenomenon from the perspective of Statistical Physics, aimed at undergraduate education in physics and related areas. We demonstrate how the learning process can be mapped as a first-order dynamic phase transition, where the validation accuracy plays the role of an order parameter, weight decay acts as a restrictive harmonic potential, and the random weight initialization combined with the chaotic/stochastic dynamic of the optimizer under finite learning rates emulate an effective temperature whose inversion favors low-energy ordered states. To make the concepts concrete, we provide reproducible Python codes for training and analyzing Multilayer Perceptron (MLP) and Transformer networks applied to three distinct experiments: modular arithmetic, the sparse parity problem, and modular energy conservation. We show that generalization emerges from discovering hidden symmetries in the dataset, manifested by the periodic alignment of weights in the form of circular trigonometric representations (analyzed via Fourier Transform) and by the concentric spatial organization of degenerate energy states in the embedding space.

Downloads

Download data is not yet available.

Submitted

06/16/2026

Posted

09/09/2026

How to Cite

Grokking and Phase Transitions: A Pedagogical Approach to the Statistical Physics of Machine Learning. (2026). In SciELO Preprints. https://doi.org/10.1590/SciELOPreprints.16570

Section

Exact and Earth Sciences

Plaudit

Data statement

  • The research data is available in one or more data repository(ies)