SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.12135 · ICML · 2021

Learning to Generate Noise for Multi-Attack Robustness

Jinwoo Shin, Sung Hwang, Divyam Madaan

arXiv · PDF · Open in the Atlas

Code that ran

9 of 16 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, 1 violated it and 3 have no contract verdict; 5 failures of our instrument; 7 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/2006.12135.json · badge: /api/ran/2006.12135.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
divyam3897/MNG_AC canonical (classifier label)
classifier basis: census
9 ran · 7 no recorded run
FunctionStatusWhere it lives
batch_norm Ran
ran; our contract draft was wrong, not the code
divyam3897/MNG_AC/torch_backend.py
code served (permissive licence) · get_code("bd8c619e1c243150")
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 BatchNorm2d. 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 = {
    "num_channels": 3,
    "bn_bias_init": 0.5,
    "bn_bias_freeze": True,
    "bn_weight_init": 1.0,
    "bn_weight_freeze": False,
}
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 BatchNorm2d — a BatchNorm2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a BatchNorm2d 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
entropy_loss Ran
ran; our contract draft was wrong, not the code
divyam3897/MNG_AC/losses.py
pointer only (licence: MIT); the stored copy get_code serves, from zjfheart/Geometry-aware-Instance-reweighted-Adversarial-Training, is pointer only (licence: NONE) · get_code("044ec38c1bb631ec")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from zjfheart/Geometry-aware-Instance-reweighted-Adversarial-Training, and GitHub detected no licence in that repository 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.

noise_loss Ran
ran on a synthesized input
divyam3897/MNG_AC/losses.py
code served (permissive licence) · get_code("25a38483a96ef158")
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 0, dtype family float, 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 torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that takes input and produces logits
class SimpleClassifier(nn.Module):
    def __init__(self, input_dim, num_classes):
        super().__init__()
        self.linear = nn.Linear(input_dim, num_classes)
    
    def forward(self, x):
        # Flatten if needed and pass through linear layer
        if x.dim() > 2:
            x = x.view(x.size(0), -1)
        return self.linear(x)

# Create model
model = SimpleClassifier(input_dim=4, num_classes=3)

# Create sample inputs
batch_size = 2
x_natural = torch.randn(batch_size, 4)  # batch_size=2, feature_dim=4
x_natural = x_natural.clamp(0.0, 1.0)  # ensure values in [0, 1] for image-like data

# Create sample labels
y = torch.tensor([0, 1])  # 2 labels for batch_size=2

# Define arguments dict
ARGS = {
    "model": model,
    "x_natural": x_natural,
    "y": y,
    "epsilon": 0.25,
    "clamp_x": True,
}
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 0, dtype family float, 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
normalise Ran
ran, violated the contract we drafted
divyam3897/MNG_AC/core.py
code served (permissive licence) · get_code("8b28005c645a1f0d")
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 3, dtype family float, shape (1, 2, 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 numpy as np

ARGS = {
    'x': np.array([[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]], dtype=np.float32),
    'mean': (0.0, 0.0, 0.0),
    'std': (1.0, 1.0, 1.0)
}
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 3, dtype family float, shape (1, 2, 3) — shape (1, 2, 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
norms Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
divyam3897/MNG_AC/evaluate.py
code served (permissive licence) · get_code("213a35c2134004c8")
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 4, dtype family float, shape (2, 1, 1, 1) 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

torch.manual_seed(0)

# The function takes Z and calls:
# - Z.view(Z.shape[0], -1)  -> reshapes to (batch_size, flattened)
# - .norm(dim=1)             -> computes L2 norm along dim 1
# - [:, None, None, None]    -> adds 3 new dimensions
# So Z should be a 4D tensor (batch, channels, height, width) or similar

Z = torch.randn(2, 4, 3, 5)

ARGS = {
    "Z": Z
}
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 4, dtype family float, shape (2, 1, 1, 1) — shape (2, 1, 1, 1) 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
norms_p Ran
ran on a synthesized input
divyam3897/MNG_AC/evaluate.py
code served (permissive licence) · get_code("270dfbbfa52ea425")
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 4, dtype family float, shape (2, 1, 1, 1) 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)

# The function expects:
# - Z: a tensor with shape (batch_size, ...) that can be viewed as (batch_size, -1)
# - order: an integer specifying the norm order (p parameter for torch.norm)

# Create a small tensor with batch size 2 and additional dimensions
# Shape: (2, 4, 3, 2) - batch=2, then three other dimensions with distinct sizes
Z = torch.randn(2, 4, 3, 2)

# The order parameter for the norm (e.g., 1, 2, etc.)
order = 2

ARGS = {
    "Z": Z,
    "order": order
}
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 4, dtype family float, shape (2, 1, 1, 1) — shape (2, 1, 1, 1) 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
pad Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
divyam3897/MNG_AC/core.py
pointer only (licence: MIT); the stored copy get_code serves, from jiancongxiao/moreau-envelope-sgd, is pointer only (licence: NONE) · get_code("1e0eb41fc8899d05")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from jiancongxiao/moreau-envelope-sgd, and GitHub detected no licence in that repository 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.

to_var Ran
ran; our contract draft was wrong, not the code
divyam3897/MNG_AC/layers.py
pointer only (licence: MIT); the stored copy get_code serves, from xjtushujun/cmw-net, is pointer only (licence: NONE) · get_code("a2f6a25906e664c5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from xjtushujun/cmw-net, and GitHub detected no licence in that repository 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.

trades_loss Ran
ran on a synthesized input
divyam3897/MNG_AC/losses.py
code served (permissive licence) · get_code("d3122446266de554")
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 0, dtype family float, shape () as a later run recorded it. 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, 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
import torch.nn.functional as F

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, num_classes=3):
        super().__init__()
        self.fc = nn.Linear(input_dim, num_classes)
    
    def forward(self, x):
        return self.fc(x)

model = SimpleModel(input_dim=4, num_classes=3)
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

x_natural = torch.randn(2, 4)
y = torch.tensor([0, 1])

ARGS = {
    'model': model,
    'x_natural': x_natural,
    'y': y,
    'optimizer': optimizer,
    'step_size': 0.003,
    'epsilon': 0.031,
    'perturb_steps': 10,
    'beta': 6.0,
    'adversarial': True,
    'distance': 'l_inf',
    'entropy_weight': 0.0
}
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 Tensor, ndim 0, dtype family float, 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
cifar10 Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/torch_backend.py
code served (permissive licence) · get_code("976a0e15b0013751")
How it ran

no invocation recorded.

cifar100 Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/torch_backend.py
code served (permissive licence) · get_code("62cfcd202fa9f187")
How it ran

no invocation recorded.

get_loaders Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/train_pgd.py
code served (permissive licence) · get_code("4829fc02195f0c39")
How it ran

no invocation recorded.

normalise2 Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/core.py
code served (permissive licence) · get_code("e947902323493385")
How it ran

no invocation recorded.

setup_data_loader Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/datasets.py
code served (permissive licence) · get_code("66afde320d908d83")
How it ran

no invocation recorded.

setup_imagenet_data_loader Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/datasets.py
code served (permissive licence) · get_code("15f887c3ff793240")
How it ran

no invocation recorded.

setup_imagenetc_data_loader Not yet run
unverified (harvested, no recorded run)
divyam3897/MNG_AC/datasets.py
code served (permissive licence) · get_code("8471056031202a90")
How it ran

no invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 8 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 6 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
to_var 17 other papers
3 dated earlier, 1 the same month, 13 later · 4 only as an assembly brick
1606.04474 (2016-06)
Learning to learn by gradient descent by gradient descent
1902.07379 (2019-02)
Meta-Weight-Net: Learning an Explicit Mapping For Sample Weighting
2003.10780 (2020-03)
Rethinking Class-Balanced Methods for Long-Tailed Visual Recognition from a Domain Adaptation Perspective
and 14 more not named here
normalise 8 other papers
2 dated earlier, 6 later
1905.02249 (2019-05)
MixMatch: A Holistic Approach to Semi-Supervised Learning
2003.14297 (2020-03)
Generative Latent Implicit Conditional Optimization when Learning from Small Sample
2103.14222 (2021-03)
Adversarial Attacks are Reversible with Natural Supervision
and 5 more not named here
pad 6 other papers
6 later
2103.14222 (2021-03)
Adversarial Attacks are Reversible with Natural Supervision
2204.03714 (2022-04)
ICLR 2022 PAIR 2 Struct Workshop USING MULTIPLE SELF-SUPERVISED TASKS IM-PROVES MODEL ROBUSTNESS
2210.03543 (2022-10)
A2: Efficient Automated Attacker for Boosting Adversarial Training
and 3 more not named here
entropy_loss 2 other papers
1 dated earlier, 1 later
1905.13736 (2019-05)
Unlabeled Data Improves Adversarial Robustness
2010.01736 (2020-10)
Geometry-aware Instance-reweighted Adversarial Training
norms 2 other papers
2 later · 1 only as an assembly brick
2012.12368 (2020-12)
Understanding and Increasing Efficiency of Frank-Wolfe Adversarial Training
2104.01231 (2021-04)
Diverse Gaussian Noise Consistency Regularization for Robustness and Uncertainty Calibration
batch_norm 1 other paper
1 later
2209.03942 (2022-09)
Data Feedback Loops: Model-driven Amplification of Dataset Biases
noise_loss 1 other paper
1 dated earlier
1905.13736 (2019-05)
Unlabeled Data Improves Adversarial Robustness
setup_data_loader 1 other paper
1 dated earlier
2001.06057 (2020-01)
A simple way to make neural networks robust against diverse image corruptions

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

Adversarial learning has emerged as one of the successful techniques to circumvent the susceptibility of existing methods against adversarial perturbations. However, the majority of existing defense methods are tailored to defend against a single category of adversarial perturbation (e.g. ∞ -attack). In safety-critical applications, this makes these methods extraneous as the attacker can adopt diverse adversaries to deceive the system. Moreover, training on multiple perturbations simultaneously significantly increases the computational overhead during training. To address these challenges, we propose a novel metalearning framework that explicitly learns to generate noise to improve the model's robustness against multiple types of attacks. Its key component is Meta Noise Generator (MNG) that outputs optimal noise to stochastically perturb a given sample, such that it helps lower the error on diverse adversarial perturbations. By utilizing samples generated by MNG, we train a model by enforcing the label consistency across multiple perturbations. We validate the robustness of models trained by our scheme on various datasets and against a wide variety of perturbations, demonstrating that it significantly outperforms the baselines across multiple perturbations with a marginal computational cost.

For agents

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

get_harvested_code_for_paper("2006.12135")
get_code_for_paper("2006.12135")
have("2006.12135")

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

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

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

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

Connect an agent — have() is free.