Joint Training of Variational Auto-Encoder and Latent Energy-Based Model

Tian Han, Erik Nijkamp, Linqi Zhou, Bo Pang, Song-Chun Zhu, Ying Nian Wu

Abstract

This paper proposes a joint training method to learn both the variational auto-encoder (VAE) and the latent energy-based model (EBM). The joint training of VAE and latent EBM are based on an objective function that consists of three Kullback-Leibler divergences between three joint distributions on the latent vector and the image, and the objective function is of an elegant symmetric and anti-symmetric form of divergence triangle that seamlessly integrates variational and adversarial learning. In this joint training scheme, the latent EBM serves as a critic of the generator model, while the generator model and the inference model in VAE serve as the approximate synthesis sampler and inference sampler of the latent EBM. Our experiments show that the joint training greatly improves the synthesis quality of the VAE. It also enables learning of an energy function that is capable of detecting out of sample examples for anomaly detection.

Introduction

Generative modeling typically involves two distinct approaches: directed models, such as Variational Auto-Encoders (VAEs), and undirected models, such as Energy-Based Models (EBMs). VAEs are favored for their efficient, MCMC-free sampling but often suffer from "over-dispersion," leading to blurry, low-fidelity reconstructions as they attempt to cover all data points. Conversely, EBMs offer high flexibility in capturing complex distributions but are computationally expensive to train due to the requirement for Markov Chain Monte Carlo (MCMC) sampling to estimate gradients.

This work introduces a framework to bridge this gap by jointly training a VAE and a latent EBM. The goal is to combine the fast sampling capabilities of VAEs with the high-fidelity density approximation of EBMs, moving beyond ad-hoc combinations of VAEs and GANs.

Methods: The Divergence Triangle

The core innovation is the Divergence Triangle, an objective function involving three joint distributions over the image ($x$) and the latent vector ($z$):

  1. The Generator Density ($p_\theta$): The standard VAE top-down model.
  2. The Data Density ($q_\phi$): The observed data combined with the VAE’s inference model.
  3. The Latent EBM Density ($\pi_\alpha$): An undirected model defined by an energy function $f_\alpha(x, z)$.

The training process is formulated as a minimax game. The EBM ($\alpha$) acts as a critic, moving toward the data density and away from the generator density. Simultaneously, the Generator ($\theta$) chases the EBM density to sharpen its output while maintaining data coverage. The Inference Model ($\phi$) bridges the gap, serving as an approximate sampler for both the generator and the EBM. This setup enables MCMC-free training of the EBM, as the VAE components provide the necessary approximate samplers.

Experimental Results

The model was evaluated on standard benchmarks including CIFAR-10, CelebA, LSUN-bedroom, and MNIST.

Synthesis Quality

The joint training significantly improves image synthesis. On the CelebA dataset, the model achieved a Frechet Inception Distance (FID) of 24.7, a substantial improvement over the standard VAE's score of 99.09. This performance is competitive with GAN-based models like SNGAN (50.4). The model also maintains high-fidelity reconstruction, outperforming previous hybrid models like ALI and ALICE in terms of Root Mean Square Error (RMSE).

Synthesis results on CIFAR-10, CelebA, and LSUN-bedroom datasets.

Anomaly Detection

The learned energy function $f_\alpha(x, z)$ naturally serves as an anomaly detector. By assigning high energy to out-of-distribution (OOD) samples, the model effectively distinguishes between training data and anomalies. On MNIST, the model achieved state-of-the-art results for unsupervised anomaly detection (e.g., an AUPRC of 0.723 for the digit "4", compared to 0.337 for a standard VAE).

Histograms of unnormalized log probabilities showing the model's ability to separate in-distribution data from various OOD sources.

Conclusion

The proposed joint training framework successfully integrates VAEs and latent EBMs via a symmetric divergence triangle. This approach corrects the over-dispersion of standard VAEs, resulting in sharper image synthesis and providing a robust mechanism for anomaly detection. While learning a stable energy landscape remains a challenge, this work provides a systematic path toward combining the strengths of directed and undirected generative models.

Summary updated

Abstract

This paper proposes a joint training method to learn both the variational auto-encoder (VAE) and the latent energy-based model (EBM). The joint training of VAE and latent EBM are based on an objective function that consists of three Kullback-Leibler divergences between three joint distributions on the latent vector and the image, and the objective function is of an elegant symmetric and anti-symmetric form of divergence triangle that seamlessly integrates variational and adversarial learning. In this joint training scheme, the latent EBM serves as a critic of the generator model, while the generator model and the inference model in VAE serve as the approximate synthesis sampler and inference sampler of the latent EBM. Our experiments show that the joint training greatly improves the synthesis quality of the VAE. It also enables learning of an energy function that is capable of detecting out of sample examples for anomaly detection.
BibTeX
@inproceedings{han2020joint,
  author = {Tian Han and Erik Nijkamp and Linqi Zhou and Bo Pang and Song-Chun Zhu and Ying Nian Wu},
  title = {{Joint Training of Variational Auto-Encoder and Latent Energy-Based Model}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  url = {https://openreview.net/forum?id=JE9U0F_sZNm},
}
Figure