Lune

CVPR2025Top-tier venue

Detect-and-Guide: Self-regulation of Diffusion Models for Safe Text-to-Image Generation via Guideline Token Optimization

Feifei Li, Mi Zhang, Yiming Sun, Min Yang

Abstract

Text-to-image diffusion models have achieved state-ofthe-art results in synthesis tasks; however, there is a growing concern about their potential misuse in creating harmful content. To mitigate these risks, post-hoc model intervention techniques, such as concept unlearning and safety guidance, have been developed. However, fine-tuning model weights or adapting the hidden states of the diffusion model operates in an uninterpretable way, making it unclear which part of the intermediate variables is responsible for unsafe generation. These interventions severely affect the sampling trajectory when erasing harmful concepts from complex, multi-concept prompts, thus hindering their practical use in real-world settings. In this work, we propose the safe generation framework Detect-and-Guide (DAG), leveraging the internal knowledge of diffusion models to perform self-diagnosis and fine-grained selfregulation during the sampling process. DAG first detects harmful concepts from noisy latents using refined crossattention maps of optimized tokens, then applies safety guidance with adaptive strength and editing regions to negate unsafe generation. The optimization only requires a small annotated dataset and can provide precise detection maps with generalizability and concept specificity. Moreover, DAG does not require fine-tuning of diffusion models, and therefore introduces no loss to their generation diversity. Experiments on erasing sexual content show that DAG achieves state-of-the-art safe generation performance, balancing harmfulness mitigation and text-following performance on multi-concept real-world prompts. * * * * Benign concepts -no changes J Unsafe-concept mitigation with minimal necessary changes J Non-Target Concept

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

5 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Set You Straight: Auto-Steering Denoising Trajectories to Sidestep Unwanted Concepts cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Set You Straight: Auto-Steering Denoising Trajectories to Sidestep Unwanted Concepts cites Learning Transferable Visual Models From Natural Language Supervision
  • Set You Straight: Auto-Steering Denoising Trajectories to Sidestep Unwanted Concepts cites Scaling Rectified Flow Transformers for High-Resolution Image Synthesis
  • Set You Straight: Auto-Steering Denoising Trajectories to Sidestep Unwanted Concepts cites Erasing Concepts from Diffusion Models
  • DSS: Dynamic Semantic Steering for Robust Concept Erasure in Diffusion Models cites High-Resolution Image Synthesis with Latent Diffusion Models
  • DSS: Dynamic Semantic Steering for Robust Concept Erasure in Diffusion Models cites Learning Transferable Visual Models From Natural Language Supervision
  • DSS: Dynamic Semantic Steering for Robust Concept Erasure in Diffusion Models cites Erasing Concepts from Diffusion Models
  • GrOCE : Graph-Guided Online Concept Erasure for Text-to-Image Diffusion Models cites High-Resolution Image Synthesis with Latent Diffusion Models
  • GrOCE : Graph-Guided Online Concept Erasure for Text-to-Image Diffusion Models cites Learning Transferable Visual Models From Natural Language Supervision
  • GrOCE : Graph-Guided Online Concept Erasure for Text-to-Image Diffusion Models cites Erasing Concepts from Diffusion Models
  • What Lurks Within? Concept Auditing for Shared Diffusion Models at Scale cites High-Resolution Image Synthesis with Latent Diffusion Models
  • What Lurks Within? Concept Auditing for Shared Diffusion Models at Scale cites Learning Transferable Visual Models From Natural Language Supervision
  • What Lurks Within? Concept Auditing for Shared Diffusion Models at Scale cites Erasing Concepts from Diffusion Models
  • Prompt-to-Prompt Image Editing with Cross-Attention Control cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Prompt-to-Prompt Image Editing with Cross-Attention Control cites Learning Transferable Visual Models From Natural Language Supervision
  • Scaling Rectified Flow Transformers for High-Resolution Image Synthesis cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Scaling Rectified Flow Transformers for High-Resolution Image Synthesis cites Learning Transferable Visual Models From Natural Language Supervision
  • Erasing Concepts from Diffusion Models cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Iterative Prompt Refinement for Safer Text-to-Image Generation cites High-Resolution Image Synthesis with Latent Diffusion Models
  • Iterative Prompt Refinement for Safer Text-to-Image Generation cites Erasing Concepts from Diffusion Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. Set You Straight: Auto-Steering Denoising Trajectories to Sidestep Unwanted ConceptsLeyang Li, Shilin Lu, Yan Ren, Adams Wai-Kin KongACM MM 2025 · 4 citations
  2. GrOCE : Graph-Guided Online Concept Erasure for Text-to-Image Diffusion ModelsNing Han, Zhenyu Ge, Feng Han, Yuhua Sun et al.CVPR 2026 · 3 citations
  3. DSS: Dynamic Semantic Steering for Robust Concept Erasure in Diffusion ModelsQinghui Gong, Zhengchun Zhou, Hua Meng, Yihuai Liang et al.CCS 2026
  4. What Lurks Within? Concept Auditing for Shared Diffusion Models at ScaleXiaoyong (Brian) Yuan, Xiaolong Ma, Linke Guo, Lan ZhangCCS 2025
  5. Iterative Prompt Refinement for Safer Text-to-Image GenerationJinwoo Jeon, JunHyeok Oh, Hayeong Lee, Byung-Jun LeeEMNLP 2025

Builds on25

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  2. High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser et al.CVPR 2022 · 13,123 citations
  3. Scaling Rectified Flow Transformers for High-Resolution Image SynthesisPatrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari et al.ICML 2024 · 3,620 citations
  4. Erasing Concepts from Diffusion ModelsRohit Gandikota, Joanna Materzynska, Jaden Fiotto-Kaufman, David BauICCV 2023 · 536 citations
  5. Prompt-to-Prompt Image Editing with Cross-Attention ControlAmir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman et al.ICLR 2023 · 361 citations

Related papers

  1. Prompting4Debugging: Red-Teaming Text-to-Image Diffusion Models by Finding Problematic PromptsZhi-Yi Chin, Chieh-Ming Jiang, Ching-Chun Huang, Pin-Yu Chen et al.ICML 2024 · 155 citations
  2. Training-Free Safe Text Embedding Guidance for Text-to-Image Diffusion ModelsByeonghu Na, Mina Kang, Jiseok Kwak, Minsang Park et al.NeurIPS 2025 · 8 citations
  3. SafeCFG: Controlling Harmful Features with Dynamic Safe Guidance for Safe GenerationJiadong Pan, Liang Li, Hongcheng Gao, Zheng-Jun Zha et al.ACM MM 2025
  4. Growth Inhibitors for Suppressing Inappropriate Image Concepts in Diffusion ModelsDie Chen, Zhiwen Li, Mingyuan Fan, Cen Chen et al.ICLR 2025
  5. NDM: A Noise-driven Detection and Mitigation Framework against Implicit Sexual Intentions in Text-to-Image GenerationYitong Sun, Yao Huang, Ruochen Zhang, Huanran Chen et al.ACM MM 2025 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines