|

Do You Need Commas In Stable Diffusion?

Prompt engineering in Stable Diffusion is a heavily discussed subject with varying opinions and experiments that were done by the community to showcase how small changes to a prompt can affect the output of the generated image. 

One such discussion revolves around the use of commas in prompts. Especially, many beginners wonder if there’s a need to use commas in prompts in Stable Diffusion. 

Today, I’ll answer the question Do you need commas in Stable Diffusion?

Generally speaking, you should add commas to separate prompts in Stable Diffusion but there’s no evidence on whether the use of commas affects the generated image. You can still use commas as a way to make sure your prompt is readable. 

But this doesn’t mean that not using commas will result in bad images. It’s said that using commas can affect the output of the image. The Stable Diffusion community doesn’t agree with it based on their tests. 

So, I’ve conducted a small experiment myself to reach a conclusion. 

What Do Commas Do In Stable Diffusion?

There’s enough mythology going around the Stable Diffusion community around the grammar of prompts and the use of punctuation. 

That’s because image generation in Stable Diffusion relies on so many factors that you can’t reach a conclusion on how much output is affected by the use of commas. 

However, what we do know is that commas in Stable Diffusion are considered soft separators. Separators in Stable Diffusion help separate a text into smaller units called tokens. 

This process called tokenization helps you describe your words or ideas more clearly and generate an output closer to your prompt. 

The impact of tokenization depends on the separators you’re using such as commas, colons, or pipes. 

While it’s said that the use of commas in prompts can affect the output image, it’s unclear how much or if it even affects the output. 

In the experiment below, I’ve generated an image of a sunrise in a desert with a horizon view using the prompt below: 

sunrise, desert, horizon

Here are the results with and without using commas in the prompt: 

Both the images follow the prompt clearly and it’s hard to tell if the use of commas had any impact on the prompt. 

This could be because the prompt was too simple or small that the use of commas didn’t make much of a difference. 

So, I generated another image with a longer prompt with and without using commas. Here’s the prompt I used. 

ocean whale ship flying birds sunny day rainbow

As you can see, there is a huge difference in both the generated images. The image without the use of commas didn’t fully follow the prompt while the one with the commas in the prompt generated a more accurate image. 

But could this be because of the use of commas alone or it’s just a random output? 

Stable Diffusion - Prompt Without Commas
Prompt Without Commas (Second Run)

Well, that’s what I thought so I generated another image with the same prompt without using commas, and here’s the result: 

This image follows the prompt very accurately without the use of commas which brings us to the conclusion: 

There’s no way we can conclude how much the use of commas if any can impact the output image in Stable Diffusion.

One can argue that in the above experiment, I didn’t generate enough images to reach a definitive conclusion.

I agree that it’s a fair argument but even if we tested this theory by generating hundreds of images, the result won’t be clear as there are many factors involved when generating images in Stable Diffusion.

You can still use commas as a way to separate your words in your prompt so that it’s more clean and readable. 

Related: Fooocus Guide: The Fastest Way To Run Stable Diffusion

Various Stable Diffusion Prompt Operators

There are various prompt operators in Stable DIffusion with different functions and they can affect how an image is generated. 

Below is a table with the most common and popular prompt operators in Stable Diffusion:

Prompt OperatorPurposeHow To Use In Prompt
( )Increases the weight of the word by a factor of 1.1(fish)
[ ] Decrease the weight of the word by a factor of 1.1[pink]
A soft separator that separates two words from one anotherJelly, fish 
Blends multiple prompts into one Tom Cruise | Matt Damon
A hard separator that separates prompts from one anotherTruck. giant lizard
;A hard separator that separates prompts from one anotherVampire; garlic; full moon 

There are many other complex prompt operators that can help you get more advanced with prompt engineering and generate beautiful images in Stable Diffusion. 

But I’ve found myself quite successful at generating beautiful images without making my prompts too complicated. 

FAQs

Does prompt order matter in Stable Diffusion? 

Prompt order does matter in Stable Diffusion as words used at the beginning of the prompt are given more weight compared to the ones used at the end. You should always use the most important words in your prompt at the beginning. 

How do you emphasize a word in Stable Diffusion?

You can emphasize a word in Stable Diffusion by using the parenthesis operator which increases the weight of the word. For example – (giant squid). You can increase its emphasis even more by adding weight to the word like (giant squid:1.4). 

Is there a word limit in Stable Diffusion? 

Generally speaking, Stable Diffusion has a token or word limit of 75 tokens. But you can write beyond 75 tokens and it automatically increases the limit to 150. So, practically speaking, the word limit in Stable Diffusion is unlimited. 

Recommended Reading: What’s The Best Image Size In Stable Diffusion?

Do You Need Commas In Stable Diffusion? – Final Verdict

Prompt engineering in Stable Diffusion can completely change the way how your images are generated. 

In this case, we learned that commas do not have a substantial effect on prompts in Stable Diffusion. But with other punctuation operators, you can greatly change the output of an image. 

For now, it depends on whether you should use commas in your prompts or not. I use it for purely aesthetic purposes as it helps me clearly read words more easily. 

Let me know your thoughts about the use of commas in Stable Diffusion and how it affects your output images.

Stable Diffusion Prompt Organizer

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.