mlsanityData to 7 Oct 2026

Beautiful Images, Toxic Words: Understanding and Addressing Offensive Text in Generated Images

arXiv 2502.05066 ↗First posted 7 Feb 2025cs.CVcited by 0

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

  1. 2024SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models10 Apr
  2. 2023Unsafe Diffusion: On the Generation of Unsafe Images and Hateful Memes From Text-To-Image Models23 May
  3. 2023SneakyPrompt: Jailbreaking Text-to-image Generative Models20 May
  4. 2023Erasing Concepts from Diffusion Models13 Mar
  5. 2022Safe Latent Diffusion: Mitigating Inappropriate Degeneration in Diffusion Models9 Nov
  6. 2022Red-Teaming the Stable Diffusion Safety Filter3 Oct

Other references · 28

  1. 2017Attention Is All You Needcited by 59,932
  2. 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
  3. 2020Denoising Diffusion Probabilistic Modelscited by 20,851
  4. 2015U-Net: Convolutional Networks for Biomedical Image Segmentationcited by 19,604
  5. 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
  6. 2022Training language models to follow instructions with human feedbackcited by 15,712
  7. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  8. 2023Visual Instruction Tuningcited by 7,792
  9. 2022Hierarchical Text-Conditional Image Generation with CLIP Latentscited by 6,539
  10. 2023SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesiscited by 4,290
  11. 2024Scaling Rectified Flow Transformers for High-Resolution Image Synthesiscited by 4,094
  12. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
16 more
  1. 2023InstructBLIP: Towards General-purpose Vision-Language Models with Instruction Tuningcited by 2,855
  2. 2018Demystifying MMD GANscited by 1,268
  3. 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,235
  4. 2020Improved Techniques for Training Score-Based Generative Modelscited by 1,036
  5. 2024Visual Autoregressive Modeling: Scalable Image Generation via Next-Scale Predictioncited by 1,005
  6. 2024Infinity: Scaling Bitwise AutoRegressive Modeling for High-Resolution Image Synthesiscited by 297
  7. 2023TextDiffuser: Diffusion Models as Text Painterscited by 223
  8. 2024Assessing the Brittleness of Safety Alignment via Pruning and Low-Rank Modificationscited by 220
  9. 2024Safety Fine-Tuning at (Almost) No Cost: A Baseline for Vision Large Language Modelscited by 160
  10. 2024HART: Efficient Visual Generation with Hybrid Autoregressive Transformercited by 128
  11. 2023GlyphControl: Glyph Conditional Control for Visual Text Generationcited by 127
  12. 2022The CRINGE Loss: Learning what language not to modelcited by 39
  13. 2024Towards Understanding the Fragility of Multilingual LLMs against Fine-Tuning Attackscited by 33
  14. 2024Whispering Experts: Neural Interventions for Toxicity Mitigation in Language Modelscited by 31
  15. 2024Harm Amplification in Text-to-Image Modelscited by 14
  16. 2024Toxicity Detection for Freecited by 14

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Disciplined Diffusion: Text-to-Image Diffusion Model against NSFW Generation
  2. 2025Comprehensive Evaluation and Analysis for NSFW Concept Erasure in Text-to-Image Diffusion Models
  3. 2025Comprehensive Assessment and Analysis for NSFW Content Erasure in Text-to-Image Diffusion Models
  4. 2025Responsible Diffusion Models via Constraining Text Embeddings within Safe Regions
  5. 2024Growth Inhibitors for Suppressing Inappropriate Image Concepts in Diffusion Models
  6. 2025Training-Free Safe Text Embedding Guidance for Text-to-Image Diffusion Models
  7. 2025Seeing It Before It Happens: In-Generation NSFW Detection for Diffusion-Based Text-to-Image Models
  8. 2026UniNDM: A Unified Noise-driven Detection and Mitigation Framework Against Sexual Content in Text-to-Image Generation