SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.15152 · ICML · 2024

On the Duality Between Sharpness-Aware Minimization and Adversarial Training

Yifei Wang, Zeming Wei, Jingyu Zhu, Yihao Zhang, Huanran Chen, Hangzhou He

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 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, 1 violated it and 0 have no contract verdict; 2 failures of our instrument; 4 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/2402.15152.json · badge: /api/ran/2402.15152.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
weizeming/SAM_AT canonical (classifier label)
classifier basis: census
4 ran · 4 no recorded run
FunctionStatusWhere it lives
check_integrity Ran
ran, violated the contract we drafted
weizeming/SAM_AT/SAM_segmentation/datasets/utils.py
pointer only (licence: NONE); the stored copy get_code serves, from xingyu-zheng/bidm, is pointer only (licence: NONE) · get_code("7345763c9b9300fb")
How it ran

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

gen_bar_updater Ran
ran; our contract draft was wrong, not the code
weizeming/SAM_AT/SAM_segmentation/datasets/utils.py
pointer only (licence: NONE) · get_code("4b9b1e0236811496")
How it ran

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

list_dir Ran
ran; our contract draft was wrong, not the code
weizeming/SAM_AT/SAM_segmentation/datasets/utils.py
pointer only (licence: NONE); the stored copy get_code serves, from ermongroup/fairgen, is pointer only (licence: NONE) · get_code("0d8aca7e68b6e3c8")
How it ran

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

voc_cmap Ran
ran, honoured the contract we drafted
weizeming/SAM_AT/SAM_segmentation/datasets/voc.py
pointer only (licence: NONE) · get_code("681c53dc1b27fe63")
How it ran

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

convert_to_separable_conv Not yet run
unverified (harvested, no recorded run)
weizeming/SAM_AT/SAM_segmentation/network/_deeplab.py
pointer only (licence: NONE) · get_code("ce942a958c0ae909")
How it ran

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

deeplabv3_hrnetv2_32 Not yet run
unverified (harvested, no recorded run)
weizeming/SAM_AT/SAM_segmentation/network/modeling.py
pointer only (licence: NONE) · get_code("e980799df5aec203")
How it ran

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

deeplabv3_hrnetv2_48 Not yet run
unverified (harvested, no recorded run)
weizeming/SAM_AT/SAM_segmentation/network/modeling.py
pointer only (licence: NONE) · get_code("c85f2e9d72fb69ec")
How it ran

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

deeplabv3_resnet50 Not yet run
unverified (harvested, no recorded run)
weizeming/SAM_AT/SAM_segmentation/network/modeling.py
pointer only (licence: NONE) · get_code("0264c7923a17f00c")
How it ran

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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 2 later) and 1 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
list_dir 19 other papers
16 dated earlier, 3 later
1803.02999 (2018-03)
On First-Order Meta-Learning Algorithms
1903.12648 (2019-03)
Overcoming Catastrophic Forgetting with Unlabeled Data in the Wild
1906.00189 (2019-06)
Are Anchor Points Really Indispensable in Label-Noise Learning?
and 16 more not named here
check_integrity 16 other papers
13 dated earlier, 3 later
1908.07724 (2019-08)
Restricted Recurrent Neural Networks
2206.02262 (2022-06)
Diffusion-GAN: Training GANs with Diffusion
2210.11633 (2022-10)
Graphically Structured Diffusion Models
and 13 more not named here
convert_to_separable_conv 10 other papers
10 dated earlier
1706.05587 (2017-06)
Rethinking Atrous Convolution for Semantic Image Segmentation
1905.03561 (2019-05)
D2-Net: A Trainable CNN for Joint Detection and Description of Local Features
2007.07984 (2020-07)
Leveraging Category Information for Single-Frame Visual Sound Source Separation
and 7 more not named here
deeplabv3_resnet50 4 other papers
4 dated earlier
1706.05587 (2017-06)
Rethinking Atrous Convolution for Semantic Image Segmentation
2106.04463 (2021-06)
A multi-centre polyp detection and segmentation dataset for generalisability assessment
and 1 more not named here
gen_bar_updater 2 other papers
2 dated earlier
Fahes_PODA_Prompt-driven_Zero-shot_Domain_Adaptation_ICCV_2023_paper (2023 (year only))
PØDA: Prompt-driven Zero-shot Domain Adaptation
2310.06368 (2023-10)
CoinSeg: Contrast Inter- and Intra- Class Representations for Incremental Segmentation
deeplabv3_hrnetv2_32 1 other paper
1 dated earlier
1706.05587 (2017-06)
Rethinking Atrous Convolution for Semantic Image Segmentation
deeplabv3_hrnetv2_48 1 other paper
1 dated earlier
1706.05587 (2017-06)
Rethinking Atrous Convolution for Semantic Image Segmentation

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

Adversarial Training (AT), which adversarially perturb the input samples during training, has been acknowledged as one of the most effective defenses against adversarial attacks, yet suffers from inevitably decreased clean accuracy. Instead of perturbing the samples, Sharpness-Aware Minimization (SAM) perturbs the model weights during training to find a more flat loss landscape and improve generalization. However, as SAM is designed for better clean accuracy, its effectiveness in enhancing adversarial robustness remains unexplored. In this work, considering the duality between SAM and AT, we investigate the adversarial robustness derived from SAM. Intriguingly, we find that using SAM alone can improve adversarial robustness. To understand this unexpected property of SAM, we first provide empirical and theoretical insights into how SAM can implicitly learn more robust features, and conduct comprehensive experiments to show that SAM can improve adversarial robustness notably without sacrificing any clean accuracy, shedding light on the potential of SAM to be a substitute for AT when accuracy comes at a higher priority. Code is available at https: //github.com/weizeming/SAM_AT.

For agents

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

get_harvested_code_for_paper("2402.15152")
get_code_for_paper("2402.15152")
have("2402.15152")

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

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

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

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

Connect an agent — have() is free.