SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.08192 · 2023

Diffusion Models for Imperceptible and Transferable Adversarial Attack

arXiv · PDF · Open in the Atlas

Code that ran

3 of 7 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 1 has no contract verdict; 2 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/2305.08192.json · badge: /api/ran/2305.08192.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
windvchen/diffattack canonical (classifier label)
classifier basis: census
3 ran · 4 no recorded run
FunctionStatusWhere it lives
encoder Ran
ran; our contract draft was wrong, not the code
windvchen/diffattack/diff_latent_attack-0.9.0.py
code served (permissive licence) · get_code("ecfdcb7de66cc30f")
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; no output shape is stated. 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 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 numpy as np
from PIL import Image
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a minimal mock model with the required VAE structure
class MockLatentDist:
    def sample(self, generator=None):
        # Return a tensor with shape (1, 4, 64, 64) for latent space
        return torch.randn(1, 4, 64, 64)

class MockVAE:
    def encode(self, image):
        mock_output = Mock()
        mock_output.latent_dist = MockLatentDist()
        return mock_output

class MockModel(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.vae = MockVAE()

# Create a small test image (RGB, 256x256)
test_image = Image.new('RGB', (256, 256), color=(100, 150, 200))

# Create the model
model = MockModel()

ARGS = {
    'image': test_image,
    'model': model,
    'res': 512
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL, 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 4, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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_weights Ran
ran on a synthesized input
windvchen/diffattack/torch_nets/tf2torch_adv_inception_v3.py
code served (permissive licence) · get_code("3db00532c993361c")
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 dict. 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 numpy as np
import tempfile
import os

# Create a temporary numpy file with a sample weights dictionary
temp_dir = tempfile.mkdtemp()
weights_dict = {
    'layer1.weight': np.array([[1.0, 2.0], [3.0, 4.0]]),
    'layer1.bias': np.array([0.1, 0.2]),
    'layer2.weight': np.array([[5.0, 6.0, 7.0], [8.0, 9.0, 10.0]])
}

weight_file_path = os.path.join(temp_dir, 'weights.npy')
np.save(weight_file_path, weights_dict)

ARGS = {
    'weight_file': weight_file_path
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
preprocess Ran
ran; our contract draft was wrong, not the code
windvchen/diffattack/diff_latent_attack-0.9.0.py
code served (permissive licence) · get_code("fa609ac1c290e653")
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; no output shape is stated. 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 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 numpy as np
import torch
from PIL import Image

torch.manual_seed(0)

# Create a small test image (4x3 RGB)
image_array = np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8)
image = Image.fromarray(image_array, mode='RGB')

ARGS = {
    'image': image,
    'res': 512
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL, 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 4, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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
calculate_activation_statistics Not yet run
unverified (harvested, no recorded run)
windvchen/diffattack/pytorch_fid/fid_score.py
code served (permissive licence) · get_code("345bd2bbf8bcb9b0")
How it ran

no invocation recorded.

calculate_frechet_distance Not yet run
unverified (harvested, no recorded run)
windvchen/diffattack/pytorch_fid/fid_score.py
code served (permissive licence) · get_code("0def50a351111624")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

ddim_reverse_sample Not yet run
unverified (harvested, no recorded run)
windvchen/diffattack/diff_latent_attack-0.9.0.py
code served (permissive licence) · get_code("f2778069fba3bee4")
How it ran

no invocation recorded.

get_activations Not yet run
unverified (harvested, no recorded run)
windvchen/diffattack/pytorch_fid/fid_score.py
code served (permissive licence) · get_code("594c40690017a276")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 6 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 6 later) and 1 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
calculate_frechet_distance 74 other papers
36 dated earlier, 2 the same month, 35 later, 1 same year, order not determinable
1610.09585 (2016-10)
Conditional Image Synthesis With Auxiliary Classifier GANs
1706.08500 (2017-06)
GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium
1807.11458 (2018-07)
To learn image super-resolution, use a GAN to learn how to do image degradation first
and 71 more not named here
calculate_activation_statistics 10 other papers
9 later, 1 same year, order not determinable
Chou_How_to_Backdoor_Diffusion_Models_CVPR_2023_paper (2023 (year only))
How to Backdoor Diffusion Models?
2306.06874 (2023-06)
VillanDiffusion: A Unified Backdoor Attack Framework for Diffusion Models
2312.12030 (2023-12)
Towards Accurate Guided Diffusion Sampling through Symplectic Adjoint Method
and 7 more not named here
ddim_reverse_sample 2 other papers
2 later
2311.16124 (2023-11)
DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification
2601.17388 (2026-01)
ONRW: Optimizing inversion noise for high-quality and robust watermark
encoder 2 other papers
2 later
2311.16124 (2023-11)
DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification
2601.17388 (2026-01)
ONRW: Optimizing inversion noise for high-quality and robust watermark
load_weights 2 other papers
1 dated earlier, 1 later
1812.08008 (2018-12)
OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields
2306.12685 (2023-06)
Rethinking the Backward Propagation for Adversarial Transferability
preprocess 2 other papers
2 later
2311.16124 (2023-11)
DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification
2601.17388 (2026-01)
ONRW: Optimizing inversion noise for high-quality and robust watermark

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

Many existing adversarial attacks generate $L_p$-norm perturbations on image RGB space. Despite some achievements in transferability and attack success rate, the crafted adversarial examples are easily perceived by human eyes. Towards visual imperceptibility, some recent works explore unrestricted attacks without $L_p$-norm constraints, yet lacking transferability of attacking black-box models. In this work, we propose a novel imperceptible and transferable attack by leveraging both the generative and discriminative power of diffusion models. Specifically, instead of direct manipulation in pixel space, we craft perturbations in the latent space of diffusion models. Combined with well-designed content-preserving structures, we can generate human-insensitive perturbations embedded with semantic clues. For better transferability, we further "deceive" the diffusion model which can be viewed as an implicit recognition surrogate, by distracting its attention away from the target regions. To our knowledge, our proposed method, DiffAttack, is the first that introduces diffusion models into the adversarial attack field. Extensive experiments on various model structures, datasets, and defense methods have demonstrated the superiority of our attack over the existing attack methods.

For agents

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

get_harvested_code_for_paper("2305.08192")
get_code_for_paper("2305.08192")
have("2305.08192")

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

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

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

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

Connect an agent — have() is free.