10

I've seen a number of prompts that put parentheses or square brackets around certain words/phrases. This seems to be used across multiple frontends (Automatic1111, ComfyUI, NovelAI, ...) and regardless of model. What does this syntax do?

7
  • 2
    I think this'd do better as a "how can I adjust the weights of parts of a prompt?" question, since the syntax is a tool-specific implementation detail.
    – wizzwizz4
    Jul 17, 2023 at 20:31
  • @wizzwizz4 True. Tried to capture users who've seen the syntax in-use and are unsure what it does (since it's commonly found in prompts with no explanation) - but possibly better to use your title for this post and have the syntax-specific question be separate with a brief answer (that it's used for weighting, then pointing here for details)?
    – SirBenet
    Jul 18, 2023 at 15:14
  • I'd then close it as a duplicate of this one. (Having an upvoted answer will prevent the system from deleting the duplicate.)
    – wizzwizz4
    Jul 18, 2023 at 15:18
  • See also: Some of my important points being ignored in text-to-image generation. How to emphasize it to be in the image? – if you edited this question, it could be a good duplicate target for that one.
    – wizzwizz4
    Jul 19, 2023 at 8:30
  • 1
    The tag image looks to me to be a meta tag. I suggest replacing it with the tags image-generation and prompt-design.
    – Wicket
    Jul 24, 2023 at 20:57

1 Answer 1

13

Square brackets and parentheses are used for adjusting the weight of the contained words:

  • Surrounding words with (parentheses) will increase their impact on the image,

  • Surrounding words with [square brackets] will decrease their impact on the image.

You can further increase/decrease the weight by adding (((more))) pairs, or explicitly specify a weight value (like this:1.2). Here's the same prompt/seed weighted differently:

Generated images side-by-side showing how increasing weight of "red" causes the image to more prominently feature red, and vice versa

Be aware that this is implemented per-frontend, so the specifics may differ slightly. For example, NovelAI uses {curly brackets} instead of parentheses, and Automatic1111 normalises weights across the prompt. Documentation:

1
  • 1
    Is there something similar for generative language models? Aug 13, 2023 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.