Hat-EBMs in Energy-Based Generative Models
- Hat-EBMs are a probabilistic framework that integrates a learned energy correction with generator outputs to refine image synthesis without explicit latent code inference.
- They use Langevin sampling to update residuals, thereby bypassing costly computations like Jacobian determinants and simplifying training.
- Empirical results demonstrate competitive FIDs and robust out-of-distribution detection, underlining their versatility in generative modeling tasks.
Hat Energy-Based Models (Hat-EBMs) are a probabilistic modeling framework that augments an existing generator network with a learned energy correction, enabling explicit energy-based modeling directly in the generator’s output space. In this approach, observed images are assumed to decompose into a latent variable passed through a generator and a residual that bridges the gap to the data manifold. Hat-EBMs allow training and sampling without the need for explicit inference of latent codes corresponding to observed data or the computation of generator Jacobians, and can incorporate both probabilistic and deterministic generators as model backbones (Hill et al., 2022).
1. Model Formulation
Let denote an observed image. The fundamental generative mechanism in Hat-EBMs is
where is an unobserved latent code sampled from a simple prior , and is a fixed or learned generator network. The residual (also denoted ) accounts for the gap between the generator manifold and the true data distribution. A typical prior for is also Gaussian:
The joint density over is given by
0
and the marginal density of 1 becomes
2
In the unconditional variant, the residual prior can be omitted, with both 3 and 4 modeled via an energy function.
2. Energy Parameterization and Model Variants
Hat-EBMs define an unnormalized density over 5 pairs via a parameterized “hat” energy network 6. The energy function is
7
giving the unnormalized joint distribution
8
There are two principal variants:
- Joint Hat EBM: No explicit priors on 9; the energy function governs the entire joint space.
- Conditional Hat EBM: With 0 fixed, the model defines
1
3. Training Objectives and Algorithms
Training is performed by minimizing the Kullback–Leibler divergence between the empirical joint distribution and the model: 2 The gradient of the log-likelihood with respect to network parameters 3 follows the standard energy-based model “positive–negative phase” form: 4
In practice, data expectations are taken over observed images, while model expectations are generated by running Markov chain Monte Carlo (MCMC) to sample negative pairs 5. Key computational advantages include:
- No need for Jacobian determinant computation (6)
- No requirement for latent code inference (7) per datum—data 8 is directly input to the energy network
4. Langevin Sampling and Algorithmic Structure
Negative samples are generated via alternating Langevin updates (a Metropolis-within-Gibbs scheme) in 9 and 0: 1 with 2. For the conditional Hat EBM, only residuals 3 are updated (latent 4 is fixed), simplifying sampling for unconditional generation.
A summary of the conditional Hat EBM training algorithm:
| Step | Operation | Details |
|---|---|---|
| 1 | Update EBM parameters | Negative samples via Langevin in 5 per 6 |
| 2 | Update generator from replay bank | Regression to align 7 to EBM sample 8 |
This algorithmic design allows the incorporation of both deterministic and probabilistic generator networks.
5. Empirical Performance and Use Cases
Hat-EBMs have been evaluated in multiple generative modeling tasks:
A. Refinement of Pretrained GANs (Joint Hat EBM)
- Datasets: CIFAR-10 (9), CelebA (0)
- SN-GAN FID: 18.58 (CIFAR-10), 6.13 (CelebA)
- DDLS refinement FID: 14.59, 6.06
- Hat EBM refinement FID: 14.04, 5.98
- Visual assessment indicates the residual 1 is nearly imperceptible; refinements occur mainly in latent space.
B. Retrofit of Deterministic Autoencoders
- Pretrained autoencoder with latent codes on a 2-sphere
- Application of joint Hat EBM sampling achieves FID ≈ 26.01 on CIFAR-10 via residual-corrected generations.
C. Unconditional Synthesis (Conditional Hat EBM)
- Short-run Langevin (3); competitive FIDs achieved:
- CIFAR-10 (4): 19.30 vs. 18.6 (SN-GAN)
- CelebA (5): 11.57 vs. 6.1 (GAN)
- ImageNet (6): 29.37 (large model), approaching SS-GAN benchmark (23.4)
- Qualitatively, samples exhibit sharp detail and diversity; residual correction primarily enhances fine texture.
D. Out-of-Distribution Detection
- Using the energy 7 as an anomaly score, Hat-EBMs show state-of-the-art unsupervised AUROC:
- SVHN: 0.92
- CIFAR-100: 0.87
- CelebA: 0.94
6. Distinctive Features and Advancements
Hat-EBMs provide the following key features:
- Modularity: Any generator network, deterministic or probabilistic, can be leveraged as an EBM component.
- No Jacobian or Latent Inference: Explicit computation of generator Jacobians and inference of latents for observed data are unnecessary; only Langevin updates are required during training and sampling.
- Scalability: The approach demonstrates competitive Fréchet Inception Distance (FID) at high image resolutions with moderate computational demands.
- Versatility: Effective out-of-distribution detection and generator refinement, and compatibility with both pretrained and jointly trained generators.
A plausible implication is that Hat-EBMs effectively unify energy-based and generator-based modeling paradigms by enabling energy correction at the generator output level, potentially broadening the applicability of EBMs to settings previously dominated by adversarial or likelihood-based generator models (Hill et al., 2022).