SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.05977 · ICML · 2023

Towards Safe Self-Distillation of Internet-Scale Text-to-Image Diffusion Models

Jinwoo Shin, Juho Lee, Moonseok Choi, Sanghyun Kim, Seohyeon Jung, Balhae Kim

arXiv · PDF · Open in the Atlas

Code that ran

2 of 3 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 0 have no contract verdict; 2 failures of our instrument; 1 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/2307.05977.json · badge: /api/ran/2307.05977.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
nannullna/safe-diffusion canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
ml-research/Q16 community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
load_prompts Ran
ran; our contract draft was wrong, not the code
nannullna/safe-diffusion/generate.py
code served (permissive licence) · get_code("9f927d43843c43af")
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 tuple. 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 json
import tempfile
import os

# Create temporary files for testing
temp_dir = tempfile.mkdtemp()

# Test case 1: .txt file
txt_path = os.path.join(temp_dir, "prompts.txt")
with open(txt_path, 'w') as f:
    f.write("A beautiful sunset\n")
    f.write("A cat sleeping\n")

# Test case 2: .json file with list of strings
json_list_path = os.path.join(temp_dir, "prompts_list.json")
with open(json_list_path, 'w') as f:
    json.dump(["A dog running", "A bird flying"], f)

# Test case 3: .json file with list of dicts
json_dict_list_path = os.path.join(temp_dir, "prompts_dict_list.json")
with open(json_dict_list_path, 'w') as f:
    json.dump([
        {"prompt": "A tree", "seed": 42},
        {"prompt": "A flower", "seed": 123}
    ], f)

# Test case 4: .json file with dict structure
json_dict_path = os.path.join(temp_dir, "prompts_dict.json")
with open(json_dict_path, 'w') as f:
    json.dump({
        "prompts": ["A mountain", "A river"],
        "seeds": [999, 888]
    }, f)

# Test case 5: .csv file
csv_path = os.path.join(temp_dir, "prompts.csv")
import pandas as pd
df = pd.DataFrame({
    "prompt": ["A cloud", "A star"],
    "seed": [111, 222]
})
df.to_csv(csv_path, index=False)

# Use the txt file as the main test case
ARGS = {
    "path": txt_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
prepare_extra_step_kwargs Ran
ran; our contract draft was wrong, not the code
nannullna/safe-diffusion/train_sdd.py
code served (permissive licence) · get_code("26275c4c2014b979")
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 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 torch
import inspect

torch.manual_seed(0)

# Create a scheduler mock that accepts both eta and generator
class SchedulerWithEtaAndGenerator:
    def step(self, eta=None, generator=None):
        pass

# Create a scheduler mock that accepts only eta
class SchedulerWithEta:
    def step(self, eta=None):
        pass

# Create a scheduler mock that accepts only generator
class SchedulerWithGenerator:
    def step(self, generator=None):
        pass

# Create a simple generator
generator = torch.Generator()
generator.manual_seed(42)

# Test with scheduler that accepts both eta and generator
scheduler = SchedulerWithEtaAndGenerator()
eta = 0.5

ARGS = {
    'scheduler': scheduler,
    'generator': generator,
    'eta': eta
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — 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
ClipSimModel Not yet run
unverified (harvested, no recorded run)
ml-research/Q16/main/models/clip.py
pointer only (licence: NONE) · get_code("d94d955dcf0da562")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ml-research/Q16 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. No invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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
prepare_extra_step_kwargs 1 other paper
1 later
2410.12777 (2024-10)
Meta-Unlearning on Diffusion Models: Preventing Relearning Unlearned Concepts

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

Large-scale image generation models, with impressive quality made possible by the vast amount of data available on the Internet, raise social concerns that these models may generate harmful or copyrighted content. The biases and harmfulness arise throughout the entire training process and are hard to completely remove, which have become significant hurdles to the safe deployment of these models. In this paper, we propose a method called SDD to prevent problematic content generation in text-to-image diffusion models. We self-distill the diffusion model to guide the noise estimate conditioned on the target removal concept to match the unconditional one. Compared to the previous methods, our method eliminates a much greater proportion of harmful content from the generated images without degrading the overall image quality. Furthermore, our method allows the removal of multiple concepts at once, whereas previous works are limited to removing a single concept at a time. Code is available at https://github.com/ nannullna/safe-diffusion. Caution: The text contains explicit and discriminatory expressions and illustrations.

For agents

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

get_harvested_code_for_paper("2307.05977")
get_code_for_paper("2307.05977")
have("2307.05977")

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

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

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

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

Connect an agent — have() is free.