A First-order Generative Bilevel Optimization Framework for Diffusion Models

Quan Xiao, Hui Yuan, A F M Saif, Gaowen Liu, Ramana Rao Kompella, Mengdi Wang, Tianyi Chen

Introduction

Diffusion models (DMs) have become the state-of-the-art for high-fidelity image generation. However, tailoring these models to specific downstream objectives—such as maximizing aesthetic scores or optimizing noise schedules—presents a significant challenge. These tasks are naturally formulated as bilevel optimization problems, where an "upper-level" objective (e.g., maximizing a reward) depends on the solution of a "lower-level" problem (e.g., finding the optimal data distribution or model weights).

Traditional bilevel optimization is computationally prohibitive for diffusion models. It typically requires differentiating through hundreds of denoising steps or computing high-order derivatives (Hessians), leading to extreme memory and time costs. This paper introduces a first-order generative bilevel framework designed to make these optimizations efficient and scalable.

The Bilevel Framework

The proposed framework addresses two primary challenges in diffusion model optimization: reward fine-tuning and noise schedule optimization.

Overview of the bilevel optimization framework for reward fine-tuning (left) and noise scheduling (right).

1. Efficient Reward Fine-tuning

When fine-tuning a pre-trained model to maximize a specific reward (like a "beauty" score), models often suffer from reward over-optimization. This occurs when the model generates high-scoring but unrealistic artifacts. To prevent this, researchers use entropy regularization (controlled by a hyperparameter $\lambda$) to keep the model close to the original data distribution.

The authors derive a novel inference-only gradient estimator for the upper-level objective (Proposition 1). By leveraging the marginal density induced by the Stochastic Differential Equation (SDE), they can estimate the gradient of the hyperparameter $\lambda$ using only samples from the pre-trained distribution. This eliminates the need for expensive "guided backward sampling" or second-order derivatives, making hyperparameter tuning significantly faster.

2. Automated Noise Scheduling

The noise schedule—the rate at which noise is added during training and removed during sampling—is a critical factor in image quality. Traditionally, these schedules are hand-tuned or found via exhaustive grid search.

The framework parameterizes the noise schedule using a simple 4-parameter function (e.g., cosine or sigmoid). To optimize these parameters, the authors employ Zeroth-Order (ZO) gradient estimation. This approach only requires evaluating the loss function at perturbed points, bypassing the need to differentiate through the entire sampling trajectory. Combined with a "warm-starting" strategy for model weights, this allows for rapid, on-the-fly optimization of the noise schedule during training.

Key Results and Insights

The framework was evaluated on standard benchmarks including StableDiffusion V1.5, ImageNet, and MNIST, using metrics like CLIP scores, HPSv2 (human preference), and FID (image quality).

Quantitative Performance

  • Superior Efficiency: In reward fine-tuning, the bilevel method outperformed traditional search strategies (Grid, Random, Bayesian), achieving an 8.32% improvement in CLIP score and an 11.76% improvement in FID over the best-performing baseline.
  • Training Speed: For noise scheduling on MNIST, the method achieved results comparable to Bayesian search while being 6 times faster.

Qualitative Improvements

A major finding is the framework's ability to avoid the "anatomical collapse" often seen in standard hyperparameter optimization. While other methods might produce abstract or deformed images when pushed for high rewards, the bilevel approach maintains biological fidelity while enhancing color and vibrancy.

Qualitative comparison showing the effects of reward over-optimization (abstract artifacts) versus the realistic, high-quality results produced by the proposed bilevel framework.

Conclusion

This research provides a theoretically grounded and computationally efficient path for steering diffusion models. By replacing expensive second-order calculations with first-order and zeroth-order estimators, the authors enable complex bilevel optimization at a fraction of the previous cost. Future work includes scaling these methods to even larger latent diffusion models and exploring multi-objective optimization where several competing rewards must be balanced simultaneously.

This summary is based on the paper "A First-order Generative Bilevel Optimization Framework for Diffusion Models."

Summary updated

BibTeX
@inproceedings{xiao2025first,
  author = {Quan Xiao and Hui Yuan and A F M Saif and Gaowen Liu and Ramana Rao Kompella and Mengdi Wang and Tianyi Chen},
  title = {{A First-order Generative Bilevel Optimization Framework for Diffusion Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=3qL4LRUaJ8},
}
Figure