Rectified Diffusion Guidance for Conditional Generation

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Xia, Mengfei, Xue, Nan, Shen, Yujun, Yi, Ran, Gong, Tieliang, Liu, Yong-Jin
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866916980839153664
author Xia, Mengfei
Xue, Nan
Shen, Yujun
Yi, Ran
Gong, Tieliang
Liu, Yong-Jin
author_facet Xia, Mengfei
Xue, Nan
Shen, Yujun
Yi, Ran
Gong, Tieliang
Liu, Yong-Jin
contents Classifier-Free Guidance (CFG), which combines the conditional and unconditional score functions with two coefficients summing to one, serves as a practical technique for diffusion model sampling. Theoretically, however, denoising with CFG \textit{cannot} be expressed as a reciprocal diffusion process, which may consequently leave some hidden risks during use. In this work, we revisit the theory behind CFG and rigorously confirm that the improper configuration of the combination coefficients (\textit{i.e.}, the widely used summing-to-one version) brings about expectation shift of the generative distribution. To rectify this issue, we propose ReCFG with a relaxation on the guidance coefficients such that denoising with \method strictly aligns with the diffusion theory. We further show that our approach enjoys a \textbf{\textit{closed-form}} solution given the guidance strength. That way, the rectified coefficients can be readily pre-computed via traversing the observed data, leaving the sampling speed barely affected. Empirical evidence on real-world data demonstrate the compatibility of our post-hoc design with existing state-of-the-art diffusion models, including both class-conditioned ones (\textit{e.g.}, EDM2 on ImageNet) and text-conditioned ones (\textit{e.g.}, SD3 on CC12M), without any retraining. Code is available at \href{https://github.com/thuxmf/recfg}{https://github.com/thuxmf/recfg}.
format Preprint
id arxiv_https___arxiv_org_abs_2410_18737
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Rectified Diffusion Guidance for Conditional Generation
Xia, Mengfei
Xue, Nan
Shen, Yujun
Yi, Ran
Gong, Tieliang
Liu, Yong-Jin
Computer Vision and Pattern Recognition
Classifier-Free Guidance (CFG), which combines the conditional and unconditional score functions with two coefficients summing to one, serves as a practical technique for diffusion model sampling. Theoretically, however, denoising with CFG \textit{cannot} be expressed as a reciprocal diffusion process, which may consequently leave some hidden risks during use. In this work, we revisit the theory behind CFG and rigorously confirm that the improper configuration of the combination coefficients (\textit{i.e.}, the widely used summing-to-one version) brings about expectation shift of the generative distribution. To rectify this issue, we propose ReCFG with a relaxation on the guidance coefficients such that denoising with \method strictly aligns with the diffusion theory. We further show that our approach enjoys a \textbf{\textit{closed-form}} solution given the guidance strength. That way, the rectified coefficients can be readily pre-computed via traversing the observed data, leaving the sampling speed barely affected. Empirical evidence on real-world data demonstrate the compatibility of our post-hoc design with existing state-of-the-art diffusion models, including both class-conditioned ones (\textit{e.g.}, EDM2 on ImageNet) and text-conditioned ones (\textit{e.g.}, SD3 on CC12M), without any retraining. Code is available at \href{https://github.com/thuxmf/recfg}{https://github.com/thuxmf/recfg}.
title Rectified Diffusion Guidance for Conditional Generation
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2410.18737