Explaining the effects of non-convergent sampling in the training of Energy-Based Models

Elisabeth Agoritsas, Giovanni Catania, Aurélien Decelle, Beatriz Seoane · DOI

TL;DR

Training Energy-Based Models (EBMs) with short, non-convergent MCMC runs doesn't actually teach the model the data distribution at equilibrium. Instead, it encodes the data's statistics into a specific dynamical path, meaning the model only "looks" like the data if you sample it for the exact same number of steps used during training.

What Problem Does This Paper Address?

Energy-Based Models (EBMs) are elegant: you define a single energy function, and the probability of a state is inversely proportional to its energy. However, training them is notoriously difficult. To update the model, you need to estimate a gradient that requires sampling from the model itself—a task usually handled by Markov Chain Monte Carlo (MCMC).

In theory, MCMC chains must "mix" (reach equilibrium) to provide an accurate gradient. In practice, this takes forever. Researchers often cut corners by using "short runs"—sampling for just a few steps ($k$) from a random starting point. Surprisingly, this works incredibly well for generating high-quality images, but only if you sample for exactly $k$ steps during inference.

Until now, this was an empirical "trick" without a solid theoretical foundation. This paper provides the first-principles analytical explanation for why this happens and what it means for the learned model.

Methods

The authors move away from the static "equilibrium" view of EBMs and instead treat the sampling process as a dynamical system described by a Master Equation.

  1. Spectral Decomposition: They decompose the probability distribution of the MCMC process into the eigenvectors of the transition matrix. This allows them to track how the distribution evolves from a random start toward equilibrium.
  2. Analytical Proofs: They prove (Theorems 3.1 and 3.2) that if an EBM reaches a training fixed point using $k$ sampling steps, it will perfectly reproduce the target data statistics only when sampled for that same duration $k$ and with the same initialization.
  3. Solvable Models: To see this in action, they derive exact results for two simplified cases:
  4. The Gaussian Model: Using Langevin dynamics, they show how the model's eigenvalues adjust to compensate for the short sampling time.
  5. Mean-Field Boltzmann Machines: They analyze the high-temperature regime of the inverse Ising problem to show the same effect holds for discrete variables.

Datasets

The authors validated their theory using:

  • CIFAR-10: A standard benchmark of 60,000 natural images. They used a Deep Convolutional EBM (ConvNet) to test image generation quality.
  • 2D Ferromagnetic Ising Model: A synthetic physics dataset ($N=49$ spins) where the ground truth is known, allowing for precise measurement of how well the model learns underlying parameters versus just reproducing statistics.

Key Insights and Ideas

  • Models with Memory: EBMs trained with short runs are "models with memory." They don't just learn an energy landscape; they learn to reproduce data through a specific dynamical process. This effectively turns EBMs into a form of diffusion model.
  • The $k'=k$ Phenomenon: The "sweet spot" for generation is not at equilibrium ($k \to \infty$), but exactly at the number of steps used in training. Sampling for longer can actually decrease the quality of the generated samples because the equilibrium measure of the trained model is "wrong"—it has been distorted to make the $k$-step distribution look "right."
FID score on CIFAR-10 showing a clear minimum when the generation time $k'$ matches the training time $k=150$.
  • Generation vs. Inference: There is a major trade-off. While short runs are great for generating realistic samples (like images), they are poor for "interpretive" applications. If you want to use an EBM to understand the physics of a protein or a genome, the energy function learned via short runs will be biased and physically misleading.

Key Results

  • Generation Quality: In the CIFAR-10 experiments, the Frechet Inception Distance (FID)—a measure of image realism—hits a sharp minimum when the sampling time $k'$ matches the training time $k$. As training progresses, this peak becomes more pronounced.
  • Parameter Error: In the Ising model experiments, the authors showed that while the model could reproduce 2-point correlations perfectly at $k'=k$, the actual learned coupling parameters ($J$) were only accurate if $k$ was sufficiently large. Very short runs ($k=1$) led to poor parameter estimation despite producing "good-looking" samples.
Error in covariance matrices for the Ising model, showing the error vanishes exactly at $k'=k$.
  • Stability Threshold: For the Gaussian model, the authors identified a mathematical lower bound for $k$. If you try to train with fewer steps than this threshold, the learning process diverges, leading to "unphysical" solutions where the energy function fails to confine the probability distribution.

Limitations and Future Work

  • Multi-modal Distributions: The authors note that short-run training is particularly risky for datasets with many isolated "modes" (clusters of data). If the MCMC chain can't jump between these clusters during the short training run, the model will fail to capture the global structure of the data.
  • Discrete vs. Continuous: While the theory covers both, finding the "perfect" sampling time is easier in continuous-time Langevin dynamics than in discrete-step MCMC, where the optimal time might fall between two integer steps.
  • Future Direction: The authors suggest this work lays the groundwork for a more formal unification of EBMs and diffusion models, potentially leading to more efficient training schemes that explicitly leverage these dynamical effects.

Summary updated

Abstract

In this paper, we quantify the impact of using non-convergent Markov chains to train Energy-Based models (EBMs). In particular, we show analytically that EBMs trained with non-persistent short runs to estimate the gradient can perfectly reproduce a set of empirical statistics of the data, not at the level of the equilibrium measure, but through a precise dynamical process. Our results provide a first-principles explanation for the observations of recent works proposing the strategy of using short runs starting from random initial conditions as an efficient way to generate high-quality samples in EBMs, and lay the groundwork for using EBMs as diffusion models. After explaining this effect in generic EBMs, we analyze two solvable models in which the effect of the non-convergent sampling in the trained parameters can be described in detail. Finally, we test these predictions numerically on a ConvNet EBM and a Boltzmann machine.
BibTeX
@inproceedings{agoritsas2023explaining,
  author = {Elisabeth Agoritsas and Giovanni Catania and Aurélien Decelle and Beatriz Seoane},
  title = {{Explaining the effects of non-convergent sampling in the training of Energy-Based Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=DF9aUqGzsV},
}
Figure