SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.15555 · ICML · 2024

Deep Networks Always Grok and Here is Why

Richard Baraniuk, Ahmed Humayun, Randall Balestriero

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2402.15555.json · badge: /api/ran/2402.15555.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
AhmedImtiazPrio/grok-adversarial marked official in Papers with Code
Papers with Code archive
3 ran · 0 no recorded run
FunctionStatusWhere it lives
get_intersection_from_activation_batched Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AhmedImtiazPrio/grok-adversarial/local_complexity.py
code served (permissive licence) · get_code("743cc3fec358b7c8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects:
# - act: a tensor of activations that will be reshaped to (batch_size, act.shape[0] // batch_size, -1)
# - batch_size: an integer for batching
#
# Looking at the function body:
# - act is reshaped to (batch_size, act.shape[0] // batch_size, -1)
# - So act.shape[0] must be divisible by batch_size
# - The function compares act[:, 1:, ...] with act[:, :1, ...]
#   which means we need at least 2 elements in dimension 1
#   so act.shape[0] // batch_size >= 2
#
# Let's use batch_size=2
# We need act.shape[0] to be divisible by 2
# Let's make act.shape[0] = 4 (so 4 // 2 = 2, giving us the needed dimension)
# And let's add a feature dimension of 3

batch_size = 2
# act will be reshaped to (batch_size=2, act.shape[0]//batch_size=2, -1)
# So we need act.shape[0] = 4
# Create a tensor of shape (4, 3) - 4 samples, 3 features
act = torch.randn(4, 3)

ARGS = {
    "act": act,
    "batch_size": batch_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_intersections_for_hulls Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AhmedImtiazPrio/grok-adversarial/local_complexity.py
code served (permissive licence) · get_code("794919ef0477c6ae")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal model that accepts input and populates activation_buffer
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 6)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Create model instance
model = MinimalModel()

# Create activation_buffer dictionary with activations for each layer
# The function expects activation_buffer to be populated with tensors
# Shape should be (batch_size * n_frame, feature_dim) based on how it's used
batch_size = 2
n_frame = 3
activation_buffer = {
    'layer1': torch.randn(batch_size * n_frame, 8),
    'layer2': torch.randn(batch_size * n_frame, 6),
}

# Create hulls tensor
# Shape: (nsamples, n_frame, *feature_shape)
# nsamples should be divisible by batch_size
nsamples = 4
hulls = torch.randn(nsamples, n_frame, 4)

# Layer names to analyze
layer_names = ['layer1', 'layer2']

ARGS = {
    'hulls': hulls,
    'model': model,
    'layer_names': layer_names,
    'activation_buffer': activation_buffer,
    'batch_size': batch_size,
    'verbose': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_layer_intersections_batched Ran
ran, honoured the contract we drafted
AhmedImtiazPrio/grok-adversarial/local_complexity.py
code served (permissive licence) · get_code("291d08d9db17436c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create activation buffer with sample activations
# The function expects activations that can be reshaped as (batch_size, n_hulls, features)
# For batch_size=2, we need activations of shape (2*n_hulls, features)
# Let's use n_hulls=3, so total shape (6, 4)

batch_size = 2
n_hulls = 3
n_features = 4

activation_buffer = {
    'layer1': torch.randn(batch_size * n_hulls, n_features),
    'layer2': torch.randn(batch_size * n_hulls, n_features),
    'layer3': torch.randn(batch_size * n_hulls, n_features),
    'layer4': torch.randn(batch_size * n_hulls, n_features),
}

# Create layer_names list with both string names and tuple names
layer_names = [
    'layer1',
    'layer2',
    ('layer3', 'layer4'),
]

ARGS = {
    'layer_names': layer_names,
    'activation_buffer': activation_buffer,
    'batch_size': batch_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Grokking, or delayed generalization, is a phenomenon where generalization in a deep neural network (DNN) occurs long after achieving near zero training error. Previous studies have reported the occurrence of grokking in specific controlled settings, such as DNNs initialized with largenorm parameters or transformers trained on algorithmic datasets. We demonstrate that grokking is actually much more widespread and materializes in a wide range of practical settings, such as training of a convolutional neural network (CNN) on CIFAR10 or a Resnet on Imagenette. We introduce the new concept of delayed robustness, whereby a DNN groks adversarial examples and becomes robust, long after interpolation and/or generalization. We develop an analytical explanation for the emergence of both delayed generalization and delayed robustness based on the local complexity of a DNN's input-output mapping. Our local complexity measures the density of so-called "linear regions" (aka, spline partition regions) that tile the DNN input space and serves as a utile progress measure for training. We provide the first evidence that, for classification problems, the linear regions undergo a phase transition during training whereafter they migrate away from the training samples (making the DNN mapping smoother there) and towards the decision boundary (making the DNN mapping less smooth there). Grokking occurs post phase transition as a robust partition of the input space thanks to the linearization of the DNN mapping around the training points. Web: bit.ly/grok-adversarial.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2402.15555")
get_code_for_paper("2402.15555")
have("2402.15555")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2402.15555.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2402.15555.svg)](https://syntology.ai/paper/2402.15555)

Connect an agent — have() is free.