SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_28365 · AAAI · 2024

AGS: Affordable and Generalizable Substitute Training for Transferable Adversarial Attack

Yuanfang Guo, Yunhong Wang, Ruikui Wang

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 2 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/aaai_28365.json · badge: /api/ran/aaai_28365.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
lwmming/AGS canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
PGD_accl_l2_norand Ran
ran on a synthesized input
lwmming/AGS/train_ags_lmdb.py
code served (permissive licence) · get_code("619c23e28fc71b62")
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, 3, 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)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(12, 8)
    
    def forward(self, x):
        # x shape: (batch_size, 3, 2, 2) -> flatten to (batch_size, 12)
        batch_size = x.shape[0]
        x_flat = x.view(batch_size, -1)
        features = self.fc(x_flat)
        out = features / (torch.norm(features, dim=1, keepdim=True) + 1e-8)
        return features, out

model = SimpleModel()

batch_size = 2
inputs1 = torch.randn(batch_size, 3, 2, 2)
inputs2 = torch.randn(batch_size, 3, 2, 2)
inputs = torch.rand(batch_size, 3, 2, 2)

ARGS = {
    "model": model,
    "inputs1": inputs1,
    "inputs2": inputs2,
    "inputs": inputs,
    "eps": 1.0,
    "alpha": 0.5,
    "iters": 2,
}
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, 3, 2, 2) — shape (2, 3, 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
dumps_data Ran
ran; our contract draft was wrong, not the code
lwmming/AGS/folder2lmdb.py
code served (permissive licence) · get_code("cadb98df0b43c793")
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 bytes. 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 pickle
import torch
import numpy as np

# Set seed for reproducibility
torch.manual_seed(0)

# Create various serializable objects to test dumps_data
obj_dict = {
    "key1": "value1",
    "key2": 42,
    "key3": [1, 2, 3]
}

obj_list = [1, 2, 3, "test", {"nested": "dict"}]

obj_tensor = torch.randn(2, 4)

obj_numpy = np.array([[1, 2, 3], [4, 5, 6]])

class SimpleClass:
    def __init__(self):
        self.data = "test_data"
        self.value = 123

obj_custom = SimpleClass()

obj_tuple = (1, 2, "three", [4, 5])

obj_string = "This is a simple string"

obj_number = 42.5

# Test with dict - this is a common serialization target
ARGS = {
    "obj": obj_dict
}
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 bytes — a bytes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a bytes 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
loads_data Ran
ran; our contract draft was wrong, not the code
lwmming/AGS/folder2lmdb.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from s-enmt/MMFT, is pointer only (licence: NOASSERTION) · get_code("2bc7277fbb33cc3f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from s-enmt/MMFT, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

nt_xent_triple Ran
ran on a synthesized input
lwmming/AGS/train_ags_lmdb.py
code served (permissive licence) · get_code("e8eb2c4800a5b7e8")
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

torch.manual_seed(0)

# Create small tensors for the three outputs
# Each should be (batch_size, embedding_dim)
batch_size = 2
embedding_dim = 4

out_1 = torch.randn(batch_size, embedding_dim)
out_2 = torch.randn(batch_size, embedding_dim)
out_3 = torch.randn(batch_size, embedding_dim)

temperature = 0.5

ARGS = {
    "out_1": out_1,
    "out_2": out_2,
    "out_3": out_3,
    "temperature": temperature,
}
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
raw_reader Ran
ran; our contract draft was wrong, not the code
lwmming/AGS/folder2lmdb.py
code served (permissive licence) · get_code("51738010a21f76a1")
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 bytes. 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 tempfile
import os

# Create a temporary binary file with some test data
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_data.bin")

# Write some binary data to the file
with open(test_file, 'wb') as f:
    f.write(b'\x00\x01\x02\x03\x04\x05')

ARGS = {
    'path': test_file
}
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 bytes — a bytes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a bytes 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

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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 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
raw_reader 8 other papers
4 dated earlier, 4 same year, order not determinable
2202.07800 (2022-02)
Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizations
2209.04996 (2022-09)
Switchable Online Knowledge Distillation
2210.05958 (2022-10)
Bridging the Gap Between Vision Transformers and Convolutional Neural Networks on Small Datasets
and 5 more not named here
loads_data 5 other papers
1 dated earlier, 1 later, 3 same year, order not determinable
2303.08500 (2023-03)
The Devil's Advocate: Shattering the Illusion of Unexploitable Data using Diffusion Models
2401.06187 (2024-01)
Scissorhands: Scrub Data Influence via Connection Sensitivity in Networks
2402.11846 (2024-02)
UnlearnCanvas: Stylized Image Dataset for Enhanced Machine Unlearning Evaluation in Diffusion Models
and 2 more not named here
dumps_data 3 other papers
1 dated earlier, 2 same year, order not determinable
2303.08500 (2023-03)
The Devil's Advocate: Shattering the Illusion of Unexploitable Data using Diffusion Models
2401.06187 (2024-01)
Scissorhands: Scrub Data Influence via Connection Sensitivity in Networks
2402.11846 (2024-02)
UnlearnCanvas: Stylized Image Dataset for Enhanced Machine Unlearning Evaluation in Diffusion Models

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

In practical black-box attack scenarios, most of the existing transfer-based attacks employ pretrained models (e.g. ResNet50) as the substitute models. Unfortunately, these substitute models are not always appropriate for transfer-based attacks. Firstly, these models are usually trained on a largescale annotated dataset, which is extremely expensive and time-consuming to construct. Secondly, the primary goal of these models is to perform a specific task, such as image classification, which is not developed for adversarial attacks. To tackle the above issues, i.e., high cost and over-fitting on taskspecific models, we propose an Affordable and Generalizable Substitute (AGS) training framework tailored for transferbased adversarial attack. Specifically, we train the substitute model from scratch by our proposed adversary-centric constrastive learning. This proposed learning mechanism introduces another sample with slight adversarial perturbations as an additional positive view of the input image, and then encourages the adversarial view and two benign views to interact comprehensively with each other. To further boost the generalizability of the substitute model, we propose adversarial invariant learning to maintain the representations of the adversarial example invariants under augmentations with various strengths. Our AGS model can be trained solely with unlabeled and out-of domain data and avoid overfitting to any task-specific models, because of its inherently selfsupervised nature. Extensive experiments demonstrate that our AGS achieves comparable or superior performance compared to substitute models pretrained on the complete Ima-geNet training set, when executing attacks across a diverse range of target models, including ViTs, robustly trained models, object detection and segmentation models. Our source codes are available at https://github.com/lwmming/AGS.

For agents

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

get_harvested_code_for_paper("aaai_28365")
get_code_for_paper("aaai_28365")
have("aaai_28365")

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

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

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

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

Connect an agent — have() is free.