Disentangled Representations from Non-Disentangled Models

Valentin Khrulkov, Leyla Mirvakhabova, Ivan V. Oseledets, Artem Babenko

Abstract

Achieving disentangled representations—where independent factors of variation are separated into distinct variables—traditionally requires specialized architectures and complex regularization. This work demonstrates that high-quality generative models, such as StyleGAN 2, naturally learn these features without explicit disentanglement objectives. We propose a post hoc framework to discover interpretable directions in a pre-trained GAN's latent space and train an encoder to extract them. Our results show that this approach matches or exceeds the performance of state-of-the-art $\beta$-VAEs while maintaining superior image quality and training stability.

Introduction

In representation learning, the "holy grail" is disentanglement: the ability to isolate independent factors like color, rotation, and shape. Conventional "end-to-end" approaches, such as $\beta$-VAE or InfoGAN, often face a trade-off between image quality and disentanglement. Furthermore, these models are highly sensitive to hyper-parameters, requiring extensive tuning against ground-truth factors that may not be available in real-world scenarios.

This paper addresses these issues by showing that disentanglement is an emergent property of high-capacity generative models. By treating disentanglement as a discovery task rather than a training constraint, we can leverage the high-fidelity outputs of models like StyleGAN 2.

Methodology

We propose a two-stage post hoc disentanglement framework. First, a standard GAN is trained using traditional objectives. Second, we identify interpretable directions within the GAN’s latent space and train a separate encoder to map images to these directions.

Conceptual framework for post hoc disentanglement. A pre-trained generator $G$ maps latent codes $\mathbf{w}$ to images. We identify a subspace $N$ corresponding to disentangled factors.

To discover these directions, we introduce DeepSpectral (DS). DS hypothesizes that intermediate generator layers contain richer semantic information than the initial layers alone. It computes the Jacobian matrix of a chosen intermediate layer and uses Singular Value Decomposition (SVD) to find the directions that cause the most significant, distinct changes in the output. Once discovered, these directions are used to generate a synthetic dataset for training a simple CNN-based encoder.

Experimental Results

We evaluated our framework on four standard benchmarks: 3D Shapes, MPI3D, Cars3D, and Isaac3D.

Disentanglement Performance

Our post hoc methods demonstrate competitive performance against specialized VAE models. On the 3D Shapes dataset, the DeepSpectral (DS) method achieved a Mutual Information Gap (MIG) of 0.398, matching top-tier VAE results. Notably, these methods exhibit significantly lower variance across random seeds compared to VAEs, offering a more reliable path to disentanglement.

Comparison of disentanglement metrics (Modularity and MIG) across GAN-based post hoc methods and standard VAE-based models on multiple datasets.

Downstream Tasks and Fairness

The extracted representations are highly semantic. When used to solve Raven’s Progressive Matrices (abstract reasoning), representations from the ClosedForm (CF) method enabled a relation network to reach over 95% accuracy. Additionally, these representations achieved "unfairness scores" comparable to VAEs, indicating their effectiveness in isolating sensitive attributes for bias mitigation.

Discussion and Conclusion

Our findings suggest that disentanglement is emergent in high-capacity models because it is an efficient way to represent complex data distributions. The "Style" space ($W$) in StyleGAN is particularly well-suited for this, as it is naturally more rectified and interpretable than the initial noise space ($Z$).

While current methods primarily focus on linear directions, future work may explore non-linear manifolds to capture even more complex factors. Furthermore, the quality of the encoder remains dependent on the underlying GAN's ability to model all relevant factors of variation. By shifting the focus from constrained training to post hoc discovery, we can achieve robust disentanglement without sacrificing generative quality.

Summary updated

BibTeX
@misc{khrulkov2021disentangled,
  author = {Valentin Khrulkov and Leyla Mirvakhabova and Ivan V. Oseledets and Artem Babenko},
  title = {{Disentangled Representations from Non-Disentangled Models}},
  year = {2021},
  eprint = {2102.06204},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2102.06204},
}
Figure