Training-Free Diffusion Model Alignment with Sampling Demons

Po-Hung Yeh, Kuang-Huei Lee, Jun-cheng Chen

Introduction

Aligning diffusion models with human preferences is a critical challenge in generative AI. Existing methods typically require either computationally expensive retraining (like Reinforcement Learning from Human Feedback, or RLHF) or rely on gradient guidance, which strictly limits users to differentiable reward functions.

Researchers have recently introduced Demon, a novel stochastic optimization approach. It is the first inference-time, backpropagation-free method designed to align diffusion models with human preferences. By "steering" the denoising process at every step, Demon allows models to be guided by non-differentiable reward sources—such as human feedback or proprietary Visual-Language Model (VLM) APIs—without any expensive retraining or fine-tuning.

The Alignment Bottleneck

While diffusion models like Stable Diffusion are incredibly powerful, their raw outputs often fail to align with specific user intents or aesthetic preferences. To correct this, the field generally relies on two paradigms:

  1. Retraining/Fine-tuning: Baking preferences directly into the model weights using RLHF. This is a massive, slow, and computationally heavy undertaking.
  2. Gradient Guidance: Using a differentiable "reward model" to calculate gradients that nudge the generation process toward higher rewards. While faster than retraining, it strictly requires the reward function to be mathematically differentiable.

This creates a significant bottleneck: what if your reward source is a "black box"? If a user wants to use the GPT-4o API to judge image quality, or rely on a human clicking their favorite intermediate step, gradients cannot be calculated. The authors tackle this non-differentiable limitation, enabling alignment with virtually any reward source precisely at the moment of generation.

The "Demon" Methodology

The authors name their method Demon, drawing a metaphor from Maxwell’s Demon—a theoretical entity in physics that manipulates particles to decrease entropy. In this context, the "Demon" manipulates the noise distribution during the diffusion process to concentrate density on high-reward regions.

Overview of the Demon sampling process

The core algorithm operates in a loop at each denoising step:

  • Sample & Predict: At time step $t$, the model draws $K$ different random noise samples. For each sample, it uses a fast "shortcut"—either a Probability Flow ODE or a Consistency Model (CM)—to predict what the final, clean image would look like.
  • Score: These predicted clean images are sent to a reward source (e.g., an aesthetics predictor, a VLM API, or a human judge).
  • Synthesize: Instead of simply selecting the single best sample, Demon uses stochastic optimization to combine these $K$ noises into one "optimal" noise vector ($z^*$).

The authors propose two primary variants of this approach:

  • Tanh Demon: This variant intuitively "flips" bad noise samples (those yielding below-average rewards) into positive directions and up-weights high-performing ones using a hyperbolic tangent function.
  • Boltzmann Demon: This variant uses a softmax-style weighting mechanism to prioritize the noise samples that lead to the highest rewards.
Visualization of the Tanh Demon manipulating noise vectors

Crucially, because this optimization happens via sampling and weighting rather than backpropagation, the reward function does not need to be differentiable.

Key Insights and Results

The Power of the "Shortcut"

A major insight of the paper is that one does not need to run the full diffusion process to score a noise sample. By utilizing Consistency Models, the authors can estimate the final reward of a noisy state in a single step, making the Demon algorithm computationally feasible at inference time.

Freedom from Backpropagation

By removing the requirement for gradients, the authors successfully integrated Google Gemini Pro/Flash and OpenAI GPT-4 Turbo/4o as "judges" during the actual generation process. The VLMs were assigned specific personas (e.g., "You are a journalist") and asked to pick the best intermediate image. In experiments, 14 out of 16 generated images showed better alignment with these specific persona prompts than the baseline.

Human-in-the-Loop Generation

The authors also demonstrated a user interface where a human could guide the diffusion process in real-time by selecting preferred intermediate images. This resulted in final outputs that closely matched a target reference, proving the viability of human-driven, step-by-step alignment.

Superior Aesthetics and Efficiency

Evaluated on standard benchmarks using models like Stable Diffusion (v1.4, v1.5) and SDXL, the results were striking:

  • On SDXL, the Tanh Demon achieved an average aesthetics score of 8.57, significantly outperforming the "Best-of-N" random sampling baseline (~7.0) and standard SDXL (~5.4).
  • The Tanh-C variant (which leverages Consistency Models) achieved high reward scores with a massive reduction in execution time compared to traditional gradient-based methods like DOODL.
  • The paper also provides a mathematical proof showing that under certain conditions (when the reward function is "near harmonic"), the Tanh Demon is theoretically guaranteed to improve the final reward compared to standard sampling.

Limitations and Future Directions

While highly effective, the Demon approach is not without limitations.

First, there is a computational overhead. Even with Consistency Models, evaluating $K$ samples at each step is inherently more expensive than a standard single-pass generation. Second, the method relies heavily on reward fidelity. If the ODE/CM prediction of the clean image diverges significantly from the actual final result, the Demon might steer the generation in the wrong direction.

To address this, the authors suggest future work could focus on training dedicated, high-fidelity distilled models specifically for reward estimation. This would help close the "fidelity gap" and further improve the speed and accuracy of inference-time alignment.

Summary updated

BibTeX
@inproceedings{yeh2025training,
  author = {Po-Hung Yeh and Kuang-Huei Lee and Jun-cheng Chen},
  title = {{Training-Free Diffusion Model Alignment with Sampling Demons}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=tfemquulED},
}
Figure