Abstract
The Energy-Based Model (EBM) framework is a very general approach to generative modeling that tries to learn and exploit probability distributions only defined through unnormalized scores. It has risen in popularity recently thanks to the impressive results obtained in image generation by parameterizing the distribution with Convolutional Neural Networks (CNN). However, the motivation and theoretical foundations behind modern EBMs are often absent from recent papers and this sometimes results in some confusion. In particular, the theoretical justifications behind the popular MCMC-based learning algorithm Contrastive Divergence (CD) are often glossed over and we find that this leads to theoretical errors in recent influential papers (Du & Mordatch, 2019; Du et al., 2020). After offering a first-principles introduction of MCMC-based training, we argue that the learning algorithm they use can in fact not be described as CD and reinterpret their methods in light of a new interpretation. Finally, we discuss the implications of our new interpretation and provide some illustrative experiments.
Introduction
Energy-Based Models (EBMs) are a powerful class of generative models that define a probability distribution through an unnormalized "energy" function. To train them, the objective is typically to decrease the energy of real data (positive phase) and increase the energy of samples generated by the model (negative phase). This process effectively shapes the energy landscape to have deep wells at data points and high peaks elsewhere.
However, this paper identifies a theoretical "identity crisis" in modern EBM research. It reveals that recent high-profile studies claiming to use Contrastive Divergence (CD) are actually performing Maximum Likelihood (NLL) training. Furthermore, it explains why a mathematical error in those papers—a "doubly wrong" auxiliary loss—actually turned out to be a beneficial feature for model stability.
Methods and Theoretical Re-classification
The authors perform a "first-principles" audit of modern EBM training, focusing on the distinction between CD and NLL.
Key components of their analysis include:
- Theoretical Re-classification: The authors demonstrate that using a persistent reservoir of samples initialized with noise is fundamentally Maximum Likelihood (NLL) training, not CD. In true CD, sampling starts from real data points to prevent the model from "wandering away" locally. In NLL, the goal is for samples to represent the model's global distribution, requiring chains that explore the entire space.
- The "Doubly Wrong" Loss Analysis: They dissect an auxiliary loss introduced by Du et al. (2020) intended to estimate a KL-divergence term. They find a sign error in the original derivation. However, by flipping the sign, the original authors accidentally created a loss that minimizes the energy of samples while maximizing their entropy (diversity). This "error" helps the negative phase converge to the true model distribution, which is exactly what NLL requires for stability.
- Langevin Sampling: The study analyzes Langevin dynamics—a noisy gradient descent on the energy landscape—as the primary mechanism for generating samples during training.
Key Insights and the Energy Landscape
The distinction between CD and NLL is more than semantic; it fundamentally changes how the model perceives the data manifold.
- Spurious Minima: Without global exploration (provided by NLL's noise-initialized chains), EBMs develop "spurious minima"—regions far from real data that the model mistakenly assigns very low energy (high probability). If trained only with CD, the model learns to erect "mountains" around the data but never explores the vast "empty" spaces, leading to failure when generating from random noise.
- The Power of Data Augmentation: One of the most effective techniques identified was using data augmentation (like elastic deformations) during the sampling process. This acts as a "teleportation" mechanism, allowing MCMC chains to jump across high-energy barriers that Langevin dynamics would normally be unable to traverse.
- Feature Overlap: The authors observed a "funnel" effect where models often collapse to specific modes (like the digit '9') because they share visual features with many other classes, causing the CNN to implicitly lower their energy during the training of other digits.
Experimental Results
Using the MNIST dataset for clear visualization, the authors confirmed several theoretical predictions:
- True CD Failure: Models trained with "true" CD could maintain a data point if initialized there but failed to generate sensible digits when starting from random noise.
- NLL Superiority: Training within the NLL framework (using noise-initialized buffers) resulted in a significantly better global energy landscape.
- Mixing Improvements: Incorporating data augmentation during training significantly reduced the "inescapable deep hole" problem, where sampling chains get trapped in a single mode (e.g., always generating the digit '1').
Conclusion and Future Work
While modern EBMs show great promise, Langevin sampling in pixel space remains fundamentally limited by slow mixing in high-dimensional spaces. The authors suggest that future research should move toward sampling in latent spaces where relationships are lower-dimensional, developing symmetry-aware transitions, or exploring alternative frameworks like GFlowNets to generate diverse samples without the pitfalls of traditional MCMC.
Summary updated