Stable Diffusion CFG Scale
Stable Diffusion is one of the most popular and well-known models you'll find in a free AI art generator, and once you've familiarised yourself with the basic functionality, you may wish to play around with more advanced tools.
For example, the Skip Clip feature in Stable Diffusion allows you to instruct the model to 'skip' layers within the CLIP model when producing a new graphic. This tool works particularly well when creating anime images or when you'd like an illustration that is less literal and more creative.
Today, we'll focus on the adjustable CFG scale, which customises the emphasis the AI text-to-artwork model places on your text input–a useful function when experimenting with textual inversion in Stable Diffusion technology to design your own bespoke word token.
What Is the CFG Setting in Stable Diffusion?
CFG stands for ‘Classifier Free Guidance’ scale and is a setting that indicates how closely you'd like your artwork generator to follow the input text or phrases you provide. AI models are trained on huge datasets, so if you want a highly specific graphic based primarily on your prompt rather than drawing on influences from elsewhere in the model's data banks, you can choose a higher CFG level.
Artwork creation platforms can apply your selected setting to text-to-image projects or image-to-image prompts.
How Do Stable Diffusion CFG Settings Work?
Stable Diffusion will normally use a default CFG value of seven, which means it partially draws on your input instructions while also using other data sources to formulate the graphic it thinks you'd like to see. If you were to set the CFG level to one, it would mean the AI model could use any references it wished to provide a graphic, whereas a higher value of fifteen or above places greater limitations on how far the model can deviate from your prompts.
Depending on the AI artwork generator platform you’re using, you can usually only set the CFG to a positive number, from one up to 30. However, it is possible to choose a negative setting or opt for a CFG value of 999.
Negative CFG settings act as a negative prompt but aren’t generally used because the theory would be that the AI would try to generate a graphic that is the opposite of your input phrases. Using negative prompts within your text to exclude any particular characteristics from your finished illustration is far easier, with more reliable outputs.
Does Adjusting the CFG Scale in Stable Diffusion Change the Image Quality?
Users often find that adjusting the CFG value has an impact on the finish, colour saturation. and contrast within their AI artwork creations–increasing the CFG setting means:
- The colour saturation and contrast also increase.
- The AI-generated image loses resolution quality.
By removing the range of data points the AI can access within its knowledge bank to create your image, you equally compromise on the clarity and depth of detail within your completed graphic. The best workaround is to avoid changing the CFG value dramatically and immediately, instead using smaller steps to tweak the setting until you achieve the output image you would like.
While processing times will increase, the result is a higher-quality graphic with the right balance between specificity and image resolution.