Safety guardrails for AI art generation.
PromptGuard introduces a safety mechanism for Text-to-Image models using optimized soft prompts, preventing unsafe content generation while maintaining image quality and generation speed.
https://arxiv.org/abs/2501.03544
π¨ Original Problem:
Text-to-Image models can generate harmful content like sexual, violent, political and disturbing images. Current solutions either modify model parameters or use external filters, both causing performance overhead and quality degradation.
π οΈ Solution in this Paper:
β Optimizes a safety soft prompt that acts like a system prompt within the model's text embedding space
β Uses a divide-and-conquer approach by training separate prompts for different unsafe content categories
β Leverages contrastive learning to balance between unsafe content removal and benign image quality
β Combines SDEdit to transform unsafe images into safer versions for training data
π‘ Key Insights:
β System prompts from LLMs can be adapted for Text-to-Image safety
β Soft prompts can guide image generation without model modifications
β Divide-and-conquer approach handles diverse unsafe content better
β Contrastive learning maintains benign generation quality
π Results:
β Achieves 5.84% unsafe ratio, lowest among all tested methods
β Processes images 7.8x faster than prior content moderation approaches
β Maintains high CLIP scores showing good prompt-image alignment
β Successfully moderates across sexual, violent, political and disturbing categories










