Unified Control for Inference-Time Guidance of Denoising Diffusion Models

Maurya Goyal, Anuj Singh, Hadi Jamali-Rad

TL;DR

This paper introduces UniCoDe, a novel framework that unifies sampling-based and gradient-based guidance for diffusion models. By integrating local gradient information directly into the sampling process, UniCoDe achieves more efficient generation of high-quality, aligned outputs while offering better trade-offs between reward alignment and divergence from the original data distribution.

What Problem Does This Paper Address?

Diffusion models have shown remarkable capabilities in generating diverse and high-quality data, such as images, videos, and audio. However, a critical challenge arises when we need these models to produce outputs that satisfy specific user-defined criteria or objectives, like aesthetic appeal or adherence to a text prompt. While existing methods for guiding diffusion models at inference time exist, they often fall into two categories: sampling-based methods that explore many possibilities and select the best, which is computationally expensive, or gradient-based methods that use gradients to steer generation, which can be less flexible or require differentiable reward functions. This paper addresses the need for a more efficient and flexible inference-time guidance method that combines the strengths of both approaches.

Methods

UniCoDe's core innovation lies in its unified approach to inference-time guidance. It integrates blockwise gradient guidance with blockwise sampling.

  • Blockwise Gradient Guidance: This technique uses gradient information derived from a reward model to nudge the diffusion process towards more desirable outputs. Unlike traditional gradient-based methods that might apply gradients to every step or sample, UniCoDe applies them in blocks, allowing for more localized control. The paper leverages the score-based formulation of diffusion models, where the gradient of the log-probability of the data can be combined with the gradient of the reward function to guide the generation.
  • Blockwise Sampling: This component builds upon the idea of exploring multiple candidate trajectories (streams) simultaneously. After gradients are applied within a block, UniCoDe employs a scheduled multinomial sampling strategy. This is a departure from greedy sampling, allowing the model to consider a wider range of promising paths and control the exploration-exploitation trade-off using a temperature parameter. The "scheduled" aspect refers to allocating more sampling budget to steps where the reward signal is expected to be most significant.
  • Extensions: UniCoDe also explores additional enhancements like clustering-based guidance to reduce the computational overhead of applying gradients to numerous samples by grouping similar ones. Furthermore, it demonstrates the ability to handle non-differentiable rewards using zero-order optimization.

Datasets

The paper evaluates UniCoDe on various tasks and reward models. The primary diffusion model used is Stable Diffusion v1.5, a text-conditioned latent diffusion model trained on the LAION-5439 dataset. For evaluation, they utilize prompts and reference images from datasets like ImageNet (for aesthetic evaluation) and HPDv2 (for text-to-image prompts).

Key Insights and Ideas

  • Unification is Key: The most significant insight is that combining sampling and gradient-based guidance is not just additive but synergistic. UniCoDe effectively mitigates the sampling inefficiency of pure sampling methods by using gradients to steer the process, while retaining the flexibility of sampling.
  • Efficiency Gains: By integrating gradients into the sampling blocks, UniCoDe significantly reduces the number of samples needed for high-quality, aligned generation, leading to substantial speedups compared to purely sampling-based methods.
  • Balancing Act: UniCoDe demonstrates a superior ability to balance reward alignment with divergence from the unconditional prior. This means it can achieve desired outcomes without drastically deviating from the natural data distribution, avoiding issues like "reward hacking."
  • Adaptability: The framework's modularity allows it to work with various reward models, including aesthetic scorers and pickscore, and even non-differentiable rewards, showcasing its versatility.

Key Results

UniCoDe consistently outperforms baseline methods like CoDe (a sampling-based approach) in terms of efficiency and reward quality across different guidance scenarios.

  • Aesthetic Guidance: UniCoDe achieves significantly higher aesthetic rewards (e.g., 1.60 vs. 1.08 for CoDe4) while taking roughly 4-5 times less time.
  • Pickscore Guidance (Text-to-Image): It improves efficiency by 3-4x, enhances prompt alignment (higher pickscore and T-CLIP), and better preserves the prior distribution (lower CMMD).
  • Multi-Reward: UniCoDe consistently achieves higher scores for both aesthetic quality and prompt adherence in multi-reward settings, optimizing both objectives simultaneously.
  • Text-and-Image-to-Image ((T+I)2I): UniCoDe balances prompt adherence and style transfer effectively, performing slightly better visually than CoDe while operating at nearly twice the speed.

Qualitative results (Figure 3, 4, 7) show UniCoDe producing visually pleasing and prompt-adherent images across various complex scenarios.

Limitations and Future Work

  • Non-Differentiable Rewards: While UniCoDe can handle non-differentiable rewards, the efficiency gains are diminished due to the high computational cost of noisy gradient estimation. For such scenarios, purely sampling-based methods like CoDe are noted as more practical.
  • Inference Speed: Despite improvements, slow inference remains a bottleneck for diffusion models. Future work could focus on narrowing the gap with unconditional diffusion speeds.
  • Dynamic Scheduling and Adaptive Sampling: The authors suggest exploring dynamic temperature scheduling and adaptive particle allocation during sampling to improve generalization and efficiency across a wider range of tasks.
  • Surrogate Models for Non-Differentiable Rewards: For non-differentiable rewards, training-based gradient approximations using surrogate models could potentially extend efficiency gains to these challenging scenarios.

Summary updated

BibTeX
@inproceedings{goyal2026unified,
  author = {Maurya Goyal and Anuj Singh and Hadi Jamali-Rad},
  title = {{Unified Control for Inference-Time Guidance of Denoising Diffusion Models}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2026},
}
Figure