Weights Syntax for Stable Diffusion Prompts in Automatic1111

Prompt weighting allows you to emphasize or de-emphasize certain parts of a prompt in Stable Diffusion, giving you more control over the generated image. This is especially useful when working in Automatic1111’s web UI.

There are two main syntaxes for adjusting prompt weights:

  • Parentheses: (keyword: weight)
  • Brackets: [keyword: weight]

Parentheses increase the weight or emphasis on a keyword, while brackets decrease it. The default weight is 1. Let’s dive deeper into how to use these properly.

Increasing Weight with Parentheses

To increase the weight of a keyword, wrap it in parentheses and specify a numerical weight higher than 1. For example:

(spaceship:1.2)

This will make “spaceship” 1.2 times more influential in the image generation than other prompt terms.

You can stack parentheses to further increase weight:

((spaceship:1.2))

Each additional set of parentheses compounds the weight.

Some rules when using parentheses:

  • Escape literal parentheses with a backslash if needed
  • Weights only work inside parentheses
  • Use a colon between the term and weight
  • Valid weight values are 1.1 to 2

Decreasing Weight with Brackets

Conversely, square brackets decrease the weight or emphasis on a prompt term:

[spaceship:0.8]

This makes “spaceship” only 0.8 times as influential.

Rules when using brackets:

  • Valid weight values are 0 to 0.9
  • Otherwise same syntax as parentheses

By combining parentheses and brackets, you can precisely tune the balance between prompt terms.

Prompt Weighting Examples

Let’s look at some examples of using weighting to control image generation:

Emphasizing a Subject

To make sure a particular subject is clearly featured, increase its weight:

((person:1.3)) in a spaceship cockpit

This will strongly prioritize rendering a visible person.

Balancing Multiple Terms

Tune the balance between two prompt elements:

An apple pie with more ((apple:1.2)) and [pie crust:0.7]

Removing Unwanted Elements

To try to avoid generating something, decrease its weight:

A beach at sunset [no people:0.2]

This makes people less likely to appear.

Advanced Weighting Techniques

There are a few more advanced techniques when weighting prompts:

  • Escape characters – Use a backslash to escape literal parentheses or brackets if needed.
  • Incremental weighting – Slowly adjust weights up and down to fine tune.
  • Prompt embedding – Split long prompts into chunks of 75 tokens for better performance.

Escaping Characters

If you need to include literal parentheses or brackets in your prompt, escape them with a backslash:

A \(spaceship\) flying over a city

This prevents the parentheses from being interpreted as weight syntax.

Incremental Weighting

Since the exact effect of a particular weight value can vary, start low and slowly increment weights up or down to tune the strength:

((apple:1.1)) pie
((apple:1.2)) pie 
((apple:1.3)) pie

Prompt Embedding

Long prompts get split into chunks of 75 tokens. Weighting keywords at the start of a new chunk can make them more influential.

You can also manually split prompts with \n\n to control this:

Spaceship cockpit with a \n\n ((person:1.3)) looking at the stars

The person is now at the start of a new prompt chunk.

Conclusion

Prompt weighting gives you finer control over what Stable Diffusion generates. Set expectations with the right weights on key prompt terms.

Some key takeaways:

  • Use parentheses to increase weights
  • Use brackets to decrease weights
  • Tune the balance between multiple terms
  • Remove unwanted elements by decreasing their weight
  • Experiment with small incremental weighting changes to perfect your prompts!

For more Stable Diffusion prompt ideas and examples, check out these resources:

Let me know if you have any other questions!