Learning Energy-Based Prior Model with Diffusion-Amortized MCMC

Peiyu Yu, Yaxuan Zhu, Sirui Xie, Xiaojian Ma, Ruiqi Gao, Song-Chun Zhu, Ying Nian Wu

Overview

This paper introduces Diffusion-Amortized MCMC (DAMC), a novel framework that uses diffusion models to "shortcut" the computationally expensive process of sampling from complex latent energy-based models. By training a lightweight diffusion model to approximate long-run MCMC chains, the authors achieve significantly more stable training and higher-quality image generation compared to traditional short-run MCMC methods.

The Problem with Latent-Space EBMs

Generative modeling often relies on Deep Latent Variable Models (DLVMs), where high-dimensional data (like images) is generated from low-dimensional latent variables. While many models use a simple Gaussian prior for these latents, Latent-space Energy-Based Models (LEBMs) offer a much more powerful and flexible alternative.

However, LEBMs have a major Achilles' heel: training them requires sampling from the prior and posterior distributions using Markov Chain Monte Carlo (MCMC), specifically Langevin Dynamics. In practice, researchers use "short-run" MCMC (just a few steps) because long chains are computationally prohibitive. Unfortunately, this shortcut leads to biased gradients, "malformed" energy landscapes, and poor generation quality, especially when the target distribution is highly multi-modal (i.e., has many distinct "peaks").

Methods: Diffusion-Amortized MCMC

The authors propose DAMC, which shifts the burden of long-run MCMC onto a learned "amortized" sampler.

Graphical model of the Diffusion-Amortized MCMC (DAMC) framework.
  1. Diffusion-Based Amortization: Inspired by the mathematical connection between MCMC and denoising diffusion, the authors use a Denoising Diffusion Probabilistic Model (DDPM) to learn the transition kernels of the MCMC process.
  2. Iterative Distillation: Instead of running a massive MCMC chain every time, the algorithm breaks the long-run chain into affordable short segments. These segments are then "distilled" into the diffusion-based sampler.
  3. Symbiotic Learning: The training process alternates between two steps:
  4. M-step: Update the LEBM parameters (the energy function) using samples provided by the current DAMC sampler.
  5. Amortization Step: Update the DDPM sampler to better approximate the updated LEBM's distribution.

Crucially, because this diffusion process happens in the latent space (which is low-dimensional) rather than the pixel space, the added computational overhead is minimal.

Key Insights

  • MCMC as a Fixed Point Update: The authors view MCMC not just as a sampling tool, but as a sequence of distributions that can be modeled. By treating the MCMC transition as a target for a diffusion model, they turn a sequential sampling problem into a learning problem.
  • The "Valid Sampler" Proof: A key theoretical contribution is proving that this amortized sampler is a valid long-run MCMC sampler. This provides a rigorous foundation for why "jumping" with a diffusion model works as well as (or better than) walking step-by-step with Langevin Dynamics.
  • Latent Space Efficiency: By performing diffusion in the latent space, the authors get the "expressive power" of diffusion models without the massive memory and time requirements of pixel-space diffusion. The DDPM used here only accounts for about 10% of the total model parameters.

Key Results

The model was evaluated on several standard image modeling benchmarks, including SVHN, CIFAR-10, CelebA, and CelebA-HQ. The DAMC approach consistently outperformed both variational methods (like VAEs) and traditional MCMC-based LEBMs.

Qualitative image generation results across SVHN, CelebA, CIFAR-10, and CelebA-HQ datasets.
  • Generation Quality: On the CelebA-HQ (256x256) dataset, DAMC achieved a FID score of 85.88, a massive improvement over the vanilla LEBM's 133.07.
  • GAN Inversion: In high-dimensional settings (FFHQ and LSUN-Tower), DAMC showed superior ability to recover latent codes that faithfully reconstruct unseen images, outperforming previous optimization-based and encoder-based methods.
  • Anomaly Detection: On MNIST, the model achieved state-of-the-art AUPRC scores (e.g., 0.939 for digit '5'), significantly better than previous energy-based and variational counterparts.
  • Stability: Qualitative results show that DAMC avoids the "oversaturation" and mode-collapse issues that typically plague long-run Langevin transitions in poorly trained EBMs.

Limitations and Future Work

  • Parameter Overhead: While the latent DDPM is "lightweight," it still introduces extra parameters and a separate training objective, which increases overall model complexity.
  • Training Time: Although sampling is fast, the training process is slower than simple VAEs because it still involves running short MCMC segments to provide targets for the diffusion model. The authors note that training takes about 15.2 minutes per epoch on CIFAR-10, compared to 14.8 for standard LEBMs and 5.5 for VAEs.
  • Future Directions: The authors suggest that this "diffusion-amortization" framework could be applied to any problem involving unnormalized continuous densities, potentially extending beyond latent variable models to fields like physics or chemistry.

Summary updated

BibTeX
@inproceedings{yu2023learning,
  author = {Peiyu Yu and Yaxuan Zhu and Sirui Xie and Xiaojian Ma and Ruiqi Gao and Song-Chun Zhu and Ying Nian Wu},
  title = {{Learning Energy-Based Prior Model with Diffusion-Amortized MCMC}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=fKQEmHoLb6},
}
Figure