Disentangling by Factorising

Hyunjik Kim, Andriy Mnih

TL;DR

FactorVAE introduces a novel unsupervised method for learning disentangled representations by directly penalizing Total Correlation via a discriminator network. This approach bypasses the severe trade-off between reconstruction quality and disentanglement found in $\beta$-VAEs while introducing a more robust metric to evaluate disentanglement quality.

What Problem Does This Paper Address?

The goal of unsupervised disentangled representation learning is to find a latent space where each dimension corresponds to exactly one independent factor of variation in the data (such as position, scale, or rotation in images). While $\beta$-VAE is a popular framework for this, it achieves disentanglement by heavily penalizing the entire KL divergence term in the VAE objective. This inadvertently suppresses the mutual information between the data and the latents, leading to a harsh trade-off: better disentanglement comes at the cost of severely degraded reconstruction quality.

Additionally, existing supervised metrics for evaluating disentanglement have critical failure modes that can yield perfect scores even when the representation is incomplete and fails to capture all factors of variation.

Methods

The authors propose FactorVAE, which augments the standard VAE objective with a penalty specifically targeting the independence of the latent dimensions. Instead of penalizing the entire KL divergence (like $\beta$-VAE), FactorVAE penalizes Total Correlation (TC):

$$TC(z) = KL\left(q(z) \,\parallel\, \prod_{j=1}^d q(z_j)\right)$$

Because this term is intractable to compute directly over the entire dataset, the authors employ the density-ratio trick. They train a separate discriminator network (a Multi-Layer Perceptron) alongside the VAE to distinguish between samples from the true aggregate posterior $q(z)$ and samples from the product of its marginals $\prod_j q(z_j)$. To efficiently sample from the product of marginals without full dataset passes, they introduce a dimension-wise permutation trick across each minibatch.

Figure 1. Architecture of FactorVAE, a Variational Autoencoder (VAE) that encourages the code distribution to be factorial. The top row is a VAE with convolutional encoder and decoder, and the bottom row is an MLP classifier, the discriminator, that dis- tinguishes whether the input was drawn from the marginal code distribution or the product of its marginals.

The paper also introduces a New Disentanglement Metric. The previous standard metric trained a linear classifier on the absolute differences of latent representations when one ground-truth factor was held fixed. The authors show this can be gamed. The new metric instead looks at the empirical variance of normalized latent dimensions when a factor is held fixed, taking the dimension with the lowest variance to predict the fixed factor via a deterministic majority-vote classifier.

Datasets

The method is evaluated on datasets with known generative factors:

  • 2D Shapes (dSprites): 737,280 binary images with factors: shape, scale, orientation, x-position, y-position.
  • 3D Shapes: 480,000 RGB images with factors: shape, scale, orientation, floor color, wall color, object color.

And datasets with unknown generative factors:

  • 3D Faces
  • 3D Chairs
  • CelebA (cropped celebrity faces)

Key Insights and Ideas

  • Surgical Regularization: By breaking down the VAE's KL divergence term, the authors show that $\beta$-VAE unnecessarily penalizes the mutual information $I(x;z)$. FactorVAE proves that you only need to penalize the Total Correlation to achieve disentanglement, leaving the model free to preserve high-fidelity data information.
  • Metric Vulnerability: The "aha moment" for evaluation metrics is demonstrating how a linear classifier can achieve a perfect score by using an elimination strategy (detecting when all other factors are non-zero) to guess the final ignored factor, masking a failure in true disentanglement.
Figure 3. A β-VAE model trained on the 2D Shapes data that scores 100% on metric in Higgins et al. (2016) (ignoring the shape factor). First row: originals. Second row: reconstructions. Re- maining rows: reconstructions of latent traversals. The model only uses three latent units to capture x-position, y-position, scale and ignores orientation, yet achieves a perfect score on the metric.

Key Results

  • Better Pareto Frontier: FactorVAE consistently achieves a superior trade-off compared to $\beta$-VAE. For instance, on the 2D Shapes dataset, FactorVAE achieves a disentanglement score of ~0.82 with a reconstruction error of ~45, whereas the best $\beta$-VAE configuration only reaches ~0.73 disentanglement for the same reconstruction quality.
Figure 5. Reconstruction error plotted against our disentanglement metric, both averaged over 10 random seeds at the end of training. The numbers at each point are values of β and γ. Note that we want low reconstruction error and a high disentanglement metric.
  • InfoGAN Comparison: The authors stabilized InfoGAN using Wasserstein distance and gradient penalties (InfoWGAN-GP) but found its disentanglement performance remained disappointingly low and highly sensitive to architectural choices compared to the robust VAE-based approaches.

Limitations and Future Work

  • Necessary but Insufficient: Minimizing Total Correlation does not guarantee disentanglement if latent dimensions collapse entirely to the prior (TC becomes 0, but no data information is preserved).
  • Supervised Evaluation: The new metric still requires the ability to generate samples with specific ground-truth factors held fixed, making it unusable for purely unsupervised real-world data evaluation.
  • Independent Factors Assumption: The framework assumes underlying factors are completely independent, making it poorly suited for data with correlated or hierarchical structures.
  • Discrete Factors: The model struggles to cleanly disentangle discrete factors (like shape) using continuous Gaussian latents, pointing to future work combining discrete and continuous latent variables.

Summary updated

BibTeX
@inproceedings{kim2018disentangling,
  author = {Hyunjik Kim and Andriy Mnih},
  title = {{Disentangling by Factorising}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=BkZHOjZO-H},
}
Figure