Over the last year, the ascension of artificial intelligence technology to the mainstream has been a vital development. Amid the meteoric rise of OpenAI’s ChatGPT, a host of industries have utilized these generative AI algorithms as useful tools. However, many of these tools come with a fairly steep learning curve. In this guide, we will uncover what is the CFG scale in Stable Diffusion.
Indeed, Stable Diffusion has become one of the most popular image-generating tools in the industry. The algorithm’s impressive output has led it to become one of the go-to image-generation programs available today. However, it still maintains a vast array of facets that will take some time to master.
There are so many things that can massively improve, or hinder, the results when using Stable Diffusion. Subsequently, it is important to know what they are, and how to use them to improve the algorithm for your specific use cases. Now, this guide will explore what a CFG Scale is, and why it is so important.
What is the CFG Scale?
![In this guide we break down the CFG scale in Stable Diffusion, and how it can impact the outcome of the image generation algorithm](https://watcher.guru/news/wp-content/uploads/2023/12/stablediffusion-1024x611.jpg)
![In this guide we break down the CFG scale in Stable Diffusion, and how it can impact the outcome of the image generation algorithm](https://watcher.guru/news/wp-content/uploads/2023/12/stablediffusion-1024x611.jpg)
Also Read: Do You Need Commas in Stable Diffusion Prompts?
Now, before we get into the effect of the program, let’s explore just what the CFG scale is. In Stable Diffusion, these three letters represent the Classifier Free Guidance scale. Specifically, this represents the setting that will denote how closely Stable Diffusion follows your text prompt when generating an image.
This scale is applied in both text-to-imate (txt2img) and image-to-image (img2img) generations for the algorithm. Moreover, the higher the CFGH value, the more strictly the algorithm will stick to the inputted text prompt.
![](https://watcher.guru/news/wp-content/uploads/2024/01/CFG-Stable-Diffusion.webp)
Alternatively, the lower the value, the more freedom the system will take in generating the image. The default value for the CFG scale is 7, which is a good starting point, and presents some balance in the systems freedom, and obedience to the given directions.
The system WebUI will only allow positive numbers, with 1 being the lowest value possible. Moreover, it will allow an input maximum of 30. These figures present good guardrails for the scale, although exceptions are possible with different iterations of the program.
How it Effects Stable Diffusion
Also Read: How to Train Stable Diffusion?
Now that we know what the CFG scale is, let’s explore how it affects Stable Diffusion. Although the scale itself will dictate how closely the system follows your text instructions, it is not quite that simple. The input CFG value will come with different side effects, and things like the Euler A Sampling Method show those differences.
![](https://watcher.guru/news/wp-content/uploads/2024/01/CFG-Stable-Diffusion-2-1024x225.webp)
Specifically, in the example from Once Upon An Algorithm, increasing CFG leads to increased color saturation. Moreover, it leads to an increase in contrast and blurrier images that will produce far less detailed work.
If you are having an issue with these things, it is important to balance out the image generation. Specifically, you can do things like increase the sampler steps or alter the sampler methods. However, it is important to remember to continuously test the effects of the CFG scale. Ultimately, trial and error is the best way to gain the optimal results for your desired output.