TL;DR
This paper introduces Dynamic VLM-Guided Negative Prompting (VL-DNP), a novel method that uses Vision-Language Models (VLMs) to dynamically generate negative prompts during the diffusion model's image generation process. This approach adapts to the evolving image content, offering a more precise and contextual way to filter unwanted elements compared to static negative prompts, leading to better safety-alignment trade-offs.
What Problem Does This Paper Address?
Diffusion models, while powerful for image generation, can sometimes produce undesirable or unsafe content. A common technique to mitigate this is "negative prompting," where users specify concepts to avoid. However, traditional negative prompting has two major drawbacks:
- Over-correction: Fixed negative prompts can sometimes suppress desired content or lead to semantic drift, even when the unwanted content isn't present.
- Inflexibility: It's hard to pre-define all possible unwanted elements for any given positive prompt, making static negative prompts either too broad or insufficient.
This paper tackles these limitations by proposing a dynamic approach that generates negative prompts on-the-fly, adapting to the specific content being generated at each step.
Methods
The core of the proposed method, VL-DNP, is to leverage the understanding capabilities of Vision-Language Models (VLMs). The process unfolds as follows:
- Standard Denoising: The diffusion model begins generating an image using the positive prompt.
- Intermediate Prediction: At specific, pre-defined timesteps during the denoising process, the model predicts a "clean" version of the image (denoted as $\hat{x}_0^{(i)}$).
- VLM Query: This intermediate image prediction is fed into a VLM. The VLM is tasked with identifying potentially inappropriate or unwanted visual elements within the image. Optionally, few-shot demonstration examples can be provided to guide the VLM.
- Dynamic Negative Prompt Generation: Based on its analysis, the VLM generates a contextually appropriate negative prompt ($c^-_{t_i}$).
- Adaptive Guidance: This dynamically generated negative prompt is then used to guide the subsequent denoising steps, steering the generation away from the identified unwanted content.
This approach integrates seamlessly into existing Classifier-Free Guidance (CFG) frameworks without requiring model retraining. The mathematical formulation involves augmenting the standard score function with a dynamically generated negative guidance term.
Datasets
The paper evaluates its approach using several datasets:
- COCO-30K: Used for general image generation performance evaluation, with 100 randomly sampled prompts. CLIP and FID scores were computed on this set.
- Ring-a-Bell-16, P4D, Unlearn-diff: These datasets consist of adversarial prompts specifically designed to test content filtering capabilities in text-to-image tasks. They are used to evaluate the safety (Attack-Success Rate - ASR, Toxic Rate - TR) of the generated images.
Key Insights and Ideas
- Dynamic Adaptation is Key: The most significant insight is that negative prompts don't need to be static. Adapting them based on intermediate image predictions allows for more precise filtering, avoiding over-correction.
- VLMs as Content Detectors: VLMs, with their strong visual and textual understanding, are effective at identifying subtle or emergent unsafe content that might be missed by pre-defined prompts.
- Improved Safety-Alignment Trade-off: VL-DNP demonstrates a superior balance between generating safe images and maintaining high image quality/text alignment compared to static negative prompting.
- Concept-Specific Negatives: VLMs can generate more granular, concept-specific negative prompts (e.g., "Male breast" instead of just "nsfw"), which reduces the suppression of legitimate content.
- Evolving Guidance: As an artifact disappears, the VLM can drop the irrelevant negative prompt and focus on new risks, preventing persistent, unnecessary filtering.
Key Results
The paper reports significant improvements in safety metrics (ASR, TR) while maintaining or even improving text-image alignment (CLIP score) and image quality (FID) compared to static negative prompting.
- Safety vs. Quality: For static negative prompting, increasing the negative guidance scale ($\omega_{neg}$) from 7.5 to 20 drastically reduced CLIP score (0.313 to 0.277) and increased FID (107 to 153). In contrast, VL-DNP with similar guidance scales kept CLIP scores high (around 0.311-0.313) and FID within a much lower range (8-15), while still significantly reducing ASR.
- Pareto Frontier: Figure 2 visually shows that VL-DNP consistently dominates static negative prompting and the SAFREE baseline across various safety-alignment trade-offs. For any given CLIP score, VL-DNP achieves better or equal safety, and for any given safety level, it achieves better or equal alignment.
- Efficiency: While VL-DNP introduces some latency due to VLM queries, the overall time per image is still manageable, with InfT (average time to generate a single image) around 29.673 seconds for the VL-DNP method at $\omega_{neg}=7.5$.
Limitations and Future Work
- Latency: The primary limitation acknowledged is the added latency introduced by VLM queries during the denoising process.
- Guidance Scale Dependency: While VL-DNP improves the trade-off, the absolute ASR still depends on the chosen negative guidance scale.
- Future Directions:
- Optimizing Latency: Exploring lightweight VLMs, caching intermediate predictions, or querying the VLM less frequently (e.g., every k steps) to reduce overhead.
- Distillation: Investigating distillation-based approaches for real-time deployment.
- Joint Scheduling: Developing methods to jointly schedule the strength and content of guidance for even better control.
Summary updated