Learning Latent Space Hierarchical EBM Diffusion Models

Jiali Cui, Tian Han

Introduction

Hierarchical generative models, such as deep Variational Autoencoders (VAEs), are powerful tools for capturing complex data distributions. They utilize multiple layers of latent variables to represent data at various scales: top layers handle high-level semantics (like the overall structure of a face), while bottom layers manage fine details (like skin texture). However, these models often struggle with a phenomenon known as the "prior hole."

This paper introduces a novel approach to bridge this gap by learning latent priors using a diffusion-based Energy-Based Model (EBM). By performing diffusion in a specialized "uni-scale" latent space, the authors successfully align simple priors with complex data distributions, making the notoriously difficult task of EBM sampling significantly more tractable.

The "Prior Hole" Problem

Traditional hierarchical models typically assume a simple Gaussian prior for their latent variables. In practice, the aggregate posterior—the actual distribution of the latent variables after encoding real data—is often highly complex and multi-modal. This mismatch between the assumed simple prior and the complex reality creates a "prior hole," which ultimately leads to poor sample quality during generation.

While Energy-Based Models (EBMs) are theoretically expressive enough to fill this hole and model the true prior, they are incredibly difficult to train in multi-layer latent spaces. Standard Markov Chain Monte Carlo (MCMC) sampling techniques tend to get "stuck" because the energy landscape is too jagged, and the variables across different hierarchical layers operate on wildly different scales.

Methodology: Diffusion in a Uni-Scale Latent Space

To overcome the sampling bottleneck, the authors propose a two-stage approach that leverages diffusion processes:

  1. The $\tilde{u}$-space Transformation: Instead of operating in the raw latent space ($\tilde{z}$), which suffers from varying scales across layers, the hierarchy is transformed into a "uni-scale" $\tilde{u}$-space using the reparameterization trick. This standardizes the variance while preserving hierarchical dependencies, making the space much easier for a single model to navigate.
  2. Latent Diffusion EBM: Rather than attempting to learn one massive "marginal" EBM for the entire latent space, the authors apply a diffusion process to learn a sequence of conditional EBMs. The forward process gradually adds Gaussian noise to the latent representations, while the reverse process trains the EBM to "denoise" the latents step-by-step.
  3. Localized MCMC: Because each diffusion step only addresses a small amount of noise, the MCMC sampler no longer has to explore the entire global distribution at once. It only needs to search locally around the sample from the previous step. This localized search is vastly more efficient and far less prone to failing or getting stuck in local minima.

Key Insights

  • Smoothing the Energy Landscape: The core breakthrough is realizing that diffusion acts as a curriculum for the EBM. By breaking the learning process into discrete steps, the energy landscape at each step becomes smoother, allowing Langevin dynamics (the specific MCMC method used) to mix between modes effectively.
  • Hierarchy Preservation: Unlike pixel-space diffusion, which can destroy structural patterns early in the noise-adding process, performing diffusion in the $\tilde{u}$-space allows the model to maintain the crucial top-down relationship between semantic and detail layers.
  • Layer-wise Controllability: Because the EBM retains its hierarchical structure, users can "plug in" labels or attributes at specific layers. For instance, one could fix the top-layer latents to preserve a person's identity while sampling middle-layer latents to alter expressions or hair color, enabling fine-tuned image editing.

Results and Performance

The model was rigorously evaluated on several standard and high-resolution benchmarks, including CIFAR-10, CelebA-HQ-256, and LSUN-Church-64.

Generated samples across CelebA-HQ, LSUN-Church, and CIFAR-10 datasets.

The proposed approach achieved State-of-the-Art Prior Modeling. On CIFAR-10, the model reached an FID of 8.93, significantly outperforming previous EBM-prior methods like Joint-EBM (11.34) and NCP-VAE (24.08). Furthermore, it successfully scaled to high-resolution generation on CelebA-HQ-256 with an FID of 8.78, producing sharp, diverse faces that traditional hierarchical VAEs typically struggle to generate.

Interestingly, ablation studies revealed that even a very small number of diffusion steps (e.g., T=3 or T=6) provided a massive boost in generation quality compared to a single-stage EBM.

Superior Out-of-Distribution Detection

Beyond generation, the model proved highly effective at Out-of-Distribution (OOD) detection. Using SVHN as an OOD dataset against CIFAR-10, the model demonstrated its ability to distinguish between known and unknown data types.

AUROC scores and histograms demonstrating superior out-of-distribution detection using the diffusion-learned EBM.

The diffusion-learned EBM yielded higher AUROC scores for OOD detection compared to standard inference methods. As the diffusion steps increase, the separation between the in-distribution (CIFAR-10) and out-of-distribution (SVHN) data becomes starkly clear, proving that the learned EBM energy scores serve as a highly reliable metric for data density.

Limitations and Future Work

While the results are highly promising, the approach does have limitations. Inference speed remains a challenge; although diffusion-based MCMC is more reliable than standard MCMC, it is still an iterative process. Sampling requires multiple Langevin steps at each diffusion step, making it slower than pure GANs or standard VAEs.

Additionally, there is still a slight performance gap when compared to the absolute best pixel-space diffusion models (like DDPM or LSGM) in terms of raw FID, even though this latent approach offers superior interpretability and controllability.

Future work will likely focus on bypassing the iterative MCMC sampling entirely or refining the Langevin dynamics to require fewer steps, bringing the speed of this highly expressive model closer to real-time applications.

Summary updated

BibTeX
@inproceedings{cui2024learning,
  author = {Jiali Cui and Tian Han},
  title = {{Learning Latent Space Hierarchical EBM Diffusion Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=o9uOuIwhZK},
}
Figure