NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Understanding the Impact of Negative Prompts: When and How Do They Take Effect?

Yuanhao Ban, Ruochen Wang, Tianyi Zhou, Minhao Cheng, Boqing Gong, Cho-Jui Hsieh

TL;DR

This paper provides the first systematic study of how and when negative prompts influence text-to-image diffusion models. The authors discover that negative prompts experience a "delayed effect" and operate via "deletion through neutralization"—insights they leverage to create a superior, training-free image inpainting method that removes objects without distorting the background.

What Problem Does This Paper Address?

Negative prompts are a staple for users of text-to-image models like Stable Diffusion, allowing them to specify what not to include in an image (e.g., "no glasses", "blurry"). Despite their widespread use, the underlying mechanism of negative prompts has remained a black box.

Without a clear understanding of when and how these prompts exert influence during the multi-step denoising process, prompt engineering remains a game of trial and error. Furthermore, applying negative prompts naively throughout the entire generation process often causes unintended side effects, such as drastically altering the image background or disrupting the overall layout. This paper aims to uncover the internal dynamics of negative prompts to make image editing more predictable and controllable.

Methods

The authors investigate the mechanics of negative prompts through both qualitative and quantitative lenses:

  1. Cross-Attention Visualization: The authors isolated and visualized the cross-attention maps for specific tokens across individual diffusion steps. This allowed them to track exactly when a negative token (like "glasses") begins to attend to the correct spatial region (the face).
  2. Quantitative Strength Metric ($r_t$): To quantify the influence of a negative prompt at any given timestep $t$, they introduced a metric that calculates the ratio of the mean squared cross-attention heat map values of the negative prompt token against its most relevant positive counterpart.
  3. Enhanced Controllable Inpainting: Armed with insights into the optimal timing of negative prompts, the authors developed a simple, training-free inference strategy. Instead of applying the negative prompt from step 0, they introduce it only during a specific intermediate window (defaulting to steps 5–15 out of 30), leaving the background layout intact while cleanly erasing the target object.

Datasets

Because no dedicated benchmarks existed for evaluating negative prompts, the authors adapted six standard text/video datasets: COCO, CC, Nocaps, Places, MSVD, and Vatex.

They used GPT-4V to identify prominent objects within images generated from these datasets' prompts. This automated pipeline yielded 1,000 test prompt pairs per dataset, which were evaluated across 5 distinct random seeds to ensure statistical robustness.

Key Insights and Ideas

  • The Delayed Effect: Negative prompts do not act immediately. While positive prompts begin shaping the layout of the image within the first four steps, negative prompts suffer from an "information lag," only accurately attending to the target region around step 5 for nouns and step 10 for adjectives.
Cross-attention maps showing the delayed effect of negative prompts compared to positive prompts.
  • Deletion Through Neutralization: How does a negative prompt actually delete something? The model's internal machinery paradoxically estimates noise to generate the forbidden object in the negative pathway, which is then subtracted from the positive pathway's noise map, effectively neutralizing the concept in latent space.
  • Reverse Activation: A highly counter-intuitive phenomenon occurs if a negative prompt is applied only during the very early stages (steps 0–3) and then removed: the forbidden object is paradoxically generated in the final image. The authors explain this via the Inducing Effect (the early negative prompt alters the initial noise trajectory toward the object region) and the Momentum Effect (subsequent diffusion steps are highly correlated and carry this initial directional push forward).
Examples of Reverse Activation, where early application of negative prompts paradoxically generates the excluded object.

Key Results

The authors' timing-based inpainting method was evaluated using both GPT-4V and human studies, measuring the Removal Success Rate (RSR) and the Comparison Rate (CR), which evaluates background preservation:

  • Minimal Impact on Success: Applying negative prompts only during intermediate steps (steps 5–15) successfully removes the target object in over 80% of cases where the baseline (applying it to all steps) succeeded.
  • Superior Background Preservation: The proposed method achieved an average Comparison Rate of 82.84% under GPT-4V evaluation and 88.45% in human evaluations. This means the modified images were overwhelmingly judged to be much more faithful to the original backgrounds than those produced by standard negative prompting, which frequently distorts the entire scene.

Limitations and Future Work

The study primarily focuses on two types of tasks: noun-based object removal and adjective-based image refinement. The behavior of negative prompts involving other parts of speech (such as verbs or complex spatial prepositions) remains unexplored.

For future work, the authors suggest designing architectural modifications to alleviate the information lag by forcing earlier interactions between the positive and negative noise pathways. They also propose exploring the use of negative prompts during the training phase as a novel form of data augmentation.

Summary updated

BibTeX
@misc{ban2024understanding,
  author = {Yuanhao Ban and Ruochen Wang and Tianyi Zhou and Minhao Cheng and Boqing Gong and Cho-Jui Hsieh},
  title = {{Understanding the Impact of Negative Prompts: When and How Do They Take Effect?}},
  year = {2024},
  eprint = {2406.02965},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.02965},
}
Figure