EasyDeepLearn

What is classifier-free guidance (CFG) in diffusion?

hard

Answer

  • Train the model to accept both conditional (c) and unconditional (∅, e.g., empty prompt) inputs, by dropping the condition 10-20% of the time.
  • At sampling, form the guided prediction epsguided  =  eps\mathrm{eps}_{\mathrm{guided}}\; = \;\mathrm{eps}(xt,  t,  )  +  w    (epsθ(xt,  t,  c)    epsθ(xt,  t,  ))(x_{t}, \;t, \;)\; + \;w\; \cdot \;(\mathrm{eps}{\theta}(x_{t}, \;t, \;c)\; - \;\mathrm{eps}{\theta}(x_{t}, \;t, \;)). w>1 amplifies condition alignment (sharper prompt adherence) at some diversity cost.
  • Standard trick in Stable Diffusion / Imagen — biggest single quality lever after model size.
Check yourself — multiple choice
  • CFG requires a classifier
  • Train with occasional empty conditioning; at sampling, extrapolate: epsuncond  +  w\mathrm{eps}_{\mathrm{uncond}}\; + \;w·(epscond    epsuncond)(\mathrm{eps}_{\mathrm{cond}}\; - \;\mathrm{eps}_{\mathrm{uncond}}) → stronger prompt alignment
  • Removes conditioning
  • Same as DDIM

CFG: extrapolation between cond/uncond predictions — huge quality boost for text-to-image.

#diffusion#generative

Practise Deep Learning

214 interview questions in this topic.

Related questions