Papers › To grok or not to grok: Disentangling generalization and memorization on corrupted...

To grok or not to grok: Disentangling generalization and memorization on corrupted algorithmic datasets

19 Oct 2023arXiv:2310.13061archive 2025-07-28

Darshil Doshi, Aritra Das, Tianyu He, Andrey Gromov

Robust generalization is a major challenge in deep learning, particularly when the number of trainable parameters is very large. In general, it is very difficult to know if the network has memorized a particular set of examples or understood the underlying rule (or both). Motivated by this challenge, we study an interpretable model where generalizing representations are understood analytically, and are easily distinguishable from the memorizing ones. Namely, we consider multi-layer perceptron (MLP) and Transformer architectures trained on modular arithmetic tasks, where (ξ·100%) of labels are corrupted (\emph{i.e.} some results of the modular operations in the training set are incorrect). We show that (i) it is possible for the network to memorize the corrupted labels \emph{and} achieve 100% generalization at the same time; (ii) the memorizing neurons can be identified and pruned, lowering the accuracy on corrupted data and improving the accuracy on uncorrupted data; (iii) regularization methods such as weight decay, dropout and BatchNorm force the network to ignore the corrupted data during optimization, and achieve 100% accuracy on the uncorrupted dataset; and (iv) the effect of these regularization methods is (``mechanistically'') interpretable: weight decay and dropout force all the neurons to learn generalizing representations, while BatchNorm de-amplifies the output of memorizing neurons and amplifies the output of the generalizing ones. Finally, we show that in the presence of regularization, the training dynamics involves two consecutive stages: first, the network undergoes \emph{grokking} dynamics reaching high train \emph{and} test accuracy; second, it unlearns the memorizing representations, where the train accuracy suddenly jumps from 100% to 100 (1-ξ)%.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2310.13061")

Code

Syntology Ran 10 of 10 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 10 ran with no contract checked.

By repository: official repository: 10 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

d-doshi/Grokking officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 10 ran; 0 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

10ran

Licence: 10 of the 10 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from d-doshi/Grokking. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

bwd_hook_ d-doshi/Grokking/utils/hooks.py official repository ran no licence file found · pointer only · b9e7372bec816408 · report
calculate_gini d-doshi/Grokking/utils/data_processing.py official repository ran fingerprinted no licence file found · pointer only · cc8f4098386e32f6 · report
calculate_ipr d-doshi/Grokking/utils/data_processing.py official repository ran fingerprinted no licence file found · pointer only · c9ea61e56776cdc8 · report
check_accuracy_grokking d-doshi/Grokking/utils/optimization.py official repository ran no licence file found · pointer only · f7c0fbb9c7ee31fc · report
fwd_hook_ d-doshi/Grokking/utils/hooks.py official repository ran no licence file found · pointer only · 1957ab794eb163a9 · report
ipr_test d-doshi/Grokking/utils/data_processing.py official repository ran no licence file found · pointer only · 903c226243d14f33 · report
noisy_dataset d-doshi/Grokking/utils/datasets.py official repository ran no licence file found · pointer only · 02ddb24b51a41c52 · report
noisy_dataset_int d-doshi/Grokking/utils/datasets.py official repository ran no licence file found · pointer only · 95c18c93cb4a4be6 · report
test_loss_grokking d-doshi/Grokking/utils/optimization.py official repository ran no licence file found · pointer only · ba1581a612dca015 · report
train_one_epoch_grokking d-doshi/Grokking/utils/optimization.py official repository ran no licence file found · pointer only · e3f8da4b30b63eb0 · report

Tasks

Memorization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSETSoftmaxTransformerWeight Decay

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections