Beautiful Images, Toxic Words: Understanding and Addressing Offensive Text in Generated Images
On the map: Diffusion models → Robustness, privacy and adversarial aspects
Abstract (arXiv)
State-of-the-art Diffusion Models (DMs) produce highly realistic images. While prior work has successfully mitigated Not Safe For Work (NSFW) content in the visual domain, we identify a novel threat: the generation of NSFW text embedded within images. This includes offensive language, such as insults, racial slurs, and sexually explicit terms, posing significant risks to users. We show that all state-of-the-art DMs (e.g., SD3, SDXL, Flux, DeepFloyd IF) are vulnerable to this issue. Through extensive experiments, we demonstrate that existing mitigation techniques, effective for visual content, fail to prevent harmful text generation while substantially degrading benign text generation. As an initial step toward addressing this threat, we introduce a novel fine-tuning strategy that targets only the text-generation layers in DMs. Therefore, we construct a safety fine-tuning dataset by pairing each NSFW prompt with two images: one with the NSFW term, and another where that term is replaced with a carefully crafted benign alternative while leaving the image unchanged otherwise. By training on this dataset, the model learns to avoid generating harmful text while preserving benign content and overall image quality. Finally, to advance research in the area, we release ToxicBench, an open-source benchmark for evaluating NSFW text generation in images. It includes our curated fine-tuning dataset, a set of harmful prompts, new evaluation metrics, and a pipeline that assesses both NSFW-ness and text and image quality. Our benchmark aims to guide future efforts in mitigating NSFW text generation in text-to-image models, thereby contributing to their safe deployment.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Robustness, privacy and adversarial aspects, one of 14 directions in Diffusion models. Builds on 34 of its 47 references that are in the map. First posted on arXiv 7 Feb 2025.
Builds on
34 of 47 references.
Closest ancestors · 6
Same direction, newest first
- 2024SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models10 Apr
- 2023Unsafe Diffusion: On the Generation of Unsafe Images and Hateful Memes From Text-To-Image Models23 May
- 2023SneakyPrompt: Jailbreaking Text-to-image Generative Models20 May
- 2023Erasing Concepts from Diffusion Models13 Mar
- 2022Safe Latent Diffusion: Mitigating Inappropriate Degeneration in Diffusion Models9 Nov
- 2022Red-Teaming the Stable Diffusion Safety Filter3 Oct
Other references · 28
- 2017Attention Is All You Needcited by 59,932
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Denoising Diffusion Probabilistic Modelscited by 20,851
- 2015U-Net: Convolutional Networks for Biomedical Image Segmentationcited by 19,604
- 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023Visual Instruction Tuningcited by 7,792
- 2022Hierarchical Text-Conditional Image Generation with CLIP Latentscited by 6,539
- 2023SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesiscited by 4,290
- 2024Scaling Rectified Flow Transformers for High-Resolution Image Synthesiscited by 4,094
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
16 more
- 2023InstructBLIP: Towards General-purpose Vision-Language Models with Instruction Tuningcited by 2,855
- 2018Demystifying MMD GANscited by 1,268
- 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,235
- 2020Improved Techniques for Training Score-Based Generative Modelscited by 1,036
- 2024Visual Autoregressive Modeling: Scalable Image Generation via Next-Scale Predictioncited by 1,005
- 2024Infinity: Scaling Bitwise AutoRegressive Modeling for High-Resolution Image Synthesiscited by 297
- 2023TextDiffuser: Diffusion Models as Text Painterscited by 223
- 2024Assessing the Brittleness of Safety Alignment via Pruning and Low-Rank Modificationscited by 220
- 2024Safety Fine-Tuning at (Almost) No Cost: A Baseline for Vision Large Language Modelscited by 160
- 2024HART: Efficient Visual Generation with Hybrid Autoregressive Transformercited by 128
- 2023GlyphControl: Glyph Conditional Control for Visual Text Generationcited by 127
- 2022The CRINGE Loss: Learning what language not to modelcited by 39
- 2024Towards Understanding the Fragility of Multilingual LLMs against Fine-Tuning Attackscited by 33
- 2024Whispering Experts: Neural Interventions for Toxicity Mitigation in Language Modelscited by 31
- 2024Harm Amplification in Text-to-Image Modelscited by 14
- 2024Toxicity Detection for Freecited by 14
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Disciplined Diffusion: Text-to-Image Diffusion Model against NSFW Generation
- 2025Comprehensive Evaluation and Analysis for NSFW Concept Erasure in Text-to-Image Diffusion Models
- 2025Comprehensive Assessment and Analysis for NSFW Content Erasure in Text-to-Image Diffusion Models
- 2025Responsible Diffusion Models via Constraining Text Embeddings within Safe Regions
- 2024Growth Inhibitors for Suppressing Inappropriate Image Concepts in Diffusion Models
- 2025Training-Free Safe Text Embedding Guidance for Text-to-Image Diffusion Models
- 2025Seeing It Before It Happens: In-Generation NSFW Detection for Diffusion-Based Text-to-Image Models
- 2026UniNDM: A Unified Noise-driven Detection and Mitigation Framework Against Sexual Content in Text-to-Image Generation