SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2012.12368 · ICML · 2020

Understanding and Increasing Efficiency of Frank-Wolfe Adversarial Training

Theodoros Tsiligkaridis, Jay Roberts

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2012.12368.json · badge: /api/ran/2012.12368.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
theot1/fw-at-adapt marked official in Papers with Code
Papers with Code archive
4 ran · 0 no recorded run
FunctionStatusWhere it lives
find_adv_input_fw Ran
ran; our contract draft was wrong, not the code
theot1/fw-at-adapt/AdversarialTrainer.py
code served (permissive licence) · get_code("34c905d0ef4570fa")
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) and returned Tensor, ndim 4, dtype family float, shape (2, 1, 2, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that accepts normalized input and returns logits
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 10)  # 4 input features, 10 classes
    
    def forward(self, x):
        # Flatten spatial dimensions if present
        batch_size = x.shape[0]
        x_flat = x.view(batch_size, -1)
        return self.fc(x_flat)

# Create model instance
model = SimpleModel()

# Create small input tensor: batch_size=2, channels=1, height=2, width=2 (total 4 features)
x = torch.randn(2, 1, 2, 2)

# Create label tensor with valid class indices (0-9 for 10 classes)
y = torch.tensor([3, 7])

# Parameters for the adversarial attack
epsilon = 0.3
K = 5  # number of steps
c = 1.0  # step size decay parameter
device = 'cpu'
adv_norm = 'L2'
loss_fn = nn.CrossEntropyLoss()
initialize = 'zero'
stage = 'train'

ARGS = {
    'model': model,
    'x': x,
    'y': y,
    'epsilon': epsilon,
    'K': K,
    'c': c,
    'device': device,
    'adv_norm': adv_norm,
    'loss_fn': loss_fn,
    'initialize': initialize,
    'stage': stage
}
Setup block drafted by
a language model, Claude Haiku 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 Tensor, ndim 4, dtype family float, shape (2, 1, 2, 2) — shape (2, 1, 2, 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
model_n Ran
ran; our contract draft was wrong, not the code
theot1/fw-at-adapt/AdversarialTrainer.py
code served (permissive licence) · get_code("2012ddbbdc44bf44")
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 3, dtype family float, shape (3, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that takes input and returns output
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 instance
model = SimpleModel()

# Create a small input tensor: batch_size=2, channels=3, spatial_dims=1
# The normalize function expects tensor to be iterable, so we need shape (3, 2, 4)
# where 3 is the number of channels to normalize over
x = torch.randn(3, 2, 4)

# Define ARGS dict with all parameters
ARGS = {
    "model": model,
    "x": x,
    "mean": (0.4914, 0.4822, 0.4465),
    "std": (0.2023, 0.1994, 0.201)
}
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 3, dtype family float, shape (3, 2, 3) — shape (3, 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
normalize Ran
ran; our contract draft was wrong, not the code
theot1/fw-at-adapt/AdversarialTrainer.py
code served (permissive licence) · get_code("839a94c30687caf2")
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 numpy as np

torch.manual_seed(0)

# The function iterates over tensor, mean, and std using zip
# It performs element-wise operations: subtraction and division
# The function expects these to be iterables of tensors or tensor-like objects

# Create a tensor with shape (2, 4) - batch of 2, dimension 4
tensor = torch.randn(2, 4)

# Create mean and std as lists of scalars or tensors
# Since the function zips over them, they should be iterables with same length as tensor
mean = [0.5, 0.3, 0.2, 0.1]
std = [1.0, 1.5, 0.8, 1.2]

ARGS = {
    "tensor": tensor,
    "mean": mean,
    "std": std
}
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 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
norms Ran
ran, honoured the contract we drafted
theot1/fw-at-adapt/AdversarialTrainer.py
code served (permissive licence) · get_code("b7ae66630d9857bc")
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 norms() takes a tensor Z and:
# 1. Accesses Z.shape[0] to get the first dimension
# 2. Calls Z.view() to reshape it to (batch_size, -1)
# 3. Calls .norm(dim=1) to compute norms along dimension 1
# 4. Indexes with [:, None, None, None] to add 3 new dimensions
# The result is reshaped back to have shape (batch_size, 1, 1, 1)

# Create a small 4D tensor: batch=2, channels=4, height=3, width=5
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

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 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 3 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
norms
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2006.12135 (2020-06)
Learning to Generate Noise for Multi-Attack Robustness
2104.01231 (2021-04)
Diverse Gaussian Noise Consistency Regularization for Robustness and Uncertainty Calibration

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-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Deep neural networks are easily fooled by small perturbations known as adversarial attacks. Adversarial Training (AT) is a technique that approximately solves a robust optimization problem to minimize the worst-case loss and is widely regarded as the most effective defense against such attacks. Due to the high computation time for generating strong adversarial examples in the AT process, single-step approaches have been proposed to reduce training time. However, these methods suffer from catastrophic overfitting where adversarial accuracy drops during training, and although improvements have been proposed, they increase training time and robustness is far from that of multi-step AT. We develop a theoretical framework for adversarial training with FW optimization (FW-AT) that reveals a geometric connection between the loss landscape and the distortion of ℓ ∞ FW attacks (the attack's ℓ 2 norm). Specifically, we analytically show that high distortion of FW attacks is equivalent to small gradient variation along the attack path. It is then experimentally demonstrated on various deep neural network architectures that ℓ ∞ attacks against robust models achieve near maximal ℓ 2 distortion, while standard networks have lower distortion. Furthermore, it is experimentally shown that catastrophic overfitting is strongly correlated with low distortion of FW attacks. This mathematical transparency differentiates FW from the more popular Projected Gradient Descent (PGD) optimization. To demonstrate the utility of our theoretical framework we develop FW-AT-ADAPT , a novel adversarial training algorithm which uses a simple distortion measure to adapt the number of attack steps during training to increase efficiency without compromising robustness. FW-AT-ADAPT provides training time on par with single-step fast AT methods and improves closing the gap between fast AT methods and multi-step PGD-ATwith minimal loss in adversarial accuracy in white-box and black-box settings.

For agents

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

get_harvested_code_for_paper("2012.12368")
get_code_for_paper("2012.12368")
have("2012.12368")

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

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

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

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

Connect an agent — have() is free.