SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.00488 · ICLR · 2023

Membership Privacy Risks of Sharpness Aware Minimization

Rajiv Khanna, Young Kim, Andrea Agiollo, Pratiksha Agrawal, Johannes Royset

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2310.00488.json · badge: /api/ran/2310.00488.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
inspire-group/MIAdefenseSELENA canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
weiaicunzai/pytorch-cifar100 canonical (classifier label)
classifier basis: census
1 ran · 0 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
inspire-group/MIAdefenseSELENA/utils.py
code served (permissive licence) · get_code("18badd533b52adb3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned list, ndim 1, 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 a batch of 2 samples with 5 classes
batch_size = 2
num_classes = 5

# output: model predictions (logits) - shape (batch_size, num_classes)
output = torch.randn(batch_size, num_classes)

# target: ground truth class indices - shape (batch_size,)
target = torch.tensor([1, 3])

# topk: tuple of k values for which to compute precision@k
topk = (1, 3)

ARGS = {
    'output': output,
    'target': target,
    'topk': topk
}
Setup block drafted by
a language model, Claude Sonnet 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 list, ndim 1, dtype family float — a list 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
cw_l2_attack Ran
ran; our contract draft was wrong, not the code
inspire-group/MIAdefenseSELENA/attack/CW_Attack.py
code served (permissive licence) · get_code("6dc5017fa7e03468")
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 tuple. 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 numpy as np

torch.manual_seed(0)

# Create a simple CNN model that takes 32x32 images and outputs class logits
class SimpleModel(nn.Module):
    def __init__(self, num_classes=10):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 8, kernel_size=3, padding=1)
        self.fc = nn.Linear(8 * 32 * 32, num_classes)
    
    def forward(self, x):
        x = self.conv1(x)
        x = x.view(x.size(0), -1)
        x = self.fc(x)
        return x

# Create model
model = SimpleModel(num_classes=10)
model.eval()

# Create tensors
batch_size = 2
device = 'cpu'

# Original images (batch_size=2, channels=3, height=32, width=32)
o_images = torch.randn(batch_size, 3, 32, 32)

# Arc images (for adversarial example construction)
arc_images = torch.randn(batch_size, 3, 32, 32)

# Images to attack
images = torch.randn(batch_size, 3, 32, 32)

# Labels (batch_size=2, with class indices in range [0, 9])
labels = torch.tensor([3, 7], dtype=torch.long)

# Confidence weights c - must be array-like, indexed by label index
c = np.array([0.01, 0.01])

ARGS = {
    'model': model,
    'o_images': o_images,
    'arc_images': arc_images,
    'images': images,
    'labels': labels,
    'device': device,
    'targeted': False,
    'c': c,
    'kappa': 0,
    'max_iter': 10,
    'learning_rate': 0.01
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
get_entropy Ran
ran, honoured the contract we drafted
inspire-group/MIAdefenseSELENA/attack/dsq_attack.py
code served (permissive licence) · get_code("7f77c88b76031ff0")
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 ndarray, ndim 1, dtype family float, shape (2,) 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

# Create sample_predictions: a 2D array where each row is a probability distribution
# Shape: (batch_size=2, num_classes=4)
sample_predictions = np.array([
    [0.1, 0.3, 0.4, 0.2],
    [0.25, 0.25, 0.25, 0.25]
], dtype=np.float32)

# Create sample_labels: labels corresponding to predictions
# Shape: (batch_size=2,) - not actually used in the function, but included for completeness
sample_labels = np.array([2, 1], dtype=np.int32)

ARGS = {
    "sample_predictions": sample_predictions,
    "sample_labels": sample_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 (2,) — shape (2,) 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
get_l2_loss Ran
ran, honoured the contract we drafted
inspire-group/MIAdefenseSELENA/attack/adaptive_attack.py
code served (permissive licence) · get_code("b51437675b710cac")
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 ndarray, ndim 1, dtype family float, shape (2,) 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

# Create small numpy arrays for the function parameters
# The function computes L2 loss by summing squared differences along axis 1
# So we need 2D arrays where each row represents a sample

batch_size = 2
feature_dim = 4

# shadow_splitai_predictions: shape (batch_size, feature_dim)
shadow_splitai_predictions = np.random.randn(batch_size, feature_dim).astype(np.float32)

# sample_predictions: shape (batch_size, feature_dim)
sample_predictions = np.random.randn(batch_size, feature_dim).astype(np.float32)

# sample_labels: not used in the function body, but required as parameter
sample_labels = np.random.randn(batch_size, 1).astype(np.float32)

ARGS = {
    "shadow_splitai_predictions": shadow_splitai_predictions,
    "sample_predictions": sample_predictions,
    "sample_labels": sample_labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 (2,) — shape (2,) 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
mobilenet Ran
ran; our contract draft was wrong, not the code
weiaicunzai/pytorch-cifar100/models/mobilenet.py
pointer only (licence: NONE) · get_code("578c32174ef2fc47")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, weiaicunzai/pytorch-cifar100 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.

print_acc_conf Ran
ran, violated the contract we drafted
inspire-group/MIAdefenseSELENA/utils.py
code served (permissive licence) · get_code("2f231286618f001d")
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 tuple, ndim 1, 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 numpy as np

# Create synthetic inference output and test labels
# infer_np: shape (batch_size, num_classes) with confidence scores
# test_labels: shape (batch_size,) with class indices

batch_size = 2
num_classes = 19

# Create inference output - shape (2, 19) with softmax-like values
np.random.seed(0)
infer_np = np.random.rand(batch_size, num_classes)
# Normalize to look like probabilities
infer_np = infer_np / infer_np.sum(axis=1, keepdims=True)

# Create test labels - shape (2,) with values in range [0, 19)
test_labels = np.array([5, 12])

ARGS = {
    'infer_np': infer_np,
    'test_labels': test_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
threshold_based_inference_attack Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
inspire-group/MIAdefenseSELENA/attack/Aug_Attack.py
code served (permissive licence) · get_code("3232aadf384d2f02")
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 tuple. 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 numpy as np

# Set random seeds for reproducibility
np.random.seed(0)

# Create small synthetic data for membership inference attack
num_class = 100
num_train_member = 50
num_train_nonmember = 50
num_test_member = 20
num_test_nonmember = 20

# Generate statistics (confidence-like values, higher is better)
# These represent model confidence scores for different samples
train_member_stat = np.random.uniform(0.6, 1.0, num_train_member).astype(np.float32)
train_nonmember_stat = np.random.uniform(0.3, 0.7, num_train_nonmember).astype(np.float32)
test_member_stat = np.random.uniform(0.6, 1.0, num_test_member).astype(np.float32)
test_nonmember_stat = np.random.uniform(0.3, 0.7, num_test_nonmember).astype(np.float32)

# Generate labels (class indices from 0 to num_class-1)
train_member_label = np.random.randint(0, num_class, num_train_member)
train_nonmember_label = np.random.randint(0, num_class, num_train_nonmember)
test_member_label = np.random.randint(0, num_class, num_test_member)
test_nonmember_label = np.random.randint(0, num_class, num_test_nonmember)

ARGS = {
    "train_member_stat": train_member_stat,
    "train_member_label": train_member_label,
    "train_nonmember_stat": train_nonmember_stat,
    "train_nonmember_label": train_nonmember_label,
    "test_member_stat": test_member_stat,
    "test_member_label": test_member_label,
    "test_nonmember_stat": test_nonmember_stat,
    "test_nonmember_label": test_nonmember_label,
    "num_class": num_class,
    "per_class": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
test_attack Not yet run
unverified (harvested, no recorded run)
inspire-group/MIAdefenseSELENA/attack/dsq_attack.py
code served (permissive licence) · get_code("386c7184dc049e22")
How it ran

no invocation recorded.

train_attack Not yet run
unverified (harvested, no recorded run)
inspire-group/MIAdefenseSELENA/attack/dsq_attack.py
code served (permissive licence) · get_code("3c015b55f3dbabbf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 8 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
accuracy 19 other papers
9 dated earlier, 10 later
1805.08318 (2018-05)
Self-Attention Generative Adversarial Networks
2105.14148 (2021-05)
OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers
2110.03006 (2021-10)
Unsupervised Selective Labeling for More Effective Semi-Supervised Learning
and 16 more not named here

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

Optimization algorithms that seek flatter minima, such as Sharpness-Aware Minimization (SAM), are credited with improved generalization and robustness to noise. We ask whether such gains impact membership privacy. Surprisingly, we find that SAM is more prone to Membership Inference Attacks (MIA) than classical SGD across multiple datasets and attack methods, despite achieving lower test error. This suggests that the geometric mechanism of SAM that improves generalization simultaneously exacerbates membership leakage. We investigate this phenomenon through extensive analysis of memorization and influence scores. Our results reveal that SAM is more capable of capturing atypical subpatterns, leading to higher memorization scores of samples. Conversely, SGD depends more heavily on majority features, exhibiting worse generalization on atypical subgroups and lower memorization. Crucially, this characteristic of SAM can be linked to lower variance in the prediction confidence of unseen samples, thereby amplifying membership signals. Finally, we model SAM under a perfectly interpolating linear regime and theoretically show that sharpness regularization inherently reduces variance, guaranteeing a higher MIA advantage for confidence and likelihood ratio attacks.

For agents

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

get_harvested_code_for_paper("2310.00488")
get_code_for_paper("2310.00488")
have("2310.00488")

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

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

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

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

Connect an agent — have() is free.