Constrained Diffusion with Trust Sampling

William Huang, Yifeng Jiang, Tom Van Wouwe, Karen Liu

Abstract

Diffusion models have emerged as a dominant paradigm in generative AI, yet steering these models to satisfy precise, fine-grained constraints remains a significant challenge. Traditional loss-guided diffusion methods often struggle to balance constraint satisfaction with generative quality, frequently resulting in unnatural artifacts or failed constraints. This paper introduces Trust Sampling, a training-free framework that treats each diffusion step as an iterative optimization problem. By utilizing "trust schedules" to modulate optimization intensity and monitoring predicted noise to maintain manifold consistency, Trust Sampling achieves state-of-the-art performance across image restoration and 3D human motion generation tasks.

Introduction

While diffusion models excel at unconstrained generation, many real-world applications require adherence to specific conditions, such as obstacle avoidance in robotics or high-fidelity reconstruction in medical imaging. The standard approach, known as loss-guided diffusion, typically alternates between a denoising step and a single gradient step toward a constraint. However, this "one-step" approach is often insufficient for complex tasks. Excessive optimization can push the sample away from the learned data manifold, while insufficient optimization fails to meet the constraint. Trust Sampling addresses this tension by providing a principled way to perform multiple optimization iterations at each timestep without sacrificing sample realism.

Methodology

Trust Sampling reframes the guided diffusion process as a series of independent optimization problems. The method introduces two primary mechanisms to ensure both constraint satisfaction and manifold adherence:

1. Trust Schedules

Rather than applying a fixed number of gradient steps, Trust Sampling employs a "trust schedule" (typically a linear function) to determine the maximum allowable optimization iterations at any given timestep. This approach is rooted in the mathematical insight that the error of a "proxy" constraint function is bounded by the variance of the diffusion process. In the early stages of generation, where variance is high and the image is mostly noise, the proxy is less reliable, and fewer steps are taken. As the structure emerges and variance decreases, the algorithm "trusts" the proxy more, allowing for more intensive optimization.

2. State Manifold Boundaries

To prevent the optimization process from generating "garbage" artifacts, the authors monitor the model's predicted noise ($\epsilon_\theta$). This value serves as a guardrail; if the magnitude of the noise exceeds a predefined threshold ($\epsilon_{max}$), it indicates that the sample is wandering too far from the manifold of valid data. When this threshold is reached, the optimization loop terminates early for that timestep, effectively keeping the generation within "legal" boundaries.

Because Trust Sampling is training-free, it can be integrated into any existing pre-trained diffusion model without the need for expensive fine-tuning.

Experimental Setup

The researchers evaluated Trust Sampling across two distinct domains to demonstrate its versatility:

  • Image Restoration: Using the FFHQ (faces) and ImageNet (general objects) datasets, the method was tested on 4x super-resolution, box inpainting, and Gaussian deblurring.
  • 3D Human Motion: Using the AMASS dataset, the method was applied to complex tasks such as root trajectory tracking, hand/foot tracking, and obstacle avoidance (e.g., jumping over specific heights).

Key Results

Trust Sampling demonstrated significant improvements over existing baselines like Diffusion Posterior Sampling (DPS):

  • Superior Realism: On the FFHQ dataset for super-resolution, Trust Sampling achieved an FID of 16.99, a substantial improvement over the previous state-of-the-art FID of 29.48.
  • Perceptual Accuracy: In ImageNet evaluations, the method showed marked improvements in LPIPS (Learned Perceptual Image Patch Similarity), particularly in challenging deblurring and inpainting scenarios.
  • Motion Precision: In 3D motion tasks, Trust Sampling successfully satisfied difficult physical constraints—such as avoiding spheres or reaching specific targets—that caused competing methods to either fail the constraint or produce physically impossible, "glitchy" movements.
  • Computational Efficiency: By utilizing manifold boundaries to terminate optimization early, the method reduced the number of neural function evaluations (NFEs) by 10–20% without a loss in quality.

Discussion and Future Work

The success of Trust Sampling highlights the limitations of the "single-step" paradigm in guided diffusion. By treating guidance as a controlled, iterative optimization process, the method provides a more robust framework for constrained generation.

However, the approach currently relies on some manual tuning of the trust schedule's start and end points for different base models. Future research will focus on automating these heuristic parameters. Additionally, the authors suggest that moving beyond first-order gradients to incorporate higher-order derivatives or advanced numerical optimization techniques (such as line searches) could further enhance the speed and precision of the guidance process.

Summary updated

BibTeX
@inproceedings{huang2024constrained,
  author = {William Huang and Yifeng Jiang and Tom Van Wouwe and Karen Liu},
  title = {{Constrained Diffusion with Trust Sampling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=dJUb9XRoZI},
}
Figure