CFG-Ctrl: Control-Based Classifier-Free Diffusion Guidance
Organizations: Tsinghua University
Abstract
Classifier-Free Guidance (CFG) has emerged as a central approach for enhancing semantic alignment in flow-based diffusion models. In this paper, we explore a unified framework called CFG-Ctrl, which reinterprets CFG as a control applied to the first-order continuous-time generative flow, using the conditional-unconditional discrepancy as an error signal to adjust the velocity field. From this perspective, we summarize vanilla CFG as a proportional controller (P-control) with fixed gain, and typical follow-up variants develop extended control-law designs derived from it. However, existing methods mainly rely on linear control, inherently leading to instability, overshooting, and degraded semantic fidelity especially on large guidance scales. To address this, we introduce Sliding Mode Control CFG (SMC-CFG), which enforces the generative flow toward a rapidly convergent sliding manifold. Specifically, we define an exponential sliding mode surface over the semantic prediction error and introduce a switching control term to establish nonlinear feedback-guided correction. Moreover, we provide a Lyapunov stability analysis to theoretically support finite-time convergence. Experiments across text-to-image generation models including Stable Diffusion 3.5, Flux, and Qwen-Image demonstrate that SMC-CFG outperforms standard CFG in semantic alignment and enhances robustness across a wide range of guidance scales. Project Page: https://hanyang-21.github.io/CFG-Ctrl
Figures & tables
| Method | Gain | Operator | Error | Control Interpretation |
| CFG [ 16 ] | Proportional control | |||
| Weight Scheduler [ 49 ] | Time-varying gain scheduling | |||
| APG [ 39 ] | Projection-based Feedback Control | |||
| CFG-Zero ⋆ [ 9 ] | , | Projection-based Feedback Control | ||
| Rectified-CFG++ [ 41 ] | Model Predictive Control | |||
| SMC-CFG | Sliding Mode Control |
| Guidance | FID | CLIP | Aesthetic | ImageReward | PickScore | HPSv2 | HPSv2.1 | MPS |
| SD3.5 [ 8 ] | 41.725 | 0.3399 | 5.4256 | 0.3591 | 0.2124 | 0.2710 | 0.2372 | 6.5554 |
| w/ CFG [ 16 ] | 21.421 | 0.3681 | 5.5875 | 0.8889 | 0.2190 | 0.2930 | 0.2842 | 7.2476 |
| w/ CFG-Zero ⋆ [ 9 ] | 20.317 | 0.3691 | 5.6124 | 0.9312 | 0.2195 | 0.2942 | 0.2862 | 7.0430 |
| w/ Rect-CFG++ [ 41 ] | 20.550 | 0.3655 | 5.5663 | 0.7097 | 0.2173 | 0.2887 | 0.2748 | 6.7854 |
| w/ SMC-CFG | 20.044 | 0.3694 | 5.5790 | 0.9486 | 0.2211 | 0.2945 | 0.2875 | 7.5719 |
| Flux-dev [ 22 ] | 52.598 | 0.3272 | 5.4568 | 0.2572 | 0.2137 | 0.2650 | 0.2280 | 5.9592 |
| FID | CLIP | Aesth | ImgRwd | ||
| 3 | 0.1 | 26.193 | 0.3698 | 5.7064 | 1.0174 |
| 4 | 0.1 | 26.006 | 0.3701 | 5.7098 | 1.0219 |
| 5 | 0.1 | 25.951 | 0.3709 | 5.7128 | 1.0248 |
| 6 | 0.1 | 26.143 | 0.3703 | 5.7071 | 1.0228 |
| 5 | 0.1 | 25.951 | 0.3709 | 5.7128 | 1.0248 |
| 5 | 0.4 | 26.143 | 0.3719 | 5.7218 | 1.0504 |
| Notation | Meaning | Value |
| Latent state at time during generative flow sampling. | (initial state) | |
| Unconditional velocity field, obtained by dropping the condition . | / | |
| Conditional velocity field, incorporating the input condition . | / | |
| Guided velocity field, combined via guidance. | / | |
| CFG guidance scale. | ||
| Semantic error signal. |
| Model | Color | Shape | Texture | Spatial |
| SD3.5 [ 8 ] | 0.6790 | 0.5915 | 0.7243 | 0.1625 |
| w/ SMC-CFG | 0.7461 | 0.6009 | 0.7406 | 0.2563 |
| Flux-dev [ 22 ] | 0.8172 | 0.5751 | 0.7432 | 0.2708 |
| w/ SMC-CFG | 0.8216 | 0.6199 | 0.7901 | 0.2939 |
| Qwen-Image [ 50 ] | 0.7747 | 0.5621 | 0.6747 | 0.2968 |
| w/ SMC-CFG | 0.8191 | 0.5934 | 0.7421 | 0.4085 |
| Method | VQAScore (GenAI-Bench) | ||
| Base | Advance | Overall | |
| Base (w/o CFG) | 0.79 | 0.64 | 0.70 |
| w/ CFG | 0.83 | 0.64 | 0.72 |
| w/ CFG-Zero ⋆ | 0.88 | 0.66 | 0.75 |
| w/ Rect-CFG++ | 0.87 | 0.64 | 0.73 |
| w/ SMC-CFG | 0.89 | 0.68 | 0.77 |
| Method | Total Score | Quality Score | Semantic Score | Color | Human Action | Subject Consistency |
| CFG | 0.5594 | 0.6581 | 0.4607 | 0.9087 | 0.5313 | 0.9450 |
| SMC-CFG | 0.5839 | 0.6747 | 0.4931 | 0.9818 | 0.6000 | 0.9609 |
| Resolution | Guidance | Memory (GB) | FLOPs (G) | Runtime (s) |
| 512×512 | CFG | 31.99 | 1203370.06 | 23.84 |
| SMC-CFG | 31.99 | 1203370.07 | 23.97 | |
| 1024×1024 | CFG | 33.59 | 3590870.89 | 44.78 |
| SMC-CFG | 33.59 | 3590870.93 | 45.09 |