CFG-Zero*: Improved Classifier-Free Guidance for Flow Matching Models
这篇论文提出了一种改进的无分类器引导方法CFG-Zero⋆,用于流匹配模型,通过优化比例尺和零初始化技术提高了图像和视频生成的质量和可控性。
更新于 2025-03-25。作者:Weichen Fan、Amber Yijia Zheng、Raymond A. Yeh、Ziwei Liu。
中文摘要
无分类器引导(CFG)是扩散/流模型中广泛采用的一种技术,用于提高图像保真度和可控性。在这项工作中,我们首先分析了CFG对训练在高斯混合模型上的流匹配模型的影响,其中真实流可以推导出来。我们观察到,在训练的早期阶段,当流估计不准确时,CFG会将样本引导到错误的轨迹上。基于这一观察,我们提出了CFG-Zero*,这是一种改进的CFG,具有两项贡献:(a)优化尺度,通过优化一个标量来校正估计速度的不准确性,因此命名为*;(b)零初始化,涉及将常微分方程求解器的第一步几步设置为0。在文本到图像(Lumina-Next、Stable Diffusion 3和Flux)和文本到视频(Wan-2.1)生成上的实验表明,CFG-Zero*在性能上始终优于CFG,突显了其在指导流匹配模型上的有效性。(代码可在github.com/WeichenFan/CFG-Zero-star获取)
英文摘要
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)
解读
一句话总结
这篇论文提出了一种改进的无分类器引导方法CFG-Zero⋆,用于流匹配模型,通过优化比例尺和零初始化技术提高了图像和视频生成的质量和可控性。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:流匹配模型在生成图像和视频时,由于速度估计不准确,导致样本轨迹偏离最优路径。
- 现有方案不足:现有的CFG方法在模型欠拟合时,无法准确引导样本。
- 研究目标:提出CFG-Zero⋆方法,以优化速度估计并提高生成质量。
问题2:论文的核心创新点是什么?
- 技术创新:引入了优化比例尺和零初始化技术。
- 方法改进:优化比例尺用于校正速度估计的不准确性,零初始化技术用于稳定早期采样。
- 优势:与标准CFG相比,CFG-Zero⋆在保持较低计算成本的同时,提高了生成质量和可控性。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在文本到图像(Lumina-Next, Stable Diffusion 3, Flux)和文本到视频(Wan-2.1)生成任务上进行了实验。
- 性能提升:实验结果表明,CFG-Zero⋆在美学评分、CLIP评分和FID分数等方面均优于标准CFG。
- 对比结果:与CFG++和ADG等基线方法相比,CFG-Zero⋆在多个评价指标上取得了最佳性能。
问题4:这个研究的实际应用价值是什么?
- 应用场景:文本到图像和视频生成、艺术创作、游戏开发等。
- 实施建议:将CFG-Zero⋆集成到现有的流匹配模型中,以提升生成质量和可控性。
- 局限与展望:未来可进一步研究CFG-Zero⋆在其他生成模型中的应用,并探索更有效的优化方法。