Learning to Sample From Diffusion Models via Inverse Reinforcement Learning

Constant Bourdrez, Alexandre Verine, Olivier Cappé

TL;DR

Training a massive diffusion model is only half the battle; figuring out how to sample from it at inference time often requires a brute-force hyperparameter grid search that can burn more compute than training the model itself. This paper replaces that tedious manual tuning with a lightweight policy network trained via Inverse Reinforcement Learning (IRL). By dynamically steering the denoising trajectory on the fly—without ever touching the frozen diffusion weights—this learned controller matches or beats hand-tuned samplers at a tiny fraction of the optimization cost.

What Problem Does This Paper Address?

Imagine you have a world-class orchestra (a pretrained diffusion denoiser), but no conductor. Even with the neural network frozen, generating crisp, diverse images requires tuning the sampling algorithm itself: how hard to push classifier-free guidance ($\omega$), when to inject extra noise ($\gamma_{\text{EDM}}$), or when to backtrack and "renoise" a sample to fix mistakes.

In practice, researchers find these sampling schedules via empirical grid search. Because evaluating just one hyperparameter combo requires generating tens of thousands of images to compute quality metrics (like FID), the compute cost explodes exponentially. On ImageNet-64, for instance, a 3-hyperparameter grid search for the popular EDM framework can devour up to 2,869 ExaFLOPs—nearly double the 1,645 ExaFLOPs spent training the denoiser in the first place! Worse yet, standard grid searches yield rigid, one-size-fits-all schedules rather than adapting to individual images as they form.

Methods

The authors reframe diffusion sampling as a sequential decision-making problem—specifically, a discrete-time Markov Decision Process (MDP). At each denoising step, the "state" is the current noisy image and its noise level $(x_t, \sigma_t)$, and the "action" is a discrete tweak to the sampler (e.g., picking a guidance scale, choosing how much noise to inject, or jumping back to an earlier noise level).

How do you train this policy without an explicit per-step reward function or ground-truth "expert" actions? The authors turn to state-only Inverse Reinforcement Learning (IRL):

  • State-Occupancy Matching: We may not know the ideal sequence of actions, but we do know what the data distribution looks like at any noise level—you just take real dataset images and add Gaussian noise. The goal is to make the distribution of states visited by the sampler match these target noisy marginals.
  • Direct Policy Gradients via $f$-Divergences: Rather than learning an intermediate reward model (which is notoriously finicky), the authors derive a policy gradient theorem that directly minimizes an $f$-divergence (like KL or Reverse-KL) between the expert and policy state distributions.
  • Practical Stabilization: To estimate the density ratio between real noisy images and policy-generated ones, they co-train a discriminator alongside the policy (built atop a frozen, pretrained ADM feature encoder) and stabilize updates using PPO-style clipping.
Figure 1: Learned sampling policies adapt trajectories at inference time. We compare trajectories from a standard guided diffusion sampler with trajectories produced by policies that learn guidance scales, renoising decisions, or stochasticity injection. All trajectories use the same pretrained denoiser; only the inference-time control policy changes. Frame colors indicate the selected action along the trajectory, showing that the learned sampler intervenes selectively rather than applying a fixed global schedule. These state-dependent controls adapt the sampler without denoiser retraining and reduce the need for manual hyperparameter tuning.

Datasets

The framework is evaluated on four standard image generation benchmarks using pretrained pixel-space EDM models and latent-space EDM2 models:

  • CIFAR-10 ($32 \times 32$)
  • FFHQ ($64 \times 64$ human faces)
  • ImageNet ($64 \times 64$ and $512 \times 512$)

No new datasets or benchmarks are introduced; the real training images from each dataset (corrupted with Gaussian noise on the fly) serve as the expert state distributions.

Key Insights and Ideas

  • Per-sample adaptivity beats global schedules: Conditioning the policy on the actual image content $(x, \sigma)$ consistently outperforms conditioning on the noise level $(\sigma)$ alone. Remarkably, in conditional generation, the policy implicitly figures out class-relevant structure directly from the noisy pixels, performing nearly as well as when explicitly handed the class label $c$.
  • Policies discover the "speciation phase" automatically: On FFHQ, the learned guidance policy stays quiet most of the time, firing strong guidance selectively at medium-to-low noise levels—the exact dynamical window where high-level object topology crystallizes.
Figure 2: Learned γEDM(x, σ) and ω(x, σ) profiles on FFHQ for different f-divergences. At each noise level, the solid curve is the average value selected by the policy across generated samples, and the shaded band shows the interquartile range (25th–75th percentiles).
  • Divergence choice is a clean dial for Precision vs. Recall: Minimizing forward KL divergence encourages mode-covering behavior, boosting sample diversity (Recall). Minimizing Reverse-KL encourages mode-seeking behavior, sharpening image fidelity (Precision).
  • Plug-and-play policy composition: Independently trained policies (one for guidance, one for stochasticity injection) can be applied simultaneously at inference time without joint retraining, yielding better quality than either policy alone.
  • Stochasticity in the schedule matters: Lowering the policy's sampling temperature at inference time to make its decisions deterministic actually hurts FID, suggesting deterministic hyperparameter schedules are inherently suboptimal.

Key Results

  • Massive tuning savings, modest inference cost: On ImageNet-64, training a single IRL policy costs 160.6 EFLOPs, replacing a $8^3$ 3-hyperparameter grid search (2,869.2 EFLOPs) for an 18$\times$ reduction in compute. At inference time, running the small policy network adds just 15% to 40% FLOPs overhead (only 16% on ImageNet-64)—less than a single extra denoiser evaluation.
  • Matching or beating hand-tuned baselines:
  • Guidance & Stochasticity: On FFHQ, adaptive Reverse-KL stochasticity lowers FID from 2.56 (hand-tuned EDM) to 2.49, while adaptive KL guidance improves FID from 3.11 to 3.03.
  • Zero-shot composition: Combining independently trained guidance and stochasticity policies on CIFAR-10 drops FID from 1.98 (EDM) and 2.07 (EDM+CFG) down to 1.75.
  • Renoising: On ImageNet-64, learned renoising improves FID from 3.01 to 2.92 while slashing the average number of function evaluations (NFE) from 350 down to 52.1.

Limitations and Future Work

The authors note a few practical caveats:

  • Discrete action spaces & initialization: The current setup requires manually discretizing the action space (picking the right number of bins matters) and can be sensitive to how the policy is initialized.
  • Dataset-dependent gains for renoising: While adaptive guidance and noise injection consistently shine, adaptive renoising is a mixed bag—on FFHQ, the standard deterministic EDM sampler remains stronger in FID (2.60 vs. 3.04).
  • Data transferability: The sampler policy is trained on the exact same dataset used to train the denoiser. Whether a learned sampling policy transfers out-of-distribution to unseen datasets remains an open question. Future directions include exploring continuous action spaces, more robust initializations, and scaling to larger foundation models.

Summary updated

Abstract

Diffusion models generate samples through an iterative denoising process guided by a pretrained neural network. Once the denoiser is fixed, the sampling algorithm itself (noise schedules, guidance scales, stochasticity profiles) still requires careful tuning, a process typically carried out through costly empirical grid search. In this work, we introduce an inverse reinforcement learning framework for learning sampling strategies without retraining the denoiser. We formulate the diffusion sampling procedure as a discrete-time finite-horizon Markov Decision Process, where actions correspond to optional modifications of the sampling dynamics. To optimize action scheduling, we avoid defining an explicit reward function and instead directly match the target behavior expected from the sampler using policy gradient techniques. We provide experimental evidence that this approach matches fine-tuned samplers and comes at a modest cost compared to grid search: on ImageNet-64, a single training run replaces exhaustive search at up to $9\times$ lower cost, with only 16\% overhead at inference.
BibTeX
@inproceedings{bourdrez2026learning,
  author = {Constant Bourdrez and Alexandre Verine and Olivier Cappé},
  title = {{Learning to Sample From Diffusion Models via Inverse Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=9RGG0tZyPh},
}
Figure