SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.17013 · NeurIPS · 2025

When Are Concepts Erased From Diffusion Models?

Kevin Lu, Chinmay Hegde, Niv Cohen, David Bau, Nicky Kriplani, Rohit Gandikota, Minh Pham

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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, 1 violated it and 6 have no contract verdict; 0 failures 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/2505.17013.json · badge: /api/ran/2505.17013.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
kevinlu4588/diffusionconcepterasure canonical (classifier label)
classifier basis not recorded on the link
7 ran · 2 no recorded run
FunctionStatusWhere it lives
check_imagenet_exists Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/classifier_guidance/e2e_concept_classifier.py
code served (permissive licence) · get_code("6934c81bcf8f05a2")
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 os
import tempfile
import shutil

# Create a temporary directory structure that mimics ImageNet
temp_dir = tempfile.mkdtemp()

# Create imagenet_train_* shard directories to make the check pass
shard_dir_1 = os.path.join(temp_dir, 'imagenet_train_0')
shard_dir_2 = os.path.join(temp_dir, 'imagenet_train_1')
os.makedirs(shard_dir_1, exist_ok=True)
os.makedirs(shard_dir_2, exist_ok=True)

ARGS = {
    'imagenet_dir': temp_dir
}
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
create_subset Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/classifier_guidance/e2e_concept_classifier.py
code served (permissive licence) · get_code("a5c602d25c31c88c")
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 os
import sys
import tempfile

# Create temporary directories for testing
temp_base = tempfile.mkdtemp()
imagenet_dir = os.path.join(temp_base, 'imagenet')
subset_dir = os.path.join(temp_base, 'subsets')
os.makedirs(imagenet_dir, exist_ok=True)
os.makedirs(subset_dir, exist_ok=True)

# Create a minimal dummy create_class_subsets.py script that the function will call
base_dir = temp_base
create_script_path = os.path.join(base_dir, 'create_class_subsets.py')
with open(create_script_path, 'w') as f:
    f.write("""
import sys
# Minimal script that just exits successfully
sys.exit(0)
""")

# Define arguments for create_subset function
ARGS = {
    'concept': 'dog, animal',
    'imagenet_dir': imagenet_dir,
    'subset_dir': subset_dir,
    'n_neg': 5,
    'base_dir': base_dir,
    'force': False
}
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
is_valid_image Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/src/noisy_diffuser_scheduling/image_processor.py
code served (permissive licence) · get_code("c9903af7cf272bc4")
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 numpy as np
import PIL.Image
import torch

torch.manual_seed(0)

# Create a PIL Image
pil_image = PIL.Image.new('RGB', (4, 3))

# Create a 2D numpy array
numpy_2d = np.random.rand(4, 3)

# Create a 3D numpy array
numpy_3d = np.random.rand(4, 3, 2)

# Create a 2D torch tensor
torch_2d = torch.randn(4, 3)

# Create a 3D torch tensor
torch_3d = torch.randn(4, 3, 2)

ARGS = {
    "image": pil_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
is_valid_image_imagelist Ran
ran, violated the contract we drafted
kevinlu4588/diffusionconcepterasure/src/noisy_diffuser_scheduling/image_processor.py
code served (permissive licence) · get_code("53ccc214b8346dff")
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 numpy as np
import PIL.Image
import torch

torch.manual_seed(0)

# Test case 1: 4D tensor (batch of images)
batch_tensor = torch.randn(2, 3, 4, 5)

# Test case 2: List of 3D tensors (list of images)
image_list = [torch.randn(3, 4, 5), torch.randn(3, 4, 5)]

# Test case 3: 3D numpy array (single image)
numpy_image = np.random.randn(3, 4, 5)

# Test case 4: 2D numpy array (grayscale image)
numpy_grayscale = np.random.randn(4, 5)

# Test case 5: PIL Image
pil_image = PIL.Image.new('RGB', (4, 5))

# Test case 6: List of PIL images
pil_image_list = [PIL.Image.new('RGB', (4, 5)), PIL.Image.new('RGB', (4, 5))]

# Test case 7: Mixed list of PIL and numpy images
mixed_list = [PIL.Image.new('RGB', (4, 5)), np.random.randn(3, 4, 5)]

# Test case 8: 4D numpy array (batch of images)
batch_numpy = np.random.randn(2, 3, 4, 5)

ARGS = {
    "images": batch_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
load_config Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/src/runner.py
code served (permissive licence) · get_code("d7caaaf962fd7a77")
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 os
import yaml
import tempfile

# Create a temporary directory and config file for testing
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, 'test_config.yaml')

# Write a test config file
test_config = {
    'base_images_path': 'results/custom_model',
    'mask_size': [512, 512],
    'initializer_token': 'special_object',
    'extra_param': 'extra_value'
}

with open(config_path, 'w') as f:
    yaml.dump(test_config, f)

ARGS = {
    'config_path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
sample_timesteps Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/classifier_guidance/create_latent_classifier.py
code served (permissive licence) · get_code("a2e60a57b08671bb")
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 1, dtype family int, shape (2,) 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 torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "num_train_timesteps": 1000,
    "batch_size": 2,
    "device": "cpu",
    "power": 3.0,
}
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 1, dtype family int, shape (2,) — shape (2,) 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
train_classifier Ran
ran on a synthesized input
kevinlu4588/diffusionconcepterasure/classifier_guidance/e2e_concept_classifier.py
code served (permissive licence) · get_code("afc91356d3af2d59")
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 os
import sys
import tempfile
import torch

# Create temporary directories for testing
temp_dir = tempfile.mkdtemp()
subset_dir = os.path.join(temp_dir, 'subset')
save_dir = os.path.join(temp_dir, 'save')
base_dir = os.path.join(temp_dir, 'base')

# Create the directories
os.makedirs(subset_dir, exist_ok=True)
os.makedirs(save_dir, exist_ok=True)
os.makedirs(base_dir, exist_ok=True)

# Create a minimal stub for the training script that the function expects to call
train_script_path = os.path.join(base_dir, 'create_latent_classifier.py')
with open(train_script_path, 'w') as f:
    f.write('''
import sys
sys.exit(0)
''')

ARGS = {
    'concept': 'test concept',
    'subset_dir': subset_dir,
    'save_dir': save_dir,
    'epochs': 5,
    'batch_size': 2,
    'lr': 0.001,
    'timestep_power': 2,
    'base_dir': base_dir,
    'force': False,
}
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 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
create_subset Not yet run
unverified (harvested, no recorded run)
kevinlu4588/diffusionconcepterasure/classifier_guidance/create_class_subsets.py
code served (permissive licence) · get_code("387c63040807a08a")
How it ran

no invocation recorded.

precompute_latents Not yet run
unverified (harvested, no recorded run)
kevinlu4588/diffusionconcepterasure/classifier_guidance/create_latent_classifier.py
code served (permissive licence) · get_code("c2e19232003f9e24")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
is_valid_image_imagelist 2 other papers
1 dated earlier, 1 later
2312.16693 (2023-12)
I2V-Adapter: A General Image-to-Video Adapter for Diffusion Models
2605.15196 (2026-05)
REFDECODER: Enhancing Visual Generation with Conditional Video Decoding
is_valid_image 1 other paper
1 dated earlier
2312.16693 (2023-12)
I2V-Adapter: A General Image-to-Video Adapter for Diffusion Models

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

In concept erasure, a model is modified to selectively prevent it from generating a target concept. Despite the rapid development of new methods, it remains unclear how thoroughly these approaches remove the target concept from the model. We begin by proposing two conceptual models for the erasure mechanism in diffusion models: (i) interfering with the model's internal guidance processes, and (ii) reducing the unconditional likelihood of generating the target concept, potentially removing it entirely. To assess whether a concept has been truly erased from the model, we introduce a comprehensive suite of independent probing techniques: supplying visual context, modifying the diffusion trajectory, applying classifier guidance, and analyzing the model's alternative generations that emerge in place of the erased concept. Our results shed light on the value of exploring concept erasure robustness outside of adversarial text inputs, and emphasize the importance of comprehensive evaluations for erasure in diffusion models. Our code, data, and results are available at unerasing.baulab.info. 1

For agents

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

get_harvested_code_for_paper("2505.17013")
get_code_for_paper("2505.17013")
have("2505.17013")

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

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

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

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

Connect an agent — have() is free.