Skip to main content
Back

Shanghai Jiao Tong's C²FG Proves Fixed Guidance Weights Are Mathematically Wrong

C²FG replaces CFG's fixed guidance weight with a theoretically-grounded exponential decay function, improving FID and IS across DiT, SiT, Stable Diffusion, and EDM2 with zero retraining.

Pro

Paper, Full Access
  • C²FG replaces CFG's fixed guidance weight with an exponential decay function omega(t) = omega_0 * exp(lambda * (1 - t/t_max)), grounded in formal theorems about score discrepancy in diffusion processes.
  • The paper proves that the gap between conditional and unconditional score functions decays as O(e^{-t}) for VP-SDE and C/sigma²(t) for VE-SDE, meaning guidance should be strongest near the final image, not uniform throughout.
  • C²FG is training-free and plug-in: it works on DiT, SiT, Stable Diffusion, EDM2, Flux, and SD3 without any fine-tuning.
  • On SiT-XL/2 (REPA), FID drops from 1.80 to 1.51 and IS improves from 284.0 to 315.0; gains hold across 20, 50, and 250 inference steps and both SDE/ODE samplers.
  • C²FG is orthogonal to interval guidance, autoguidance, and other CFG variants, and stacks with them for further gains.
  • The method introduces only one new hyperparameter (lambda), with lambda = 1.0 working well across most tested models.

Classifier-Free Guidance (CFG) is the invisible hand behind almost every modern image diffusion model. It is the mechanism that makes a prompt actually stick, steering the denoising process toward a target condition by blending conditional and unconditional score predictions at each step. The catch: for over three years, the guidance weight has been a single fixed number, chosen by feel. A new paper from researchers at Shanghai Jiao Tong University and vivo BlueImage Lab argues this is not just suboptimal, it is mathematically wrong, and they have the theorems to prove it.

The paper introducing C²FG (Control Classifier-Free Guidance) starts from a deceptively simple observation: in a diffusion process, the gap between what the model predicts under a condition versus without one is not constant across timesteps. It changes, and it changes in a predictable, mathematically bounded way.

Why a fixed weight is the wrong abstraction

To understand the problem, recall how CFG works. At every denoising step, the model runs twice: once with your prompt (conditional), once without (unconditional). The final noise prediction is:

epsilon_guided = epsilon_uncond + omega * (epsilon_cond - epsilon_uncond)

The scalar omega is the guidance weight. Set it to 1.5 and walk away. That is how virtually every implementation works today. CFG's reliance on a fixed or heuristic dynamic guidance weight is predominantly empirical and overlooks the inherent dynamics of the diffusion process.

The problem is that the diffusion process itself is not static. Existing models typically use a fixed weighting coefficient throughout all denoising steps. Although this ensures stable guidance, it frequently results in excessive guidance at early stages and insufficient guidance at later stages, introducing unwanted artifacts. But prior work treating this as a heuristic problem has been missing the deeper reason why.

The theoretical core: score discrepancy bounds

The C²FG paper formalizes this intuition into four theorems. The key insight is about the score discrepancy, which is the difference between the conditional score function (the gradient of the log-probability under your prompt) and the unconditional one. The authors prove strict upper bounds on this discrepancy as a function of timestep t.

For the two standard diffusion parameterizations:

  • VP-SDE (Variance-Preserving, used by DDPM/DDIM): the score discrepancy bound decays as O(e^{-t}), an exponential decay.
  • VE-SDE (Variance-Exploding, used by EDM): the bound decays as C / sigma²(t), also monotonically decreasing.

The implication is direct: their analysis highlights intrinsic properties of diffusion dynamics, making the applicability of the framework broader. Their exponential design is supported by formal theorems, providing a stronger theoretical grounding than prior heuristic approaches.

They also prove complementary Harnack-type inequalities, which bound how probability density functions at different spatial locations and timesteps relate to each other. These show that as t → 0 (the final denoising steps), the PDF becomes increasingly hard to bound, meaning the conditional and unconditional distributions are most different precisely when you are closest to the final image.

C2FG pipeline showing VP and VE diffusion dynamics with time-dependent weight schedules

The method: one formula, two hyperparameters

Motivated by the exponential decay of the score discrepancy, the authors replace the fixed omega with a time-dependent control function:

omega(t) = omega_0 * exp(lambda * (1 - t / t_max))

This is the entirety of C²FG. During the reverse process (going from noise to image), t decreases from t_max to 0. So omega(t) starts at omega_0 (low guidance, near pure noise) and grows to omega_0 * e^lambda (high guidance, near the final image). This matches the theoretical finding that the conditional signal matters most in the final denoising stages.

The design has exactly two hyperparameters:

  • omega_0: the base guidance strength, analogous to the standard CFG scale
  • lambda: controls the decay rate, i.e., how much guidance ramps up as generation progresses

Crucially, C²FG is training-free and plug-in. You swap the constant omega for the function omega(t) in your existing sampler. No fine-tuning, no new model weights.

Benchmarks and results

The experiments span a wide range of architectures and tasks, all evaluated on ImageNet and MS-COCO.

C²FG is effective and broadly applicable across diverse generative tasks, while also exhibiting orthogonality to existing strategies. Concretely, the numbers:

  • DiT-XL/2 on ImageNet-256: FID drops from 2.29 to 2.07, IS improves from 276.8 to 291.5
  • SiT-XL/2 (REPA) on ImageNet-256: FID drops from 1.80 to 1.51, IS improves from 284.0 to 315.0
  • SiT-XL/2 (REPA) with interval guidance: FID drops from 1.42 to 1.41, IS improves from 305.7 to 308.0
  • DiT-XL/2 on ImageNet-512: FID drops from 6.81 to 6.54
  • U-ViT on MS-COCO: FID drops from 5.37 to 5.28
  • Stable Diffusion 1.5 on MS-COCO: CLIP score improves from 31.8 to 31.9

The gains on SiT-XL/2 (REPA) are particularly notable because REPA is already an exceptionally strong baseline. The paper notes that even in this near-saturation regime, C²FG yields further gains.

2D toy distribution comparison showing C2FG produces fewer outliers than EDM2 and beta-CFG

Orthogonality: it stacks with other tricks

One of the more practically useful properties is that C²FG is orthogonal to existing guidance strategies. It was tested in combination with:

  • Interval guidance (applying CFG only in a middle noise-level window): C²FG further reduces FID on top of this
  • Autoguidance (EDM2's technique of guiding with a weaker version of the same model): FID on ImageNet-64 drops from 1.044 to 1.028
  • Flux and SD3: CLIP scores improve from 31.4 to 31.5 on both models

The method also holds up across different samplers (SDE and ODE) and different numbers of inference steps. At 50 steps, FID improves from 3.36 to 3.20 for SDE and from 3.46 to 3.25 for ODE. At 20 steps, the gains are even more pronounced for ODE sampling.

Limitations and what to watch for

C²FG introduces a second hyperparameter lambda that needs tuning per model and task. The paper shows the method is robust across a range of values (best results at lambda = log(e) = 1.0 for REPA), but practitioners will need to sweep it. The gains are also incremental rather than transformative: improvements are real but measured in tenths of FID points on already-strong baselines.

The theoretical bounds also have a singularity at t → 0, meaning the framework does not directly prescribe behavior in the very last denoising steps. The authors handle this pragmatically by extrapolating the exponential function smoothly, but it is worth noting the theory has this gap.

Comparison chart showing C2FG exponential weight schedule versus constant CFG weight over timesteps

The bigger picture

What makes this work interesting beyond the numbers is the direction it points. The CFG weight has been treated as a scalar dial since the technique was introduced. This paper is among the first to derive what that dial should actually look like from first principles, using stochastic differential equations and Fokker-Planck analysis rather than ablation studies. The result is a clean, two-parameter family of schedules with a clear theoretical justification.

The code and pretrained weights are not yet released as a standalone repository, but the method is simple enough to implement in a few lines on top of any existing diffusion sampler. Given that it works across DiT, SiT, Stable Diffusion, EDM2, Flux, and SD3, it is likely to see adoption as a default inference improvement in the near term.