NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Gradient Guidance for Diffusion Models: An Optimization Perspective

Yingqing Guo, Hui Yuan, Yukang Yang, Minshuo Chen, Mengdi Wang

Introduction

Diffusion models have become the gold standard for generative AI, but "steering" them toward specific goals—such as maximizing a reward function or satisfying a constraint—remains a complex challenge. This paper provides a rigorous mathematical framework that links guided diffusion models to classical optimization theory. The authors introduce a "look-ahead" gradient guidance method that optimizes user-specified rewards while provably preserving the data's natural structure. Furthermore, they demonstrate an adaptive fine-tuning approach that achieves a state-of-the-art $\tilde{\mathcal{O}}(1/K)$ convergence rate to global optima.

The Challenge: Reward Over-Optimization and Manifold Drift

A common failure mode in guided generation is reward over-optimization: a model might achieve a high score on a target objective but produce "garbage" samples that no longer resemble the training data.

The core issue is that naive gradient guidance—simply pushing the model in the direction that increases the reward—often forces the samples off the "data manifold" (the low-dimensional subspace where real data lives). Furthermore, there has been a historical lack of formal convergence guarantees for these guided processes. This paper seeks to answer a fundamental question: How can we optimize external objectives without destroying the latent structure of the generated samples?

Methods: Guided Diffusion as Regularized Optimization

The authors establish that guided diffusion is essentially a form of regularized optimization, where the pre-trained model acts as a "prior" that keeps samples near the training data distribution. To improve upon naive guidance, they propose two main algorithmic contributions:

Gradient-Guided Diffusion Framework
  1. Look-Ahead Gradient Guidance ($G_{loss}$): Instead of taking the gradient of the reward with respect to the noisy sample $x_t$, the authors use the pre-trained score function (via Tweedie’s formula) to "look ahead" and estimate the clean sample $x_0$. The guidance is then based on the loss between this predicted $x_0$ and a target value. This method is mathematically proven to stay within the data's latent subspace.
  2. Adaptive Fine-Tuning: To overcome the "regularization" limit of a fixed pre-trained model, the authors propose an iterative process. In each round, they generate new samples, update the guidance, and fine-tune the score network using these self-generated samples. This allows the model to eventually reach the unregularized global optimum of the reward function.

Experimental Setup

The researchers validated their framework across different environments:

  • Synthetic Subspace Data: A controlled environment where data lives in a 16-dimensional subspace within a 64-dimensional ambient space, allowing for precise measurement of "off-subspace" errors.
  • Image Generation: They utilized Stable Diffusion v1.5 as the pre-trained base model.
  • Reward Model: A ResNet-18 architecture pre-trained on ImageNet, modified with a custom linear head to produce scalar reward outputs for steering the diffusion process.

Key Insights and Results

The Pre-trained Model as a Regularizer

A fixed pre-trained model acts as a "leash." No matter how strong your guidance is, you will only reach a regularized optimum. To reach the true global maximum of a reward, the model itself must evolve through fine-tuning. The authors show that the iterative guided diffusion process mimics first-order optimization (like gradient ascent), allowing them to port over convergence proofs from the optimization world to the diffusion world. For concave objectives, the adaptive fine-tuning algorithm achieves a convergence rate of $\tilde{\mathcal{O}}(1/K)$, matching the classical efficiency of convex optimization.

Structure Preservation and Subspace Fidelity

Naive guidance fails because it doesn't "know" about the data manifold. By using the score function to predict the clean image first, $G_{loss}$ automatically projects the guidance onto the valid data subspace.

Conceptual and empirical comparison of guidance methods

In simulations, the proposed $G_{loss}$ maintained a significantly lower "off-support ratio" compared to naive guidance. As shown in the empirical results, it successfully kept samples on the data manifold while optimizing the reward, whereas naive guidance drifted into off-subspace regions.

Qualitative Success in Image Generation

In image tasks (e.g., generating "foxes" or "horses"), the model successfully increased reward scores over iterations. However, the authors noted an interesting trade-off: as rewards reached extreme values, images became more "abstract" or "stylized," shifting away from photo-realism. This serves as a visual confirmation of the inherent tension between optimization and regularization.

Limitations and Future Work

  • Linearity Assumptions: Much of the rigorous theoretical analysis (specifically the convergence proofs) relies on the assumption of a linear score class and subspace data structures. While the empirical results on U-Nets and Stable Diffusion are promising, extending the full theory to highly non-linear manifolds remains an open challenge.
  • Computational Cost: The adaptive fine-tuning algorithm requires iterative training, which is more computationally expensive than simple inference-time guidance.
  • Safety and Ethics: The authors acknowledge that while this technology enables better control over generative models, it could potentially be misused to more efficiently generate harmful or biased content if guided by malicious reward functions.

Summary updated

BibTeX
@inproceedings{guo2024gradient,
  author = {Yingqing Guo and Hui Yuan and Yukang Yang and Minshuo Chen and Mengdi Wang},
  title = {{Gradient Guidance for Diffusion Models: An Optimization Perspective}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=X1QeUYBXke},
}
Figure