Beginner's Guide to Understanding Negative Prompts in Stable Diffusion

This is a beginner’s guide to using negative prompts and shedding light on its significance in image generation with Stable Diffusion.

Beginner's Guide to Understanding Negative Prompts in Stable Diffusion

Negative prompts in Stable Diffusion serve as a guiding mechanism to define what to exclude from generated images. In Stable Diffusion, positive prompts are used to describe the desired output, while negative prompts are used to describe undesired elements. The positive features condition the conditioned latent, while the negative features condition the “unconditioned” latent. This causes the latent image to move towards the image prompt and away from the negative image prompt.

                                  * Get $0.50 daily free credits on Segmind.

In this blog post, we look at different ways to use negative prompts, along with a few tips and tricks in Stable Diffusion image generation.

💡
We have curated some of the best negative prompts used in various scenarios here

Best Practices for Crafting Effective Negative Prompts

  1. Emphasizing Negative Prompts: If you’re generating an image of a “forest” but you really don’t want any “bears” in the image, you could use “bears:1.3” as your negative prompt to make it 30% more important that there are no bears in the image.
  2. Modifying Images: If you’ve generated an image of a “red apple” but you want it to be less red, you could use “red:0.5” as your negative prompt to nudge the model towards making the apple less red.
  3. Keep Negatives Concise: If you’re generating an image of a “city skyline at night” and you don’t want any “cars” or “street lights” in the image, it’s better to specify those directly as your negative prompts rather than using a vague term like “no city elements”.
  4. Using Negative Prompts like ‘no duplicates’ or ‘no blurry pictures’: If you’re generating an image of a “bouquet of flowers” and you want each flower to be unique and the image to be sharp, you could use “duplicates” and “blurry pictures” as your negative prompts.

Practical Examples of Negative Prompts

Let's take the simple example where we want to generate the image of animals present in the forest, but there needs to be no bears as mentioned in the best practices above. We will present to you the images generated with and without the specific negative prompts.

Prompt: A forest filled with animals
Negative prompt : scary, cartoon,bears:1.3

The negative prompt specifies the need to make sure that there were no "bears" present

By comparing both generated images, we can observe distinct differences. In the image on the left, animals are present as intended, but it deviates from our preference by including bears. On the right, various animals are depicted, aligning with our overall intention. Importantly, the specification "bears:1.3" ensures a 30% emphasis on the absence of bears, successfully excluding them from the image.

Let us take another example where we want to have a 3d rendered image of an apple. Our goal is to make sure that the color of the apple isn't too bright and red in color.

Prompt: An apple, front view, studio photo, hyper-realistic, fashion, photorealistic, 3d render
Negative prompt: scary, cartoon, painting, poor quality,  red:0.5

We can see the difference and the impact of the negative prompt in the images generated, without including "red:0.5," the resulting image is prominently red. However, by introducing this specific term during image generation there is a distinct contrast in the generated image.

Assume we want to generate an image of a skyscraper that consists of vibrant street art, however, the images generated should not consist of any streetlights nor there should be the presence of cars. The intention is to have a vibrant image only with the presence of skyscrapers and glass windows.

Prompt : Skyscrapers with vibrant street art, urban aesthetic , comic book style
Negative Prompt: scary, cartoon, painting, poor quality , cars

On taking a close look at the generated images we can see how there is no presence of cars when we get to add "cars" in the negative prompt.

In this specific example, our goal is to generate an image featuring an American woman with exceptionally long blonde hair, yet with the unique requirement that she is facing away, striking a posed stance. While such specifications can be directly included in the prompt, the effectiveness of negative prompts becomes apparent in fine-tuning our desired output. As we previously know, utilizing negative prompts allows us to explicitly exclude elements not desired in the image.

Prompt : Hasselblad photo portrait of a beautiful and mysterious American woman model with long extra blond hair, wearing short clothes. The setting is a clean house with colorful paintings.
Negative prompt : scary, cartoon, painting, poor quality , big wide smile , facing towards camera

The presence of the keywords "big wide smile, facing towards camera" in the negative prompts helps in generating the image according to our intention.

Explore Stable models on Segmind. Get 100 free inferences every day.