What is Negative Prompt in Stable Diffusion?
A negative prompt is an argument that instructs the Stable Diffusion model to not include certain things in the generated image. This powerful feature allows users to remove any object, styles, or abnormalities from the original generated image.
Though Stable Diffusion takes input known as prompts in the form of human language, it is difficult for it to understand negative words, such as “no”, “not”, “except”, “without”. Hence, you need to use negative prompting to gain full control over your prompts.
How to Use Negative Prompts in Stable Diffusion
Now that you know what a negative prompt is, let’s move on to how to use it.
The syntax of negative prompts varies according to the different GUIs of the Stable Diffusion model.
Before knowing how to use negative prompts, it is essential to know prompt weighting.
Prompt weighting is a technique supported by Stable Diffusion that gives users fine control over their prompt. Using prompt weight, you can tell Stable Diffusion where to pay more attention and where to pay less.
Example of Prompt weighting:
Prompt 1: a hybrid between a Shiba inu:0.7 and a polar bear, photography, award winning, documentary, wildlife, 8k
The above prompt tells Stable Diffusion to emphasize Shiba Inu. So, you can expect an image that has the dominance of a Shiba Inu over a polar bear. In this case, Stable Diffusion focuses mostly on Shiba Inu and automatically applies the difference (which is 0.3) to polar bear.
Alternatively, you can assign weights to each words in your prompt for finer control.
Prompt 2: a cute:0.2 hybrid between a Shiba inu:0.5 and a polar bear:0.3, photography, award winning, documentary, wildlife, 8k
Below is the same prompt 1, in which I have swapped the weights for clear understanding.
Prompt 3: a hybrid between a Shiba inu and a polar bear:0.7, photography, award winning, documentary, wildlife, 8k
Since I have given more weights to polar bear, you can see the dominance of polar bear characteristic in the output.
Things to Remember About Stable Diffusion Prompt Weighting
- By default, words with no explicit weighting have a weight of 1.0.
- The sum of all text weight has to be greater than zero. Hence, if you mentioned 0.6 for one word, the stable diffusion automatically fills the difference, which is 0.4 in this case, for other subjective word in your prompt.
- As shown in the next heading, you can also use negative weights.
How to Use Negative Prompts in DreamStudio
DreamStudio does not have a dedicated option for negative prompts like seed or CFG scale. However, from the December 2nd week of 2022, DreamStudio will support negative prompts.
You need to include a negative number (prompt weight) in your prompt to use negative prompts in DreamStudio. Just like the weight, the negative weight needs to be added with a single colon (:).
Typically the weights must be between the range of -2.0 to 2.0. However, you can use it to the maximum value of + or – 10.
The value of -1 is equivalent to -100%. It guarantees the full elimination of a particular word.
Prompt 4: Portrait of Tom Cruise in red:-1 suit, 4k, high quality
The above prompt tells Stable Diffusion to not include a red suit in the generated image.
How to Use Negative Prompts in Other Stable Diffusion GUIs
Apart from DreamStudio, there are many Stable Diffusion GUIs available for free such as NMKD Stable Diffusion GUI, AUTOMATIC1111’s Stable Diffusion WebUI, etc.
Some of them have a separate field, like in NMKD’s 1.7.X version, where you can easily list all negative prompts.
If there is no separate field, you can either wrap the negative prompt with square brackets or use prompt weight.
Prompt 6: A bowl of fresh fruits [Kiwi] = A bowl of fresh fruits, no Kiwi
If the above prompting technique doesn’t give you the expected results, try the prompt weighting technique.
Prompt 7: A bowl of fresh fruits Kiwi::-1 or A bowl of fresh fruits Kiwi:-1 = A bowl of fresh fruits, no Kiwi
Using the negative number will tell Stable Diffusion to omit the fruit kiwi while generating “A bowl of fresh fruits”.
Use Cases of Negative Prompts
As mentioned earlier, negative prompts can be used to remove objects, styles, and image abnormalities in pre-existing images.
Removing Cap from the Girl:
Removing Fog from the Scene:
Removing Duplicate Artifacts:
Some negative prompt keywords to keep in mind:
- Extra fingers
- Poorly drawn hands
- Extra limbs
- Gross proportions
- Missing arms
- Mutated hands
- Long neck
- Mutilated hands
- Poorly drawn face
- Bad anatomy
- Cloned face
- Malformed limbs
- Missing legs
- Too many fingers
A Terrifying Fictional Character Born Out of a Negative Prompt
If you are using Twitter and are a follower of Stable Diffusion stuff, you may have heard about the fictional horror character “Loab”.
Loab is a fictional character born out of a negative prompt weight from the mind of a person called Supercomposite. A negative prompt on the logo below results in that character.
While experimenting with the negative prompts, Supercomposite had a weird idea of what would be the opposite of this logo. To fuel his idea, he immediately responded with a prompt “DIGITA PNTICS skyline logo::-1”.
To his surprise, the result was a devastated-looking older woman with rosacea on her cheeks.
After wondering about the result, he continued his experiment with “Loab” as the main character and produced a mega thread on it.
The thread contains photos of Loab as a result of experimenting with “combining” or “cross-breeding” with other images. It has bagged over 78k likes.
At the moment, you need to follow a few rules of syntax, such as colon, square braces, and prompt weighting to implement negative prompts. However, in the future, DreamStudio and other Stable Diffusion GUIs might have a dedicated field for negative prompts like height, width, steps, seed, and CFG scale attributes.