SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.01412 · 2020

Sharpness-Aware Minimization for Efficiently Improving Generalization

Hossein Mobahi, Behnam Neyshabur, Pierre Foret, Ariel Kleiner

arXiv · PDF · Open in the Atlas

Code that ran

15 of 20 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 13 have no contract verdict; 2 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2010.01412.json · badge: /api/ran/2010.01412.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
google-research/sam canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
wangermeng2021/Scaled-YOLOv4-tensorflow2 community
Papers with Code archive
2 ran · 0 no recorded run
simon20010923/DDAMFN community
Papers with Code archive
1 ran · 0 no recorded run
Jannoshh/simple-sam community
Papers with Code archive
1 ran · 0 no recorded run
moskomule/sam.pytorch community
Papers with Code archive
1 ran · 0 no recorded run
ys-zong/medfair community
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
NiMlr/pynlqn community
Papers with Code archive
1 ran · 0 no recorded run
mhassann22/GCSAM community
Papers with Code archive
0 ran · 1 no recorded run
rollovd/LookSAM community
Papers with Code archive
0 ran · 1 no recorded run
Janus-Shiau/SAM-tf2 community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
AssignLR Ran
ran on a synthesized input · constructed an object; no result was computed
wangermeng2021/Scaled-YOLOv4-tensorflow2/utils/sam.py
code served (permissive licence) · get_code("6b43b1c7e8d505da")
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, through the batch API) and returned an instance of its own class, AssignLR: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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
import torch.optim as optim

# Create a simple mock optimizer that has a learning_rate attribute
# that supports .assign() and .numpy() methods (TensorFlow-style)
class MockLearningRate:
    def __init__(self, value):
        self.value = value
    
    def assign(self, lr):
        self.value = lr
    
    def numpy(self):
        return self.value

class MockOptimizer:
    def __init__(self, lr=0.001):
        self.learning_rate = MockLearningRate(lr)

# Create the optimizer instance
mock_optimizer = MockOptimizer(lr=0.001)

# Define ARGS mapping all parameters
ARGS = {
    "optimizer": mock_optimizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AssignLR — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AssignLR output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
SAM Ran
ran on a synthesized input · constructed an object; no result was computed
simon20010923/DDAMFN/DDAMFN++/sam.py
pointer only (licence: NONE) · get_code("f04e7b9eb0136335")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, simon20010923/DDAMFN when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

SAM Ran
ran on a synthesized input · constructed an object; no result was computed
Jannoshh/simple-sam/sam.py
code served (permissive licence) · get_code("954d13e2c6b31007")
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, through the batch API) and returned an instance of its own class, SAM: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 tensorflow as tf

# Create a simple base optimizer (SGD from TensorFlow)
base_optimizer = tf.keras.optimizers.SGD(learning_rate=0.01)

# Create sample trainable variables
var1 = tf.Variable([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], trainable=True)
var2 = tf.Variable([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]], trainable=True)
trainable_vars = [var1, var2]

# Create sample gradients matching the shape of trainable variables
gradient1 = tf.constant([[0.01, 0.02, 0.03, 0.04], [0.05, 0.06, 0.07, 0.08]], dtype=tf.float32)
gradient2 = tf.constant([[0.001, 0.002], [0.003, 0.004], [0.005, 0.006]], dtype=tf.float32)
gradients = [gradient1, gradient2]

ARGS = {
    "base_optimizer": base_optimizer,
    "rho": 0.05,
    "eps": 1e-12,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SAM — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SAM output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
SAMOptimizer Ran
ran on a synthesized input · constructed an object; no result was computed
wangermeng2021/Scaled-YOLOv4-tensorflow2/utils/sam.py
code served (permissive licence) · get_code("dfc916dc5ccaee4e")
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, through the batch API) and returned an instance of its own class, SAMOptimizer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 tensorflow as tf
import numpy as np

# Create a simple base optimizer (e.g., SGD or Adam)
base_optimizer = tf.keras.optimizers.SGD(learning_rate=0.01)

# Create trainable variables to test with
var1 = tf.Variable([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], trainable=True)
var2 = tf.Variable([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]], trainable=True)

# Create gradients that match the shape of trainable variables
grad1 = tf.constant([[0.01, 0.02, 0.03, 0.04], [0.05, 0.06, 0.07, 0.08]])
grad2 = tf.constant([[0.001, 0.002], [0.003, 0.004], [0.005, 0.006]])

ARGS = {
    "base_optimizer": base_optimizer,
    "rho": 0.05
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SAMOptimizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SAMOptimizer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
SAMSGD Ran
ran on a synthesized input · constructed an object; no result was computed
moskomule/sam.pytorch/sam.py
code served (permissive licence) · get_code("5583e2f7e9e49a0c")
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, through the batch API) and returned an instance of its own class, SAMSGD: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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
from torch.optim._multi_tensor import SGD

torch.manual_seed(0)

# Create a simple model with parameters to optimize
model = nn.Linear(4, 3, bias=True)

# Extract parameters for optimization
params = list(model.parameters())

# Initialize gradients for the parameters
for p in params:
    p.grad = torch.randn_like(p)

# Create a closure that returns a loss value
def closure():
    loss = torch.sum(model(torch.randn(2, 4)) ** 2)
    return loss

# Build the ARGS dictionary with all required parameters
ARGS = {
    'params': params,
    'lr': 0.01,
    'momentum': 0.9,
    'dampening': 0.0,
    'weight_decay': 1e-4,
    'nesterov': False,
    'rho': 0.05,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SAMSGD — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SAMSGD output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
SAM_optimizer Ran
ran on a synthesized input · constructed an object; no result was computed
ys-zong/medfair/models/SAM/utils.py
pointer only (licence: NONE) · get_code("46c3f10ab0f4669c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ys-zong/medfair when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

centralized_gradient Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from mhassann22/GCSAM
pointer only; the stored copy get_code serves, from mhassann22/GCSAM, is pointer only (licence: NONE) · get_code("27a3d56a09e0e7cf")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

dense_layer_init_fn Ran
ran on a synthesized input
google-research/sam/sam_jax/models/utils.py
code served (permissive licence) · get_code("be4a2c63cc33ff44")
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, through the batch API) and returned ArrayImpl, ndim 2, dtype family float, shape (3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 jax
import jax.numpy as jnp

# Create a PRNG key for JAX
key = jax.random.PRNGKey(0)

# Define the shape of the tensor to initialize (output_dim=5, input_dim=3)
shape = (3, 5)

# Define the data type
dtype = jnp.float32

# Construct the ARGS dictionary with all parameters
ARGS = {
    "key": key,
    "shape": shape,
    "dtype": dtype,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (3, 5) — shape (3, 5) as a later run recorded it
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
name_to_image_size Ran
ran on a synthesized input
google-research/sam/sam_jax/efficientnet/efficientnet.py
code served (permissive licence) · get_code("cb2821198470712c")
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, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

ARGS = {
    'name': 'efficientnet-b0'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
normalize_image Ran
ran on a synthesized input
google-research/sam/sam_jax/datasets/dataset_source_imagenet.py
code served (permissive licence) · get_code("245dfb545218b755")
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, through the batch API) and returned EagerTensor, 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 tensorflow as tf
import numpy as np

# Create a small test image tensor
# Shape: (height, width, channels) = (4, 4, 3)
# Using values in typical uint8 range [0, 255]
image_data = np.random.randint(0, 256, size=(4, 4, 3), dtype=np.uint8)
image_tensor = tf.constant(image_data, dtype=tf.float32)

ARGS = {
    "image": image_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py recorded SymbolicTensor ndim 3, which disagrees with the fixture run
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
preprocess_for_eval Ran
ran on a synthesized input
google-research/sam/sam_jax/datasets/dataset_source_imagenet.py
code served (permissive licence) · get_code("db053b3b48a12365")
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, through the batch API) and returned EagerTensor, ndim 3, dtype family float, shape (224, 224, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 tensorflow as tf
import numpy as np

# Create a small valid JPEG image binary
# We'll construct a minimal valid JPEG programmatically
def create_minimal_jpeg(height=256, width=256):
    """Create a minimal valid JPEG image as bytes."""
    # Create a simple RGB image using numpy
    image_array = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
    
    # Encode to JPEG using tensorflow
    jpeg_bytes = tf.io.encode_jpeg(image_array)
    return jpeg_bytes.numpy()

# Generate a minimal JPEG image
image_bytes_val = create_minimal_jpeg(height=256, width=256)

# Convert to TensorFlow tensor
image_bytes_tensor = tf.constant(image_bytes_val)

ARGS = {
    "image_bytes": image_bytes_tensor,
    "dtype": tf.float32,
    "image_size": 224
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (224, 224, 3) — shape (224, 224, 3) as a later run recorded it
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
round_filters Ran
ran on a synthesized input
google-research/sam/sam_jax/efficientnet/efficientnet.py
code served (permissive licence) · get_code("2c7d0d794dc5a73c")
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, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
from typing import Tuple, Optional

class BlockConfig(object):
    """Class that contains configuration parameters for a single block."""

    def __init__(self, input_filters: int=0, output_filters: int=0, kernel_size: int=3, num_repeat: int=1, expand_ratio: int=1, strides: Tuple[int, int]=(1, 1), se_ratio: Optional[float]=None, id_skip: bool=True, fused_conv: bool=False, conv_type: str='depthwise'):
        for arg in locals().items():
            setattr(self, *arg)

class ModelConfig(object):
    """Class that contains configuration parameters for the model."""

    def __init__(self, width_coefficient: float=1.0, depth_coefficient: float=1.0, resolution: int=224, dropout_rate: float=0.2, blocks: Tuple[BlockConfig, ...]=(BlockConfig(32, 16, 3, 1, 1, (1, 1), 0.25), BlockConfig(16, 24, 3, 2, 6, (2, 2), 0.25), BlockConfig(24, 40, 5, 2, 6, (2, 2), 0.25), BlockConfig(40, 80, 3, 3, 6, (2, 2), 0.25), BlockConfig(80, 112, 5, 3, 6, (1, 1), 0.25), BlockConfig(112, 192, 5, 4, 6, (2, 2), 0.25), BlockConfig(192, 320, 3, 1, 6, (1, 1), 0.25)), stem_base_filters: int=32, top_base_filters: int=1280, activation: str='swish', batch_norm: str='default', bn_momentum: float=0.99, bn_epsilon: float=0.001, weight_decay: float=5e-06, drop_connect_rate: float=0.2, depth_divisor: int=8, min_depth: Optional[int]=None, use_se: bool=True, input_channels: int=3, model_name: str='efficientnet', rescale_input: bool=True, data_format: str='channels_last', dtype: str='float32'):
        """Default Config for Efficientnet-B0."""
        for arg in locals().items():
            setattr(self, *arg)

config = ModelConfig(
    width_coefficient=1.0,
    depth_coefficient=1.0,
    resolution=224,
    dropout_rate=0.2,
    blocks=(BlockConfig(32, 16, 3, 1, 1, (1, 1), 0.25),),
    stem_base_filters=32,
    top_base_filters=1280,
    activation='swish',
    batch_norm='default',
    bn_momentum=0.99,
    bn_epsilon=0.001,
    weight_decay=5e-06,
    drop_connect_rate=0.2,
    depth_divisor=8,
    min_depth=None,
    use_se=True,
    input_channels=3,
    model_name='efficientnet',
    rescale_input=True,
    data_format='channels_last',
    dtype='float32'
)

ARGS = {
    'filters': 64,
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
absl, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
round_repeats Ran
ran on a synthesized input
google-research/sam/sam_jax/efficientnet/efficientnet.py
code served (permissive licence) · get_code("61a40ee8921487b9")
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, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 math

def round_repeats(repeats: int, depth_coefficient: float) -> int:
    """Returns rounded number of repeats based on depth coefficient."""
    return int(math.ceil(depth_coefficient * repeats))

ARGS = {
    "repeats": 5,
    "depth_coefficient": 1.2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
sam Ran
ran; our contract draft was wrong, not the code
NiMlr/pynlqn/pynlqn/algorithms.py
code served (permissive licence) · get_code("23710a8851b7ec81")
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 ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np

def f(x):
    """Objective function: sum of squares"""
    if x.ndim == 1:
        return np.sum(x**2)
    else:
        return np.sum(x**2, axis=0)

def gf(x):
    """Gradient of objective function"""
    if x.ndim == 1:
        return 2 * x
    else:
        return 2 * x

x0 = np.array([1.0, 2.0, 3.0, 4.0])
sigma = 0.1
eta = 0.01
C = 30
verbose = True

ARGS = {
    'f': f,
    'gf': gf,
    'x0': x0,
    'sigma': sigma,
    'eta': eta,
    'C': C,
    'verbose': verbose
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
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
shake_shake_train Ran
ran on a synthesized input
google-research/sam/sam_jax/models/utils.py
code served (permissive licence) · get_code("16e98d61f39aa54e")
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, through the batch API) and returned ArrayImpl, ndim 4, dtype family float, shape (2, 4, 3, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 jax
import jax.numpy as jnp
import flax

# Create small test tensors for xa and xb
# Shape: (batch_size=2, channels=4, height=3, width=3)
# Using distinct dimensions to probe shapes later
xa = jnp.ones((2, 4, 3, 3), dtype=jnp.float32)
xb = jnp.zeros((2, 4, 3, 3), dtype=jnp.float32)

# Create a PRNG key for JAX
rng = jax.random.PRNGKey(0)

# Build the arguments dictionary
ARGS = {
    "xa": xa,
    "xb": xb,
    "rng": rng,
    "true_gradient": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 4, dtype family float, shape (2, 4, 3, 3) — shape (2, 4, 3, 3) as a later run recorded it
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
GCSAM Not yet run
unverified (harvested, no recorded run)
mhassann22/GCSAM/cifar10_gcsam_resnet50.py
pointer only (licence: NONE) · get_code("90e63eaa2117ba4e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mhassann22/GCSAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

LookSAM Not yet run
unverified (harvested, no recorded run)
rollovd/LookSAM/looksam.py
pointer only (licence: NONE) · get_code("2debef19d3a36af7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rollovd/LookSAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

SAMWarpper Not yet run
unverified (harvested, no recorded run)
Janus-Shiau/SAM-tf2/lib/optimizers/sam.py
pointer only (licence: NONE) · get_code("b2eabc22e2ca9282")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Janus-Shiau/SAM-tf2 when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

cutout Not yet run
unverified (harvested, no recorded run)
google-research/sam/sam_jax/datasets/augmentation.py
code served (permissive licence) · get_code("33f3bcef5a763ff8")
How it ran

no invocation recorded.

weak_image_augmentation Not yet run
unverified (harvested, no recorded run)
google-research/sam/sam_jax/datasets/augmentation.py
code served (permissive licence) · get_code("967ecdba90ad4784")
How it ran

no invocation recorded.

Also present in other papers' code

Of 20 samples lifted from this paper's linked repositories, 20 carry a function identity and 0 do not. Of the 20 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 0 later) and 19 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.

FunctionAlso present inEarliest-datedOthers named
centralized_gradient 2 other papers
1 dated earlier, 1 the same month
2004.01461 (2020-04)
Gradient Centralization: A New Optimization Technique for Deep Neural Networks
2010.07468 (2020-10)
AdaBelief Optimizer: Adapting Stepsizes by the Belief in Observed Gradients

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-22.

Repositories linked to this paper

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

Abstract

In today's heavily overparameterized models, the value of the training loss provides few guarantees on model generalization ability. Indeed, optimizing only the training loss value, as is commonly done, can easily lead to suboptimal model quality. Motivated by prior work connecting the geometry of the loss landscape and generalization, we introduce a novel, effective procedure for instead simultaneously minimizing loss value and loss sharpness. In particular, our procedure, Sharpness-Aware Minimization (SAM), seeks parameters that lie in neighborhoods having uniformly low loss; this formulation results in a minmax optimization problem on which gradient descent can be performed efficiently. We present empirical results showing that SAM improves model generalization across a variety of benchmark datasets (e.g., CIFAR-{10, 100}, Ima-geNet, finetuning tasks) and models, yielding novel state-of-the-art performance for several. Additionally, we find that SAM natively provides robustness to label noise on par with that provided by state-of-the-art procedures that specifically target learning with noisy labels. We open source our code at https: //github.com/google-research/sam. * Work done as part of the Google AI Residency program.

For agents

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

get_harvested_code_for_paper("2010.01412")
get_code_for_paper("2010.01412")
have("2010.01412")

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

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

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

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

Connect an agent — have() is free.