On the Anatomy of MCMC-based Maximum Likelihood Learning of Energy-Based Models

Erik Nijkamp, Mitch Hill, Tian Han, Song-Chun Zhu, Ying Nian Wu

Abstract

This study investigates the effects of Markov chain Monte Carlo (MCMC) sampling in unsupervised Maximum Likelihood (ML) learning. Our attention is restricted to the family of unnormalized probability densities for which the negative log density (or energy function) is a ConvNet. We find that many of the techniques used to stabilize training in previous studies are not necessary. ML learning with a ConvNet potential requires only a few hyper-parameters and no regularization. Using this minimal framework, we identify a variety of ML learning outcomes that depend solely on the implementation of MCMC sampling. On one hand, we show that it is easy to train an energy-based model which can sample realistic images with short-run Langevin. ML can be effective and stable even when MCMC samples have much higher energy than true steady-state samples throughout training. Based on this insight, we introduce an ML method with purely noise-initialized MCMC, high-quality short-run synthesis, and the same budget as ML with informative MCMC initialization such as CD or PCD. Unlike previous models, our energy model can obtain realistic high-diversity samples from a noise signal after training. On the other hand, ConvNet potentials learned with non-convergent MCMC do not have a valid steady-state and cannot be considered approximate unnormalized densities of the training data because long-run MCMC samples differ greatly from observed images. We show that it is much harder to train a ConvNet potential to learn a steady-state over realistic images. To our knowledge, long-run MCMC samples of all previous models lose the realism of short-run samples. With correct tuning of Langevin noise, we train the first ConvNet potentials for which long-run and steady-state MCMC samples are realistic images.

Introduction: The Challenge of MCMC in EBMs

Energy-Based Models (EBMs) define a probability distribution through an unnormalized energy function, typically parameterized by a ConvNet. Training these models via Maximum Likelihood (ML) requires comparing real data samples with "negative" samples generated from the model. Since the model's distribution is intractable, researchers rely on Markov Chain Monte Carlo (MCMC) methods, such as Langevin Dynamics, to produce these samples.

A long-standing issue in the field is the discrepancy between "short-run" and "long-run" performance. While EBMs can often generate realistic images after a few MCMC steps, these samples frequently degrade into "oversaturated" or "garbage" patterns if the chain is allowed to run to its steady state. This suggests that the learned energy function does not truly represent a valid probability density of the training data. This study deconstructs the learning process to identify why this happens and how to achieve stable, convergent training.

Methodology

The authors employ a minimalist framework, using a standard ConvNet as the energy potential $U(x; \theta)$ without common stabilizing techniques like batch normalization or heavy regularization. Their analysis focuses on varying three key components of the ML learning algorithm:

  1. MCMC Initialization: Comparing informative initialization (starting from real data or previous samples) against pure noise initialization.
  2. MCMC Duration: Evaluating the difference between short-run and long-run sampling regimes.
  3. Langevin Noise ($\epsilon$): Tuning the balance between the energy gradient and random walk noise.

The Two Axes of Learning

The research identifies two fundamental dimensions that govern the stability and outcome of EBM training.

The two axes of EBM training: Energy Difference and MCMC Convergence.

The first axis is Energy Difference, which describes the oscillation between expansion (pushing samples away from data) and contraction (pulling them toward data). The second axis is MCMC Convergence, which distinguishes between models that only produce realistic samples in the short run and those that maintain realism at their steady state.

A key insight is that "short-run synthesis" is relatively easy to achieve. One can train an EBM to generate high-quality images from noise in approximately 100 steps without the model ever reaching a steady state. However, in this non-convergent regime, the energy function often contains "holes"—regions of infinitely low energy—meaning it is not a valid density.

Convergent ML and Realistic Steady-States

The study's most significant contribution is the "Convergent ML" recipe. By precisely tuning the Langevin noise ($\epsilon$), the authors successfully trained ConvNet potentials where long-run MCMC samples remain realistic.

Convergent ML: Energy stabilizes and samples remain realistic over long MCMC runs.

If the Langevin noise is too low, the model collapses to a flat solution. When correctly tuned, the gradient learns to balance the noise, creating a stable energy landscape. This allows for the first EBMs where steady-state samples (after $L \approx 500$ steps with persistent initialization) do not lose the realism of short-run samples. Furthermore, the authors demonstrate that informative initialization is not a necessity; training from pure noise is possible and results in high sample diversity.

Conclusion

This work provides a clear anatomy of the EBM training process, moving beyond "black-box" stabilization tricks. While achieving a true steady state is computationally more expensive—sometimes requiring tens of thousands of MCMC steps—it results in a more robust model that partitions the image space into meaningful basins of attraction. Future work will likely explore the utility of these convergent landscapes for unsupervised clustering and more reliable generative modeling.

Summary updated

Abstract

This study investigates the effects of Markov chain Monte Carlo (MCMC) sampling in unsupervised Maximum Likelihood (ML) learning. Our attention is restricted to the family of unnormalized probability densities for which the negative log density (or energy function) is a ConvNet. We find that many of the techniques used to stabilize training in previous studies are not necessary. ML learning with a ConvNet potential requires only a few hyper-parameters and no regularization. Using this minimal framework, we identify a variety of ML learning outcomes that depend solely on the implementation of MCMC sampling. On one hand, we show that it is easy to train an energy-based model which can sample realistic images with short-run Langevin. ML can be effective and stable even when MCMC samples have much higher energy than true steady-state samples throughout training. Based on this insight, we introduce an ML method with purely noise-initialized MCMC, high-quality short-run synthesis, and the same budget as ML with informative MCMC initialization such as CD or PCD. Unlike previous models, our energy model can obtain realistic high-diversity samples from a noise signal after training. On the other hand, ConvNet potentials learned with non-convergent MCMC do not have a valid steady-state and cannot be considered approximate unnormalized densities of the training data because long-run MCMC samples differ greatly from observed images. We show that it is much harder to train a ConvNet potential to learn a steady-state over realistic images. To our knowledge, long-run MCMC samples of all previous models lose the realism of short-run samples. With correct tuning of Langevin noise, we train the first ConvNet potentials for which long-run and steady-state MCMC samples are realistic images.
BibTeX
@inproceedings{nijkamp2020anatomy,
  author = {Erik Nijkamp and Mitch Hill and Tian Han and Song-Chun Zhu and Ying Nian Wu},
  title = {{On the Anatomy of MCMC-based Maximum Likelihood Learning of Energy-Based Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i04.5973},
}
Figure