Efficient Inference for Flow Matching via Unified Path CFG
摘要
Classifier-Free Guidance (CFG) is indispensable for high-fidelity image generation in generative models such as Flow Matching. However, CFG suffers from a severe drawback: it necessitates two forward passes—conditional and unconditional—per step, doubling the inference computational cost. In this paper, we propose CFG with Unified Path (cfgUP) to halve this inference cost. Built on the hypothesis that the internal representations of a conditional path contain sufficient information to reconstruct unconditional predictions, we introduce a lightweight adapter—comprising less than 1% of total parameters—attached to a frozen backbone model. This enables the computation of the CFG term within a single forward pass. Evaluations on ImageNet demonstrate that cfgUP effectively doubles inference speed while maintaining generation quality (FID). Furthermore, our method requires no retraining of the backbone model and can be trained efficiently on a single GPU, significantly enhancing the practicality of large-scale generative models. The implementation code is available at https://github.com/Okita-Laboratory/cfgUP .