TL;DR
When training Energy-Based Models (EBMs) via maximum likelihood, practitioner sampling relies on non-convergent, "short-run" Langevin dynamics rather than true MCMC draws. This paper demonstrates that this training scheme is not actually fitting an energy density, but rather training an implicit continuous-flow generator through a self-adversarial game. Removing the Langevin noise entirely stabilizes training and improves sample quality, which can be boosted even further by adding an explicit GAN-style generator loss.
What Problem Does This Paper Address?
Standard training of an EBM, $p_\theta(x) \propto \exp(-E_\theta(x))$, seeks to maximize data log-likelihood by taking gradient descent steps that contrast real data against negative samples drawn from the model. In practice, sampling from deep energy functions is intractable, so researchers approximate it using a few tens of steps of Langevin dynamics (LD).
However, MCMC in high dimensions converges far too slowly for short-run LD to reach the stationary distribution. Prior work observed that short-run LD does not mix across modes and that the initial noise vectors act more like latent variables in a generator. This raises a fundamental conceptual challenge: Is maximum-likelihood EBM training actually fitting an EBM, or is it doing something completely different?
Methods
The authors demystify the training dynamics through three steps:
- Noise-Free Formulation as Invertible Flow: They strip out the stochastic Brownian motion term from Langevin dynamics, replacing it with a deterministic gradient descent ordinary differential equation (ODE): $$\frac{dx(t)}{dt} = -\nabla_x E_\theta(x(t)), \quad x(0) = x_0 \sim \mathcal{N}(0, I)$$ Under mild smoothness conditions, this ODE defines an invertible continuous normalizing flow $x_T = G_\theta^T(x_0)$. This makes it possible to explicitly evaluate the exact log-likelihood of data under the sampling dynamic using the instantaneous change-of-variables formula: $$\log p(x) = \log p(x_0) + \int_0^T \text{tr}\left[\nabla_{xx} E_\theta(x(t))\right] dt$$
- EBM Training as a Self-Adversarial Game: The authors reframe the standard EBM parameter update as a Wasserstein GAN (W-GAN) game. Here, the energy network $E_\theta$ acts as the discriminator/critic, while the gradient flow $G_\theta$ acts as the generator. Crucially, the generator and discriminator share the exact same parameters $\theta$—making it a self-adversarial loss.
- Adding an Explicit Generator Loss: In standard EBM training, parameters are only updated via the discriminator loss. The authors propose adding an explicit generator update term that differentiates through the ODE trajectory: $$\min_\theta \Big( E_\theta(x) - E_\theta(G_{\text{sg}(\theta)}(x_0)) + E_{\text{sg}(\theta)}(G_\theta(x_0)) \Big)$$ where $\text{sg}(\cdot)$ is the stop-gradient operator.
Datasets
The authors evaluated their approach on:
- 2D Synthetic Toy Data: Swiss roll and a 9-component Gaussian mixture grid.
- Image Benchmarks: MNIST, Fashion-MNIST ($32 \times 32$), CIFAR-10, and CelebA.
No new datasets were introduced.
Key Insights and Ideas
- The EBM density is a mirage; the dynamic is the real model: On 2D toy datasets, the actual energy function density $\exp(-E_\theta(x))/Z$ fails completely to match the ground-truth distribution. However, the density induced by the deterministic ODE flow matches the ground truth cleanly. The sampling dynamic itself is the true generative model.
- Noise is harmful, not helpful: Contrary to the MCMC rationale that stochastic noise is required to explore the distribution, the noise in short-run LD degrades performance and frequently causes training divergence. Noise-free dynamics dramatically improve stability.
- Adversarial gradients supercharge quality: Treating the sampling process explicitly as a generator and updating $\theta$ through backpropagation along the ODE path produces substantial gains in generation quality.
Key Results
- Toy Likelihoods: On Swiss roll and Gaussian grid, the flow induced by the EBM objective achieved test log-likelihoods of -0.86 nats and -1.95 nats (compared to -0.69 and -1.47 nats when trained directly via maximum likelihood continuous flow), confirming it learns a well-behaved density despite an inaccurate energy surface.
- Image Generation (Fréchet Inception Distance, lower is better): Removing the sampling noise consistently reduced FID across all datasets, and adding the generator loss term delivered dramatic further improvements:
| Method | MNIST | Fashion-MNIST | CIFAR-10 | CelebA |
|---|---|---|---|---|
| EBM w/ noisy dynamics | 15.4 | 61.7 | 70.4 | 69.6 |
| EBM w/ noise-free dynamics | 11.7 | 50.1 | 61.6 | 56.6 |
| + Generator loss | 7.7 | 40.6 | 47.9 | 34.8 |
- Training Stability: Models trained with noisy dynamics collapsed and diverged around 20,000 iterations on CIFAR-10, whereas the noise-free and generator-loss variants remained stable throughout training.
Limitations and Future Work
- Architectural Scope: Experiments relied on relatively shallow convolutional networks rather than modern, heavily parameterized residual networks.
- Invertibility Constraints: In discrete forward-Euler steps, invertibility requires strict Lipschitz bounds on $\nabla_x E_\theta$ and small step sizes $\eta$, which can be tricky to tune without adaptive ODE solvers.
- Implications for EBM Research: The paper underscores that if the goal is truly to learn unnormalized energy functions, researchers cannot rely on short-run LD under the guise of maximum likelihood; they must either guarantee MCMC convergence or pivot to sampling-free alternatives (such as score matching or noise-contrastive estimation).
Summary updated