Overlooked Implications of the Reconstruction Loss for VAE Disentanglement

Nathan Michlo, Richard Klein, Steven James

TL;DR

Disentanglement in Variational Autoencoders (VAEs) is widely believed to be driven by the regularization term in the loss function. This paper flips that assumption on its head, demonstrating that disentanglement is largely an accident of how the reconstruction loss interacts with standard benchmark datasets. By introducing an adversarial dataset where standard pixel-wise losses fail, the authors show that disentanglement can be restored simply by changing the reconstruction loss to match the data's underlying structure.

What Problem Does This Paper Address?

Disentangled representation learning aims to train models to automatically separate independent factors of variation in data—such as separating an object's shape, size, and color into distinct latent variables. While VAE variants like $\beta$-VAE achieve this, they lack an explicit mechanism forcing latents to align with human-intuitive factors.

The machine learning community has long hypothesized that the KL-divergence regularization term (the information bottleneck) is primarily responsible for this behavior. The authors challenge this view, investigating why unsupervised VAEs manage to disentangle at all. They reveal that current success is heavily reliant on a hidden assumption: that standard pixel-wise reconstruction losses (like Mean Squared Error) accidentally mirror ground-truth factor distances.

Methods

  • Perceived Distance: The authors formalize how a VAE "sees" distance between two data points based purely on its reconstruction loss: $$d_{pcv}(x^{(a)}, x^{(b)}) = L_{rec}(x^{(a)}, x^{(b)})$$
  • Random Sampling Reorganization: They clarify the mechanism of disentanglement. Regularization forces latent distributions to overlap. When they overlap, random sampling during training causes the decoder to make mistakes. To minimize these reconstruction errors, the VAE is forced to organize the latent space such that images with small perceived distances are placed close together.
Figure 1: Nearby distributions in the latent space that correspond to different inputs. The VAE reconstructs a sample from the middle distributions. Left: weaker regularisation leads to few sampling mis- takes, resembling a lookup table [Mathieu et al., 2019]. Right: strong regularisation leads to more reconstruction mistakes, where samples are attributed to nearby distributions, encouraging reorganisation.
  • Spatially Aware Reconstruction Loss: To fix cases where standard pixel-wise MSE fails due to a lack of pixel overlap, they introduce a modified loss function that appends a channel-wise box blur term: $$L_{Overlap}(x, \hat{x}) = L_{rec}(x, \hat{x}) + \alpha L_{rec}(blur(x), blur(\hat{x}))$$ This artificially creates spatial overlap, providing the necessary distance gradients for the VAE to organize the latent space.

Datasets

  • Standard Benchmarks: 3D Shapes, Cars3D, dSprites, and Small NORB.
  • XYSquares (New Adversarial Benchmark): Designed by the authors to target pixel-wise losses. It consists of three colored squares ($8 \times 8$ pixels) moving along grid positions in a $64 \times 64$ world. Because the step size matches the square size, there is zero pixel overlap between adjacent positions. Consequently, a standard pixel-wise MSE loss perceives the exact same distance between any two non-overlapping positions, completely hiding the continuous spatial relationship from the VAE.

Key Insights and Ideas

  • Disentanglement by Accident: Standard synthetic datasets are unintentionally constructed so that smooth changes in ground-truth factors correspond to smooth changes in pixel-wise MSE. VAEs simply learn these pixel-space distances; they do not possess an intrinsic drive toward human-interpretable concepts.
  • The Catalyst Role of Regularization: Regularization doesn't create the disentangled axes. Instead, it acts as a catalyst by forcing latent distributions to overlap, which triggers reconstruction errors that drive latent space reorganization based on the reconstruction loss.
  • Subjectivity of Disentanglement: What humans consider "disentangled" is highly subjective and tied to how we perceive features. If a machine's loss function doesn't share that perceptual bias, unsupervised disentanglement fails completely.

Key Results

  • Complete Failure on Adversarial Data: State-of-the-art models like $\beta$-VAE and Ada-GVAE completely fail to learn disentangled representations on the standard XYSquares dataset, yielding very low MIG (Mutual Information Gap) and DCI disentanglement scores.
  • Overlap Matters: When the authors manually decreased the grid spacing of XYSquares from 8 pixels down to 1 pixel (introducing pixel overlap), disentanglement performance steadily improved because the pixel-wise MSE could finally resolve ordering.
  • Loss-Based Rescue: By swapping standard MSE for their proposed BoxBlurMSE loss on the non-overlapping XYSquares dataset, both $\beta$-VAE and Ada-GVAE successfully recovered high disentanglement scores, proving that the choice of reconstruction loss is a powerful inductive bias.

Limitations and Future Work

  • The proposed box-blur augmentation is a handcrafted solution specifically tailored to the spatial nature of the XYSquares dataset. It is not a universal reconstruction loss applicable to any arbitrary dataset.
  • Automatically learning or identifying the optimal reconstruction loss for a given real-world dataset remains an open challenge.
  • Ultimately, because ground-truth factors are subjective, fully unsupervised disentanglement may be impossible without incorporating domain-specific supervision or general world knowledge into the loss design.

Summary updated

BibTeX
@inproceedings{michlo2023overlooked,
  author = {Nathan Michlo and Richard Klein and Steven James},
  title = {{Overlooked Implications of the Reconstruction Loss for VAE Disentanglement}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/453},
}
Figure