arXiv:2503.18886cs.CV2025-03被引 51

改进扩散模型的生成引导机制,提升图像视频生成质量

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

  • 通过优化缩放系数和前几步归零,修正早期训练中的速度估计误差
  • 在多个文本到图像/视频模型上,生成效果显著优于传统CFG方法
  • 适合追求高质量可控生成的开发者与研究者使用

Classifier-Free Guidance(CFG)是扩散/流模型中广泛采用的技术,用于提升图像保真度和可控性。本文首次从理论上分析了CFG在高斯混合分布上训练的流匹配模型中的作用。发现训练初期因流估计不准确,传统CFG会引导样本走向错误轨迹。基于此,提出CFG-Zero*:一是优化缩放系数以纠正速度估计偏差(名称中的“*”即源于此);二是对ODE求解器的前几步进行置零处理(zero-init)。在文本到图像(Lumina-Next、Stable Diffusion 3、Flux)和文本到视频(Wan-2.1)生成任务上的实验表明,CFG-Zero*始终优于标准CFG,充分验证其有效性。(代码已开源:github.com/WeichenFan/CFG-Zero-star)

原文摘要 · Abstract (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)

流匹配生成引导图像生成扩散模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。