Abstract: In spite of the remarkable potential of Latent Diffusion Models (LDMs) in image generation, the desired properties and optimal design of the autoencoders have been underexplored. In this work, we analyze the role of autoencoders in LDMs and identify three key properties: latent smoothness, perceptual compression quality, and reconstruction quality. We demonstrate that existing autoencoders fail to simultaneously satisfy all three properties, and propose Variational Masked AutoEncoders (VMAEs), taking advantage of the hierarchical features maintained by Masked AutoEncoders. We integrate VMAEs into the LDM framework, introducing Latent Diffusion Models with Masked AutoEncoders (LDMAEs).
Introduction
Latent Diffusion Models (LDMs), such as Stable Diffusion, have revolutionized image generation by operating within a compressed latent space rather than directly on pixels. This approach enhances computational efficiency but creates a critical dependency: the generative quality is fundamentally capped by the performance of the underlying autoencoder. Recent research from Seoul National University identifies a persistent trade-off in current autoencoder designs between latent smoothness, perceptual compression, and reconstruction accuracy.
The Three Pillars of LDM Autoencoders
The authors identify three critical properties necessary for an ideal LDM autoencoder:
- Latent Smoothness: The ability of the latent space to handle small perturbations, ensuring stable diffusion denoising.
- Perceptual Compression: The capacity to retain semantic meaning while reducing data dimensionality.
- Reconstruction Quality: The fidelity of the final pixel-level output compared to the original input.
Existing models like the standard Stable Diffusion VAE (SD-VAE) often struggle to balance these. For instance, aggressive compression can lead to the loss of fine-grained textures, while a lack of smoothness causes the diffusion process to produce artifacts.
Methodology: Variational Masked AutoEncoders (VMAE)
To address these limitations, the researchers introduced the Variational Masked AutoEncoder (VMAE). This architecture replaces traditional convolutional blocks with a Vision Transformer (ViT) and incorporates a masking objective. By hiding 60% of image patches during training, the model is forced to learn a hierarchy of features, capturing both global structures and local details.
Probabilistic Alignment and Smoothness
A key insight of the paper is the necessity of a probabilistic latent space. Deterministic encoders (standard AEs) create "holes" in the latent space that lead to decoding failures when the diffusion model introduces even minor noise. By using a KL-divergence loss, VMAE ensures the latent space is continuous and smooth.
Experimental Results
The resulting framework, LDMAE, was evaluated on ImageNet-1K and CelebA-HQ.
- Generation Quality: LDMAE achieved a gFID of 5.98 on ImageNet-1K, surpassing the SD-VAE baseline of 6.49.
- Reconstruction Fidelity: The model nearly doubled the perceptual reconstruction quality of SD-VAE, achieving an rFID of 0.89 compared to 1.89.
- Efficiency: VMAE is remarkably lightweight, utilizing only 13.4% of the parameters (42.7 MB vs 319.7 MB) and 4.1% of the GFLOPs of standard VAEs. Training speed for the autoencoder component improved by 2.7x.
Conclusion
LDMAE demonstrates that rethinking the autoencoder component is a viable path toward more efficient and higher-quality generative models. By leveraging the hierarchical learning of Masked AutoEncoders and the stability of variational inference, VMAE provides a superior latent foundation for diffusion models. Future work will explore scaling these benefits to ultra-high-resolution tasks and specialized image editing applications.
Summary updated