SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.08714 · 2021

Fighting Gradients with Gradients: Dynamic Defenses against Adversarial Attacks

arXiv · PDF · Open in the Atlas

Code that ran

12 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 11 failures of our instrument; 1 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/2105.08714.json · badge: /api/ran/2105.08714.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
DequanWang/dent canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
DequanWang/tent canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
4 ran · 1 no recorded run
FunctionStatusWhere it lives
Tent Ran
ran on a synthesized input · constructed an object; no result was computed
this paper's copy was not recorded; identical code first harvested from DequanWang/tent
pointer only · get_code("9b0b70ed44f66088")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

collect_params Ran
ran; our contract draft was wrong, not the code
DequanWang/tent/tent.py
code served (permissive licence) · get_code("fb3d07027ed3b46c")
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 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Build a small model with BatchNorm2d layers
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 4, kernel_size=3)
        self.bn1 = nn.BatchNorm2d(4)
        self.conv2 = nn.Conv2d(4, 8, kernel_size=3)
        self.bn2 = nn.BatchNorm2d(8)
        self.linear = nn.Linear(8, 2)
    
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.conv2(x)
        x = self.bn2(x)
        return x

model = SimpleModel()

ARGS = {
    'model': model
}
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 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
collect_stats Ran
ran; our contract draft was wrong, not the code
DequanWang/dent/norm.py
pointer only (licence: MIT); the stored copy get_code serves, from royzry98/moase-pytorch, is pointer only (licence: NONE) · get_code("c5f915703f30ab89")
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 royzry98/moase-pytorch, 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.

configure_model Ran
ran; our contract draft was wrong, not the code
DequanWang/dent/norm.py
pointer only (licence: MIT); the stored copy get_code serves, from royzry98/moase-pytorch, is pointer only (licence: NONE) · get_code("8f537ee8d4a9b397")
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 royzry98/moase-pytorch, 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.

copy_model_and_optimizer Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from yuyongcan/stamp
pointer only; the stored copy get_code serves, from yuyongcan/stamp, is pointer only (licence: NONE) · get_code("d203451c6493f65d")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

forward_and_adapt Ran
ran; our contract draft was wrong, not the code
DequanWang/tent/tent.py
code served (permissive licence) · get_code("dae52c9027c48afd")
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 2, dtype family float, shape (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)

# Create a simple model that takes input and produces logits
class SimpleModel(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

# Set up the components
input_dim = 4
output_dim = 3
batch_size = 2

# Create model
model = SimpleModel(input_dim, output_dim)

# Create input tensor (batch_size=2, input_dim=4)
x = torch.randn(batch_size, input_dim)

# Create optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

ARGS = {
    "x": x,
    "model": model,
    "optimizer": optimizer
}
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 2, dtype family float, shape (2, 3) — shape (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
forward_and_adapt Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from DequanWang/tent
pointer only · get_code("1d10e9bc70ce18a5")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

setup_source Ran
ran; our contract draft was wrong, not the code
DequanWang/dent/cifar10c.py
code served (permissive licence) · get_code("721e565ebd5fda4e")
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 MinimalModel. 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
import logging

logger = logging.getLogger(__name__)

# Set seed for reproducibility
torch.manual_seed(0)

# Create a minimal model that can be set to eval mode
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the model
model = MinimalModel()

# Construct the arguments dictionary
ARGS = {
    'model': model
}
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 MinimalModel — a MinimalModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MinimalModel 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
shot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
DequanWang/dent/dent.py
code served (permissive licence) · get_code("1a3691c12b2dbd54")
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; 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 torch

torch.manual_seed(0)

# The function 'shot' takes a single tensor argument 'x'
# It expects x to be a 2D tensor (based on softmax(1) and operations on dim=1)
# The function computes entropy and divergence losses
# We need a batch of logits/scores

# Create a small tensor: batch_size=2, num_classes=4
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
softmax_entropy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
DequanWang/dent/tent.py
pointer only (licence: MIT); the stored copy get_code serves, from Feliciaxyao/ICML2024-FSTTA, is pointer only (licence: NONE) · get_code("3078648c75e3e1e3")
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 Feliciaxyao/ICML2024-FSTTA, 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.

softmax_entropy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from fredzzhang/atlas
pointer only; the stored copy get_code serves, from fredzzhang/atlas, is pointer only (licence: NONE) · get_code("60e9cb8fea03027c")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

tent Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
DequanWang/dent/dent.py
code served (permissive licence) · get_code("5a02af70018fdf00")
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; 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function tent expects a tensor x with shape (batch_size, num_classes)
# It computes softmax and log_softmax along dimension 1, multiplies them element-wise,
# sums along dimension 1, and then takes the mean across the batch.
# So we need a 2D tensor with at least 2 dimensions.

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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_model_and_optimizer Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from DequanWang/tent
pointer only · get_code("5014c3a1f79a6661")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 9 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 8 later) and 2 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
softmax_entropy 22 other papers
1 dated earlier, 20 later, 1 undated · 4 only as an assembly brick
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION
2110.14038 (2021-10)
Robustness of Graph Neural Networks at Scale
2302.12400 (2023-02)
Towards Stable Test-Time Adaptation in Dynamic Wild World
and 19 more not named here
load_model_and_optimizer 9 other papers
1 dated earlier, 8 later · 8 only as an assembly brick
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION
2203.13591 (2022-03)
Continual Test-Time Domain Adaptation
2302.12400 (2023-02)
Towards Stable Test-Time Adaptation in Dynamic Wild World
and 6 more not named here
copy_model_and_optimizer 8 other papers
1 dated earlier, 7 later · 4 only as an assembly brick
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION
2110.10232 (2021-10)
Test time Adaptation through Perturbation Robustness
2302.12400 (2023-02)
Towards Stable Test-Time Adaptation in Dynamic Wild World
and 5 more not named here
forward_and_adapt 5 other papers
1 dated earlier, 3 later, 1 undated
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION
2306.04344 (2023-06)
ViDA: Homeostatic Visual Domain Adapter for Continual Test Time Adaptation
2406.10737 (2024-06)
DPCore: Dynamic Prompt Coreset for Continual Test-Time Adaptation
and 2 more not named here
setup_source 4 other papers
4 later
2306.04344 (2023-06)
ViDA: Homeostatic Visual Domain Adapter for Continual Test Time Adaptation
2405.16486 (2024-05)
Decomposing the Neurons: Activation Sparsity via Mixture of Experts for Continual Test Time Adaptation
2406.10737 (2024-06)
DPCore: Dynamic Prompt Coreset for Continual Test-Time Adaptation
and 1 more not named here
collect_stats 3 other papers
3 later
2311.14402 (2023-11)
TEA: Test-time Energy Adaptation
2404.06065 (2024-04)
Unified Entropy Optimization for Open-Set Test-Time Adaptation
2405.16486 (2024-05)
Decomposing the Neurons: Activation Sparsity via Mixture of Experts for Continual Test Time Adaptation
configure_model 3 other papers
3 later
2311.14402 (2023-11)
TEA: Test-time Energy Adaptation
2404.06065 (2024-04)
Unified Entropy Optimization for Open-Set Test-Time Adaptation
2405.16486 (2024-05)
Decomposing the Neurons: Activation Sparsity via Mixture of Experts for Continual Test Time Adaptation
collect_params 2 other papers
1 dated earlier, 1 later
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION
2405.05012 (2024-05)
The Entropy Enigma: Success and Failure of Entropy Minimization
Tent 1 other paper
1 dated earlier
2006.10726 (2020-06)
TENT: FULLY TEST-TIME ADAPTATION BY ENTROPY MINIMIZATION

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 attacks optimize against models to defeat defenses. Existing defenses are static, and stay the same once trained, even while attacks change. We argue that models should fight back, and optimize their defenses against attacks at test time. We propose dynamic defenses, to adapt the model and input during testing, by defensive entropy minimization (dent). Dent alters testing, but not training, for compatibility with existing models and train-time defenses. Dent improves the robustness of adversarially-trained defenses and nominally-trained models against white-box, black-box, and adaptive attacks on CIFAR-10/100 and ImageNet. In particular, dent boosts state-of-the-art defenses by 20+ points absolute against AutoAttack on CIFAR-10 at $ε_\infty$ = 8/255.

For agents

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

get_harvested_code_for_paper("2105.08714")
get_code_for_paper("2105.08714")
have("2105.08714")

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

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

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

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

Connect an agent — have() is free.