Loss-Guided Diffusion Models for Plug-and-Play Controllable Generation

Jiaming Song, Qinsheng Zhang, Hongxu Yin, Morteza Mardani, Ming-Yu Liu, Jan Kautz, Yongxin Chen, Arash VahdatICML 2023

Introduction

Diffusion models are renowned for generating high-quality data, but steering them toward specific, complex requirements—like making a generated avatar walk around an obstacle—traditionally requires expensive retraining or massive datasets of paired data.

This paper introduces Loss-Guided Diffusion (LGD), a framework that allows users to control pre-trained diffusion models using any differentiable loss function without any extra training. By replacing the biased "point-estimate" approximations used in previous methods with a more robust Monte Carlo sampling approach, LGD achieves significantly better control in tasks ranging from image super-resolution to complex human motion synthesis.

The Challenge of Plug-and-Play Guidance

"Plug-and-play" methods aim to use a pre-trained model as a prior and guide it with a loss function at inference time. However, there is a significant mathematical hurdle: the "guidance term" needed to steer the diffusion process is an intractable integral.

Current state-of-the-art methods, such as Diffusion Posterior Sampling (DPS), simplify this by using a single "point estimate." They essentially guess the final clean image and calculate the gradient from that single point. The authors demonstrate that this simplification leads to massive errors. Specifically, the guidance becomes far too strong when the image is very noisy and too weak when the noise is low. This "scale mismatch" makes it incredibly difficult to solve complex, non-linear constraints.

Overview of the Loss-Guided Diffusion framework demonstrating how plug-and-play losses guide diffusion priors to achieve controllable generation.

The LGD-MC Approach

To overcome these limitations, the authors propose LGD-MC (Loss-Guided Diffusion via Monte Carlo). Instead of relying on a single point estimate (a delta distribution), LGD-MC approximates the guidance integral using multiple samples from a smoother Gaussian distribution centered around the model's current best guess.

The core innovations include:

  1. Smoother Distribution: Replacing the "hard" point estimate with a Gaussian distribution reduces approximation bias, providing a much more accurate gradient for guidance.
  2. Monte Carlo Integration: The method draws multiple samples from this distribution, evaluates the loss for each, and aggregates the results.
  3. Computational Efficiency: Crucially, the heavy diffusion neural network is only called once per step. The multiple samples are only used to evaluate the loss function, which is typically computationally cheap. This delivers vastly improved guidance with almost no extra cost.

Key Insights and Results

The researchers evaluated LGD-MC across several domains, including synthetic data, ImageNet for image generation, and HumanML3D for motion synthesis.

  • Overcoming the Scale Problem: By proving that a point estimate is "too far" from the ideal distribution, the paper explains why previous methods fail to balance constraint adherence with realism. LGD-MC's "good enough" Gaussian approximation is sufficient to dramatically stabilize this scale.
  • Image Super-resolution: On ImageNet (256x256), LGD-MC achieved an impressive FID of 5.21 compared to 74.11 for DPS when using 100 sampling steps, highlighting its stability at lower step counts.
  • Label and Text Conditioning: When guiding an unconditional ImageNet model, LGD-MC maintained a better balance between image quality and label adherence than traditional Classifier Guidance. It also successfully applied CLIP losses to generate stylized images.
LGD successfully guiding a 3D human avatar to avoid a red spherical obstacle, a complex non-linear constraint where baseline methods fail.
  • Complex Motion Synthesis: Because LGD only requires a differentiable loss function, it can force a text-to-motion model to follow specific geometric paths. In obstacle avoidance tasks, LGD-MC successfully steered avatars around barriers that caused baseline models to collide, reducing the objective loss by nearly 10x.

Limitations and Future Work

While highly effective, the authors acknowledge that the Gaussian assumption for the sampling distribution remains a simplification. In scenarios where the "clean" data distribution is exceptionally complex, this assumption might still yield inaccuracies.

Furthermore, like all plug-and-play methods, LGD-MC is fundamentally limited by the knowledge embedded in the pre-trained prior. If tasked with generating something entirely outside its training distribution, the model will likely fail. Future work may explore more sophisticated sampling techniques, such as annealed importance sampling, to further refine the guidance term and expand the boundaries of training-free controllable generation.

Summary updated

BibTeX
@inproceedings{song2023loss,
  author = {Jiaming Song and Qinsheng Zhang and Hongxu Yin and Morteza Mardani and Ming-Yu Liu and Jan Kautz and Yongxin Chen and Arash Vahdat},
  title = {{Loss-Guided Diffusion Models for Plug-and-Play Controllable Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=JzZ2xAvCs8},
}
Figure