Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models

About

Text-to-image (T2I) models, such as Stable Diffusion, have exhibited remarkable performance in generating high-quality images from text descriptions in recent years. However, text-to-image models may be tricked into generating not-safe-for-work (NSFW) content, particularly in sexually explicit scenarios. Existing countermeasures mostly focus on filtering inappropriate inputs and outputs, or suppressing improper text embeddings, which can block sexually explicit content (e.g., naked) but may still be vulnerable to adversarial prompts -- inputs that appear innocent but are ill-intended. In this paper, we present SafeGen, a framework to mitigate sexual content generation by text-to-image models in a text-agnostic manner. The key idea is to eliminate explicit visual representations from the model regardless of the text input. In this way, the text-to-image model is resistant to adversarial prompts since such unsafe visual representations are obstructed from within. Extensive experiments conducted on four datasets and large-scale user studies demonstrate SafeGen's effectiveness in mitigating sexually explicit content generation while preserving the high-fidelity of benign images. SafeGen outperforms eight state-of-the-art baseline methods and achieves 99.4% sexual content removal performance. Furthermore, our constructed benchmark of adversarial prompts provides a basis for future development and evaluation of anti-NSFW-generation methods.

Xinfeng Li, Yuchen Yang, Jiangyi Deng, Chen Yan, Yanjiao Chen, Xiaoyu Ji, Wenyuan Xu• 2024

Related benchmarks

TaskDatasetResultRank
Text-to-Image GenerationMS-COCO
FID67.59
193
Safe Text-to-Image GenerationMMA-Diffusion--
33
Text-to-Image GenerationI2P
ASR16
21
Text-to-Image GenerationRAB
ASR0.23
21
Text-to-Image GenerationVSA
ASR24
21
Text-to-Image GenerationMMA
ASR4
21
Semantic PreservationHard Negative Prompts (Nudity)
CLIP Score33.97
19
Safe Text-to-Image GenerationP4D--
13
Inappropriate Content RemovalI2P (test)
Hate32
12
Safe Image GenerationI2P (test)
Q16 IP0.35
12
Showing 10 of 23 rows

Other info

Follow for update