CFG-Ctrl: Control-Based Classifier-Free Diffusion Guidance

Hanyang Wang, Yiyang Liu, Jiawei Chi, Fangfu Liu, Ran Xue, Yueqi Duan

TL;DR

The paper introduces CFG-Ctrl, a unified framework that reinterprets Classifier-Free Guidance (CFG) in diffusion models through the lens of classical control theory. By identifying standard CFG's limitations as a simple linear proportional controller, the authors propose SMC-CFG—a nonlinear guidance method based on Sliding Mode Control that stabilizes generative trajectories, significantly improving prompt alignment and image quality at high guidance scales.

What Problem Does This Paper Address?

Classifier-Free Guidance (CFG) is the industry-standard technique for ensuring text-to-image diffusion models actually follow user prompts. Traditionally, CFG works by linearly extrapolating between a model's conditional (text-prompted) and unconditional (blank-prompted) predictions.

However, this linear approach assumes a straightforward path that rarely holds true in complex, highly nonlinear model architectures. When users increase the "guidance scale" to force strict prompt adherence, the generation trajectory often overshoots or oscillates wildly out of the learned data manifold. This results in well-known visual artifacts: oversaturated colors, warped geometric structures, and a severe loss of fine detail.

Methods

The authors bridge generative modeling and control theory by modeling the flow matching sampling process as a continuous-time controlled dynamical system. In this framework, the discrepancy between conditional and unconditional velocity predictions acts as a natural "error signal."

The authors demonstrate that standard CFG is mathematically equivalent to a Proportional (P) controller with a fixed gain. To overcome its linear instability, they introduce Sliding Mode Control CFG (SMC-CFG). Instead of relying on rigid linear extrapolation, SMC-CFG defines an exponential "sliding surface" over the semantic prediction error. It introduces a nonlinear switching control term (utilizing a sign function) to actively force the generative trajectory back onto a stable, rapidly converging manifold. The authors back this approach with a rigorous Lyapunov stability analysis to theoretically guarantee finite-time convergence.

Figure 1. Phase diagram in the e-˙e plane. We schematically il- lustrate the convergence patterns of CFG and the proposed SMC- CFG. Left: CFG’s ideal linear convergence trajectory and the strong oscillatory divergence under high guidance scales. Right: the proposed SMC-CFG, through a switching-forcing mechanism, drives the system states toward the sliding mode surface governed by parameter λ, achieving robust and rapid convergence.

Datasets

The method was evaluated on a benchmark subset of the MS-COCO dataset, comprising 5,000 image-text pairs. To demonstrate model-agnostic generality, the authors tested SMC-CFG across three state-of-the-art flow-based foundation models of varying scales:

  • Stable Diffusion 3.5 (SD3.5) (8B parameters)
  • Flux-dev (12B parameters)
  • Qwen-Image (20B parameters)

Key Insights and Ideas

  • CFG as Feedback Control: The core "aha" moment is realizing that the conditional-unconditional gap isn't just a static vector to extrapolate along; it is a dynamic error signal that can be actively regulated using feedback control loops.
  • The Failure of Linearity: Linear control laws inherently struggle when the underlying system dynamics are highly nonlinear—which is always the case with massive neural networks operating under strong guidance scales.
  • Robustness via Chattering: By introducing a switching mechanism, SMC-CFG trades smooth but divergent linear paths for a controlled "chattering" convergence. This keeps the trajectory tightly bound to the ideal semantic manifold, preventing catastrophic divergence even at extremely high guidance scales.

Key Results

SMC-CFG consistently outperformed standard CFG and recent advanced baselines (such as CFG-Zero and Rectified-CFG++) across all tested model backbones.

  • Quantitative Improvements: On Stable Diffusion 3.5, SMC-CFG achieved the lowest Frechet Inception Distance (FID) of 20.044 (compared to 21.421 for standard CFG), indicating superior image realism. It simultaneously boosted text-alignment metrics, achieving the highest CLIP score (0.3694) and leading across human preference metrics like ImageReward and PickScore.
  • Qualitative Improvements: Visual results demonstrate that SMC-CFG drastically reduces color distortion and structural warping at high guidance scales. It maintains sharp details, coherent object structures, and superior text rendering where standard CFG fails.

Limitations and Future Work

The authors note that SMC-CFG introduces two new hyperparameters: $\lambda$ (which shapes the sliding surface) and $k$ (the switching gain). If $k$ is set too high, it can cause abrupt pulls and erratic sampling vibrations, which degrades aesthetic appeal. Conversely, setting it too low weakens prompt alignment. Currently, finding the sweet spot requires manual tuning per model backbone. The authors suggest that future work should focus on developing adaptive or automated scheduling mechanisms to dynamically tune these control parameters during the generation process.

Summary updated

BibTeX
@inproceedings{wang2026cfg,
  author = {Hanyang Wang and Yiyang Liu and Jiawei Chi and Fangfu Liu and Ran Xue and Yueqi Duan},
  title = {{CFG-Ctrl: Control-Based Classifier-Free Diffusion Guidance}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=GWw0E0OM4b},
}
Figure