Disentangling Latent Space for VAE by Label Relevant/Irrelevant Dimensions

Zhilin Zheng, Li Sun, Qingli Li

Introduction

Generative modeling with Variational Auto-Encoders (VAEs) has long faced two significant hurdles: the production of blurry images and the phenomenon of posterior collapse. Posterior collapse occurs when the latent code fails to capture meaningful input data, as the model defaults to the standard Gaussian prior to minimize loss. Furthermore, while Conditional VAEs (cVAEs) introduce label-based generation, they often fail to cleanly separate category-defining features (e.g., identity) from common variations (e.g., pose or lighting).

This paper proposes a novel VAE architecture designed to explicitly disentangle the latent space into label-relevant dimensions ($z_s$) and label-irrelevant dimensions ($z_u$). By leveraging a Gaussian Mixture Model (GMM) prior and adversarial training, the model achieves high-quality, diverse image generation and robust performance in semi-supervised tasks.

Proposed Architecture

The core of the innovation lies in a dual-encoder framework that partitions the latent representation to ensure independence between identity and style.

The proposed dual-encoder VAE architecture featuring label-relevant ($z_s$) and label-irrelevant ($z_u$) latent spaces.

1. Label-Relevant Encoder ($Encoder^s$)

The label-relevant encoder maps inputs to $z_s$. Unlike standard VAEs that use a single Gaussian prior, $z_s$ is modeled using a Gaussian Mixture Model (GMM), where each cluster represents a specific class. This is optimized via a "Gaussian mixture cross-entropy loss" (GM loss), providing global stochastic supervision and allowing $z_s$ to act as a "variational soft label."

2. Label-Irrelevant Encoder ($Encoder^u$)

The label-irrelevant encoder maps inputs to $z_u$, which follows a standard Gaussian $N(0, I)$. To prevent label information from "bleeding" into $z_u$, an adversarial classifier is employed. While the classifier attempts to predict the label from $z_u$, the encoder is trained to maximize the classifier's uncertainty, effectively "scrubbing" label-specific information from this space.

3. Hybrid Decoder and Discriminator

The concatenated latent code $[z_s, z_u]$ is processed by a decoder. To mitigate the characteristic blurriness of VAE outputs, a GAN-style discriminator is integrated into the pixel domain. This adversarial component pushes the model toward generating sharper, more realistic textures.

Experimental Results

The model was evaluated on diverse benchmarks, including FaceScrub (identities), CIFAR-10/100 (objects), and CUB-200-2011 (birds).

Qualitative comparison of generated samples on FaceScrub and CIFAR-10 datasets.

Quantitative Performance

The proposed method consistently outperformed baselines such as cVAE, cGAN, and CVAE-GAN. On the FaceScrub dataset, the model achieved an Inception Score (IS) of 17.91, surpassing CVAE-GAN's 16.75. Additionally, intra-class diversity measurements using MS-SSIM confirmed that the model generates a wider variety of images within a single category compared to its competitors.

Disentanglement and Inpainting

Visualizations demonstrate successful disentanglement: fixing $z_s$ while varying $z_u$ allows for changing expressions or poses while maintaining identity. Conversely, fixing $z_u$ while varying $z_s$ changes the identity while keeping the environmental context constant. The model also showed superior performance in image inpainting, producing identity-consistent completions for missing facial regions where other models often failed.

Discussion and Future Work

The use of adversarial "scrubbing" in the latent space proves to be a powerful mechanism for ensuring disentanglement. Furthermore, the model's ability to handle unlabeled data by treating unknown classes as a weighted sum of GMM components offers significant flexibility for semi-supervised learning.

Future research may focus on improving the interpretability of individual dimensions within the $z_s$ and $z_u$ spaces. While the spaces are separated, the specific meaning of each dimension remains abstract. Additionally, scaling the model to incorporate more granular labels (e.g., specific facial attributes) could further enhance the controllability of the generative process.

Summary updated

Abstract

VAE requires the standard Gaussian distribution as a prior in the latent space. Since all codes tend to follow the same prior, it often suffers the so-called ”posterior collapse”. To avoid this, this paper introduces the class specific distribution for the latent code. But different from cVAE, we present a method for disentangling the latent space into the label relevant and irrelevant dimensions, zs and zu, for a single input. We apply two separated encoders to map the input into zs and zu respectively, and then give the concatenated code to the decoder to reconstruct the input. The label irrelevant code zu represent the common characteristics of all inputs, hence they are constrained by the standard Gaussian, and their encoder is trained in amortized variational inference way, like VAE. While zs is assumed to follow the Gaussian mixture distribution in which each component corresponds to a particular class. The parameters for the Gaussian components in zs encoder are optimized by the label supervision in a global stochastic way. In theory, we show that our method is actually equivalent to adding a KL divergence term on the joint distribution of zs and the class label c, and it can directly increase the mutual information between zs and the label c. Our model can also be extended to GAN by adding a discriminator in the pixel domain so that it produces high quality and diverse images.
BibTeX
@inproceedings{zheng2019disentangling,
  author = {Zhilin Zheng and Li Sun and Qingli Li},
  title = {{Disentangling Latent Space for VAE by Label Relevant/Irrelevant Dimensions}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.01247},
}
Figure