SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1904.13000 · 2019

Adversarial Training and Robustness for Multiple Perturbations

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 0 failures of our instrument; 0 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/1904.13000.json · badge: /api/ran/1904.13000.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
ftramer/MultiRobustness canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
delta_update Ran
ran on a synthesized input
ftramer/MultiRobustness/pgd_attack.py
code served (permissive licence) · get_code("45b412e65b738df8")
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 4, dtype family float, shape (2, 3, 4, 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 numpy as np

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

# Create small tensors for the function arguments
batch_size = 2
height = 3
width = 4
channels = 5

# old_delta: shape (batch, height, width, channels)
old_delta = np.random.randn(batch_size, height, width, channels).astype(np.float32)

# g: gradient with same shape as old_delta
g = np.random.randn(batch_size, height, width, channels).astype(np.float32)

# x_adv: adversarial examples with same shape as old_delta
x_adv = np.random.uniform(-1, 1, size=(batch_size, height, width, channels)).astype(np.float32)

# x_min and x_max: scalar bounds
x_min = -1.0
x_max = 1.0

# weight: shape (batch_size,) - per-sample weights
weight = np.array([1.0, 0.8], dtype=np.float32)

# attack: dictionary specifying attack configuration
attack = {
    'type': 'linf',  # Can be 'linf', 'l2', or 'l1'
    'epsilon': 0.3,
    'k': 10,
    'a': 0.01
}

# seed: optional random seed
seed = 42

# t: optional timestep (not used in function body)
t = None

ARGS = {
    'old_delta': old_delta,
    'g': g,
    'x_adv': x_adv,
    'attack': attack,
    'x_min': x_min,
    'x_max': x_max,
    'weight': weight,
    'seed': seed,
    't': t
}
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 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 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
get_model Ran
ran on a synthesized input
ftramer/MultiRobustness/eval_ch.py
code served (permissive licence) · get_code("c1f9e6aef58749ea")
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 MockMadryMNIST. 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

# Mock the cleverhans_models module since we can't import it
class MockMadryMNIST(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(784, 10)
    
    def forward(self, x):
        return self.linear(x.view(x.size(0), -1))

class MockWResNet(nn.Module):
    def __init__(self, scope, filters):
        super().__init__()
        self.scope = scope
        self.filters = filters
        self.linear = nn.Linear(filters, 10)
    
    def forward(self, x):
        return self.linear(x)

def make_wresnet(scope, filters):
    return MockWResNet(scope, filters)

# Create a mock module
import sys
from types import ModuleType

mock_cleverhans = ModuleType('cleverhans_models')
mock_cleverhans.MadryMNIST = MockMadryMNIST
mock_cleverhans.make_wresnet = make_wresnet
sys.modules['cleverhans_models'] = mock_cleverhans

# Now construct the config for the function
config_mnist = {
    'data': 'mnist'
}

config_wresnet = {
    'data': 'cifar10',
    'filters': 64
}

# Test both cases - use the MNIST case as primary
ARGS = {
    'config': config_mnist
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cleverhans_models, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockMadryMNIST — a MockMadryMNIST output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockMadryMNIST 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
init_delta Ran
ran on a synthesized input
ftramer/MultiRobustness/pgd_attack.py
code served (permissive licence) · get_code("8e40b704f9b8cd20")
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 4, dtype family float, shape (2, 3, 4, 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 numpy as np

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

# Create small test data
# x should be a batch of images with shape (batch_size, channels, height, width)
x = np.random.randn(2, 3, 4, 5).astype(np.float32)

# attack dict with required keys
attack = {
    'random_start': True,
    'epsilon': 0.3,
    'type': 'linf'  # can be 'linf', 'l2', or 'l1'
}

# weight should be a 1D array with length equal to batch size
weight = np.array([1.0, 0.5])

ARGS = {
    'x': x,
    'attack': attack,
    'weight': weight
}
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 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 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
one_hot Ran
ran on a synthesized input
ftramer/MultiRobustness/eval_ch.py
code served (permissive licence) · get_code("6a20026ff6ff35da")
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 2, dtype family int, shape (4, 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

# Construct arguments for one_hot function
# The function takes:
# - a: array-like of class indices (must be integers in range [0, n_classes))
# - n_classes: number of classes (int)

# Create a small array of class indices
a = np.array([0, 2, 1, 3])

# Number of classes
n_classes = 4

ARGS = {
    "a": a,
    "n_classes": n_classes,
}
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 2, dtype family int, shape (4, 4) — shape (4, 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
uniform_weights Ran
ran on a synthesized input
ftramer/MultiRobustness/pgd_attack.py
code served (permissive licence) · get_code("f5fa09b884f0c0d3")
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 2, dtype family float, shape (5, 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

np.random.seed(0)

n_attacks = 5
n_samples = 3

ARGS = {
    "n_attacks": n_attacks,
    "n_samples": n_samples,
}
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 2, dtype family float, shape (5, 3) — shape (5, 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

Also present in other papers' code

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

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

Defenses against adversarial examples, such as adversarial training, are typically tailored to a single perturbation type (e.g., small $\ell_\infty$-noise). For other perturbations, these defenses offer no guarantees and, at times, even increase the model's vulnerability. Our aim is to understand the reasons underlying this robustness trade-off, and to train models that are simultaneously robust to multiple perturbation types. We prove that a trade-off in robustness to different types of $\ell_p$-bounded and spatial perturbations must exist in a natural and simple statistical setting. We corroborate our formal analysis by demonstrating similar robustness trade-offs on MNIST and CIFAR10. Building upon new multi-perturbation adversarial training schemes, and a novel efficient attack for finding $\ell_1$-bounded adversarial examples, we show that no model trained against multiple attacks achieves robustness competitive with that of models trained on each attack individually. In particular, we uncover a pernicious gradient-masking phenomenon on MNIST, which causes adversarial training with first-order $\ell_\infty, \ell_1$ and $\ell_2$ adversaries to achieve merely $50\%$ accuracy. Our results question the viability and computational scalability of extending adversarial robustness, and adversarial training, to multiple perturbation types.

For agents

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

get_harvested_code_for_paper("1904.13000")
get_code_for_paper("1904.13000")
have("1904.13000")

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

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

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

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

Connect an agent — have() is free.