Introduction
Classifier-Free Guidance (CFG) has become the standard mechanism for controlling conditional generation in diffusion models, such as Stable Diffusion and DALL-E. By interpolating between conditional and unconditional score predictions, CFG allows users to adjust the "guidance scale" to ensure the model adheres strictly to a given prompt. However, despite its widespread adoption, CFG relies on an intuitive "sum-to-one" coefficient constraint that lacks a rigorous theoretical foundation. This paper identifies a fundamental flaw in this approach—the "expectation shift"—and proposes Rectified Classifier-Free Guidance (ReCFG) as a mathematically grounded solution.
The Expectation Shift Problem
In standard CFG, the guided score is calculated using a weight $\gamma$ for the conditional prediction and $(1-\gamma)$ for the unconditional prediction. The authors demonstrate that this constraint causes the mean of the generated distribution to drift away from the true data distribution as the guidance scale increases. This drift, termed the "expectation shift," violates the core requirement of diffusion probabilistic models: that the denoising process should remain reciprocal to the forward noise process.
As shown in the toy examples above, increasing the guidance scale in standard CFG moves the peak of the generated distribution further from the ground truth. This shift often manifests in high-resolution models as over-saturation, visual artifacts, or a loss of fine-grained texture.
Rectified Classifier-Free Guidance (ReCFG)
To address this, the authors introduce ReCFG, which relaxes the rigid sum-to-one constraint. Instead of a single parameter, ReCFG utilizes two independent coefficients, $\gamma_1$ and $\gamma_0$.
- Theoretical Alignment: The authors derive a closed-form solution for $\gamma_0$ that ensures the expectation of the guided score function remains zero, aligning the sampling process with diffusion theory.
- Efficient Implementation: Because the optimal $\gamma_0$ varies by prompt and timestep, calculating it dynamically is computationally expensive. The authors propose a "lookup table" approach, pre-computing the ratio of expectations between conditional and unconditional noise predictions by traversing the dataset once.
- Post-hoc Application: ReCFG is a plug-and-play method that requires no retraining. It can be applied to any existing diffusion model during the inference stage with virtually zero additional computational overhead.
Experimental Results
The authors evaluated ReCFG across various models (DiT, EDM2, Stable Diffusion 3) and datasets (ImageNet, CC12M, MS-COCO). The results consistently show that ReCFG improves both image fidelity and prompt adherence.
Quantitative Improvements
On ImageNet 512x512 using the EDM2 model, ReCFG reduced the Fréchet Inception Distance (FID) from 1.96 to 1.89. In text-to-image tasks using Stable Diffusion 3 (SD3), ReCFG simultaneously improved the CLIP Score (measuring prompt faithfulness) and reduced the FID, overcoming the typical trade-off seen in standard CFG.
Qualitative Analysis
Visually, ReCFG corrects common artifacts found in high-guidance regimes. It produces richer textures and more natural color balances compared to the vanilla CFG approach.
Conclusion and Future Work
ReCFG demonstrates that the industry-standard approach to guidance is theoretically sub-optimal. By rectifying the expectation shift, ReCFG provides a simple yet effective way to enhance the performance of pre-trained diffusion models. While the current lookup table method is effective, future work may involve training small predictor networks to estimate optimal coefficients for open-vocabulary prompts or exploring more sophisticated controls for distribution variance.
Summary updated