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

Training-Free Safe Text Embedding Guidance for Text-to-Image Diffusion Models

About

Text-to-image models have recently made significant advances in generating realistic and semantically coherent images, driven by advanced diffusion models and large-scale web-crawled datasets. However, these datasets often contain inappropriate or biased content, raising concerns about the generation of harmful outputs when provided with malicious text prompts. We propose Safe Text embedding Guidance (STG), a training-free approach to improve the safety of diffusion models by guiding the text embeddings during sampling. STG adjusts the text embeddings based on a safety function evaluated on the expected final denoised image, allowing the model to generate safer outputs without additional training. Theoretically, we show that STG aligns the underlying model distribution with safety constraints, thereby achieving safer outputs while minimally affecting generation quality. Experiments on various safety scenarios, including nudity, violence, and artist-style removal, show that STG consistently outperforms both training-based and training-free baselines in removing unsafe content while preserving the core semantic intent of input prompts. Our code is available at https://github.com/aailab-kaist/STG.

Byeonghu Na, Mina Kang, Jiseok Kwak, Minsang Park, Jiwoo Shin, SeJoon Jun, Gayoung Lee, Jin-Hwa Kim, Il-Chul Moon• 2025

Related benchmarks

TaskDatasetResultRank
Text-to-Image GenerationMS-COCO
FID24.71
193
Text-to-Image GenerationCOCO 30k
FID65.37
77
Concept RemovalRing-A-Bell Nudity
Attack Success Rate (ASR)67.1
52
Nudity RemovalMMA-Diffusion
ASR67.5
45
NSFW suppressionP4D
ASR0.331
41
Nudity Concept RemovalUnlearnAtk
ASR31.7
25
Concept RemovalRing-A-Bell violence
Attack Success Rate (ASR)76
22
Nudity Concept RemovalRing-A-Bell 77
Attack Success Rate (ASR)27.4
15
Showing 8 of 8 rows

Other info

Follow for update