SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.06219 · NeurIPS · 2024

Data Free Backdoor Attacks

Bo Li, Jinyuan Jia, Dawn Song, Bochuan Cao, Jinghui Chen, Zhen Xiang, Wenbo Guo, Chuxuan Hu

arXiv · PDF · Open in the Atlas

Code that ran

9 of 13 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 4 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/2412.06219.json · badge: /api/ran/2412.06219.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
AAAAAAsuka/DataFree_Backdoor_Attacks canonical (classifier label)
classifier basis: census
7 ran · 3 no recorded run
aaaaaasuka/datafree_backdoor_attacks canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran; our contract draft was wrong, not the code
AAAAAAsuka/DataFree_Backdoor_Attacks/handcrafted_backdoor.py
code served (permissive licence) · get_code("c47aa7fdcc2f4011")
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 logits tensor: batch_size=2, num_classes=4
logits = torch.randn(2, 4)

# Create labels tensor: batch_size=2, with class indices in range [0, 3]
labels = torch.tensor([1, 3])

ARGS = {
    "logits": logits,
    "labels": labels,
}
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
add_trigger_handcrafted Ran
ran; our contract draft was wrong, not the code
AAAAAAsuka/DataFree_Backdoor_Attacks/handcrafted_backdoor.py
code served (permissive licence) · get_code("05d5635890d407c4")
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, 10, 10) 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)

# Analyze the function:
# - Takes parameter 'x' which is indexed with [:, :, xlen - ii - 1, xlen - jj - 1]
#   This means x needs at least 4 dimensions
# - Takes parameter 'size' with default value 8
# - Accesses x.shape[-1] to get the last dimension
# - Sets values in x using modulo operation: (ii + jj) % 2

# Create a 4D tensor: [batch, channels, height, width]
# Make it large enough that xlen - size - 1 is valid
# If size=8, we need x.shape[-1] - 1 >= 8, so shape[-1] >= 9
# Let's use shape [2, 3, 10, 10] to have room

x = torch.zeros(2, 3, 10, 10, dtype=torch.float32)

size = 8

ARGS = {
    "x": x,
    "size": size
}
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, 10, 10) — shape (2, 3, 10, 10) 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
atk_first_filter Ran
ran, honoured the contract we drafted
AAAAAAsuka/DataFree_Backdoor_Attacks/inject_backdoor.py
code served (permissive licence) · get_code("3348cf5f81b0f343")
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 (4, 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

torch.manual_seed(0)

# The function atk_first_filter takes a tensor and modifies it in-place
# It accesses aim_filter.shape[0] and aim_filter.shape[1]
# It performs indexing with [i, j] and assignment
# So aim_filter needs to be a 2D tensor

aim_filter = torch.zeros(4, 3)

ARGS = {
    "aim_filter": aim_filter
}
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 2, dtype family float, shape (4, 3) — shape (4, 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
channel_random_select Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
aaaaaasuka/datafree_backdoor_attacks/inject_backdoor.py
code served (permissive licence) · get_code("14ecdc1bdbf62ce1")
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 1, dtype family int, shape (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

# Analyze the function:
# - channel_num_list: used with enumerate() and indexed with [i], passed to np.random.choice()
#   Each element should be an integer representing the number of channels to choose from
# - yt: used as an integer, assigned to the last element of the result
# The function returns an array of the same shape as channel_num_list

# Create a small channel_num_list with distinct integer values
channel_num_list = np.array([10, 20, 15, 8])

# Create a yt value
yt = 2

ARGS = {
    "channel_num_list": channel_num_list,
    "yt": yt
}
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 1, dtype family int, shape (4,) — shape (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
compute_lam Ran
ran, honoured the contract we drafted
AAAAAAsuka/DataFree_Backdoor_Attacks/utils.py
code served (permissive licence) · get_code("a1773d2413d1906c")
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 float, 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 math

ARGS = {
    "alpha": 0.5,
    "e": 25,
    "prob": 1e-05,
}
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 float, 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
generate_trigger Ran
ran, honoured the contract we drafted
AAAAAAsuka/DataFree_Backdoor_Attacks/inject_backdoor.py
code served (permissive licence) · get_code("be49f068eb9963c2")
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 (32, 32) 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

ARGS = {
    "trigger_size": 8,
    "input_size": 32,
}
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 (32, 32) — shape (32, 32) 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
generate_trigger_fix_weight_rgb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
aaaaaasuka/datafree_backdoor_attacks/inject_backdoor.py
code served (permissive licence) · get_code("9f02cb10d3b78f7f")
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 3, dtype family float, shape (3, 6, 6) 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

# Analyze the function:
# - aim_filter: indexed as aim_filter[c, row, col], needs shape [3, filter_size, filter_size]
# - filter_size: integer, used in range and indexing
# - input_size: integer, default 32, used in range and array initialization
# - resnet: boolean, used in conditional

# Create aim_filter with shape [3, filter_size, filter_size]
# Use filter_size=4 and input_size=6 for small distinct dimensions
filter_size = 4
input_size = 6

# Create aim_filter as numpy array with shape [3, 4, 4]
# Fill with positive and negative values to test both branches
aim_filter = np.array([
    [[1, -1, 0.5, -0.5],
     [2, -2, 1, -1],
     [0.1, -0.1, 0.3, -0.3],
     [5, -5, 3, -3]],
    [[0.2, -0.2, 0.8, -0.8],
     [-1, 1, -0.5, 0.5],
     [1.5, -1.5, 0, 0],
     [-2, 2, -3, 3]],
    [[4, -4, 2, -2],
     [0.1, -0.1, 0.05, -0.05],
     [-0.3, 0.3, -0.7, 0.7],
     [1, -1, 1, -1]]
], dtype=np.float32)

ARGS = {
    "aim_filter": aim_filter,
    "filter_size": filter_size,
    "input_size": input_size,
    "resnet": False
}
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 3, dtype family float, shape (3, 6, 6) — shape (3, 6, 6) 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
loss_inner Ran
ran; our contract draft was wrong, not the code
AAAAAAsuka/DataFree_Backdoor_Attacks/defends/ibau/IBAU.py
code served (permissive licence) · get_code("d39599094668333d")
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. 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, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Build a minimal model that implements forward()
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = TinyModel()

# Get a model parameter (just for the signature, though it's not actually used in the function)
model_param = list(model.parameters())[0]

# Create tiny tensors: batch_size=2, feature_dim=4
images = torch.randn(2, 4)
labels = torch.randint(0, 3, (2,))

# Perturb tensor with same shape as images
perturb = [torch.randn(2, 4)]

# Wrap in lists as expected by the function
images_list = [images]
labels_list = [labels]

ARGS = {
    "perturb": perturb,
    "model_param": model_param,
    "model": model,
    "images_list": images_list,
    "labels_list": labels_list,
}
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
time_calc Ran
ran; our contract draft was wrong, not the code
AAAAAAsuka/DataFree_Backdoor_Attacks/utils.py
code served (permissive licence) · get_code("f3f1a40575d9367c")
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 function. 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 time

def time_calc(func):
    def wrapper(*args, **kargs):
        start_time = time.time()
        f = func(*args, **kargs)
        exec_time = time.time() - start_time
        print('func.name:{}\texec_time:{}'.format(func.__name__, exec_time))
        return f
    return wrapper

# Define a simple test function to decorate
@time_calc
def sample_function(x, y):
    return x + y

# Create arguments
torch.manual_seed(0)
test_tensor_1 = torch.randn(2, 4)
test_tensor_2 = torch.randn(3, 5)

ARGS = {
    'func': sample_function
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
InjectBackdoor_VGG Not yet run
unverified (harvested, no recorded run)
aaaaaasuka/datafree_backdoor_attacks/inject_backdoor.py
code served (permissive licence) · get_code("d870dafe0d1eea2e")
How it ran

no invocation recorded.

get_data Not yet run
unverified (harvested, no recorded run)
AAAAAAsuka/DataFree_Backdoor_Attacks/utils.py
code served (permissive licence) · get_code("07ed1f92894f4360")
How it ran

no invocation recorded.

loss_outer Not yet run
unverified (harvested, no recorded run)
AAAAAAsuka/DataFree_Backdoor_Attacks/defends/ibau/IBAU.py
code served (permissive licence) · get_code("c477bfb68df6fef4")
How it ran

no invocation recorded.

test Not yet run
unverified (harvested, no recorded run)
AAAAAAsuka/DataFree_Backdoor_Attacks/handcrafted_backdoor.py
code served (permissive licence) · get_code("7879e76c2a733e4a")
How it ran

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 13 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 13 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-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

Backdoor attacks aim to inject a backdoor into a classifier such that it predicts any input with an attacker-chosen backdoor trigger as an attacker-chosen target class. Existing backdoor attacks require either retraining the classifier with some clean data or modifying the model's architecture. As a result, they are 1) not applicable when clean data is unavailable, 2) less efficient when the model is large, and 3) less stealthy due to architecture changes. In this work, we propose DFBA, a novel retraining-free and data-free backdoor attack without changing the model architecture. Technically, our proposed method modifies a few parameters of a classifier to inject a backdoor. Through theoretical analysis, we verify that our injected backdoor is provably undetectable and unremovable by various state-of-theart defenses under mild assumptions. Our evaluation on multiple datasets further demonstrates that our injected backdoor: 1) incurs negligible classification loss, 2) achieves 100% attack success rates, and 3) bypasses six existing state-of-the-art defenses. Moreover, our comparison with a state-of-the-art non-data-free backdoor attack shows our attack is more stealthy and effective against various defenses while achieving less classification accuracy loss. The code for our experiment can be found at https://github.com/AAAAAAsuka/DataFree_Backdoor_Attacks

For agents

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

get_harvested_code_for_paper("2412.06219")
get_code_for_paper("2412.06219")
have("2412.06219")

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

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

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

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

Connect an agent — have() is free.