PromptGuard: Soft Prompt-Guided Unsafe Content Moderation for Text-to-Image Models
On the map: LLM safety and security → Vision-language and text-to-image safety
Abstract (arXiv)
Recent text-to-image (T2I) models have exhibited remarkable performance in generating high-quality images from text descriptions. However, these models are vulnerable to misuse, particularly generating not-safe-for-work (NSFW) content, such as sexually explicit, violent, political, and disturbing images, raising serious ethical concerns. In this work, we present PromptGuard, a novel content moderation technique that draws inspiration from the system prompt mechanism in large language models (LLMs) for safety alignment. Unlike LLMs, T2I models lack a direct interface for enforcing behavioral guidelines. Our key idea is to optimize a safety soft prompt that functions as an implicit system prompt within the T2I model's textual embedding space. This universal soft prompt (P*) directly moderates NSFW inputs, enabling safe yet realistic image generation without affecting inference efficiency or requiring proxy models. We further enhance its reliability and helpfulness through a divide-and-conquer strategy that optimizes category-specific soft prompts and combines them into unified safety guidance. Extensive experiments across five datasets demonstrate that PromptGuard effectively mitigates NSFW content generation while preserving high-quality benign outputs. PromptGuard is 3.8 times faster than prior content moderation methods while outperforming eight state-of-the-art defenses. Evaluations using both a multi-head safety classifier and a VLM-based guardrail further confirm its robustness, with average unsafe ratios of 5.84% and 6.18%, respectively. Our code and dataset are available at https://t2i-promptguard.github.io/.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Placed in Vision-language and text-to-image safety, one of 12 directions in LLM safety and security. Builds on 38 of its 66 references that are in the map. First posted on arXiv 7 Jan 2025.
Builds on
38 of 66 references.
Closest ancestors · 6
Same direction, newest first
- 2024AlignGuard: Scalable Safety Alignment for Text-to-Image Generation13 Dec
- 2024Perception-guided Jailbreak against Text-to-Image Models20 Aug
- 2024Direct Unlearning Optimization for Robust and Safe Text-to-Image Models17 Jul
- 2024Defensive Unlearning with Adversarial Training for Robust Concept Erasure in Diffusion Models24 May
- 2024SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models10 Apr
- 2023SneakyPrompt: Jailbreaking Text-to-image Generative Models20 May
Other references · 32
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Denoising Diffusion Probabilistic Modelscited by 20,851
- 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
- 2023GPT-4 Technical Reportcited by 18,132
- 2014Microsoft COCO: Common Objects in Contextcited by 17,498
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2018The Unreasonable Effectiveness of Deep Features as a Perceptual Metriccited by 11,029
- 2023SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesiscited by 4,290
- 2022LAION-5B: An open large-scale dataset for training next generation image-text modelscited by 4,131
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
20 more
- 2022InstructPix2Pix: Learning to Follow Image Editing Instructionscited by 2,591
- 2022An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversioncited by 2,231
- 2021SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equationscited by 1,903
- 2022Null-text Inversion for Editing Real Images using Guided Diffusion Modelscited by 1,168
- 2021P-Tuning v2: Prompt Tuning Can Be Comparable to Fine-tuning Universally Across Scales and Taskscited by 686
- 2023Erasing Concepts from Diffusion Modelscited by 530
- 2023DecodingTrust: A Comprehensive Assessment of Trustworthiness in GPT Modelscited by 505
- 2022Safe Latent Diffusion: Mitigating Inappropriate Degeneration in Diffusion Modelscited by 501
- 2023Unified Concept Editing in Diffusion Modelscited by 377
- 2023Visual-Language Prompt Tuning with Knowledge-guided Context Optimizationcited by 307
- 2023MMA-Diffusion: MultiModal Attack on Diffusion Modelscited by 184
- 2023Unsafe Diffusion: On the Generation of Unsafe Images and Hateful Memes From Text-To-Image Modelscited by 171
- 2024The Prompt Report: A Systematic Survey of Prompt Engineering Techniquescited by 115
- 2024On Prompt-Driven Safeguarding for Large Language Modelscited by 109
- 2024Latent Guard: a Safety Framework for Text-to-image Generationcited by 68
- 2024LlavaGuard: An Open VLM-based Framework for Safeguarding Vision Datasets and Modelscited by 49
- 2023Towards Safe Self-Distillation of Internet-Scale Text-to-Image Diffusion Modelscited by 41
- 2024Diffusion Lens: Interpreting Text Encoders in Text-to-Image Pipelinescited by 28
- 2024Universal Prompt Optimizer for Safe Text-to-Image Generationcited by 27
- 2024Towards Understanding Unsafe Video Generationcited by 10
Built on by
Citing papers per year: 2025: 9; 2026: 7.
16 papers.
Sort:
By area:
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systemscited by 125
- 2026ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedbackcited by 64
- 2025Safety at Scale: A Comprehensive Survey of Large Model and Agent Safetycited by 63
- 2025Erasing Concepts, Steering Generations: A Comprehensive Survey of Concept Suppressioncited by 10
- 2025Evolution-based Region Adversarial Prompt Learning for Robustness Enhancement in Vision-Language Modelscited by 6
- 2025AutoPrompt: Automated Red-Teaming of Text-to-Image Models via LLM-Driven Adversarial Promptscited by 6
- 2026FragFuse: Bypassing Access Control of Large Language Model Agents via Memory-Based Query Fragmentation and Fusioncited by 4
- 2025NSFW-Classifier Guided Prompt Sanitization for Safe Text-to-Image Generationcited by 3
- 2025PromptSafe: Gated Prompt Tuning for Safe Text-to-Image Generationcited by 2
- 2025SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editingcited by 2
- 2025Do Concept Replacement Techniques Really Erase Unacceptable Concepts?cited by 1
- 2026SPOT: Selective Prompt Projection via Total Variation for Inference-Only Safe Text-to-Image Generationcited by 0
4 more
- 20263DEditSafe: Defending 3D Editing Pipelines from Unsafe Generationcited by 0
- 2026DiSCO: Defending text-to-image generation through distribution-guided contrastive prompt optimizationcited by 0
- 2026First Token Matters: Understanding Safety Collapse in Large Reasoning Modelscited by 0
- 2026ShieldCLIP: Selective Safety Alignment for Harmful Content Mitigation in Multimodal Foundation Modelscited by 0
- 2026ShieldCLIP: Selective Safety Alignment for Harmful Content Mitigation in Multimodal Foundation Models30 Sep 2026
- 2026First Token Matters: Understanding Safety Collapse in Large Reasoning Models16 Sep 2026
- 2026DiSCO: Defending text-to-image generation through distribution-guided contrastive prompt optimization17 Aug 2026
- 2026FragFuse: Bypassing Access Control of Large Language Model Agents via Memory-Based Query Fragmentation and Fusion14 Jun 2026
- 20263DEditSafe: Defending 3D Editing Pipelines from Unsafe Generation14 May 2026
- 2026SPOT: Selective Prompt Projection via Total Variation for Inference-Only Safe Text-to-Image Generation31 Jan 2026
- 2026ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback15 Jan 2026
- 2025SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editing28 Oct 2025
- 2025AutoPrompt: Automated Red-Teaming of Text-to-Image Models via LLM-Driven Adversarial Prompts28 Oct 2025
- 2025PromptSafe: Gated Prompt Tuning for Safe Text-to-Image Generation2 Aug 2025
- 2025NSFW-Classifier Guided Prompt Sanitization for Safe Text-to-Image Generation23 Jun 2025
- 2025Do Concept Replacement Techniques Really Erase Unacceptable Concepts?10 Jun 2025
4 more
- 2025Erasing Concepts, Steering Generations: A Comprehensive Survey of Concept Suppression26 May 2025
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systems31 Mar 2025
- 2025Evolution-based Region Adversarial Prompt Learning for Robustness Enhancement in Vision-Language Models17 Mar 2025
- 2025Safety at Scale: A Comprehensive Survey of Large Model and Agent Safety2 Feb 2025
- 2025AutoPrompt: Automated Red-Teaming of Text-to-Image Models via LLM-Driven Adversarial Promptscited by 6
- 2025NSFW-Classifier Guided Prompt Sanitization for Safe Text-to-Image Generationcited by 3
- 2025SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editingcited by 2
- 2026DiSCO: Defending text-to-image generation through distribution-guided contrastive prompt optimizationcited by 0
- 2026DiSCO: Defending text-to-image generation through distribution-guided contrastive prompt optimization17 Aug 2026
- 2025SafeEditor: Unified MLLM for Efficient Post-hoc T2I Safety Editing28 Oct 2025
- 2025AutoPrompt: Automated Red-Teaming of Text-to-Image Models via LLM-Driven Adversarial Prompts28 Oct 2025
- 2025NSFW-Classifier Guided Prompt Sanitization for Safe Text-to-Image Generation23 Jun 2025
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systemscited by 125
- 2026ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedbackcited by 64
- 2026FragFuse: Bypassing Access Control of Large Language Model Agents via Memory-Based Query Fragmentation and Fusioncited by 4
- 2026FragFuse: Bypassing Access Control of Large Language Model Agents via Memory-Based Query Fragmentation and Fusion14 Jun 2026
- 2026ToolSafe: Enhancing Tool Invocation Safety of LLM-based agents via Proactive Step-level Guardrail and Feedback15 Jan 2026
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systems31 Mar 2025
Similar, not cited
Close in wording, no citation either way
- 2025Prompt-Based Safety Guidance Is Ineffective for Unlearned Text-to-Image Diffusion Models
- 2026DTVI: Dual-Stage Textual and Visual Intervention for Safe Text-to-Image Generation
- 2025PurifyGen: A Risk-Discrimination and Semantic-Purification Model for Safe Text-to-Image Generation
- 2025T2I-RiskyPrompt: A Benchmark for Safety Evaluation, Attack, and Defense on Text-to-Image Model
- 2025Beautiful Images, Toxic Words: Understanding and Addressing Offensive Text in Generated Images
- 2025SafeGuider: Robust and Practical Content Safety Control for Text-to-Image Models
- 2026SafeCtrl: Region-Aware Safety Control for Text-to-Image Diffusion via Detect-Then-Suppress
- 2025Reimagining Safety Alignment with An Image