What Is Stable Diffusion CFG Scale – AI Tool’s Addition
Stable Diffusion is an AI photo generator that is entirely free and open source. Seeing its rapid growth, there are many settings in this tool. For example, the CFG scale in Stable Diffusion. But many people still do not know what this setting is and how to use it when generating images. Well, find out more about the CFG scale in Stable Diffusion by reading this post.
Guide List
Part 1: What Is CFG Scale in Stable Diffusion Part 2: How to Use CFG Scale in Stable Diffusion Part 3: Comparison of Different CFG Scale Images Part 4: FAQs about CFG Scale in Stable DiffusionPart 1: What Is CFG Scale in Stable Diffusion
CFG or Classifier Free Guidance scale is the setting that contributes to the nearest result of the input prompts. For a more elaborate explanation, putting a greater CFG scale value will result in a closer resemblance to the prompt, but it will be distorted in quality. Meanwhile, this can be done otherwise, with a higher quality in exchange.
The default CFG scale value is set at 7 to balance the creative freedom and the direction. On the other hand, a value of 1 will likely allow Stable Diffusion to have freedom, while a value of 15 and above will have restrictions. Although the AI image generator limits CFG from 1 to 30 at the maximum, you can set the scale at 999 in Stable Diffusion, both negative and positive, via the Terminal.
It may sound like a straightforward setting, but the AI image generator will make it harder to control with the tradeoffs from various CFG values. But to use the scale most effectively, you can follow the demonstration below on how to use it on Stable Diffusion.
Part 2. How to Use CFG Scale in Stable Diffusion
In this demonstration, you can start experimenting with CFG on DreamStudio or Playground. However, there are more options available for you, such as the Stable Diffusion Online Demo, full Stable Diffusion Web UI, or a minimal setup on RunPod.io.
Step 1.Visit DreamStudio, Lexica, or Playground AI and sign up. Lexica does not require users to sign up, but the other two platforms require a Gmail or Discord account. Once you are in, enter the text in the prompt box.
Step 2.Click the "Generate" button once you have settled with the prompts. Depending on the platform you use, DreamStudio will have CFG Scale, while Lexica has Guidance Scale. On the other hand, you can find Prompt Guidance on Playground AI on the right part of the interface.
Step 3.Adjust the parameter according to your liking. Remember that between 7 and 11 values have more optimal output usually. But it still depends on your requirement, so take your time with the experimentation until you have the best result.
Part 3. Comparison of Different CFG Scale Images
How do you see the differences for every adjustment on the CFG scale? The changes are visible to the output, especially if you are jumping from a small value to a larger one. Even if you are only using one platform, the difference will tell the distortion and quality with a few tweaks. To demonstrate, here are some pictures from Stable Diffusion and CFG scale:
The prompt used in this picture is Portrait of Tom Cruise in the Stable Diffusion prompts of red suit, high quality, 4K. It is generated in Stable Diffusion with specific CFG values. As a result, the similarity of the image to the input prompt is more visible.
There are also some things you can see for the different values. Color saturation and contrast are increased as the CFG scale value is added. But on another point, just above the default value will put the output image to a blurrier quality, resulting in detail loss.
If you want to avoid low-quality results, there are two things you can do. First, increase the sampler steps. But since it is the same with CFG, sampler steps can create longer processing time. If the first method is not a favor for you, you can change the samplers to generate better image details, even at a greater value than 7. Here are more sample images upscaled to 4K for certain CFG scale values.
Bonus Tips: How to Enlarge Stable Diffusion CFG Images
If you don’t want to do more tweaking on Stable Diffusion, then another way to have high-quality AI photos is to use AnyRec AI Image Upscaler. It is an online tool with the power of AI technology, supporting popular image formats, such as PNG, BMP, JPEG, GIF, and more. With its intuitive interface, you can increase the Magnification level of a photo at 2x, 4x, 6x, and 8x maximum values. It will automatically recover the detailed loss in downloading, including pixels, colors, textures, etc. This is the solution for enlarging pictures, suitable for printing, graphic designing, and social media sharing.
- 100% free online photo enlarger for large Stable Diffusion CFG Scale value.
- Side-by-side preview of the original and output results.
- Provide a built-in zoom-in/out function to see the output details.
- Protect privacy by removing uploads from the server after the process.
Step 1.Click the "Upload Photo" button and choose the picture from your device.
Step 2.Choose the Magnification level; check the details with the Zoom function.
Step 3.Click the "Save" button when satisfied to download the final result.
Part 4: FAQs about CFG Scale in Stable Diffusion
-
1. When do I need to change the CFG Scale?
If you want Stable Diffusion to generate the prompt outside of its knowledge, then you may need CFG to align the prompt to the image result. Of course, you have to look for quality when increasing the scale value.
-
2. Is there a difference between the CFG scale and denoising strength?
Yes. CFG scale works for the closeness of the prompt to the result, while denoising strength is more for determining the AI creativeness of the tool. With the perfect blend of these two, you can balance the creativity and accuracy of the picture.
-
3. What is better: a higher or lower value in CFG?
Users find adjusting the scale to a higher value easier, as it produces accurate results. Although the quality is not good, you can find another alternative to increase the quality, such as AnyRec AI Image Upscaler.
-
4. What Stable Diffusion version should I use with the CFG scale?
Stable Diffusion 2 is better than the first one, providing more depth, upscale, and inpainting models. Of course, using CFG with this version will create accurate results.
-
5. Which value has to be set for CFG?
The best value to choose is between 7 and 10. While the result is not promising, you can take your time to see the best-generated pictures.
Conclusion
CFG scale in Stable Diffusion is used to control the closeness of the image result to the input prompt. While platforms like DreamStudio, Lexica, and Playground AI are more effective in experimenting with the setting, you can also set the Stable Diffusion CFG scale higher value and use AnyRec AI Image Upscaler to enlarge the size and recover the details in one click.