Sculpting Latent Spaces With MMD: Disentanglement With Programmable Priors

Quentin Fruytier, Akshay Malhotra, Shahab Hamidi-Rad, Aditya Sant, Aryan Mokhtari, Sujay Sanghavi · DOI

Introduction

In representation learning, the goal of disentanglement is to create a latent space where each dimension corresponds to a single, independent factor of variation. Traditionally, Variational Autoencoders (VAEs) have addressed this using a Kullback-Leibler (KL) divergence penalty to force latent variables toward a factorized Gaussian distribution.

However, this approach faces a fundamental flaw: the KL penalty is typically applied per-sample, often failing to enforce the desired distribution on the aggregate posterior (the distribution of all latent codes across the entire dataset). This leads to entangled representations and a "reconstruction trade-off," where better disentanglement often results in lower-quality, blurry outputs. This paper proposes a "Programmable Prior" framework using Maximum Mean Discrepancy (MMD) to precisely shape latent representations without these drawbacks.

Methodology: The MMD Regularizer

The authors shift from analytical regularizers like KL to a non-parametric, sample-based approach using Maximum Mean Discrepancy (MMD). Instead of forcing individual encodings to look like a Gaussian, the MMD regularizer ensures the entire batch of latent codes matches a target distribution.

The AE-MMD architecture. A batch-wise MMD loss regularizes the latent distribution to match a programmable target prior, bypassing the limitations of per-sample KL divergence.

Because MMD only requires samples from a target prior, it is "programmable." Practitioners can choose any distribution—Gaussian, Uniform, Mixture Models, or even empirical samples from another model—to "sculpt" the latent space. To measure success without ground-truth labels, the authors introduce the Latent Predictability Score (LPS). LPS trains a regressor to predict each latent dimension from the others; a lower score indicates better independence and, thus, superior disentanglement.

Key Insights and Results

The framework was evaluated on synthetic benchmarks (dSprites, XY family) and real-world datasets (MNIST, CIFAR-10, Tiny ImageNet).

Overcoming the Reconstruction Trade-off

Unlike VAE-based methods, which often sacrifice reconstruction quality for disentanglement, the MMD-based approach maintains high reconstruction fidelity. As shown in the quantitative results, AE-MMD achieves state-of-the-art independence while keeping reconstruction NMSE competitive with standard Autoencoders.

Reconstruction NMSE and Latent Predictability Score (LPS) across varying latent space sizes. AE-MMD maintains low reconstruction error and superior independence (low LPS) compared to VAE variants.

Scalability and Programmability

On CIFAR-10, the MMD-based model achieved an LPS of 0.04, significantly lower than the 0.85 achieved by a standard $\beta$-VAE. This indicates that MMD features are almost entirely unpredictable from one another. Furthermore, the model maintains this high independence even as the latent space grows (e.g., to 96 dimensions), whereas VAE-based methods tend to become more entangled.

The "programmability" of the prior also allows for feature engineering. For datasets where the ground truth is uniformly distributed, using a Uniform Prior via MMD leads to near-perfect alignment with the actual factors of variation, far outperforming Gaussian-based models.

Conclusion

By replacing analytical KL penalties with sample-based MMD regularization, this framework provides a powerful tool for sculpting latent spaces. It achieves superior disentanglement and independence without the typical reconstruction trade-offs seen in VAEs. While selecting the optimal prior for complex real-world data remains a challenge, the ability to "program" the latent geometry opens new avenues for representation learning and knowledge distillation.

Summary updated

BibTeX
@misc{fruytier2025sculpting,
  author = {Quentin Fruytier and Akshay Malhotra and Shahab Hamidi-Rad and Aditya Sant and Aryan Mokhtari and Sujay Sanghavi},
  title = {{Sculpting Latent Spaces With MMD: Disentanglement With Programmable Priors}},
  year = {2025},
  eprint = {2510.11953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.11953},
}
Figure