Learning Disentangled Joint Continuous and Discrete Representations

Emilien DupontNeurIPS 2018

Introduction

JointVAE is a framework that allows Variational Autoencoders (VAEs) to learn "disentangled" representations—where individual neurons control specific, interpretable features—across both continuous and discrete factors simultaneously. By managing the information capacity of continuous and discrete latent channels separately, the model can automatically discover categories (like digit type) alongside fluid variations (like rotation or thickness) in an entirely unsupervised way.

The Challenge of Discrete Data

In representation learning, the goal is for models to discover the underlying "factors of variation" in data. For example, in a dataset of faces, a disentangled model might allocate one latent variable for skin tone, another for hair length, and another for head pose.

Most existing state-of-the-art methods, such as $\beta$-VAE, focus almost exclusively on continuous factors. However, the real world is full of discrete categories: a dataset of objects contains different types of items (shoes vs. bags), and MNIST contains ten distinct digits. When a continuous-only model tries to represent discrete data, it often "entangles" the categories with continuous features, leading to messy, uninterpretable latent spaces. While alternative models like InfoGAN can handle both continuous and discrete variables, they suffer from the classic instability and training difficulties associated with Generative Adversarial Networks (GANs).

Methodology: The JointVAE Approach

The authors introduce JointVAE, which builds on the stable VAE architecture but makes two critical modifications to handle mixed data types.

Architecture of JointVAE showing separate continuous and discrete latent channels.
  1. Joint Latent Distribution: The latent space is augmented. Instead of just having a vector of continuous variables ($z$), the model includes a set of categorical variables ($c$). To keep the model end-to-end differentiable (a strict requirement for backpropagation), they use the Gumbel-Softmax (or Concrete) distribution. This acts as a "relaxed" version of a discrete distribution, allowing gradients to flow smoothly through the sampling steps.
  2. Separated Capacity Control: This is the framework's core innovation. The authors found that simply adding discrete variables to a standard VAE causes the model to ignore them in favor of the continuous ones. To fix this, they use a modified objective function that limits the "information capacity" ($C$) of the continuous and discrete channels independently. By gradually increasing these capacities during training, they force the model to encode information in both types of variables.

The final loss function balances reconstruction accuracy against two separate KL-divergence terms (one for continuous, one for discrete), each pressured to match a specific, growing capacity target.

Key Insights

  • The "Capacity" Hack: Disentanglement is essentially a tug-of-war between reconstruction and compression. By controlling the "bandwidth" of discrete and continuous channels separately, the model is forced to use the discrete channel for what it does best: representing distinct categories.
  • Stability over GANs: Unlike InfoGAN, which can be finicky to train, JointVAE inherits the stability of the VAE framework, making it much more reliable for unsupervised discovery.
  • Unsupervised Classification: Because the model is forced to find discrete factors, it effectively performs unsupervised classification. On MNIST, the model's discrete latent variable naturally aligned with the actual digit types with high accuracy, despite never seeing a label.

Key Results

The model was evaluated on several standard computer vision benchmarks, including MNIST, FashionMNIST, CelebA, Chairs, and dSprites.

JointVAE successfully disentangles continuous factors like angle from discrete factors like digit type on MNIST.
  • MNIST Disentanglement: JointVAE successfully separated "digit type" (discrete) from "slant," "width," and "thickness" (continuous). Standard $\beta$-VAEs failed this, often entangling the digit identity with the stroke style.
  • Inference Accuracy: The model achieved 88.7% accuracy on MNIST digit classification in a completely unsupervised manner simply by looking at the discrete latent units.
  • Quantitative Performance: On the dSprites benchmark, JointVAE achieved a disentanglement score of 0.69. While slightly lower than the continuous-only FactorVAE (0.82), it was the only model capable of correctly encoding the discrete shape factor into a discrete latent variable.
  • Image Editing: By encoding an image and manually "flipping" the latent variables, the authors demonstrated targeted edits—such as rotating a chair or changing the background color of a face—while keeping other features constant.

Limitations and Future Work

While powerful, JointVAE has a few limitations. Like many disentanglement methods, it is sensitive to hyperparameters, specifically the choice of $\gamma$ (the weight of the capacity constraint) and the rate at which capacity $C$ is increased. Additionally, the quality of disentanglement can vary between different training runs due to random seed variance. Finally, if a dataset lacks a "prominent" discrete factor, the model might fail to learn meaningful discrete representations. Future directions could involve combining this approach with more recent VAE improvements like FactorVAE or $\beta$-TCVAE to further sharpen the disentanglement.

Summary updated

BibTeX
@inproceedings{dupont2018learning,
  author = {Emilien Dupont},
  title = {{Learning Disentangled Joint Continuous and Discrete Representations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
}
Figure