TL;DR
Current safety guardrails for text-to-image diffusion models attempt to block multiple types of inappropriate content by lumping all safety keywords together into a single aggregated set. This paper reveals that doing so creates "harmful conflicts" where different safety directions cancel each other out or misalign, paradoxically increasing the risk of generating unsafe images. To fix this, the authors introduce Conflict-aware Adaptive Safety Guidance (CASG), a training-free, plug-and-play framework that dynamically isolates and applies the single most relevant safety direction at each step of image generation.
What Problem Does This Paper Address?
Text-to-Image (T2I) diffusion models are incredibly powerful, but they risk generating harmful content like violence, sexual imagery, and hate speech. To prevent this without the high cost of retraining or fine-tuning models, researchers use training-free "safety-guidance" methods. These methods steer the image generation process away from "harmful zones" defined by specific keywords.
However, real-world deployment requires protecting against multiple categories of harm simultaneously. Existing methods handle this by simply concatenating all safety keywords into one giant list. The authors discover that this category-agnostic approach suffers from a major flaw: harmful conflicts.
Different harm categories define distinct, often incompatible or opposing safety directions in the model's space. Forcing them together causes two key issues:
- Directional Inconsistency: Steering away from one type of harm can accidentally push the model toward another. For example, applying a "hate" safety direction to a prompt intended to generate sexual content can actually increase the harmful generation rate compared to using no safety guidance at all.
- Directional Attenuation: Different safety vectors can partially cancel each other out, diluting the overall strength of the safety guardrail.
This phenomenon is illustrated clearly in Figure 1, demonstrating how multi-category aggregation degrades safety performance.
Methods
The authors propose Conflict-aware Adaptive Safety Guidance (CASG), a training-free, plug-and-play framework that can enhance both latent-space safeguards (like Safe Latent Diffusion) and text-space safeguards (like SAFREE). Instead of aggregating categories, CASG dynamically selects the most critical safety direction at each denoising timestep using two core components:
- Conflict-aware Category Identification (CaCI): At each timestep, CaCI evaluates the alignment between the model's current generative state and each individual harmful category. In the latent space, this is done by measuring the cosine similarity between the prompt guidance and each category's safety direction. In the text space, it analyzes the residual magnitude after orthogonal projection.
- Conflict-resolving Guidance Application (CrGA): Once the dominant harmful category is identified for that specific step, CrGA applies safety steering solely along that category's direction. This eliminates cross-category interference and preserves the full strength of the safety vector.
An overview of how CASG integrates into both latent and text spaces is shown in Figure 4.
Datasets
The framework was evaluated across four prominent T2I safety benchmarks:
- I2P (Inappropriate Image Prompts): 4,703 prompts spanning seven harm categories.
- T2VSafetyBench: 3,443 curated prompts across categories like pornography, gore, and illegal activities.
- Unsafe Diffusion (UD): 904 user-contributed prompts covering five harmful categories.
- CoProv2: 1,000 severe, LLM-generated harmful prompts.
- COCO-30k: 1,000 sampled benign captions used to evaluate whether the safety features accidentally degrade standard image quality.
Key Insights and Ideas
- More Keywords $\neq$ More Safety: The common practice of stacking as many safety keywords as possible is fundamentally counterproductive. Heterogeneous safety directions actively dilute or oppose one another during aggregation (as visualized via PCA in Figure 2 and quantified in Figure 3).
- Safety is a Moving Target: The relationships and conflicts between harmful categories evolve dynamically across denoising timesteps. Static prompt classification (e.g., using an LLM to categorize a prompt before generation begins) fails because it cannot adapt to these test-time semantic shifts.
- Dynamic Isolation Beats Aggregation: Focusing entirely on the single most critical harm threatening the model at any given instant yields a much more robust safety boundary than trying to mitigate all harms simultaneously.
Key Results
- State-of-the-Art Safety Mitigation: Integrating CASG with Safe Latent Diffusion (CASG+SLD) achieved the lowest harmful rates across all four benchmarks. On T2VSafetyBench, CASG+SLD slashed the harmful rate to 9.8%, down from vanilla SLD's 25.2% and the unguided Stable Diffusion baseline of 58.3%.
- Quality Preservation: On benign prompts from the COCO dataset, CASG maintained competitive image quality, showing virtually no degradation in FID or CLIP scores compared to standard baselines.
- Outperforming LLM Classifiers: CASG significantly outperformed static LLM-assisted classification variants (using GPT-4o or QwenGuard), proving that timestep-level adaptive guidance is necessary to resolve evolving conflicts.
Limitations and Future Work
- Inference Overhead in Latent Space: While the text-space implementation (CASG+SAFREE) adds negligible computational cost, the latent-space version (CASG+SLD) scales linearly with the number of predefined harmful categories ($k$). For 7 categories, it increases inference time by roughly 2.58$\times$ because it must compute noise predictions for each category at every step.
- Future Directions: The authors note that optimizing the computational efficiency of the latent-space component—perhaps by early-pruning irrelevant categories or approximating safety directions—is a vital direction for future research.
Summary updated