Particle Dynamics for Learning EBMs

Kirill Neklyudov, Priyank Jaini, Max Welling

TL;DR

Training Energy-Based Models (EBMs) typically relies on expensive and often unstable MCMC chains to draw negative samples from the evolving model distribution at each gradient step. This paper introduces a deterministic particle dynamic that tracks the evolution of the energy function in continuous time via the vector field $v^* = -\nabla \frac{\partial E}{\partial t}$. Instead of repeatedly waiting for MCMC to converge from scratch, particles are transported along with the model's updates in finite time, resulting in faster and more stable training.

What Problem Does This Paper Address?

Energy-Based Models (EBMs) define unnormalized probability distributions as $q_\theta(x) \propto \exp(-E(x, \theta))$. Maximizing the log-likelihood of data under an EBM requires computing expectations under the model distribution to provide a "contrastive" gradient.

In practice, obtaining these samples requires Markov Chain Monte Carlo (MCMC) methods such as Langevin dynamics or Persistent Contrastive Divergence (PCD). However, MCMC theoretically requires infinitely long chains to draw unbiased samples. In reality, practitioners use short, truncated chains or replay buffers, which can suffer from severe training instability, mode collapse, or distorted distributions due to heuristic noise scaling.

Methods

Rather than treating sampling as an isolated stationary inference problem at each training step, the authors view the density $q_t$ and the particles as co-evolving systems.

  • Optimal Vector Field: By matching the time derivative of the particle distribution's log-density with that of the model distribution in $L^2_q$, they derive the ideal vector field for particle transport: $$v^* = -\nabla_x \frac{\partial E_t(x)}{\partial t}$$
  • Discretization Variants:
  • Method $\alpha$ (Discretized Energy): Discretizes the energy update between time steps, yielding: $$x_{t+dt} \approx x_t - \nabla_{x} E(x_t, \theta(t+dt)) + \nabla_{x} E(x_t, \theta(t))$$ Intuitively, this acts as a deterministic update that aligns particles with the new energy landscape while unmatching the old one.

  • Method $\beta$ (Discretized Parameters): Discretizes parameter space updates instead: $$x_{t+dt} \approx x_t - \nabla_x \langle \nabla_\theta E(x_t, \theta(t)), \theta(t+dt) - \theta(t) \rangle$$

  • Method $\gamma$ (Non-parametric RKHS / MMD Flow): Represents energy updates via reproducing kernel Hilbert spaces (RKHS), leading to particle dynamics driven by attraction to true data and repulsion among particles.
  • Connection to NTK: Under standard gradient descent, Method $\beta$ is analytically equivalent to Method $\gamma$ using the model's Neural Tangent Kernel (NTK), effectively executing an MMD gradient flow that directly targets data samples while repelling particles to cover the state space.

Datasets

  • 2D Synthetic Toy Distribution: A multimodal 2D target distribution used to visualize mode coverage and evaluate learned density landscapes.
  • Note: No large-scale natural image datasets (e.g., CIFAR-10, ImageNet) were tested in this workshop paper.

Key Insights and Ideas

  • Transport Over Sampling: Instead of running a Markov chain to approximate a static target distribution at every iteration, particles can be deterministically transported across iterations along the path dictated by the energy function's velocity.
  • Theoretical Bridge to Wasserstein Gradient Flows: The optimal field $v^* = -\nabla \frac{\partial E}{\partial t}$ coincides with standard Wasserstein gradient flow formulations (Otto calculus) when optimizing density functionals.
  • Parametric MMD Flow via NTK: Method $\beta$ shows that standard backpropagation updates naturally induce kernelized particle dynamics where the kernel is the Neural Tangent Kernel, bypassing the need for pairwise distance computations across whole batches.

Key Results

Experiments on the 2D multimodal dataset using a 2-layer MLP (300 hidden units with Swish activations) showed:

  • Mode Coverage: Methods $\alpha$ and $\beta$ captured all distribution modes cleanly, whereas standard PCD frequently collapsed and failed to identify all modes.
  • Density Fidelity: While Replay Buffers with noise annealing were numerically stable, they learned an overly dispersed (annealed/higher-temperature) density. Methods $\alpha$ and $\beta$ achieved higher log-likelihood and lower squared Maximum Mean Discrepancy ($\text{MMD}^2$).
  • Computational Efficiency: Proposed methods achieved better density models while requiring half the Langevin correction steps (10 steps) compared to baseline PCD / Replay Buffer setups (20 steps).

Limitations and Future Work

  • Toy Benchmark Only: The empirical validation is limited to a synthetic 2D distribution; performance on high-dimensional data (e.g., images or audio) remains unverified.
  • Residual Stochasticity: In practice, pure deterministic particle transport accumulated numerical discretization errors, requiring 10 additional stochastic Langevin steps at each iteration to maintain sample quality.
  • Degeneracy in Method $\gamma$: Running Method $\gamma$ with fixed parameters caused representations to degenerate, necessitating sampling parameters randomly from an initialization prior $\pi_0$ at each step.

Summary updated

BibTeX
@inproceedings{neklyudov2021particle,
  author = {Kirill Neklyudov and Priyank Jaini and Max Welling},
  title = {{Particle Dynamics for Learning EBMs}},
  booktitle = {DGMs Applications @ NeurIPS},
  year = {2021},
  url = {https://openreview.net/forum?id=kOk5iXi2Qr},
}
Figure