A Guide to Prompt Keyword Attention and Weighting
Sometimes your prompt just does not reflect all the keywords that you added to your prompt. Do you wish you could give that specific word a little more oomph in the AI generation mix? Well, thankfully, you can! Today I’ll teach you everything you need to know about adding emphasis to words or phrases in Stable Diffusion.
How Do You Emphasize a Word in a Stable Diffusion Prompt?
There are 3 different ways in which you can emphasize a specific word or phrase in your Stable Diffusion prompts. One of these only works on Automatic1111’s Web UI (which I am using for this guide).
The 3 ways to add emphasis to keywords are:
- Place it at the front of the prompt
- Add parentheses
- Add parentheses with a decimal value (Auto1111’s web UI feature)
Adding parentheses to important words is the most common tactic, but we will look at all 3 with examples.
1. Place it First in Your Prompt
Stable Diffusion prioritizes keywords based on their position in your prompt. The words (specifically, the nouns) at the front of the prompt will have more impact. So if you want to emphasize a specific phrase, then the first thing you can do is put it first in your prompt.
It’s a start, but it will not always yield the best results. This is because of the statistical way in which the language model of Stable Diffusion works. Some keywords or phrases are more common than others, so more odd or obscure keywords may need added attention. If your prompt is something that the language model just doesn’t know well, it’s going to spit out inaccurate results.
Even if you place a certain phrase first, you may need to add some more modifiers to the prompt before it gets the focus you want. We’ll start talking about modifiers in Method #3 (adding parentheses).
Word Order Example
Here’s an example of how prompt order can change your image results. Let’s say I have 2 primary subjects for a prompt. The keywords for these subjects are:
- A fruit bowl, and
- A cup of coffee
Let’s see what happens when I re-arrange the order of the two main subject phrases in my prompt. I will generate 4 images per batch for each prompt so we can then compare general differences in each prompt ordering.
A Fruit Bowl First
Word Order Test 1
Prompt: A fruit bowl and a cup of coffee on a table, still life photo, morning light, 50mm lens, detailed, realistic
|Sampling Method||Euler a|
|Size||512 x 512|
I will be using these same settings for all of the still life photos in this guide.
Notice how Stable Diffusion barely noticed my request for “a cup of coffee”. An actual coffee cup only appears in 1 of the 4 photos. Now let’s mention that cup of coffee first…
Word Order Test 2
Prompt: A cup of coffee and a fruit bowl on a table, still life photo, morning light, 50mm lens, detailed, realistic
Now that cup of coffee is showing up in all 4 image results…and the fruit is no longer in a bowl.
2. Add Parentheses
Parentheses are the most common form of word emphasis in Stable Diffusion. Any keyword that you place inside parentheses will get a priority boost from the AI software. It tells the model to pay extra attention to that particular item. Also, the more parentheses you include for that word, the more that the AI will focus on that part. Let’s continue with your still life example…
For this specific prompt, adding a single parentheses did not do much to actually accentuate the coffee mug. But what happens if we crank up that emphasis?
Okay, now Stable Diffusion is really focusing on the idea of a coffee cup. But not just “a cup of coffee”, this over-emphasis started adding other items that are associated with that as well (coffee beans and a coffee maker).
Next, we’ll try a different prompt and this time we’ll keep the same seed but add parenthetical emphasis to different words and see what happens. Our base prompt is:
Portrait of a pretty teenage girl looking scared by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting
|Size||512 x 704|
Our first image will follow the above prompt. Then, we’ll ratchet up the attention on the word “scared” by adding some parentheses. Then we’ll remove the emphasis on “scared” and instead put it on the phrase “dark wavy hair”. All 3 of the resulting images used the same seed. Here’s a comparison:
|Portrait of a pretty teenage girl looking scared by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting||Portrait of a pretty teenage girl looking ((scared)) by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting||Portrait of a pretty teenage girl looking scared by Kyle Lambert, in the woods at night, with a flashlight, pale skin, ((dark wavy hair)), in a red jacket, highly detailed, realistic, digital painting|
By now, I hope you’ve realized the amazing potential of using this quick emphasis trick. You can freeze an image seed and easily make minor tweaks to your image by just adding a few parentheses here and there. The image will remain mostly the same but you can get slight variations on it’s theme.
3. Add Parentheses with Decimal Values
In the Stable Diffusion Web UI by Automatic1111, we have an additional way to add emphasis. Instead of adding multiple parentheses, we can just specify the attention paid to a specific word or phrase with a decimal value. It works like this:
- Put your keyword in parentheses,
- Immediately after the word, but before the last parenthesis, add a colon,
- Add a weight factor as a decimal value between the colon and the close parenthesis
This will give attention to that word by the factor of the number you add. This replaces the need for duplicate parentheses in the prompt and allow you more control over how important that emphasized term will be.
Let’s continue with our last prompt and specify a weight factor for the word “scared”:
|Portrait of a pretty teenage girl looking scared by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting||Portrait of a pretty teenage girl looking (scared:1.1) by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting||Portrait of a pretty teenage girl looking (scared:1.25) by Kyle Lambert, in the woods at night, with a flashlight, pale skin, dark wavy hair, in a red jacket, highly detailed, realistic, digital painting|
Here is a bit of background on this modifer from the creator of the Web UI:
- (keyword) increases the emphasis to the word “keyword” by a factor of 1.1
- ((keyword)) increases the emphasis by a factor of 1.21 (or 1.1 x 1.1)
- (keyword:1.5) increases the emphasis by a factor of 1.5
So now you know how to accentuate a certain word in your prompts, but…
How Do You De-Emphasize a Word in Stable Diffusion?
Sometimes you may have a word that overpowers the rest of the prompt. How do you reduce it’s impact? Thankfully, there is a way to reduce a word’s emphasis as well. To de-emphasize a word in Stable Diffusion, put it in brackets like so:
“start of your prompt, [word you want reduced] the rest of your prompt”
When using Automatic1111’s repo of Stable Diffusion, you can also specify the weight of de-emphasis with decimal values. For this, you do not use brackets  but rather parentheses (). When de-emphasizing in this manner, you will want to specify a number that is less than 1. Example:
- [scared] would be the same as (scared:0.909) in a prompt. Both would reduce the impact of the word “scared” by a factor of 1.1
Stable Diffusion allows for any word or phrase to be emphasized by varying degrees. It’s quite easy to push and pull the AI’s attention on specific keywords.
To add attention/emphasis:
- Put that word at the front of the prompt, and/or
- Add some parentheses () around the word
To decrease attention/emphasis:
- Put the keyword in brackets , or
- Add a single parentheses to the keyword with a colon and a decimal smaller than 1
Thank you for stopping by! If you found this article helpful, here are a few more that you may like: