Papers › DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification

DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification

27 Oct 2023NeurIPS 2023 11arXiv:2311.16124archive 2025-07-28

Mintong Kang, Dawn Song, Bo Li

Diffusion-based purification defenses leverage diffusion models to remove crafted perturbations of adversarial examples and achieve state-of-the-art robustness. Recent studies show that even advanced attacks cannot break such defenses effectively, since the purification process induces an extremely deep computational graph which poses the potential problem of gradient obfuscation, high memory cost, and unbounded randomness. In this paper, we propose a unified framework DiffAttack to perform effective and efficient attacks against diffusion-based purification defenses, including both DDPM and score-based approaches. In particular, we propose a deviated-reconstruction loss at intermediate diffusion steps to induce inaccurate density gradient estimation to tackle the problem of vanishing/exploding gradients. We also provide a segment-wise forwarding-backwarding algorithm, which leads to memory-efficient gradient backpropagation. We validate the attack effectiveness of DiffAttack compared with existing adaptive attacks on CIFAR-10 and ImageNet. We show that DiffAttack decreases the robust accuracy of models compared with SOTA attacks by over 20% on CIFAR-10 under ℓ_∞ attack (ϵ=8/255), and over 10% on ImageNet under ℓ_∞ attack (ϵ=4/255). We conduct a series of ablations studies, and we find 1) DiffAttack with the deviated-reconstruction loss added over uniformly sampled time steps is more effective than that added over only initial/final steps, and 2) diffusion-based purification with a moderate diffusion length is more robust under DiffAttack.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2311.16124")

Code

Syntology Ran 18 of 24 code samples harvested from 2 repositories linked to this paper; 6 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · violated contract; 10 ran · our draft was wrong; 1 ran · fixture could not drive it; 5 ran with no contract checked.

By repository: official repository: 21 samples from 1 repository, 16 ran; community: 3 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

kangmintong/diffattack officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

24 samples harvested; 18 ran; 1 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · violated contract
10ran · our draft was wrong
1ran · fixture could not drive it
5ran
6unverified

Licence: 21 of the 24 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Normalize kangmintong/DiffAttack/DiffAttack_DDPM_Based/ddpm/unet_ddpm.py official repository ran · our draft was wrong no licence file found · pointer only · c3a6b977022957cb · report
approx_standard_normal_cdf kangmintong/DiffAttack/DiffAttack_DDPM_Based/guided_diffusion/losses.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · cfd76fd0d89574a4 · report
compute_n_params kangmintong/DiffAttack/DiffAttack_Score_Based/utils.py official repository ran · our draft was wrong no licence file found · pointer only · ad12a494674d23fb · report
dict2namespace kangmintong/DiffAttack/DiffAttack_Score_Based/utils.py official repository ran · our draft was wrong no licence file found · pointer only · bd1f17e427bf51a5 · report
discretized_gaussian_log_likelihood kangmintong/DiffAttack/DiffAttack_DDPM_Based/guided_diffusion/losses.py official repository ran · our draft was wrong no licence file found · pointer only · cd33283d615fb3d7 · report
get_optimizer kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/losses.py official repository ran no licence file found · pointer only · 8ff7c24dade9904c · report
get_sde_loss_fn kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/losses.py official repository ran no licence file found · pointer only · fac494cec4301110 · report
get_timestep_embedding kangmintong/DiffAttack/DiffAttack_DDPM_Based/ddpm/unet_ddpm.py official repository ran · fixture could not drive it fingerprinted no licence file found · pointer only · cb49209c125de1b4 · report
lerp_clip kangmintong/DiffAttack/DiffAttack_DDPM_Based/classifiers/attribute_net.py official repository ran no licence file found · pointer only · 195d635db8eb778b · report
max_res_from_state_dict kangmintong/DiffAttack/DiffAttack_DDPM_Based/classifiers/attribute_net.py official repository ran no licence file found · pointer only · d5eb57879ef1704e · report
nonlinearity kangmintong/DiffAttack/DiffAttack_DDPM_Based/ddpm/unet_ddpm.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · 3137073275f8c21a · report
normal_kl kangmintong/DiffAttack/DiffAttack_DDPM_Based/guided_diffusion/losses.py official repository ran · honoured contract fingerprinted no licence file found · pointer only · cf2798b666b231ca · report
optimization_manager kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/losses.py official repository ran no licence file found · pointer only · 366bb8c7035a2fc8 · report
register_corrector kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/sampling.py official repository ran · our draft was wrong no licence file found · pointer only · a05b1d0cf3f508b4 · report
register_predictor kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/sampling.py official repository ran · our draft was wrong no licence file found · pointer only · 473066ddf62a075a · report
str2bool kangmintong/DiffAttack/DiffAttack_Score_Based/utils.py official repository ran · violated contract no licence file found · pointer only · 7c508037b40522af · report
DiffAttack kangmintong/diffattack/DiffAttack_Score_Based/diffattack/DiffAttack.py official repository unverified no licence file found · pointer only · d84e0830078f5a50 · report
check_randomized kangmintong/diffattack/DiffAttack_Score_Based/diffattack/DiffAttack.py official repository unverified no licence file found · pointer only · 8749fc2e6cd3b1c8 · report
check_square_sr kangmintong/diffattack/DiffAttack_Score_Based/diffattack/DiffAttack.py official repository unverified no licence file found · pointer only · 2cd3e1d64ab9a5bb · report
from_state_dict kangmintong/DiffAttack/DiffAttack_DDPM_Based/classifiers/attribute_net.py official repository unverified no licence file found · pointer only · 0dd156dfa78cac88 · report
get_predictor kangmintong/DiffAttack/DiffAttack_DDPM_Based/score_sde/sampling.py official repository unverified no licence file found · pointer only · a58facb8fe71823a · report
encoder WindVChen/DiffAttack/diff_latent_attack.py community ran · our draft was wrong Apache-2.0 (permissive) · ecfdcb7de66cc30f · report
preprocess WindVChen/DiffAttack/diff_latent_attack.py community ran · our draft was wrong Apache-2.0 (permissive) · fa609ac1c290e653 · report
ddim_reverse_sample WindVChen/DiffAttack/diff_latent_attack.py community unverified Apache-2.0 (permissive) · f2778069fba3bee4 · report

Tasks

Adversarial Purification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Diffusion

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections