Table of Contents
Fetching ...

NDM: A Noise-driven Detection and Mitigation Framework against Implicit Sexual Intentions in Text-to-Image Generation

Yitong Sun, Yao Huang, Ruochen Zhang, Huanran Chen, Shouwei Ruan, Ranjie Duan, Xingxing Wei

TL;DR

NDM tackles the challenge of implicit sexual content in text-to-image diffusion by leveraging early-stage denoising noise for quick, accurate detection and by applying a noise-informed, adaptive mitigation strategy that minimizes degradation of benign generation. The framework introduces a two-stage approach: (1) detect implicit malicious intent via a noise-based classifier trained on early denoising noise, and (2) mitigate content through noise-enhanced adaptive negative guidance, including initial-noise optimization guided by cross-attention and an LLM-driven, prompt-aware negative prompt construction. Empirical results on natural and adversarial prompts show superior detection performance, substantially lower attack success rates, and high benign-preservation metrics (NRR ~97.31%), with fast inference (~0.95 s/sample) compared to baselines. The work offers a practical, robust path to safer T2I generation without significant loss of creative capability, validated across multiple datasets and prompt lengths.

Abstract

Despite the impressive generative capabilities of text-to-image (T2I) diffusion models, they remain vulnerable to generating inappropriate content, especially when confronted with implicit sexual prompts. Unlike explicit harmful prompts, these subtle cues, often disguised as seemingly benign terms, can unexpectedly trigger sexual content due to underlying model biases, raising significant ethical concerns. However, existing detection methods are primarily designed to identify explicit sexual content and therefore struggle to detect these implicit cues. Fine-tuning approaches, while effective to some extent, risk degrading the model's generative quality, creating an undesirable trade-off. To address this, we propose NDM, the first noise-driven detection and mitigation framework, which could detect and mitigate implicit malicious intention in T2I generation while preserving the model's original generative capabilities. Specifically, we introduce two key innovations: first, we leverage the separability of early-stage predicted noise to develop a noise-based detection method that could identify malicious content with high accuracy and efficiency; second, we propose a noise-enhanced adaptive negative guidance mechanism that could optimize the initial noise by suppressing the prominent region's attention, thereby enhancing the effectiveness of adaptive negative guidance for sexual mitigation. Experimentally, we validate NDM on both natural and adversarial datasets, demonstrating its superior performance over existing SOTA methods, including SLD, UCE, and RECE, etc. Code and resources are available at https://github.com/lorraine021/NDM.

NDM: A Noise-driven Detection and Mitigation Framework against Implicit Sexual Intentions in Text-to-Image Generation

TL;DR

NDM tackles the challenge of implicit sexual content in text-to-image diffusion by leveraging early-stage denoising noise for quick, accurate detection and by applying a noise-informed, adaptive mitigation strategy that minimizes degradation of benign generation. The framework introduces a two-stage approach: (1) detect implicit malicious intent via a noise-based classifier trained on early denoising noise, and (2) mitigate content through noise-enhanced adaptive negative guidance, including initial-noise optimization guided by cross-attention and an LLM-driven, prompt-aware negative prompt construction. Empirical results on natural and adversarial prompts show superior detection performance, substantially lower attack success rates, and high benign-preservation metrics (NRR ~97.31%), with fast inference (~0.95 s/sample) compared to baselines. The work offers a practical, robust path to safer T2I generation without significant loss of creative capability, validated across multiple datasets and prompt lengths.

Abstract

Despite the impressive generative capabilities of text-to-image (T2I) diffusion models, they remain vulnerable to generating inappropriate content, especially when confronted with implicit sexual prompts. Unlike explicit harmful prompts, these subtle cues, often disguised as seemingly benign terms, can unexpectedly trigger sexual content due to underlying model biases, raising significant ethical concerns. However, existing detection methods are primarily designed to identify explicit sexual content and therefore struggle to detect these implicit cues. Fine-tuning approaches, while effective to some extent, risk degrading the model's generative quality, creating an undesirable trade-off. To address this, we propose NDM, the first noise-driven detection and mitigation framework, which could detect and mitigate implicit malicious intention in T2I generation while preserving the model's original generative capabilities. Specifically, we introduce two key innovations: first, we leverage the separability of early-stage predicted noise to develop a noise-based detection method that could identify malicious content with high accuracy and efficiency; second, we propose a noise-enhanced adaptive negative guidance mechanism that could optimize the initial noise by suppressing the prominent region's attention, thereby enhancing the effectiveness of adaptive negative guidance for sexual mitigation. Experimentally, we validate NDM on both natural and adversarial datasets, demonstrating its superior performance over existing SOTA methods, including SLD, UCE, and RECE, etc. Code and resources are available at https://github.com/lorraine021/NDM.
Paper Structure (16 sections, 9 equations, 7 figures, 3 tables)

This paper contains 16 sections, 9 equations, 7 figures, 3 tables.

Figures (7)

  • Figure 1: Overview of the NDM framework. Stage I: Noise-based Detection utilizes predicted noise separability to classify benign and sexual prompts. Stage II: When sexual prompts are detected, adaptive mitigation begins by optimizing the initial noise through suppressing significant foreground regions in the cross-attention map. This is followed by combining the optimized noise with adaptive negative prompts generated by an LLM, tailored to the input prompts for more effective sexual mitigation.
  • Figure 2: Visualized separability of predicted noises at different timesteps for benign and sexual generations using t-SNE.
  • Figure 3: Generation results of the same prompt under various sampled initial noises. The cases framed in $\textcolor{teal}{green}$ are safe, while the cases framed in $\textcolor{red}{red}$ are sexual.
  • Figure 4: The Nudity Removal Rate (NRR) of different body parts in I2P. The initial total number of detected elements across five categories, obtained using SD-v1.4-base is 298 [Buttocks-24; genitalia (M)—7; Breast (M)—27; Genitalia (F)—23; Breast (F)-217].
  • Figure 5: Visual comparisons of methods evaluated in this work. Prompts of five rows are randomly sampled from five different sexual datasets used in this paper. The cases framed in $\textcolor{teal}{green}$ are safe, while the cases framed in $\textcolor{red}{red}$ are sexual.
  • ...and 2 more figures