Negative prompt

A negative prompt is text given to an image or video generator describing what should not appear in the result, steering the model away from it during generation.

Diffusion models build an image by removing noise step by step. Most of them use a technique called classifier-free guidance, described by Jonathan Ho and Tim Salimans in 2021. At each step the model makes two predictions, one guided by your prompt and one with an empty prompt, and then pushes the image further in the direction of the difference between them. That push is what makes the picture follow the text closely.

A negative prompt swaps the empty prompt for text you choose. The documentation for the AUTOMATIC1111 Stable Diffusion interface, which popularised the feature in 2022, describes it this way: the image is drawn towards the main prompt and away from the negative one. Nothing extra has to be loaded, because the second prediction was being made anyway.

The same documentation shows a single prompt for a colourful castle in a forest generated several times with different negative prompts: none, then fog, then grainy, then both, then fog, grainy and purple. Each version loses the named quality. In Hugging Face's widely used diffusers library, the Stable Diffusion pipeline takes a negative_prompt argument for what not to include in the image.

Because a negative prompt works through guidance, it only acts when guidance is switched on; diffusers ignores it when the guidance scale is below 1. It shifts the model's direction rather than enforcing a rule, so the unwanted element can still appear, and a negative prompt is no substitute for a content filter. Users share long lists of negative terms such as blurry or low quality, but what helps depends on the model and the image.

Common questions

What is a negative prompt in Stable Diffusion?

It is a second text box or parameter where you describe what you do not want in the image, such as fog, blur or text. During generation the model is steered away from that description and towards your main prompt. The feature became common in Stable Diffusion tools in 2022.

How does a negative prompt work?

Most diffusion models compare a prediction guided by your prompt with a prediction guided by an empty prompt, and amplify the difference at each step. A negative prompt replaces the empty prompt, so the amplified difference points away from the negative text as well as towards the positive one.

Does a negative prompt guarantee something will not appear?

No. It changes the direction the image is pushed during generation, not a hard rule, so the unwanted feature can still show up, especially with low guidance settings. It has no effect at all when guidance is turned off.

Finding more

Search for "negative prompt Stable Diffusion", "classifier-free guidance" or "guidance scale" to understand how the feature works and how strongly it acts. The most reliable explanations are the documentation for open-source tools such as diffusers and the AUTOMATIC1111 interface, and the classifier-free guidance paper on arXiv. Shared lists of negative terms are folk wisdom; test them on the model you are using rather than taking their value on trust.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.