Counterfactuals uncover the modular structure of deep generative models

Michel Besserve, Rémy Sun, Bernhard SchölkopfarXiv 2018

TL;DR

This paper introduces a novel framework for understanding the internal workings of deep generative models by using counterfactual interventions to uncover "modular structures" – groups of internal variables that control specific aspects of the generated output. This approach allows for more interpretable and controllable manipulation of generated images, leading to applications like efficient style transfer and robustness testing for recognition systems.

What Problem Does This Paper Address?

Deep generative models (like GANs and VAEs) are powerful tools for creating realistic images, but understanding how they achieve this and how to precisely control their output remains a significant challenge. While previous work has tried to achieve this by disentangling latent factors (i.e., making each latent variable control a distinct feature), this often requires supervision and can be too restrictive for complex, real-world data. The authors argue that a more fundamental approach is to uncover a modular structure within the model's internal representations, where groups of variables work together to control specific aspects of the output, even if these variables aren't statistically independent.

Methods

The core of the paper's contribution lies in its causal framework for analyzing generative models. They define a Causal Generative Model (CGM), which represents the computational graph of a generative model. Using this framework, they introduce counterfactual interventions: essentially, changing the value of a specific internal variable (or group of variables) and observing how the output changes.

Key concepts include:

  • Intrinsic Disentanglement: This is the central idea. It means that a group of internal variables (a "module") can be manipulated independently, and this manipulation will result in a predictable, disentangled change in the output. This is achieved by finding "faithful" counterfactuals, where the intervention results in a plausible output that could have been generated by the original model.
  • Counterfactual Hybridization: A practical method for implementing counterfactual interventions. They take two generated images, identify a module of internal variables, and then "mix" the internal representations of these two images to create a hybrid. For example, they might take the "background" module from image A and the "object" module from image B to create a new image with the object from B in the background of A.
  • Influence Maps (EIMs): To identify these modules, they compute elementary influence maps (EIMs) for each individual internal variable (e.g., a single channel in a convolutional layer). These maps show how much that variable influences different parts of the output image.
  • Unsupervised Clustering: They then use unsupervised methods (like Non-negative Matrix Factorization - NMF) to cluster these EIMs, grouping variables that have similar influence patterns into modules.

Datasets

The authors evaluate their methods on several standard datasets:

  • CelebA: A dataset of celebrity faces, used for training and evaluating VAEs, DCGANs, and BEGANs.
  • ImageNet: A large-scale dataset of diverse images, used for evaluating BigGAN.

Key Insights and Ideas

  • Modularity over Statistical Independence: The paper convincingly argues that focusing on modularity (groups of variables working together) is more effective and less restrictive than relying solely on statistical independence for disentanglement, especially for complex real-world data.
  • Counterfactuals as a Tool for Discovery: Counterfactual interventions are not just for generating new images but are a powerful tool for discovering the internal structure of generative models.
  • Unsupervised Module Discovery: The proposed method for identifying modules is entirely unsupervised, relying on the model's internal activations and influence maps, making it broadly applicable.
  • Interpretable Modules: The discovered modules often correspond to semantically meaningful aspects of the generated images (e.g., background, face, hair, object texture).
  • Generative Models as Causal Systems: The framework frames generative models as causal systems, allowing for a more rigorous understanding of how changes in internal states lead to changes in output.

Key Results

  • Successful Module Identification: The method successfully identified interpretable modules in various generative models (VAE, DCGAN, BEGAN, BigGAN) trained on CelebA and ImageNet. For instance, in face generation, modules corresponding to background, face, and hair were found.
  • High-Quality Counterfactual Generation: The counterfactual hybridization technique produced visually plausible and coherent hybrid images, demonstrating the effectiveness of manipulating discovered modules. Examples include swapping objects between classes (e.g., ostrich-cock, koala-teddy) and modifying backgrounds while preserving objects.
  • Application to Style Transfer: The discovered modules enable computationally efficient style transfer, allowing for targeted manipulation of specific image aspects.
  • Robustness Assessment: The paper demonstrates how counterfactuals can be used to probe the robustness of image classifiers to contextual changes. By creating hybrids, they showed that some classifiers are more sensitive to background context than others. For example, NASNet-large was found to be more robust to context changes in koala/teddy bear hybrids.

Limitations and Future Work

  • Computational Cost: While the method enables efficient style transfer after training, the process of identifying modules (especially computing EIMs and clustering) can be computationally intensive.
  • Model Dependence: The interpretability and effectiveness of the discovered modules are inherently tied to the architecture and training of the specific generative model.
  • Future Work: The authors suggest exploring this framework for more complex applications, such as understanding the interplay between different modules, developing more sophisticated counterfactual interventions, and further investigating its use in assessing and improving the robustness of downstream tasks like object recognition. They also highlight the potential for this work to contribute to more sustainable AI research by enhancing interpretability and reusability of trained models.

Summary updated

BibTeX
@misc{besserve2018counterfactuals,
  author = {Michel Besserve and Rémy Sun and Bernhard Schölkopf},
  title = {{Counterfactuals uncover the modular structure of deep generative models}},
  year = {2018},
  eprint = {1812.03253},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.03253},
}
Figure