Setting Weights in a Stable Diffusion Prompt

Prompt weighting allows controlling the emphasis placed on different parts of a text prompt when generating images with Stable Diffusion. By increasing the weight, or importance, given to certain words or phrases, you can guide the AI to focus more on those concepts. Conversely, reducing the weight causes the AI to deprioritize those ideas. Mastering prompt weighting is key to creating better AI art.

How Prompt Weighting Works

Behind the scenes, Stable Diffusion converts text prompts into numeric vector representations using a process called embedding. The AI uses these embedded vectors, not the original text, when generating images.

Prompt weighting multiplies the vector for a word or phrase by a number, increasing or decreasing its magnitude. For example, doubling the weight causes the vector to point in the same direction but become twice as long. The AI sees the larger vector and gives more attention to the corresponding text.

Using Weights and Parentheses

The easiest way to adjust prompt weights is by wrapping text in parentheses. For example:

(cat) playing with a ball of yarn

Here, “cat” is wrapped in parentheses, so its weight is increased by the default amount. The exact multiplier depends on the Stable Diffusion version, but is around 1.05x.

You can use multiple parentheses to further increase the weight. Each additional set of parentheses boosts the weight by the default amount again:

((cat)) playing with a ball of yarn

To reduce the weight instead, wrap text in square brackets:

[ball of yarn] being played with by a cat

You can also manually specify the exact weight multiplier instead of using the defaults. For example:

(cat:1.5) playing with a [ball of yarn:0.7]

Tips for Effective Prompt Weighting

Emphasize Key Subjects

Use increased weights on the most important nouns in your prompt to tell the AI what you want it to focus on rendering. For example, to generate an alien character, write:

((alien:1.2)) wearing a space suit

Reduce Unwanted Elements

Wrap descriptive terms that aren’t critical in square brackets with reduced weights to deprioritize them. For example, if you don’t care about the alien’s gender:

((alien:1.2)) [male:0.7] wearing a space suit 

Balance Multi-Element Prompts

When combining multiple subjects in one prompt, use weights to control their relative prominence. For example, for an alien planet scene:

An alien planet landscape with a large ((moon:1.5)) and small [planet:0.8] in the purple sky

Prompt Weighting Examples

Stylize a Subject With an Artist

Use weighting to keep the focus on the main subject while applying a style.

Portrait painting by [Picasso:0.8] of a ((woman:1.2)) with cubist style

Create a Hybrid

Combine disparate concepts into new creations with precise weighting.

((Robot:1.5)) [wearing:0.8] a superhero costume with a flowing red cape and mask

Emphasize Specific Details

Call out low-level aspects that you want to ensure are included and prominent.

Close-up portrait photo of an elderly man with very ((wrinkled:1.2)) skin and [brown:0.8] eyes

Useful Stable Diffusion Resources