Manuscript Offprint

arXiv:2610.37146

Variational Optimal Control for Diffusion Guidance

Ruoyu Wang, Xinyi Ye, Yunshuo Shi, Liangyu Yuan, Beier Zhu, Chi Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We present a variational control framework that connects sampling-time guidance and reward-based model adaptation through a shared Jacobian pullback. Starting from terminal reward maximization with a path-space KL penalty, the Gibbs variational principle and Doob transform yield a correction to the generative dynamics. A local denoising approximation exposes the pullback that transports output preferences to the controlled variable. This construction gives Variational Optimal Guidance (VOG) in state space and extends to Distilled Variational Optimal Control (DVOC) by amortizing locally improved endpoints into model parameters. The resulting controls share a local variational rule: VOG acts through the denoising Jacobian, while DVOC realizes the parameter pullback by endpoint distillation. Under a linear MMSE model, VOG's exact correction lies in the data subspace. On ImageNet, VOG reduces DiT-XL/2 FID from 2.27 to 2.04 at 250 sampling steps and from 7.58 to 4.44 at 25 steps. After 20 updates on Z-Image-Turbo, DVOC improves HPSv3++ and four held-out evaluator scores over the untrained model, with the highest corresponding means among the trained methods compared. These results connect inference-time control and reward adaptation through a common geometric principle.

1 Introduction

Diffusion models have become powerful image generators by learning to transform noise into samples from a data distribution [17, 19, 25, 34]. In many applications, however, faithfully reproducing that distribution is only a starting point: users seek images with particular content, stronger prompt alignment, or preferred visual attributes. These goals call for adapting a pretrained generator to an objective that may differ from its training criterion. The challenge is to improve the desired objective while retaining the quality and diversity supported by the learned prior.

Sampling-time guidance and reward-based fine-tuning offer two ways to pursue this goal. Classifier-free guidance (CFG) [16] strengthens conditioning by extrapolating between conditional and unconditional predictions, while gradient-based methods steer sampling using an objective evaluated on a predicted clean image [1, 4, 45]. Fine-tuning instead updates model parameters through reward backpropagation or reinforcement learning, incorporating preferences into future generations [2, 6, 27, 42]. Stronger intervention is not always beneficial: increasing the CFG scale can reduce distributional coverage [3, 30], and an external objective can favor directions that depart from the data structure [13].

A central difficulty is that preferences are defined on a completed image, whereas interventions act on noisy intermediate states or model parameters. Translating a desired output change into an effective intervention requires accounting for how the generator responds. We therefore ask how a terminal objective and a cost of intervention should determine the control, and whether a common local principle can govern both sampling-time guidance and parameter adaptation.

We address these questions through variational optimal control (VOC). For sampling, the pretrained conditional process provides a reference, and control maximizes terminal reward while penalizing deviation from that reference through a path-space KL divergence. This objective makes the trade-off between preference and prior explicit. Its optimal solution reweights future denoising trajectories by terminal reward and determines a corresponding correction to the dynamics. A local Gaussian approximation and a denoised reward proxy then yield Variational Optimal Guidance (VOG): the output gradient is transported to the current state through the denoising Jacobian. This Jacobian accounts for which changes in the noisy state affect the predicted clean sample. Under a linear subspace model with an optimal denoiser, the exact correction lies in the data subspace; the practical sampler approximates this pullback for neural denoisers.

The local control principle also suggests how to incorporate terminal improvements into the generator. We introduce Distilled Variational Optimal Control (DVOC), which first refines a sampled terminal latent using reward gradients within a bounded neighborhood, then trains the model to reproduce the resulting target. Differentiating the distillation loss transports the target displacement through a parameter Jacobian, realizing the parameter-space counterpart of the local VOG control. Selected denoising steps carry this parameter gradient, and the adapted model uses its ordinary sampler at inference. VOG and DVOC thus share a concrete mechanism: a preferred output change is mapped through the sensitivity of the controlled variable, acting on the current state in VOG and on model parameters in DVOC (Figure 1).

Our contributions are:

• A variational account of diffusion guidance. We derive VOG from terminal reward maximization with a path-space KL penalty and characterize the subspace support of its exact correction under a linear MMSE model.

• A connection between guidance and model adaptation. We identify a shared local control principle and derive DVOC’s endpoint distillation objective as its parameter-space realization.

• Evaluation across guidance and reward adaptation. VOG improves FID in all twelve ImageNet model–guidance pairings and reduces 25-step DiT-XL/2 FID from 7.58 to 4.44. After 20 updates, DVOC improves HPSv3++ and four held-out evaluator scores over pretrained Z-Image-Turbo, with the highest corresponding means among the trained methods compared.

References (45)

  • Universal guidance for diffusion models
  • Training diffusion models with reinforcement learning
  • What does guidance do? a fine-grained analysis in a simple setting
  • Diffusion posterior sampling for general noisy inverse problems
  • CFG++: Manifold-constrained classifier free guidance for diffusion models
  • Directly fine-tuning diffusion models on differentiable rewards
  • ImageNet: A large-scale hierarchical image database
  • DEFT: Efficient fine-tuning of diffusion models by learning the generalised h-transform
  • Diffusion models beat GANs on image synthesis
  • Adjoint matching: Fine-tuning flow and diffusion generative models with memoryless stochastic optimal control
  • DPOK: Reinforcement learning for fine-tuning text-to-image diffusion models
  • Masked diffusion transformer is a strong image synthesizer
  • Gradient guidance for diffusion models: An optimization perspective
  • Manifold preserving guided diffusion
  • GANs trained by a two time-scale update rule converge to a local Nash equilibrium
  • Classifier-Free Diffusion Guidance
  • Denoising diffusion probabilistic models
  • Guiding a diffusion model with a bad version of itself
  • Analyzing and improving the training dynamics of diffusion models
  • Pick-a-Pic: An open dataset of user preferences for text-to-image generation
  • Applying guidance in a limited interval improves sample and distribution quality in diffusion models
  • Flow-GRPO: Training flow matching models via online RL. In Proc
  • HPSv3++: Scaling reward models across the full spectrum of diffusion model capabilities (opens arXiv in a new tab)
  • h-Edit: Effective and flexible diffusion-based editing via Doob's h-transform
  • Scalable diffusion models with transformers
  • The intrinsic dimension of images and its impact on learning
  • Aligning text-to-image diffusion models with reward backpropagation (opens arXiv in a new tab)
  • Learning transferable visual models from natural language supervision
  • CADS: Unleashing the diversity of diffusion models through condition-annealed sampling
  • Eliminating oversaturation and artifacts of high guidance scales in diffusion models
  • M. Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly
  • Generative modeling by estimating gradients of the data distribution
  • Score-based generative modeling through stochastic differential equations
  • Diffusion model alignment using direct preference optimization
  • Exploring the design space of reward backpropagation for flow matching (opens arXiv in a new tab)
  • Analysis of classifier-free guidance weight schedulers
  • Q-Align: Teaching LMMs for visual scoring via discrete text-defined levels
  • Deep reward supervisions for tuning text-to-image diffusion models
  • Rectified diffusion guidance for conditional generation
  • ImageReward: Learning and evaluating human preferences for text-to-image generation
  • Advantage weighted matching: Aligning RL with pretraining in diffusion models
  • Teaching large language models to regress accurate image quality scores using score distribution
  • FreeDoM: Training-free energy-guided conditional diffusion model
  • DiffusionNFT: Online diffusion reinforcement with forward process
  • On-Policy Self-Distillation in Diffusion Models