Zubnet AIAprenderWiki › Guidance Scale
Using AI

Guidance Scale

CFG Scale, Classifier-Free Guidance
Um parâmetro que controla quão fortemente um modelo de geração de imagens segue o prompt textual. Guidance baixa (1–3): o modelo gera livremente, produzindo imagens diversas mas potencialmente fora do tópico. Guidance alta (7–15): o modelo segue o prompt estritamente mas pode produzir imagens saturadas, cheias de artefatos. O sweet spot típico é 7–9. É o equivalente de temperature para imagens.

Por que importa

Guidance scale é o parâmetro mais impactante em geração de imagens depois do próprio prompt. Muito baixo e a imagem ignora sua descrição. Muito alto e ela parece supersaturada e artificial. Entender guidance scale te ajuda a diagnosticar “por que minha imagem não bate com meu prompt?” (guidance muito baixa) e “por que minha imagem parece estranha?” (guidance muito alta).

Deep Dive

Classifier-free guidance (Ho & Salimans, 2022) works by computing two denoising predictions per step: one conditional (using your prompt) and one unconditional (ignoring the prompt). The final prediction amplifies the difference: output = unconditional + scale × (conditional − unconditional). Scale=1 means no guidance (just the conditional prediction). Scale=7 means the model amplifies the prompt's influence 7x beyond what it would naturally do.

Why Higher Isn't Always Better

Higher guidance makes the image more "prompt-aligned" but at a cost: the model overshoots, producing oversaturated colors, unrealistic lighting, and visual artifacts. Very high guidance (15+) often produces images that look like they've been run through a sharpening filter — technically matching the prompt but aesthetically poor. The sweet spot depends on the model: SD 1.5 works well at 7–9, SDXL at 5–8, and Flux at 3–5.

Dynamic and Negative CFG

Avançado techniques manipulate guidance during generation: starting with high guidance (to establish composition) and reducing it in later steps (to refine details naturally). Negative CFG (guidance scale below 1) inverts the prompt's effect, generating the opposite of what's described — useful for understanding what the model associates with specific concepts but rarely useful for actual image generation.

Conceitos relacionados

← Todos os termos
ESC