Improving Classifier-Free Guidance of Flow Matching via Manifold Projection

Jian-Feng Cai, Haixia Liu, Zhengyi Su, Chao Wang
1/29/2026
cs.CVcs.AI

No official code found. Best implementation: LeonSuZhengYi/CFG-MP (9 stars, MIT, last commit 2026-02-02).

Abstract

Classifier-free guidance (CFG) is a widely used technique for controllable generation in diffusion and flow-based models. Despite its empirical success, CFG relies on a heuristic linear extrapolation that is often sensitive to the guidance scale. In this work, we provide a principled interpretation of CFG through the lens of optimization. We demonstrate that the velocity field in flow matching corresponds to the gradient of a sequence of smoothed distance functions, which guides latent variables toward the scaled target image set. This perspective reveals that the standard CFG formulation is an approximation of this gradient, where the prediction gap, the discrepancy between conditional and unconditional outputs, governs guidance sensitivity. Leveraging this insight, we reformulate the CFG sampling as a homotopy optimization with a manifold constraint. This formulation necessitates a manifold projection step, which we implement via an incremental gradient descent scheme during sampling. To improve computational efficiency and stability, we further enhance this iterative process with Anderson Acceleration without requiring additional model evaluations. Our proposed methods are training-free and consistently refine generation fidelity, prompt alignment, and robustness to the guidance scale. We validate their effectiveness across diverse benchmarks, demonstrating significant improvements on large-scale models such as DiT-XL-2-256, Flux, and Stable Diffusion 3.5.

View on arXivView PDF

Code Implementations(1)

MIT

Official code for Improving Classifier-Free Guidance of Flow Matching via Manifold Projection

92PythonJan 29, 20268 months agoMIT

Similar Papers

Cite this paper

@article{cai2026improving,
  title  = {Improving Classifier-Free Guidance of Flow Matching via Manifold Projection},
  author = {Jian-Feng Cai and Haixia Liu and Zhengyi Su and Chao Wang},
  year   = {2026},
  eprint = {2601.21892},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.21892v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.21892.svg)](https://codeofpaper.com/paper/2601.21892)

Discussion