Master Prompting in Stable Diffusion
45sQuickly teaches the core concept of prompt ordering and structure, essential for beginners.
▶ Play ClipThis video explains various prompting techniques for Stable Diffusion using the Automatic1111 interface, covering how to structure prompts, use weighting, embeddings, prompt editing, and other tools to control image generation.
Prompts are ordered from most important to least important from top to bottom and left to right.
Token limits refer to the maximum number of words in a chunk of 75 tokens; if you have 100 tokens, it processes 75 and then 25 independently.
The negative prompt tells Stable Diffusion what you don't want in the image, such as bad anatomy or artifacts.
Wrapping a word in parenthesis increases its attention by a factor of 1.1 per pair.
Square brackets decrease the attention to a word by a factor of 1.1 per pair.
Using a colon and a number inside parentheses allows precise control over word importance, e.g., (snowy weather:1.5).
Angled brackets are used for embeddings like LoRAs, with format <lora:filename:multiplier>.
Prompt editing swaps prompts during generation using [from:to:when] format, where when can be a decimal (percentage of steps) or whole number (exact step).
A backslash before a special character turns it into ordinary text, removing its effect.
The BREAK keyword fills the current chunk with padding and starts a new chunk.
Using vertical bars inside square brackets creates alternation, e.g., [long black hair|brown dreadlocks|orange curly hair].
CFG scale determines how strongly the image conforms to the prompt; lower values give more creative results, recommended range 5-12.
The Prompt Matrix tests the impact of individual prompts by generating a grid of images with different prompt combinations.
Multiple prompts can be tested by separating them with line breaks in a textbox or from a file.
XYZ Plot allows testing and comparing variables like seed, CFG scale, and prompt S/R (search and replace).
Understanding these prompting techniques allows you to have more control over Stable Diffusion image generation, enabling you to fine-tune results and create images closer to your vision.
"The title accurately promises a 12-minute tutorial on prompting techniques, and the video delivers exactly that."
How are prompts ordered in terms of importance?
From most important to least important from top to bottom and left to right.
0:24
What is the token limit per chunk in Stable Diffusion?
75 tokens per chunk.
1:06
What does wrapping a word in parentheses do?
It increases the attention to that word by a factor of 1.1 per pair.
3:02
What do square brackets do to a word's weight?
They decrease the attention to the word by a factor of 1.1 per pair.
3:45
How do you specify a custom weight for a word using a colon?
By writing (word:number), e.g., (snowy weather:1.5).
4:23
What is the format for using a LoRA embedding?
<lora:filename:multiplier>
5:12
In prompt editing, what does the 'when' value represent if it's a decimal?
It represents the percentage of total sampling steps at which the switch occurs.
6:32
How do you escape a special character like a parenthesis?
By placing a backslash before it, e.g., \(.
7:22
What does the BREAK keyword do?
It fills the current chunk with padding and starts a new chunk.
7:56
How does alternation work with vertical bars?
Words inside square brackets separated by vertical bars are looped through during generation, e.g., [a|b|c].
8:19
What is the recommended CFG scale range?
Between 5 and 12.
8:55
What is the purpose of the Prompt Matrix?
To test the impact of individual prompts by generating a grid of images with different prompt combinations.
9:36
How can you test multiple prompts at once?
By putting each prompt on a separate line in the textbox or from a file.
10:30
What variables can be tested with XYZ Plot?
Seed, CFG scale, prompt S/R (search and replace), and others.
11:09
Prompt Ordering Principle
Establishes a fundamental rule for structuring prompts to achieve desired results.
0:24Parenthesis Weighting
A simple yet powerful technique to emphasize specific elements in the generated image.
3:02Prompt Editing
Enables dynamic changes during generation, allowing for complex transitions.
5:51CFG Scale Guidance
Provides a practical range for CFG scale to balance creativity and adherence to prompt.
8:55Prompt Matrix Utility
A systematic way to debug and optimize prompts by isolating their effects.
9:36[00:00] hey everyone I'm b-size genius prompting
[00:02] instable diffusion can be a mystery and
[00:05] it's sometimes tricky to know what does
[00:07] what but there are techniques that you
[00:10] can use to get the results you want and
[00:12] in this video I'll be breaking them down
[00:14] so you can spend less time reading and
[00:16] more time creating but like the video
[00:19] and give it to me bite-sized so let me
[00:21] quickly cover some basic information
[00:24] prompts are ordered from most important
[00:26] to least important from the top to the
[00:29] bottom from the left to the right there
[00:31] were various theories on how you
[00:33] structure your prompt for the best
[00:35] result but it's worth keeping in mind
[00:37] certain Concepts such as the subject
[00:40] lighting photography style color scheme
[00:43] doing words and much more which help to
[00:46] build up your image when it comes to
[00:49] style prompts can influence this
[00:51] alongside your desired checkpoint as
[00:53] stable diffusion was trained on a
[00:54] multitude of data sets from across the
[00:56] internet meaning you can draw references
[00:59] to art style
[01:00] celebrities clothing types and much more
[01:03] to influence your image The Prompt
[01:06] sections have these numbers on the top
[01:08] right called token limits and these
[01:10] refer to the maximum number of words you
[01:12] could fit into a chunk of 75 tokens for
[01:15] example if you had 100 tokens then it
[01:18] would process 75 tokens and then 25
[01:21] tokens independently into stable
[01:24] diffusions unit this in plain English is
[01:28] how the AI language model breaks down
[01:30] and manipulates text for processing The
[01:33] Prompt box is where the magic happens
[01:35] this is where you will describe
[01:37] manipulate and design your image through
[01:39] the text to image section or alter
[01:42] images if you're using image to image in
[01:44] conjunction with your reference photo
[01:46] you can put as much text as you like in
[01:48] here but often it's better to keep
[01:50] things short and sweet so your prompts
[01:52] are easier to fix orine as you make
[01:55] adjustments closer to your desired image
[01:57] for example let's type out medium shot
[02:00] of a woman with four lips golden eyes
[02:02] and a white crop top long black hair
[02:05] snowy weather octane render we can see
[02:08] that stable diffusion will attempt to
[02:10] generate its interpretation of that
[02:11] prompt and this interpretation will
[02:13] change depending on the seed image size
[02:17] and other settings which change the type
[02:18] of image generated from the same prompt
[02:21] the negative prompt box is where you
[02:23] tell stable diffusion what you don't
[02:25] want in your image and this can include
[02:28] literal Concepts items weather or
[02:31] artifacts and bad Anatomy within an
[02:34] image again you can put as much text as
[02:37] you want in here but it's good to keep
[02:39] it reasonable to make life easier for
[02:41] yourself later down the line for example
[02:44] let's type out bad dream unrealistic
[02:47] dream nons saafe for work and we will
[02:50] notice that we get a much higher quality
[02:51] image that's safe for work it's worth
[02:54] checking the example images of the
[02:56] checkpoint you are using to ensure that
[02:58] you are using the best NE negative
[03:00] prompts for your chosen model the
[03:02] parenthesis is used to put a greater
[03:04] weight or importance on a word than your
[03:06] prompt and for each parenthesis wrapping
[03:09] a word it would increase its attention
[03:11] by a factor of 1.1 and the further
[03:13] parenthesis will multiply the attention
[03:16] by 1.1 I'll be honest in saying that the
[03:19] mass behind this isn't really all that
[03:21] important as experimenting with your
[03:23] prompts will yield better results but
[03:25] it's still important to see this in
[03:27] action so you can find two your images
[03:30] so for example if I were to write out
[03:32] our previous prompt but put snowy
[03:34] weather in parenthesis then we can see
[03:37] how the snow and even the clothes start
[03:39] to turn either white or have a much
[03:41] snowier presence the more parenthesis we
[03:43] use square brackets are used to reduce
[03:46] the weight or the importance of a word
[03:48] in your prompt and for each square
[03:50] bracket it will decrease the attention
[03:52] to the word by 1.1 and of course we'll
[03:55] multiply the detention by 1.1 for each
[03:58] pair of square brackets WRA a word again
[04:01] it's better to experiment when it comes
[04:03] to fine-tuning your prompt but by
[04:05] understanding what these functions do
[04:06] you have another tool in your belt for
[04:08] fine tuning images so for example if I
[04:11] were to write out our previous prompt
[04:14] but put snowy weather in square brackets
[04:16] then we can see how the snow is reduced
[04:19] especially around the hair and the
[04:20] clothing the more square brackets we use
[04:23] let's address prompt waiting you can
[04:26] manipulate prompts to either add or
[04:28] remove waiting or importance from words
[04:30] within your prompts and what this means
[04:32] in plain English is that you can control
[04:35] how much impact certain words have over
[04:37] others within your prompt and words with
[04:40] greater impact will be visualized more
[04:42] strongly in your image this is done by
[04:45] wrapping your word in a parenthesis but
[04:48] we will now add both a colon and then a
[04:50] number which can be a whole number or
[04:52] with decimal values so for example if I
[04:56] were to write out snowy weather with a
[04:58] variety of prompt ratings we can see how
[05:00] the impact changes from no promp waiting
[05:03] to a really high promp waiting value we
[05:05] obviously get rather lowquality images
[05:08] at very high waiting so keep the numbers
[05:10] reasonable you may have seen these
[05:12] angled brackets in certain prompts
[05:14] perhaps some websites that provide
[05:16] checkpoints and luras these are known as
[05:19] embeddings and are common in luras where
[05:21] a file and multiplier for the file needs
[05:24] to be specified to determine the
[05:26] strength of the Laura the typical format
[05:28] would be Laura file name and then
[05:31] multiplier and unfortunately you can't
[05:33] do prompt editing with Aur in this
[05:36] version of stable diffusion in this
[05:38] example I've used the add details Laura
[05:41] which adds or removes detail from our
[05:43] generated images and we can see the
[05:46] effects of changing the values within
[05:48] our embeddings and how it is structured
[05:51] now prompt editing is a powerful way of
[05:54] controlling your generated images by
[05:56] swapping the prompts being used for
[05:58] generating an image during the
[06:00] generation a good way to illustrate the
[06:02] format is by using from to and when
[06:06] where from determines what prompt you
[06:08] start with two determines which prompt
[06:11] you end with and the Step at which the
[06:13] switch takes place is determined by when
[06:16] you can also do from and when with two
[06:19] colons in between to remove the prompt
[06:21] being specified after a fixed number of
[06:24] steps determined by when and don't worry
[06:27] I'll show you this in practice so you
[06:29] don't feel like you're in another Mass
[06:30] class but remember this key piece of
[06:32] information the weightings you provide
[06:35] in decimal numbers are percentages of
[06:37] your sampling steps which must total up
[06:39] to one meaning 0.5 is actually 50% of
[06:43] your total sampling steps anything l a
[06:46] whole number above one will be the exact
[06:48] sampling step you want to specify
[06:51] meaning a figure of 20 means stop or
[06:54] switch at sampling step 20 so for
[06:57] example you can see the impact in these
[06:59] images with our first image using
[07:02] decimals which represent percentages to
[07:04] transition from snow to Sun after a
[07:07] certain number of steps the second image
[07:10] uses whole numbers to represent the step
[07:12] for the transition based on the 30 steps
[07:14] we are using and lastly we can indicate
[07:17] at which step we should stop using the
[07:20] selected prompt s weather Al together
[07:22] now here's a call trick using a
[07:25] backslash before a special character
[07:27] such as a bracket or par parenthesis
[07:30] will turn that special character into
[07:32] ordinary text so using it in practice
[07:35] we'll remove the effect of the
[07:36] parenthesis giving you snowy weather as
[07:39] pure text with no effect you can see an
[07:42] action here where we have the standard
[07:44] prompt snowy weather compared to snowy
[07:46] weather within the parenthesis and then
[07:48] the literal parenthesis represented as
[07:50] text alongside our prompt and you know
[07:53] it worked because the snow is less
[07:54] prominent now thinking back to the
[07:57] tokens which form chunks I described in
[07:59] the the beginning the break keyword in
[08:01] uppercase will fill the current chunks
[08:03] with padding characters and adding more
[08:06] text after break will start a new chunk
[08:09] I personally do not see any practical
[08:11] use for breaking up your chunks
[08:12] prematurely before hitting that 75 token
[08:15] limit but if you wanted to achieve this
[08:17] then this is your solution now the
[08:19] horizontal line is used to trigger
[08:22] alternation or a loop in prompts where
[08:25] words are broken up with horizontal
[08:26] lines and are given the chance to
[08:28] influence the generation repeatedly as
[08:30] stable diffusion Loops through the words
[08:33] within the square brackets so if we were
[08:35] to use long black hair brown dreadlocks
[08:38] orange curly hair as a prompt then the
[08:40] first step will be long black hair then
[08:43] Brown dreadlocks then orange curly hair
[08:46] this is another technique for
[08:47] controlling the types of generations you
[08:49] get during the generation process and
[08:52] you can see in action how this impacts
[08:54] the final result the CFG scale will
[08:57] determine how strongly the generated
[08:59] image should conform to the prompt you
[09:00] provide with lower values giving you
[09:03] more creative results extremely low or
[09:06] high values may give you unpredictable
[09:08] results so I tend to go between 5 and 12
[09:12] sometimes it can be useful to generate a
[09:14] few images through batch with a low CFG
[09:16] scale allowing you to get a more varied
[09:19] set of images and then running an image
[09:21] that you like through image to image
[09:23] with a higher CFG scale to make
[09:25] adjustments more closer to your prompt
[09:27] in these examples you can see a variety
[09:30] of CFG scales being used and I think the
[09:33] values 5 to9 are more accurate to The
[09:35] Prompt The Prompt Matrix is used to see
[09:38] what impact your individual prompts have
[09:41] on your generated image allowing you to
[09:43] remove unwanted or unimpactful prompts
[09:46] and keep the ones nearing you to the
[09:48] image you want in order to use the
[09:50] prompt Matrix start your prompt with the
[09:52] subject of your image and then follow up
[09:54] with the prompts you want to test with a
[09:56] horizontal line anything nested between
[09:59] or after a horizontal line will be put
[10:01] onto a matrix allowing you to see and
[10:04] compare the impacts of that prompt the
[10:06] more specific your prompt that the more
[10:09] consistent the results you will get
[10:10] across your images allowing you to
[10:12] identify the prompts which are causing
[10:14] issues by singling them out I'll be
[10:17] doing a separate video breaking down the
[10:19] prpt Matrix specifically as it's a
[10:21] useful tool which could do of its own
[10:23] easy to find dedicated video but in the
[10:26] meantime you can look at this image to
[10:28] see the comparison in action the prompts
[10:30] from file or textbox section will allow
[10:33] you to test multiple prompts at the same
[10:35] time either from the text box or from a
[10:38] file all you have to do is put your
[10:40] prompts in and use a line break to
[10:42] separate them then generate and you will
[10:45] get an image per line of your prompts
[10:47] allowing you to see the comparisons for
[10:49] each and I'll probably do a separate
[10:50] Deep dive video on this topic so it's
[10:53] easy to find here are some examples and
[10:56] while you look at these if you wanted to
[10:58] use a file then just put the prompts
[11:00] into a notepad on separate lines then
[11:02] drag the notepad file into the file
[11:04] section and it will copy the information
[11:06] over to disable diffusion for generating
[11:09] XYZ plot allows you to test and compare
[11:12] a range of variables on your generated
[11:15] images and make comparisons against
[11:17] those valuables such as a seed CFG scale
[11:21] and using prompt Sr or search and
[11:23] replace which allows you to replace your
[11:25] prompt with a different prompt during a
[11:28] generation to see the results now this
[11:31] script has a lot of options so I'll
[11:33] probably do a separate breakdown video
[11:36] of each option so you know what they do
[11:38] and you can see comparisons between each
[11:40] of the options but I've used this
[11:42] feature throughout the video to generate
[11:44] comparisons such as a CFG scale so
[11:47] hopefully you have a good indication of
[11:48] what it does but to wrap things up I
[11:51] hope this video has helped you to
[11:52] understand prompting a little bit more
[11:54] like the video before you leave the
[11:56] building and subscribe to be notified
[11:58] when my next video drops drops there's
[12:00] also a patreon for those who want to
[12:01] support this is bite-sized genius and I
[12:04] hope you enjoyed
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.