How Large Must a Model Be to Grok? A competition between memorisation and generalisation timescales

Yiding Song, Hanming YeNeurIPS 2026

TL;DR

Why do neural networks sometimes memorize a training set almost instantly, linger in overfitting purgatory for thousands of epochs, and then suddenly learn the true underlying rule—a phenomenon known as "grokking"? This paper reveals that whether a model groks isn't just about having enough parameters to memorize the data; it's a race between two distinct clocks: the speed of memorization and the speed of generalization. By measuring these two timescales independently, the authors can predict the model size where grokking begins—and even forecast datasets where grokking disappears entirely.

What Problem Does This Paper Address?

In machine learning, grokking is delayed generalization: training accuracy hits 100% early on, while test accuracy stays flat near random chance before abruptly shooting up much later in training.

We know model size plays a role in grokking, and a natural intuition is that grokking starts as soon as a neural network has enough information capacity (parameters) to brute-force memorize the training set. Yet empirically, that's not what happens! Smaller models whose storage capacities exceed the complexity of the dataset often still generalize immediately without any grokking delay. The authors set out to solve a crisp quantitative puzzle: Can we predict the exact parameter count at which a model starts to grok?

Methods

Focusing on small, 2-layer decoder-only Transformers (sweeping embedding widths to vary parameter count $P$), the authors treat training as a competition between two processes and measure their timescales using first-passage epochs:

  1. Empirical Information Capacity: Adapting recent information-theoretic frameworks, they train Transformers on pure random noise to measure how many bits of raw data each parameter can store ($C_{\text{model}}$).
  2. Memorization Timescale ($T_{\text{mem}}$): To isolate pure memorization without any algorithmic shortcuts, they measure how many epochs it takes a model to hit 99% training accuracy on a random-label dataset with the exact same bit-complexity as the real task.
  3. Generalization Timescale ($T_{\text{gen}}$): They train the model on the actual structured task and record the epochs needed to reach 99% validation accuracy.
  4. Empirical Scaling Laws: Finally, they fit mathematical scaling laws to $T_{\text{mem}}$ and $T_{\text{gen}}$ across primes $p \in [97, 139]$ and extrapolate them to larger, unseen dataset sizes.
Figure 1: Generalisation delay and learning timescales across models of different sizes for three primes. Orange curve: epochs to generalise; purple curve: epochs to memorise a random dataset of the same complexity. The colour of each dot encodes its model dimension d, which is proportional to parameter count. Generalisation delay is taken as the minimum delay over ten seeds; timescale curves are arithmetic means of measured times. The dotted vertical line marks out bPcross(p), the parameter size at which the timescale of memorisation intersects that of generalisation. Empirically, bPcross(p) correlates with parameter count where generalisation delay first becomes consistently non-zero.

Datasets

No new external benchmarks are introduced; instead, the authors use synthetic datasets tailored for controlled scaling experiments:

  • Modular Arithmetic: Standard grokking benchmarks over prime fields $\mathbb{Z}_p$ (primarily modular division $a / b \bmod p$, with sweeps on addition and multiplication), formatted as length-4 token sequences [a, op, b, =]. Half the valid pairs are used for training ($\alpha = 1/2$) and half for validation, testing primes from $p=97$ up to $p=199$.
  • Matched Random-Label Datasets: Synthetic classification datasets with uniformly random labels, sized to match the exact worst-case bit-complexity ($K_{\text{mem}}$) of each corresponding modular arithmetic training set.

Key Insights and Ideas

  • Capacity isn't destiny; speed is: Having enough capacity to memorize doesn't mean gradient descent will memorize first. Smaller models generalize immediately—even above the memorization capacity threshold—simply because finding the general rule is faster than brute-force memorization ($T_{\text{gen}} < T_{\text{mem}}$). Grokking only kicks in when $P$ grows large enough that memorization wins the race ($T_{\text{mem}} \lesssim T_{\text{gen}}$).
  • A universal curve for memorization speed: Memorization time collapses neatly onto a single exponential curve governed solely by the capacity fraction $f$—the ratio of dataset bit-complexity to model capacity. Because a fixed dataset takes up a smaller fraction of a larger model's capacity, larger models memorize exponentially faster, explaining an observation long noted in large language models.
  • The disappearing grokking regime: While $T_{\text{gen}}$ follows a power law ($A p^a P^{-b}$) and $T_{\text{mem}}$ follows an exponential in $1/P$, their scaling geometry forms a "cone." Extrapolating these curves reveals a startling out-of-distribution prediction: past a critical dataset size (prime $p^*$), the two curves never intersect, meaning no model of any size should consistently grok!
Figure 2: (a) The region where grokking occurs, as a function of model parameter count and prime p; note that dataset size increases with p. The generalisation delay of each model during training was evaluated across 10 seeds for each combination of parameter count and dataset size, and the minimum observed generalisation delay reported. The colour of each dot shows the positive minimum generalisation delay; hollow markers denote a zero minimum. The red line is the predicted parameter size for which generalisation first becomes consistently delayed, calculated from the intersection of our empirical Tgen and Tmem scaling laws. The laws were fitted on primes up to and including p = 139 (intersection show as solid red line) and extrapolated for larger primes (intersection shown as dotted red line). The vertical dashed line marks the critical prime p∗= 167.89, beyond which our empirical laws predict no model would consistently grok. (b,c) Memorisation and generalisation timescales, in epochs, as a function of parameter count and prime p. For points p ≤139, we show the arithmetic means of observed times across 10 seeds; these were used to fit our empirical laws. For p > 139, we show the timescales predicted by our empirical laws. Contours join points with equal timescales (10, 100, and 1000 epochs). The figures share a logarithmic colour scale, capped at yellow for any point above 104.

Key Results

  • Bits per parameter: Their Transformer family stores roughly $C_{\text{model}} \approx 0.785$ bits per parameter.
  • Predicting grokking onset: Across the 10 main primes, the parameter count where $T_{\text{mem}}$ and $T_{\text{gen}}$ intersect correlates tightly with the empirical onset of consistent grokking (Spearman $\rho = 0.988, p = 10^{-4}$). It does, however, exhibit a systematic offset—actual grokking begins roughly 32% below the intersection parameter count. Adding this timescale intersection significantly improves onset predictions over using dataset complexity capacity ($P_{\text{mem}}$) alone ($p = 3.61 \times 10^{-6}$).
  • Testing the critical prime $p^*$: Fitting their scaling laws ($R^2 \approx 0.87$ in log-space) on $p \le 139$ predicts that consistent grokking should vanish beyond $p^* \approx 167.89$. When tested on larger primes, the grokking region visibly thins out, and by $p = 193, 197,$ and $199$, zero sampled model sizes grokked consistently across all 10 random seeds (though the boundary is fuzzy, with five isolated grokking cases appearing between $p=173$ and $191$).

Limitations and Future Work

  • Entangled generalization: Measuring $T_{\text{gen}}$ on modular division doesn't prevent concurrent memorization from happening under the hood, meaning $T_{\text{gen}}$ isn't a purely isolated measurement.
  • Empirical calibration: The scaling laws are empirical fits rather than exact mechanistic derivations, and the systematic offset between timescale intersection and grokking onset shifts across hyperparameters (like weight decay and learning rate), requiring fresh calibration per setup. Furthermore, sweeps varying model depth and initialization scale were inconclusive due to compute budgets.
  • Next steps: The authors aim to derive these scaling constants from first principles, test MLPs and deeper Transformers, and figure out how to rigorously define and measure generalization timescales on messy, naturalistic language or vision datasets.

Summary updated

Abstract

Despite a known dependence between grokking and model parameter count, how model capacity shapes grokking remains an open question. Focusing on small Transformers and modular arithmetic, we give a quantitative account of the relationship between model capacity and grokking as a competition between two timescales: generalisation ($T_{\text{gen}}$) and memorisation ($T_{\text{mem}}$). Building on prior formalisms for the empirical information capacity of Transformers, we define and measure $T_{\text{gen}}$ on modular arithmetic datasets and $T_{\text{mem}}$ on random-label datasets of equivalent complexity, and show that their intersection correlates with model sizes where consistent grokking begins. We also observe empirical laws for $T_{\text{gen}}$ and $T_{\text{mem}}$ as models and datasets scale, motivating their forms theoretically and finding that our model of $T_{\text{mem}}$ is consistent with prior observations that larger models tend to memorise faster. Moreover, extrapolating our empirical timescale laws predicted the existence of datasets for which no model of any size would consistently grok, a pattern supported on the modular arithmetic datasets of larger primes, demonstrating that our framework can make qualitative predictions out-of-distribution.
BibTeX
@inproceedings{song2026how,
  author = {YIDING SONG and Hanming Ye},
  title = {{How Large Must a Model Be to Grok? A competition between memorisation and generalisation timescales}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=2kLkhhcpNe},
}
Figure