SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.14265 · EMNLP · 2023

CT-GAT: Cross-Task Generative Adversarial Attack based on Transferability

Wei Zhou, Kun Li, Songlin Hu, Minxuan Lv, Chengwei Dai

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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, 2 violated it and 1 has no contract verdict; 1 failure of our instrument; 2 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/2310.14265.json · badge: /api/ran/2310.14265.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
xiaoxuanNLP/CT-GAT community
Papers with Code archive
4 ran · 2 no recorded run
FunctionStatusWhere it lives
Bart Ran
ran on a synthesized input · constructed an object; no result was computed
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("915a5c75d18093ac")
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 an instance of its own class, Bart: the run constructed the object and did not call it, so no result was computed. 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 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
from transformers import BartForConditionalGeneration, BartTokenizer

torch.manual_seed(0)

# Create a minimal mock BartForConditionalGeneration
class MockBartModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, input_ids, attention_mask, labels):
        # Return a mock output with loss as first element
        loss = torch.tensor(0.5)
        return (loss,)
    
    def generate(self, input_ids, attention_mask, max_length, num_beams, num_return_sequences, temperature, do_sample):
        # Return mock token ids
        batch_size = input_ids.shape[0]
        return torch.randint(0, 100, (batch_size * num_return_sequences, max_length))

# Create a minimal mock BartTokenizer
class MockBartTokenizer:
    def __init__(self):
        pass
    
    def __call__(self, text, return_tensors=None, return_length=None, truncation=None, padding=None):
        batch_size = 1
        seq_len = 8
        return {
            'input_ids': torch.randint(0, 100, (batch_size, seq_len)),
            'attention_mask': torch.ones((batch_size, seq_len), dtype=torch.long)
        }
    
    def decode(self, token_ids, skip_special_tokens=False):
        return "mock generated text"
    
    @classmethod
    def from_pretrained(cls, base, add_prefix_space=True):
        return cls()

# Monkey patch the transformers module functions
import sys
from unittest.mock import MagicMock

original_from_pretrained = BartForConditionalGeneration.from_pretrained
BartForConditionalGeneration.from_pretrained = lambda x: MockBartModel()
BartTokenizer.from_pretrained = MockBartTokenizer.from_pretrained

# Create test tensors
batch_size = 2
seq_len = 8
input_ids = torch.randint(0, 100, (batch_size, seq_len))
input_mask = torch.ones((batch_size, seq_len), dtype=torch.long)
output_ids = torch.randint(0, 100, (batch_size, seq_len))

ARGS = {
    'base': 'facebook/bart-base',
    'device': torch.device('cpu')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Bart — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Bart 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
content_chinese Ran
ran, violated the contract we drafted
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("c891ff9b5fc2783a")
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 bool, 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.

# Setup code for is_chinese and content_chinese functions

ARGS = {
    "sentence": "Hello世界你好123"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, 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
get_lowest_loss_file Ran
ran; our contract draft was wrong, not the code
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("754eebf42bdb8878")
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 str. 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 os
import re
import tempfile

# Create a temporary directory with test files
temp_dir = tempfile.mkdtemp()

# Create some test files with loss values in their names
test_files = [
    "checkpoint_loss_0.95_epoch_1.pt",
    "checkpoint_loss_0.42_epoch_2.pt",
    "checkpoint_loss_0.87_epoch_3.pt",
    "model_loss_0.15_final.pt",
    "other_file.txt",
    "no_loss_here.pt",
]

for filename in test_files:
    filepath = os.path.join(temp_dir, filename)
    with open(filepath, 'w') as f:
        f.write("dummy content")

ARGS = {
    'directory': temp_dir + os.sep
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
is_chinese Ran
ran, violated the contract we drafted
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("4b812e89f35c77c9")
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 bool, 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 numpy as np

# The function is_chinese checks if a character is within a specific Unicode range
# Parameter 'ch' is a single character (string)

# Valid Chinese characters are between '一' (U+4E00) and '龥' (U+9FA5)
# We'll test with a character in that range

ARGS = {
    'ch': '中'  # A valid Chinese character within the range
}
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 bool, 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
attack Not yet run
unverified (harvested, no recorded run)
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("935a803ec33c91d0")
How it ran

no invocation recorded.

get_output_label Not yet run
unverified (harvested, no recorded run)
xiaoxuanNLP/CT-GAT/src/CT-GAT.py
code served (permissive licence) · get_code("960d20de5866a0a1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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

Neural network models are vulnerable to adversarial examples, and adversarial transferability further increases the risk of adversarial attacks. Current methods based on transferability often rely on substitute models, which can be impractical and costly in real-world scenarios due to the unavailability of training data and the victim model's structural details. In this paper, we propose a novel approach that directly constructs adversarial examples by extracting transferable features across various tasks. Our key insight is that adversarial transferability can extend across different tasks. Specifically, we train a sequence-to-sequence generative model named CT-GAT (Cross-Task Generative Adversarial ATtack) using adversarial sample data collected from multiple tasks to acquire universal adversarial features and generate adversarial examples for different tasks. We conduct experiments on ten distinct datasets, and the results demonstrate that our method achieves superior attack performance with small cost. You can get our code and data at: https: //github.com/xiaoxuanNLP/CT-GAT

For agents

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

get_harvested_code_for_paper("2310.14265")
get_code_for_paper("2310.14265")
have("2310.14265")

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

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

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

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

Connect an agent — have() is free.