Learning Energy-Based Model with Variational Auto-Encoder as Amortized Sampler

Jianwen Xie, Zilong Zheng, Ping Li

Abstract

This paper introduces Variational MCMC Teaching, a framework that jointly trains an Energy-Based Model (EBM) and a Variational Auto-Encoder (VAE). By utilizing the VAE as an "amortized sampler" to provide high-quality initializations for Markov Chain Monte Carlo (MCMC), the authors address the notorious "slow mixing" problem in EBM training. This synergy results in a model that generates high-quality images and excels at complex conditional tasks like image completion, combining the sharp, expressive energy landscapes of EBMs with the fast, diverse sampling of VAEs.

The Challenge of Energy-Based Models

Energy-Based Models (EBMs) are mathematically elegant, defining a probability distribution via an "energy function" where low energy corresponds to high probability. However, training them is computationally intensive. Updating the model requires sampling from it using MCMC methods like Langevin dynamics. In high-dimensional spaces such as images, MCMC is often too slow to converge or gets "trapped" in local modes, failing to represent the full diversity of the data. While Variational Auto-Encoders (VAEs) sample very quickly, they often produce blurry results. This research seeks to combine the best of both worlds.

Variational MCMC Teaching

The authors propose a joint training scheme called Variational MCMC Teaching. The process operates in a continuous loop:

  1. Ancestral Langevin Sampling (ALS): Instead of starting MCMC from random noise, the VAE generator creates an initial "draft" image. This draft is then refined by a few steps (15–50) of Langevin dynamics guided by the EBM's energy function.
  2. EBM Learning: The EBM is updated using Maximum Likelihood Estimation (MLE), treating the refined MCMC samples as the model's current guess and comparing them to real data.
  3. VAE Learning: The VAE "chases" the EBM. It treats the refined MCMC samples as training data and updates its encoder and decoder to better mimic the EBM’s distribution.
Comparison of MCMC teaching frameworks: (a) standard MCMC teaching, (b) fast MCMC teaching, and (c) the proposed variational MCMC teaching.

Information Geometry Perspective

The authors interpret this process through the lens of Information Geometry as a "dynamic alternating projection" between three manifolds: the data distribution ($\Pi$), the VAE's distribution ($Q$), and the EBM's distribution ($P$). The VAE acts as a "fast-thinking" component that can jump across the data landscape to find different modes, while the EBM acts as a "slow-thinking" component that refines the details. By training the VAE to mimic the MCMC process, the cost of sampling is "amortized" over the training process, making the overall system much more efficient than traditional EBMs.

Information geometry view of the alternating projections between the EBM distribution (P) and the VAE distribution (Q).

Key Results and Insights

The model was evaluated on several standard benchmarks, including MNIST, Fashion-MNIST, CIFAR-10, and datasets for image completion (Paris StreetView and CMP Facade).

  • Image Quality: On MNIST, the model achieved an FID score of 8.95, significantly outperforming standard VAEs (21.85) and previous cooperative models like CoopNets (9.70). On CIFAR-10, it reached an Inception Score (IS) of 6.65, competitive with popular GAN architectures like DCGAN (6.40).
  • Image Completion: In filling the center of an image, the model outperformed strong baselines like pix2pix and cVAE-GAN++. On the Facade dataset, it achieved a PSNR of 21.62, compared to 19.34 for pix2pix.
  • Efficiency: The model produces high-quality samples with as few as 15 Langevin steps, whereas traditional EBMs often require hundreds of steps to produce comparable results.
  • Theoretical Alignment: The paper provides a theoretical proof that if the system reaches a Nash Equilibrium, the EBM, the VAE, and the true data distribution will perfectly align ($p_\theta = q_\alpha = p_{data}$).

Limitations and Future Work

Despite its success, the framework is sensitive to hyperparameters such as the number of Langevin steps and step size. Additionally, managing three distinct networks (EBM, VAE encoder, and VAE decoder) increases architectural complexity. While successful on $32\times32$ and $128\times128$ images, scaling this joint training approach to very high-resolution datasets (e.g., $1024\times1024$) remains a target for future research.

Summary updated

BibTeX
@inproceedings{xie2021learning,
  author = {Jianwen Xie and Zilong Zheng and Ping Li},
  title = {{Learning Energy-Based Model with Variational Auto-Encoder as Amortized Sampler}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i12.17250},
}
Figure