SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.01156 · ICML · 2022

Removing Batch Normalization Boosts Adversarial Training

Haotao Wang, Zhangyang Wang, Aston Zhang, Mu Li, Xingjian Shi, Shuai Zheng

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 3 failures of our instrument; 0 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/2207.01156.json · badge: /api/ran/2207.01156.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
amazon-research/normalizer-free-robust-training canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
FunctionStatusWhere it lives
default_conv Ran
ran; our contract draft was wrong, not the code
amazon-research/normalizer-free-robust-training/deepaug/EDSR_Model/common.py
code served (permissive licence) · get_code("8b0e794d4d8f9b13")
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 Conv2d. 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

torch.manual_seed(0)

ARGS = {
    'in_channels': 3,
    'out_channels': 5,
    'kernel_size': 3,
    'bias': True
}
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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
find_classes Ran
ran; our contract draft was wrong, not the code
amazon-research/normalizer-free-robust-training/deepaug/CAE_distort_imagenet.py
code served (permissive licence) · get_code("36a1160d7f36cda6")
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 os
import tempfile
import shutil

# Create a temporary directory with subdirectories to act as classes
temp_dir = tempfile.mkdtemp()

# Create some class directories
class_names = ['cat', 'dog', 'bird']
for class_name in class_names:
    os.makedirs(os.path.join(temp_dir, class_name), exist_ok=True)

# Define arguments for find_classes
ARGS = {
    'dir': temp_dir
}
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 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_color_distortion Ran
ran; our contract draft was wrong, not the code
amazon-research/normalizer-free-robust-training/dataloaders/imagenet.py
code served (permissive licence) · get_code("94226f82998bee03")
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 Compose. 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
from torchvision import transforms

torch.manual_seed(0)

# The function get_color_distortion takes a single parameter 's' (default 1.0)
# which is a scaling factor for color jitter parameters.
# The function uses 's' in arithmetic operations: 0.8 * s and 0.2 * s
# These are passed to ColorJitter and RandomGrayscale constructors.
# No complex objects or special attributes/methods are required.

ARGS = {
    "s": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
imagenet_datasets Ran
ran on a synthesized input
amazon-research/normalizer-free-robust-training/dataloaders/imagenet.py
code served (permissive licence) · get_code("73681c24fc0f7154")
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 os
import shutil
import tempfile
from PIL import Image
import numpy as np

# Create a temporary directory structure for ImageNet-like data
temp_dir = tempfile.mkdtemp()
data_dir = temp_dir

# Create train and val directories with class subdirectories
train_root = os.path.join(data_dir, 'train')
val_root = os.path.join(data_dir, 'val')
os.makedirs(train_root, exist_ok=True)
os.makedirs(val_root, exist_ok=True)

# Create a few class directories and dummy images
num_test_classes = 5
for class_idx in range(num_test_classes):
    class_train_dir = os.path.join(train_root, f'class_{class_idx}')
    class_val_dir = os.path.join(val_root, f'class_{class_idx}')
    os.makedirs(class_train_dir, exist_ok=True)
    os.makedirs(class_val_dir, exist_ok=True)
    
    # Create dummy training images (224x224 RGB)
    for img_idx in range(2):
        img_array = np.random.randint(0, 256, (224, 224, 3), dtype=np.uint8)
        img = Image.fromarray(img_array)
        img.save(os.path.join(class_train_dir, f'train_{img_idx}.jpg'))
    
    # Create dummy validation images (224x224 RGB)
    for img_idx in range(1):
        img_array = np.random.randint(0, 256, (224, 224, 3), dtype=np.uint8)
        img = Image.fromarray(img_array)
        img.save(os.path.join(class_val_dir, f'val_{img_idx}.jpg'))

ARGS = {
    'data_dir': data_dir,
    'min_crop_scale': 0.08,
    'num_classes': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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
imagenet_deepaug_dataset Ran
ran on a synthesized input
amazon-research/normalizer-free-robust-training/dataloaders/imagenet.py
code served (permissive licence) · get_code("26ccec159c6509f3")
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 Subset. 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 numpy as np
import os
import tempfile
from torchvision import transforms
from torchvision.datasets import ImageFolder
from PIL import Image

torch.manual_seed(0)

# Create a temporary directory structure with minimal ImageNet-like data
temp_dir = tempfile.mkdtemp()
train_dir = os.path.join(temp_dir, 'train')

# Create class directories and dummy images
num_dummy_classes = 5
for class_idx in range(num_dummy_classes):
    class_dir = os.path.join(train_dir, str(class_idx))
    os.makedirs(class_dir, exist_ok=True)
    
    # Create 2 dummy images per class
    for img_idx in range(2):
        img = Image.new('RGB', (256, 256), color=(73, 109, 137))
        img_path = os.path.join(class_dir, f'img_{img_idx}.jpg')
        img.save(img_path)

ARGS = {
    'data_dir': temp_dir,
    'min_crop_scale': 0.08,
    'num_classes': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Subset — a Subset 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
load_ckpt Ran
ran on a synthesized input
amazon-research/normalizer-free-robust-training/utils/utils.py
code served (permissive licence) · get_code("cfb106a12475f94c")
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 os
import torch
import torch.nn as nn
import tempfile

torch.manual_seed(0)

# Create a simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model, optimizer, and scheduler
model = SimpleModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=10)

# Create a checkpoint dictionary with all required keys
checkpoint = {
    'epoch': 5,
    'best_acc': 0.95,
    'training_loss': 0.25,
    'val_acc': 0.92,
    'model': model.state_dict(),
    'optimizer': optimizer.state_dict(),
    'scheduler': scheduler.state_dict(),
}

# Save checkpoint to a temporary file
with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as tmp:
    checkpoint_path = tmp.name
    torch.save(checkpoint, checkpoint_path)

# Create fresh instances for loading
model_fresh = SimpleModel()
optimizer_fresh = torch.optim.SGD(model_fresh.parameters(), lr=0.01)
scheduler_fresh = torch.optim.lr_scheduler.StepLR(optimizer_fresh, step_size=10)

ARGS = {
    'model': model_fresh,
    'optimizer': optimizer_fresh,
    'scheduler': scheduler_fresh,
    'path': checkpoint_path,
}
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 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
load_ckpt_adv Ran
ran on a synthesized input
amazon-research/normalizer-free-robust-training/utils/utils.py
code served (permissive licence) · get_code("e63b113d977c2bc2")
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 os
import torch
import torch.nn as nn
import tempfile

torch.manual_seed(0)

# Create a minimal model
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model, optimizer, and scheduler
model = TinyModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.1)

# Create a checkpoint file
checkpoint = {
    'epoch': 5,
    'best_SA': 0.95,
    'best_RA': 0.87,
    'training_loss': [0.5, 0.4, 0.3, 0.2, 0.1],
    'val_SA': [0.80, 0.85, 0.90, 0.93, 0.95],
    'val_RA': [0.70, 0.75, 0.80, 0.85, 0.87],
    'model': model.state_dict(),
    'optimizer': optimizer.state_dict(),
    'scheduler': scheduler.state_dict(),
}

# Write checkpoint to a temporary file
with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.pt') as f:
    torch.save(checkpoint, f)
    ckpt_path = f.name

# Create fresh model, optimizer, scheduler for loading
model_fresh = TinyModel()
optimizer_fresh = torch.optim.SGD(model_fresh.parameters(), lr=0.01)
scheduler_fresh = torch.optim.lr_scheduler.StepLR(optimizer_fresh, step_size=1, gamma=0.1)

ARGS = {
    'model': model_fresh,
    'optimizer': optimizer_fresh,
    'scheduler': scheduler_fresh,
    'path': ckpt_path,
}
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 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
soft_sign Ran
ran on a synthesized input
amazon-research/normalizer-free-robust-training/utils/utils.py
code served (permissive licence) · get_code("bf9bce3661ad7ca2")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small tensor for w
w = torch.randn(2, 4, requires_grad=False)

# Create a float threshold
th = 0.5

ARGS = {
    "w": w,
    "th": th
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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

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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 2 the same month, 3 later) and 5 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
default_conv 57 other papers
20 dated earlier, 1 the same month, 35 later, 1 same year, order not determinable · 2 only as an assembly brick
1707.02921 (2017-07)
Enhanced Deep Residual Networks for Single Image Super-Resolution
1803.02735 (2018-03)
Deep Back-Projection Networks For Super-Resolution
1803.04626 (2018-03)
Maintaining Natural Image Statistics with the Contextual Loss
and 54 more not named here
find_classes 30 other papers
18 dated earlier, 1 the same month, 9 later, 2 same year, order not determinable
1406.2661 (2014-06)
Generative Adversarial Networks
1612.06321 (2016-12)
Large-Scale Image Retrieval with Attentive Deep Local Features
1809.04729 (2018-09)
A Less Biased Evaluation of Out-of-distribution Sample Detectors
and 27 more not named here
get_color_distortion 6 other papers
3 dated earlier, 3 later
2002.05709 (2020-02)
A Simple Framework for Contrastive Learning of Visual Representations
2104.09866 (2021-04)
Distill on the Go: Online knowledge distillation in self-supervised learning
2110.01445 (2021-10)
Robust and Decomposable Average Precision for Image Retrieval
and 3 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

Adversarial training (AT) defends deep neural networks against adversarial attacks. One challenge that limits its practical application is the performance degradation on clean samples. A major bottleneck identified by previous works is the widely used batch normalization (BN), which struggles to model the different statistics of clean and adversarial training samples in AT. Although the dominant approach is to extend BN to capture this mixture of distribution, we propose to completely eliminate this bottleneck by removing all BN layers in AT. Our normalizer-free robust training (NoFrost) method extends recent advances in normalizerfree networks to AT for its unexplored advantage on handling the mixture distribution challenge. We show that NoFrost achieves adversarial robustness with only a minor sacrifice on clean sample accuracy. On ImageNet with ResNet50, NoFrost achieves 74.06% clean accuracy, which drops merely 2.00% from standard training. In contrast, BN-based AT obtains 59.28% clean accuracy, suffering a significant 16.78% drop from standard training. In addition, NoFrost achieves a 23.56% adversarial robustness against PGD attack, which improves the 13.57% robustness in BN-based AT. We observe better model smoothness and larger decision margins from NoFrost, which make the models less sensitive to input perturbations and thus more robust. Moreover, when incorporating more data augmentations into NoFrost, it achieves comprehensive robustness against multiple distribution shifts. Code and pretrained models are public 1 .

For agents

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

get_harvested_code_for_paper("2207.01156")
get_code_for_paper("2207.01156")
have("2207.01156")

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

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

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

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

Connect an agent — have() is free.