Disciplined Diffusion: Text-to-Image Diffusion Model against NSFW Generation

Chi Zhang, Changjia Zhu, Xiaowen Li, Yao Liu, Zhuo Lu
5/1/2026
cs.CV
diffusion-flow

No confident code implementation found for this paper.

Abstract

Text-to-image (T2I) diffusion models have the ability to build high-quality pictures from text prompts, but they pose safety concerns because they can generate offensive or disturbing imagery when provided with harmful inputs. Existing safety filters typically rely on text-based classifiers or image-based checkers that completely block the output upon detecting a threat, issuing an explicit allow/block feedback signal to the user.

Show full abstract

This binary strategy leaves models vulnerable to adversarial attacks that alter keywords to bypass detection, and it causes high false-alarm rates that degrade the experience for benign users. To address such vulnerabilities, we propose Disciplined Diffusion (DDiffusion), a novel robust text-to-image diffusion that counters Not Safe For Work (NSFW) generation by uncovering implicit malicious semantics in prompt embeddings. DDiffusion leverages a semantic retrieval mechanism to evaluate prompts against concept distributions rather than relying on brittle pairwise similarity. Furthermore, it employs a localization method during the diffusion process to selectively edit only the harmful regions of the generated image. By returning locally sanitized images instead of applying uniform blocking, DDiffusion suppresses malicious content while preserving generation fidelity for benign prompts and avoiding the binary allow-deny signal on which existing probing attacks rely.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhang2026disciplined,
  title  = {Disciplined Diffusion: Text-to-Image Diffusion Model against NSFW Generation},
  author = {Chi Zhang and Changjia Zhu and Xiaowen Li and Yao Liu and Zhuo Lu},
  year   = {2026},
  eprint = {2605.01113},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.01113v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.01113.svg)](https://codeofpaper.com/paper/2605.01113)

Discussion