In Stable Diffusion, CFG stands for Classifier Free Guidance scale. CFG scale is a parameter that controls Stable Diffusion how 'strict' it should follow the prompt input in image generation. Lower CFG give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt.
But this does not mean that you should use a larger CFG values in creating images. In fact, low values might produce more details and softer image but sometimes not include certain aspects of the prompt.High values are usually sharper, are more likely to include everything from the prompt but can have less details, especially things not in the prompt.
The default CFG scale value in Stable diffusion WEB UI is 7, which gives a good balance between creative freedom and following your direction. But this does not mean that 7 is the best choice for all prompt words. We need to flexibly adjust the size of the CFG scale value according to the complexity of the prompt words.
So how to choose the best CFG scale value? Here is a basic guide:
Prompt: (masterpiece:1.3), (absurdres:1.3), (best quality:1.3), (ultra-detailed:1.3),(best shadow:0.7), (handled hair), (sharp eyeliner, eyeshadow, detailed eyes:1.1), perfect anatomy, BREAK, 1girl, solo, RED HAIR, hair between eyes, GREEN EYES, glowing eyes, sailor collar, school uniform, side ponytail, sidelocks
cfg scale:1
cfg scale:4
cfg scale:7
cfg scale:10
cfg scale:13
cfg scale:16
cfg scale:19
cfg scale:22
cfg scale:25
cfg scale:28
Prompt: Hatsune Miku (vocaloid), gothic inflatable dark dress, closed eyes, (cyborg mask), inflatable shapes, (((wires, tubes, veins, electric arc, electric sparks))), white biomechanical details, ((wearing epic bionic cyborg implants)), masterpiece, intricate, biopunk, vogue, highly detailed, artstation, concept art, extremely detailed, beautiful, unreal engine 5, extremely detailed background
cfg scale:1
cfg scale:4
cfg scale:7
cfg scale:10
cfg scale:13
cfg scale:16
cfg scale:19
cfg scale:22
cfg scale:25
Compared with the previous case1, the prompt I entered this time is more complex, so at CFG=10~13, the picture quality is optimal. As the CFG value increases, the color of the picture becomes more inconsistent and the picture quality becomes sharper. When the CFG scale is 1~7, the pictures are chaotic and the picture quality is very poor.
The CFG scale in Stable Diffusion is a parameter for the user to control the 'strictness' of the AI's execution of prompt. The larger CFG scale you enter, the more you want the AI to follow your prompt. However we recommend keeping the CFG value between 7 and 10 to maintain a balance between the AI's 'imagination' and 'prompt instructions'. In one word, dynamically changing the CFG scale according to the complexity of the prompt words is the best way to generate perfect AI pictures.