CFG-Zero*: Improved Classifier-Free Guidance for Flow Matching Models

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Fan, Weichen, Zheng, Amber Yijia, Yeh, Raymond A., Liu, Ziwei
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916672455049216
author Fan, Weichen
Zheng, Amber Yijia
Yeh, Raymond A.
Liu, Ziwei
author_facet Fan, Weichen
Zheng, Amber Yijia
Yeh, Raymond A.
Liu, Ziwei
contents Classifier-Free Guidance (CFG) is a widely adopted technique in diffusion/flow models to improve image fidelity and controllability. In this work, we first analytically study the effect of CFG on flow matching models trained on Gaussian mixtures where the ground-truth flow can be derived. We observe that in the early stages of training, when the flow estimation is inaccurate, CFG directs samples toward incorrect trajectories. Building on this observation, we propose CFG-Zero*, an improved CFG with two contributions: (a) optimized scale, where a scalar is optimized to correct for the inaccuracies in the estimated velocity, hence the * in the name; and (b) zero-init, which involves zeroing out the first few steps of the ODE solver. Experiments on both text-to-image (Lumina-Next, Stable Diffusion 3, and Flux) and text-to-video (Wan-2.1) generation demonstrate that CFG-Zero* consistently outperforms CFG, highlighting its effectiveness in guiding Flow Matching models. (Code is available at github.com/WeichenFan/CFG-Zero-star)
format Preprint
id arxiv_https___arxiv_org_abs_2503_18886
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle CFG-Zero*: Improved Classifier-Free Guidance for Flow Matching Models
Fan, Weichen
Zheng, Amber Yijia
Yeh, Raymond A.
Liu, Ziwei
Computer Vision and Pattern Recognition
Classifier-Free Guidance (CFG) is a widely adopted technique in diffusion/flow models to improve image fidelity and controllability. In this work, we first analytically study the effect of CFG on flow matching models trained on Gaussian mixtures where the ground-truth flow can be derived. We observe that in the early stages of training, when the flow estimation is inaccurate, CFG directs samples toward incorrect trajectories. Building on this observation, we propose CFG-Zero*, an improved CFG with two contributions: (a) optimized scale, where a scalar is optimized to correct for the inaccuracies in the estimated velocity, hence the * in the name; and (b) zero-init, which involves zeroing out the first few steps of the ODE solver. Experiments on both text-to-image (Lumina-Next, Stable Diffusion 3, and Flux) and text-to-video (Wan-2.1) generation demonstrate that CFG-Zero* consistently outperforms CFG, highlighting its effectiveness in guiding Flow Matching models. (Code is available at github.com/WeichenFan/CFG-Zero-star)
title CFG-Zero*: Improved Classifier-Free Guidance for Flow Matching Models
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2503.18886