Introduction
Deep generative models like Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs) are highly effective at producing realistic images. However, they suffer from a fundamental "probability problem": it is notoriously difficult to calculate the actual probability density of an image produced by these networks.
This difficulty stems from three main hurdles. First, calculating the density usually requires the log-determinant of the generator's Jacobian—a computationally brutal or impossible task for most modern architectures. Second, generators map a low-dimensional latent space to a high-dimensional image space, meaning the resulting distribution is constrained to a thin manifold where standard density modeling fails. Finally, some models, like deterministic autoencoders, are not designed to be probabilistic at all, making it hard to sample new, realistic images from them.
The Hat EBM is a novel framework designed to solve these issues. By placing a "hat" network on top of a standard generator and adding a small residual image to bridge the gap to the real data manifold, this method turns virtually any generator network into a robust Energy-Based Model (EBM).
The Hat EBM Architecture
Instead of modeling the image $X$ directly, the Hat EBM posits that an observed image is the sum of a generator output and a residual: $$X = G(Z) + Y$$ Here, $G(Z)$ is the generator's output from a latent vector $Z$, and $Y$ is a residual image that fills the gap between the generator's output and the actual image manifold.
The "Hat" refers to an energy network $H(X; \theta)$ that sits atop this combination. The energy of a pair $(Y, Z)$ is defined by the output of this hat network: $U(Y, Z; \theta) = H(G(Z) + Y; \theta)$.
This formulation offers several key innovations:
- Bypassing the Jacobian: By defining the energy on the sum of the generator and a residual, the model completely sidesteps the need for the Jacobian determinant, making it compatible with virtually any neural architecture.
- No Latent Inference: Unlike previous latent-space EBMs, this method does not require inferring the latent state $Z$ for real observed images during training.
- Tandem Training: The Hat network learns to refine images, while the generator is updated to "absorb" those refinements, essentially learning to produce the images the EBM favors.
Key Capabilities and Results
The Hat EBM was evaluated across several standard benchmarks, including CIFAR-10, CelebA, and ImageNet, demonstrating strong performance across three primary tasks: synthesis, refinement, and retrofitting.
- High-Resolution Synthesis: On the challenging unconditional ImageNet 128x128 dataset, the Hat EBM achieved an FID score of 29.2. This is highly competitive with state-of-the-art models like SS-GAN (23.4), while utilizing significantly fewer computational resources.
- Refinement of Existing Generators: The Hat EBM can effectively "polish" the outputs of existing generators. When applied to a pre-trained SN-GAN on CIFAR-10, the model improved the FID score from 18.58 to 14.04.
- Retrofitting "Dead" Models: One of the most compelling capabilities of the Hat EBM is its ability to take a standard, deterministic autoencoder—which cannot normally sample new images—and "retrofit" it into a generative model capable of producing high-quality, diverse samples.
- Out-of-Distribution (OOD) Detection: The model also proved exceptionally adept at distinguishing between "in-distribution" and "out-of-distribution" data, outperforming many unsupervised and supervised baselines on the SVHN/CIFAR-100 benchmark.
Limitations and Future Directions
While the residual image $Y$ is often visually imperceptible, it is mathematically vital for providing the "wiggle room" necessary to keep the EBM stable during training. However, balancing the "work" done by the generator versus the residual remains a fine-tuning challenge; if the residual becomes too large, it can introduce unwanted noise.
Additionally, like most EBMs, the Hat EBM relies on Markov Chain Monte Carlo (MCMC) methods—specifically Langevin dynamics—for sampling. While the authors utilize "shortrun" chains to keep this manageable, it remains computationally more expensive than a single forward pass of a standard GAN. Future work will likely focus on mitigating these MCMC costs and scaling the framework to even higher resolutions, such as 256x256 or 512x512.
Summary updated