Flat Loss, Evolving Features: Grokking in Modular Addition
Organizations: University of California, San Diego · Microsoft AI
Abstract
Can a network keep learning while its training cross-entropy stays nearly flat at a positive level? We show that it can. On modular addition, a standard testbed for grokking, ReLU networks trained with supported-Polar hidden updates, normalized output-layer updates and weight decay can keep 100% training accuracy while their hidden features change and held-out accuracy rises from zero to above 90%, at relatively flat training cross-entropy. Correct classification need not minimize cross-entropy, which still depends on prediction confidence. We prove this coexistence for one-hidden-layer networks in two finite-window theorems from constructed initializations: one gives a constant gain in the Fourier fraction of the hidden features, and the other holds at arbitrarily low positive loss, where a readout refitted on the training data generalizes before the network. Experiments from random initialization show the same coexistence on a window fixed in advance, and in deeper networks held-out accuracy also rises over post-hoc windows with a net increase in training cross-entropy. With a last-layer rate set per training fraction and head decay scaled with the prime, deeper networks at p=47 and 61 meet a criterion on post-hoc windows, fixed in advance, in nearly all fresh runs. A one-block transformer trained with the same updates and a slowly decaying output gain keeps every training pair correct at every logged checkpoint while its training cross-entropy rises and its held-out accuracy approaches one; with two blocks this holds through the held-out rise, after which training pairs begin to flip. A plateau in training loss need not be a plateau in learning. Code: https://github.com/akashkumar-d/flat-loss-evolving-features.
Figures & tables
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Study | Window | Runs | Flat | Rec. | First-fit | Med. | Med. | Med. min CE | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Headline (fresh) | 24/.03/.015 | pre k | 31 | 20 | 20 | 20 | 0 | 7.06% | .0965 | 1.48 |
| Per-prime (fresh) | 24/.01/.005 | pre k | 17 | 20 | 16 | 20 | 15 | 6.3% | .039 | |
| 48/.03/.005 | pre k | 23 | 20 | 20 | 20 | 0 | 5.4% | .041 | ||
| 96/.03/.005 | pre k | 29 | 20 | 20 | 20 | 0 | 6.5% | .043 | ||
| Replays | 24/.03/.01 | per run | 23 | 5 | 5 | 5 | – | 2.4% | .038 | 0.26 |
| 24/.03/.015 | per run | 31 | 5 | 5 | 5 | – | 2.7% | .049 | 1.5 |
| Setting | Indices | Horizon | Primary | RF | |||||
|---|---|---|---|---|---|---|---|---|---|
| Primary | 21–40 / 1–20 | .50 | 3.85 | 80k | 40/40 | 0/17 | 40/2 | 0 | |
| Primary | 21–40 / 1–20 | .35 | 3.85 | 100k | 39/40 | 0/13 | 39/0 | 0 | |
| Primary | 21–40 / 1–20 | .35 | 3.85 | 80k | 38/40 | 0/19 | 39/0 | 0 | |
| Modulus | 41–60 | .35 | 3.85 | 120k | 0/20 | 0/0 | 0/0 | 0 | |
| Width | 61–64 | .40 | 4.50 | 100k | 0/4 | 0/1 | 4/1 | 0 | |
| NGD | 1–20 | .50 | 3.85 | 80k | 0/20 | 0/0 | 0/0 | 0 |
| Fraction | Pass | (rose) | Lead | Mis. | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 3 | 47 | 0.8 | .45 | 10/10 | 0.52 | (10) | .51 | 2.4 | 19.5 | 0 |
| 3 | 47 | 0.7 | .30 | 10/10 | 0.35 | (10) | .54 | 2.8 | 24.2 | 0 |
| 3 | 47 | 0.6 | .18 | 10/10 | 0.15 | (10) | .48 | 3.7 | 34.1 | 0 |
| 3 | 47 | 0.5 | .08 | 8/10 | 0.007 | (10) | .48 | 4.7 | 48.1 | 0 |
| 3 | 61 | 0.8 | .45 | 10/10 | 0.58 | (8) | .53 | 1.2 | 17.6 | 18 |
| 3 | 61 | 0.7 | .30 | 10/10 | 0.43 | (10) | .63 | 1.3 | 22.0 | 1 |
| Setting | Runs | Pass | Fit | Final | Failing condition | ||
|---|---|---|---|---|---|---|---|
| Polar, gain | 10 | 10 | 200 | ( , ) | 0.93–1.00 | 0.999–1.000 | – |
| Polar, no gain | 10 | 0 | 1,190 | ( , ) | 0.35–0.51 | 0.999–1.000 | share (10), refit (9) |
| Polar, fixed | 3 | 0 | 240 | ( , ) | 0.20–0.26 | 0.999–1.000 | share, refit (3) |
| Polar, fixed | 3 | 0 | 200 | ( , ) | 0.13–0.17 | 1.000 | share, refit (3) |
| Polar, fixed | 3 | 0 | 160 | ( , ) | 0.07–0.10 | 1.000 | share, refit (3) |
| fixed | |||||
|---|---|---|---|---|---|
| 1/3, | 3/3, | 2/3, | 2/3, | 0/3, | |
| 3/3, | 3/3, | 3/3, | 2/3, | 0/3, | |
| 3/3, | 3/3, | 3/3, | 2/3, | 0/3, |
| Change at 12k | Pass | Window ends | First flip | Most | Final |
|---|---|---|---|---|---|
| None | 0/10 | 30k (end) | 17.8k–22.0k | 45–438 | 0.941–0.994 |
| Gain frozen ( , ) | 2/3 | 13.5k–13.7k | 18.8k–19.7k | 57–217 | 0.983–0.997 |
| Head step : | 0/3 | 30k (end) | 21.6k–23.0k | 59–395 | 0.950–0.970 |
| Feature step : | 2/3 | 12.0k | none | 0 | 0.986–0.997 |
| Training pairs | Pass | Loose | No-mirror | Final | ||||
|---|---|---|---|---|---|---|---|---|
| 61 | 0.30 | 0.45 | 1,116 | 1/5 | 1/5 | 1/5 | 0.979–0.994 | |
| 61 | 0.30 | 0.60 | 1,116 | 1/5 | 1/5 | 1/5 | 0.964–0.991 | |
| 61 | 0.33 | 0.45 | 1,227 | 5/10 | 5/10 | 10/10 | 0.994–0.999 | |
| 61 | 0.35 | 0.45 | 1,302 | 0/5 | 0/5 | 5/5 | 0.998–0.999 | |
| 61 | 0.45 | 2,046 | 9/10 | 9/10 | 9/10 | 0.9899–0.997 | ||
| 89 | 0.20 | 0.33 | 1,584 | 1/5 | 1/5 | 1/5 | 0.39–0.996 |
| Readout | Crossing | |||||
|---|---|---|---|---|---|---|
| Refit, all frequencies | 0.5 | (0) | (0) | (0) | (0) | (0) |
| 0.9 | (0) | (0) | (0) | (0) | (0) | |
| Fourier refit, top 8 | 0.5 | (9) | (10) | (10) | (10) | (10) |
| 0.9 | (0) | (0) | (10) | (10) | (10) | |
| Network’s logits, top 8 | 0.5 | (9) | (10) | (10) | (10) | (10) |
| 0.9 | (0) | (0) | (10) | (10) | (10) |
Neural Network Training Dynamics
Neural network training dynamics studies how parameters and representations change during optimization and how those changes shape learning, stability, and generalization.
See all 507 papers