Stable Diffusion is a powerful AI text-to-image model that can turn simple text prompts into beautiful images. But how do you control the quality and diversity of the output images? How do you make sure that the image you create matches what you had in mind? The CFG Scale in stable diffusion has the answer.
The CFG Scale helps you adjust Stable Diffusion to find the right balance between making the pictures look like your words and making them really nice. If you set the CFG Scale high, the pictures will try hard to match your words, but they might end up a bit messy. If you set the CFG Scale low, the pictures can be more creative, but might not follow your words perfectly.
I’ll show you how to use the CFG Scale to get great pictures with Stable Diffusion. I’ll also give you some tips to make the tool work best for you.
How to Use the CFG Scale in Stable Diffusion?
The CFG scale can be used in Automatic1111, which is a web app that allows users to generate images using the Stable Diffusion model. To use the CFG scale in Automatic1111, simply enter the desired CFG scale value in the “CFG Scale” field or use the slider as shown in the image below.
CFG Scale Comparison and Examples
The images below were all generated using the same prompt but with different CFG scales. These images will show you how the CFG scale affects the image.
The default CFG Scale value is 7, which is a good balance between following the prompt and freedom. If you want the model to be more creative, you can try lowering the CFG Scale value to 5 or 3. If you want the model to be more faithful to your prompt, you can try increasing the CFG Scale value to 9 or 11.
Prompt : very detailed cute bird, t- shirt design, cute, charming, 3D vector art, cute and quirky, 4K resolution, highly detailed clean, vector image, photorealistic masterpiece, professional photography, simple space backdrop, flat white background, isometric, vibrant vector
You can also experiment with different CFG Scale values to see what works best for you. The best CFG Scale value will depend on the specific prompt you are using and the type of image you want to generate.
Prompt: a Viking warrior, semi-profile, wrinkled face, bright brown eyes, weathered skin, highly detailed, war paint, war bonnet
Here are some examples of how CFG Scale in stable diffusion can affect the results of image generation:
- A CFG Scale value of 1 will make the model very creative and likely to stray from the prompt. The generated image may not look anything like what you were expecting.
- A CFG Scale value of 7 is a good balance between following the prompt and freedom. The generated image will likely resemble the prompt, but it will also have some creative elements.
- A CFG Scale value of 15 will make the model more likely to follow the prompt. The generated image will be more faithful to your instructions, but it may be less creative.
Prompt: Portrait of Tom Cruise in red suit, 4K, high quality, highly detailed
Prompt: Anthropomorphic cute and adorable charming smiling pirate frog wearing glasses and Chuck Taylor sneakers, pirate hat and red turban, 3d cartoon character. hyperrealism, photorealistic, beautiful detailed intricate, insanely detailed, award-winning photograph. dark background, illuminated by neon light
Prompt: a delicious triple meat burger with bacon and yellow cheese, accompanied with a glass of whiskey on the rocks
Tips and Tricks to Master the CFG Scale in Stable Diffusion
Here are some tips and tricks that can help you master the CFG Scale in Stable Diffusion and generate amazing images:
- Start with a CFG scale of 7-11. This is a good starting point for most prompts.
- Increase the CFG scale if the generated image does not match the prompt. This will make the image more faithful to the prompt, but it may also make it more distorted or noisy.
- Decrease the CFG scale if the generated image is too distorted or noisy. This will make the image less faithful to the prompt, but it may also make it higher quality and more creative.
- Experiment with different CFG scales to see what works best for you. There is no one-size-fits-all answer to the CFG scale question. The best CFG scale for a particular prompt will vary depending on the content of the prompt and the desired outcome
- Use the CFG scale to create different effects. For example, you can use a high CFG scale to create a more realistic image, or you can use a low CFG scale to create a more abstract image.
- Combine the CFG scale with other settings to create even more creative images. For example, you can combine the CFG scale with the seed setting to create different variations of the same image.
Here are some additional tips that may be helpful:
- Use a clear and concise prompt. The more clear and concise your prompt is, the easier it will be for the model to generate an image that matches your expectations.
- Use keywords that are relevant to the image you want to generate. The more keywords you use, the more specific the model will be able to be.
- Avoid using negative words in your prompt. Negative words can sometimes confuse the model and lead to unexpected results.
- Be patient. It may take a few tries to generate the perfect image. The model is still under development, so it is not always perfect.
The CFG Scale is a powerful tool that can be used to control the fidelity and quality of the output images in Stable Diffusion. By adjusting the CFG Scale.
Ultimately, the best CFG Scale for a particular prompt will vary depending on the content of the prompt and the desired outcome. By experimenting with different CFG Scales, you can find the settings that work best for you. I hope this guide is helpful!