SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.15618 · NeurIPS · 2024

Erasing Undesirable Concepts in Diffusion Models with Adversarial Preservation

Dinh Phung, Trung Le, Long Vuong, Paul Montague, Anh Bui, Khanh Doan, Tamas Abraham

arXiv · PDF · Open in the Atlas

Code that ran

11 of 11 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, 1 violated it and 0 have no contract verdict; 7 failures of our instrument; 0 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/2410.15618.json · badge: /api/ran/2410.15618.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
tuananhbui89/Erasing-Adversarial-Preservation canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
tuananhbui89/erasing-adversarial-preservation canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
chunk Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/generate_images_ldm.py
pointer only (licence: NONE); the stored copy get_code serves, from vicgalle/stable-diffusion-aesthetic-gradients, is pointer only (licence: NOASSERTION) · get_code("8241c0562bc710fd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

get_vocab Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/gen_embedding_matrix.py
pointer only (licence: NONE) · get_code("0be5dca592f6fd54")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

gram_matrix Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/eval-scripts/styleloss.py
pointer only (licence: NONE); the stored copy get_code serves, from Oldpan/Deep-Painterly-Harmonization-Pytorch, is pointer only (licence: NONE) · get_code("1090950b58e9358b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

image_loader Ran
ran, honoured the contract we drafted
tuananhbui89/Erasing-Adversarial-Preservation/eval-scripts/styleloss.py
pointer only (licence: NONE) · get_code("9ad49e53202d0110")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

load_img Ran
ran, honoured the contract we drafted
tuananhbui89/Erasing-Adversarial-Preservation/train_adversarial_pgd.py
pointer only (licence: NONE) · get_code("33b9cc6eebe44312")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

numpy_to_pil Ran
ran, violated the contract we drafted
tuananhbui89/Erasing-Adversarial-Preservation/generate_images_ldm.py
pointer only (licence: NONE); the stored copy get_code serves, from vicgalle/stable-diffusion-aesthetic-gradients, is pointer only (licence: NOASSERTION) · get_code("1e63d588563eb90a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

renew_resnet_paths Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/convertModels.py
pointer only (licence: NONE) · get_code("dfb052a0af48540f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

renew_vae_resnet_paths Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/convertModels.py
pointer only (licence: NONE) · get_code("c5ec9c13e456a046")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

retrieve_embedding_token Ran
ran, honoured the contract we drafted
tuananhbui89/Erasing-Adversarial-Preservation/gen_embedding_matrix.py
pointer only (licence: NONE) · get_code("53b69f32ea5b7643")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

sample_model Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tuananhbui89/erasing-adversarial-preservation/train_adversarial_gumbel.py
pointer only (licence: NONE) · get_code("15e005b12a64650d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/erasing-adversarial-preservation when it was checked. 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.

shave_segments Ran
ran; our contract draft was wrong, not the code
tuananhbui89/Erasing-Adversarial-Preservation/convertModels.py
pointer only (licence: NONE) · get_code("cea0bc82e0c96896")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tuananhbui89/Erasing-Adversarial-Preservation when it was checked. 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.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 9 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 1 the same month, 5 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
chunk 40 other papers
37 dated earlier, 2 later, 1 same year, order not determinable
2106.14490 (2021-06)
Making Images Real Again: A Comprehensive Survey on Deep Image Composition
2112.10752 (2021-12)
High-Resolution Image Synthesis with Latent Diffusion Models
2204.11824 (2022-04)
Semi-Parametric Neural Image Synthesis
and 37 more not named here
numpy_to_pil 23 other papers
21 dated earlier, 1 later, 1 same year, order not determinable
2106.14490 (2021-06)
Making Images Real Again: A Comprehensive Survey on Deep Image Composition
2112.10752 (2021-12)
High-Resolution Image Synthesis with Latent Diffusion Models
2209.12330 (2022-09)
Personalizing Text-to-Image Generation via Aesthetic Gradients
and 20 more not named here
renew_resnet_paths 14 other papers
12 dated earlier, 2 later
2307.04725 (2023-07)
AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning
2310.15169 (2023-10)
FreeNoise: Tuning-Free Longer Video Diffusion via Noise Rescheduling
2311.03054 (2023-11)
AnyText: Multilingual Visual Text Generation And Editing
and 11 more not named here
shave_segments 14 other papers
12 dated earlier, 2 later
2307.04725 (2023-07)
AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning
2310.15169 (2023-10)
FreeNoise: Tuning-Free Longer Video Diffusion via Noise Rescheduling
2311.03054 (2023-11)
AnyText: Multilingual Visual Text Generation And Editing
and 11 more not named here
gram_matrix 12 other papers
11 dated earlier, 1 the same month
1508.06576 (2015-08)
A Neural Algorithm of Artistic Style
1703.07511 (2017-03)
Deep Photo Style Transfer
1804.03189 (2018-04)
Deep Painterly Harmonization
and 9 more not named here
renew_vae_resnet_paths 11 other papers
11 dated earlier
2307.04725 (2023-07)
AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning
2310.15169 (2023-10)
FreeNoise: Tuning-Free Longer Video Diffusion via Noise Rescheduling
2311.16933 (2023-11)
SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models
and 8 more not named here
sample_model 5 other papers
2 dated earlier, 3 later
2401.05779 (2024-01)
Erasing Undesirable Influence in Diffusion Models
2403.12326 (2024-03)
Hiding and Recovering Knowledge in Text-to-Image Diffusion Models via Learnable Prompts
2412.07808 (2024-12)
Boosting Alignment for Post-Unlearning Text-to-Image Generative Models
and 2 more not named here
image_loader 3 other papers
3 dated earlier
1703.07511 (2017-03)
Deep Photo Style Transfer
2402.11846 (2024-02)
UnlearnCanvas: Stylized Image Dataset for Enhanced Machine Unlearning Evaluation in Diffusion Models
2405.15234 (2024-05)
Defensive Unlearning with Adversarial Training for Robust Concept Erasure in Diffusion Models
load_img 1 other paper
1 dated earlier
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance

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

Diffusion models excel at generating visually striking content from text but can inadvertently produce undesirable or harmful content when trained on unfiltered internet data. A practical solution is to selectively removing target concepts from the model, but this may impact the remaining concepts. Prior approaches have tried to balance this by introducing a loss term to preserve neutral content or a regularization term to minimize changes in the model parameters, yet resolving this trade-off remains challenging. In this work, we propose to identify and preserving concepts most affected by parameter changes, termed as adversarial concepts. This approach ensures stable erasure with minimal impact on the other concepts. We demonstrate the effectiveness of our method using the Stable Diffusion model, showing that it outperforms state-of-the-art erasure methods in eliminating unwanted content while maintaining the integrity of other unrelated elements. Our code is available at https: //github.com/tuananhbui89/Erasing-Adversarial-Preservation. Recent advances in text-to-image diffusion models (Rombach et al., 2022;Ramesh et al., 2021Ramesh et al., , 2022) ) have captured significant attention thanks to their outstanding image quality and boundless creative potential. These models undergo training on extensive internet datasets, enabling them to capture a wide range of concepts, which inevitably include undesirable concepts such as racism, sexism, and violence. Hence, these models can be exploited by users to generate harmful content, contributing to the proliferation of fake news, hate speech, and disinformation (Rando et al., 2022;Qu et al., 2023;Westerlund, 2019). Removing these undesirable contents from the model's output is thus a critical step in ensuring the safety and usefulness of these models. Addressing this challenge, several methods have been proposed to erase undesirable concepts from pretrained text-to-image models, such as TIME (Orgad et al., 2023), UCE (Zhang et al., 2023), Concept Ablation (Kumari et al., 2023), and ESD (Gandikota et al., 2023). Despite differing approaches, these methods reach a common finding: removing even one concept can significantly reduce the model's ability to generate other concepts. This is because large-scale generative models G : C → X , such as Stable Diffusion (StabilityAI, 2022), are trained on billions of image-text pairs (x, c), where x is an image and c is its caption, implicitly containing a set of concepts. The concept space is thus vast and intricately entangled within the model's parameters, meaning no specific part of the model's weights is solely responsible for a single concept. Consequently, the removal of one concept alters the entire model's parameters, causing a decline in overall performance. To address this degradation, existing methods typically select a neutral concept, such as "a photo" or an empty string, as an anchor to preserve while erasing the target concept, expecting that maintaining the neutral concept should help retain other concepts as well Orgad et al. (2023);Gandikota et al. (2024). 38th Conference on Neural Information Processing Systems (NeurIPS 2024).

For agents

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

get_harvested_code_for_paper("2410.15618")
get_code_for_paper("2410.15618")
have("2410.15618")

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

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

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

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

Connect an agent — have() is free.