ChatPaper.aiChatPaper

CFG-Zero*: Miglioramento della Guida Senza Classificatore per Modelli di Flow Matching

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

March 24, 2025
Autori: Weichen Fan, Amber Yijia Zheng, Raymond A. Yeh, Ziwei Liu
cs.AI

Abstract

Classifier-Free Guidance (CFG) è una tecnica ampiamente adottata nei modelli di diffusione/flusso per migliorare la fedeltà e la controllabilità delle immagini. In questo lavoro, studiamo inizialmente in modo analitico l'effetto di CFG sui modelli di flow matching addestrati su miscele gaussiane, dove il flusso reale può essere derivato. Osserviamo che nelle prime fasi dell'addestramento, quando la stima del flusso è imprecisa, CFG indirizza i campioni verso traiettorie errate. Sulla base di questa osservazione, proponiamo CFG-Zero*, una versione migliorata di CFG con due contributi: (a) scala ottimizzata, dove uno scalare viene ottimizzato per correggere le imprecisioni nella velocità stimata, da cui l'asterisco nel nome; e (b) zero-init, che prevede l'azzeramento dei primi passi del risolutore ODE. Esperimenti su generazione testo-immagine (Lumina-Next, Stable Diffusion 3 e Flux) e testo-video (Wan-2.1) dimostrano che CFG-Zero* supera costantemente CFG, evidenziandone l'efficacia nel guidare i modelli di Flow Matching. (Il codice è disponibile su github.com/WeichenFan/CFG-Zero-star)
English
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)

Summary

AI-Generated Summary

PDF212March 25, 2025