Independence Constrained Disentangled Representation Learning from Epistemological Perspective
Ruoyu Wang Lina Yao







Independence Constrained Disentangled Representation Learning






Wang et al.






University of New South Wales Commonwealth Scientific and Industrial Research Organisation, Australia


Independence Constrained Disentangled Representation Learning from Epistemological Perspective
    Ruoyu Wang 1 Lina Yao 1,2
    September 9, 2024
==============================================================================================



§ ABSTRACT 
Disentangled Representation Learning aims to improve the explainability of deep learning methods by training a data encoder that identifies semantically meaningful latent variables in the data generation process. Nevertheless, there is no consensus regarding a universally accepted definition for the objective of disentangled representation learning. In particular, there is a considerable amount of discourse regarding whether should the latent variables be mutually independent or not. In this paper, we first investigate these arguments on the interrelationships between latent variables by establishing a conceptual bridge between Epistemology and Disentangled Representation Learning. Then, inspired by these interdisciplinary concepts, we introduce a two-level latent space framework to provide a general solution to the prior arguments on this issue. Finally, we propose a novel method for disentangled representation learning by employing an integration of mutual information constraint and independence constraint within the Generative Adversarial Network (GAN) framework. Experimental results demonstrate that our proposed method consistently outperforms baseline approaches in both quantitative and qualitative evaluations. The method exhibits strong performance across multiple commonly used metrics and demonstrates a great capability in disentangling various semantic factors, leading to an improved quality of controllable generation, which consequently benefits the explainability of the algorithm.








§ INTRODUCTION


Representation learning is widely recognized as a fundamental task in the field of machine learning, as the efficacy of machine learning methods heavily relies on the quality of data representation. It is suggested that an ideal representation should be disentangled <cit.>, which means it can identify the genuine generative factors hidden in the observed data, and the latent variables should be semantically meaningful and correspond to the ground truth generative factors.



However, there is no general agreement on a formal definition of disentangled representation <cit.> <cit.> <cit.>. Despite the lack of agreement on the formal definition of disentangled representation learning, existing methods suggested that two quantities are significant in disentangled representation learning: 1) Mutual Information between the latent variables and the data <cit.>; and 2) Independence between the latent variables <cit.><cit.>.

Nevertheless, regarding the second quantity Independence between the latent variables, it is worth noting that there is a lack of consensus about whether latent variables should be mutually independent in disentangled representation learning. While some <cit.> suggest that hidden factors should be strictly independent, some other works <cit.> argued that causal relationships exist between generative factors, thus they are not necessarily independent. Therefore, these arguments lead us to ask:



    What should be considered as generative factors? What should be independent in latent space? And what should be causally connected?



To answer these questions, it is crucial to understand how humans perceive and comprehend these factors and their relationships, because the fundamental objective of disentangled representation learning is to extract factors that are interpretable to us human. Therefore, in this paper, we first answer the above questions by borrowing the concepts from epistemology. Then, based on these interdisciplinary theories, we introduce a unified framework to consolidate prior arguments regarding the relationships between latent variables. Finally, after clarifying these questions, we propose a novel method for disentangled representation learning that jointly optimizes the two objectives mentioned earlier: 1) the mutual information objective and 2) the independent objective. The contribution of this paper is threefold:


  
  * We establish a conceptual bridge between epistemology and disentangled representation learning to facilitate the understanding of the data generation process and disentangled representation learning.
  
  * We introduce a two-level latent space framework to unify the prior arguments regarding the relationships between generative factors and latent variables in disentangled representation learning.
  
  * We propose a novel method for disentangled representation learning to jointly optimize the mutual information and the independent objectives, which outperforms the baseline methods consistently on multiple evaluation metrics.












§ OUR METHOD



 §.§ A Perspective of Epistemology



As discussed in Section <ref>, comprehending the relationships between latent variables in disentangled representation learning necessitates an understanding of how humans perceive these factors. Because the concept of interpretability inherently implies interpretability to humans; therefore, interdisciplinary insights from epistemology are indispensable in this context.

In epistemology, mental representations of perceptions are called ideas, which can be grouped into two categories, simple ideas and complex ideas <cit.>. Simple ideas are basic, indivisible concepts that form the foundation of our knowledge, and complex ideas are more advanced concepts that are built upon multiple simple ideas. For instance, when we imagine an apple (Figure <ref>), the sensory perceptions of an apple such as its colour, shape and taste are irreducible, and thus are regarded as simple ideas. These simple ideas can then be combined to form the complex idea of an apple as a whole. 

Taking these theories as a reference, we argue that the disagreement regarding whether latent variables should be independent arises from the lack of understanding of this hierarchical structure of human concepts. Existing works instinctively consider ALL latent variables in a single latent space. However, building upon these interdisciplinary theories, we contend that interpretable latent variables in disentangled representation learning should also follow a hierarchical structure in a similar way as demonstrated in Figure <ref>.











 §.§ Two-level Latent Space Framework


Inspired by the interdisciplinary theories introduced in Section <ref>, we propose a two-level latent space framework to consolidate prior arguments on the interrelationships between the latent variables, as illustrated in Figure <ref>. 

The framework groups all latent variables into two levels: 1) Atomic Level: which corresponds to the simple idea in epistemology, and comprises the factors that can be directly perceived from the observed data, and latent variables in this level should be mutually independent. 2) Complex Level: which comprises concepts derived from the atomic level variables. The two levels are connected by causal relationships and can be modelled by the Structural Causal Model (SCM). Within this framework, atomic-level latent variables should be mutually independent, and complex-level variables are not necessarily independent because the atomic-level variables may work as confounders due to the causal relationships between the two levels. 

We argue that prior arguments regarding the relationships between latent variables are primarily due to their focus on a set of selected factors in certain datasets, thus having different views on this issue. In contrast, our framework, supported by the theories in epistemology<cit.> and also cognitive science <cit.>, offers a general explanation that is adaptable to various scenarios, and consolidates prior arguments regarding the interrelationships between latent variables. In this paper, we concentrate on the datasets that consist only of atomic-level latent variables, thus all latent variables are independent. Therefore, we leverage the constraints of independent and mutual information to augment the efficacy of our proposed method for disentangled representation learning.




 §.§ Method Formulation




After clarifying the legitimacy of applying independence constraints in this problem in Section <ref>, we introduce our proposed method in this section. We build our method in the paradigm of Generative Adversarial Networks (GAN). Formally, GAN solves the minimax optimization problem (Equation <ref>) by utilizing a generator G and a discriminator D, and the generator G could learn the real data distribution P_real(x) when this framework converges. 

    min_Gmax_Dℒ_GAN(D,G) = 𝔼_x ∼ P_real[ log D(x) ] + 𝔼_z ∼ noise[ log (1-D(G(z))) ]


However, this framework imposes no restrictions on the semantic meaning of the latent variable z_i. To encourage the latent variables to possess semantic meanings, as introduced in Section <ref>, we apply the two constraints in this framework: 1) Mutual information between the latent variables and the data <cit.>; and 2) Independence between the latent variables <cit.>. 

For the constraint on mutual information, we adapt the implementation of InfoGAN <cit.>. First, the latent variables are decomposed into latent code z which controls the semantics in the image, and noise ϵ which is considered incompressible. Then, an auxiliary network Q is introduced into the framework to maximize the lower bound of mutual information between the latent code z and the image (Equation <ref>). In practice, a regularization term ℒ_I(G,Q) (Equation <ref>) is introduced into the framework to maximize the Mutual Information between latent variable z and the generated data.

    I(z,G(z,ϵ)) ≥𝔼_x ∼ G(z,ϵ)[ 𝔼_z' ∼ P(z|x)log Q(z'|x) ] + H(z)

On the other hand, for the independence constraint, we aim to minimize the Total Correlation <cit.> between latent variables, and apply this constraint to the learned latent code ẑ such that:

    TC(ẑ) = KL(q(ẑ)|| ∏_iq(ẑ_i))

where ẑ is the samples drawn from the learned posterior distribution obtained by Q(G(z)). Therefore, by integrating these two constraints, the overall objective of our method becomes:


    min_G,Qmax_Dℒ_TCGAN = ℒ_GAN(D,G) - λℒ_I(G,Q) + βℒ_TC(G,Q)

where

    ℒ_I(G,Q) = 𝔼_z ∼ P_(z), x ∼ G_(z,ϵ)[ log Q(z|x) ]


    ℒ_TC(G,Q) = KL(q(ẑ)|| ∏_iq(ẑ_i))


Thus far, we have formulated our method by integrating the two constraints in the paradigm of Generative Adversarial Network. However, the total correlation term (Equation <ref>) is intractable. In Section <ref>, we introduce the method to estimate this term and how this estimation process is integrated into our framework, then give an end-to-end illustration of our method.




 §.§ Total Correlation Estimation



To estimate the Total Correlation term (Equation <ref>), we adapt the method from FactorVAE <cit.>. Specifically, we utilize the Density-Ratio trick, which trains a Total Correlation Discriminator TCD to predict the probability that the input vector is from q(ẑ) rather than ∏_iq(ẑ_i), and then the Total Correlation term can be estimated by Equation <ref>.



    TC(ẑ) = 𝔼_q(ẑ)[ logq(ẑ)/∏_iq(ẑ_i)] ≈𝔼_q(z)[ logTCD(ẑ)/1-TCD(ẑ)]



The end-to-end framework of our method is illustrated in Figure <ref>. On top of the vanilla GAN framework which comprises a generator G, a data encoder E and a Discriminator head D, we first utilize an auxiliary network Q to predict the mean and variance of the latent variables of the generated data, as implemented in InfoGAN <cit.>. Then, we sample ẑ by utilizing a reparametrization trick to ensure the differentiability of the framework. By employing this approach, we acquired samples from the distribution q(ẑ). On the other hand, samples from ∏_iq(ẑ_i) cannot be sampled directly, so we adapt the permute-dim algorithm proposed in <cit.> to do the sampling, where the samples are drawn by randomly permuting across the batch for each latent dimension. Therefore, the input of our framework should be two randomly selected batches of latent variables, one of which is used to calculate the mutual information loss ℒ_I and sample from q(ẑ), another batch is used to sample from ∏_iq(ẑ_i) in order to estimate the total correlation loss ℒ_TC.


We perform three steps iteratively to train the framework: 1) Train the Discriminator D in GAN to ensure the generated images look real with other modules fixed; 2) Train the Generator G and Network Q by the loss defined in Equation <ref> with other modules fixed, where ℒ_TC is estimated by Equation <ref>; 3) Train the Total Correlation Discriminator TCD to distinguish q(ẑ) and ∏_iq(ẑ_i) with other modules fixed. These steps are illustrated in Algorithm <ref>.













§ EXPERIMENTS



 §.§ Experiment Setting


We evaluate the performance of our method from two perspectives: (1) Quantitative Evaluation (Section <ref>), where we compare our method with several baseline methods on multiple commonly used metrics for Disentangled Representation Learning; and (2) Qualitative Evaluation (Section <ref>), where we conduct Latent Space Traversal Test and compare our results with the case without the enforcement of independence constraint, to observe the direct impact of our method on the generated images.

We follow the settings in previous works on the model architectures of the Generator, Discriminator <cit.> and the Total Correlation Discriminator <cit.>. We use the Adam optimizer for training, with a learning rate equal to 0.001 for the generator, 0.002 for the discriminator and TC discriminator. We use α=0.1 and β=0.001 in Equation <ref>. The latent dimension equals 10. We used a batch size of 64 and trained the model for 30 epochs, then selected the checkpoint with the highest Explicitness score for evaluation on other metrics.









































































 §.§ Quantitative Evaluation


Since the quantitative evaluation of disentanglement requires ground-truth labels of all generative factors, most datasets are not suitable for quantitative evaluation. Therefore, following previous works in this domain, we concentrate on dSprites <cit.> for quantitative evaluation, where all factors are well-defined. 




  §.§.§ Metrics

We evaluate the quality of disentanglement by several metrics proposed in recent literature, including 1) Explicitness Score <cit.> which evaluates the quality of disentanglement by training a classifier on latent code to predict the ground-truth factor classes, a higher Explicitness Score indicates that all the generative factors are decoded in the representation; 2) JEMMIG Score <cit.> which evaluates the quality of disentanglement by estimating the mutual information (MI) between the ground-truth generative factors and the latent variables; 3) Modularity Score <cit.> which measures whether one latent variable encodes no more than one generative factor, it estimates the mutual information (MI) between a certain latent variable and the factor with maximum MI and compares it with all other factors; 4) SAP Score <cit.>, which evaluates the quality of disentanglement by training a linear regression model for every pair of latent variables and ground-truth factor, and uses the R^2 score of the regression model to denote the disentanglement score; and 5) Z-diff <cit.> which first selects pairs of data points with the same value on a fixed latent variable, and then evaluates the quality of disentanglement by training a classifier to predict which factor was fixed. We used the code provided by <cit.> for all evaluation metrics.







  §.§.§ Baselines

We compare our method with several baseline methods in the domain of Disentangled Representation Learning, which include VAE <cit.>, β-VAE <cit.>, AnnealedVAE <cit.>, Factor-VAE <cit.>, β-TCVAE <cit.>, InfoGAN <cit.>, IB-GAN <cit.>, and InfoGAN-CR <cit.>. For the VAE-based baseline methods <cit.>, we reproduce the results by the code provided in <cit.> with the suggested optimized parameters. In particular, we use a batch size of 64 for all experiments and train the model for 30 epochs then select the checkpoint with the highest Explicitness score for evaluation. We use the model architecture suggested in <cit.> and use a latent dimension equal to 10 for all methods. For β-VAE <cit.>, we train the model with β equal to 4. For Annealed VAE <cit.>, we set the capacity equal to 25. For factor VAE and β-TCVAE, we use the weight of 6.4 for the total correlation term. On the other hand, for baseline methods based on GAN <cit.>, we reproduce the result with the exact parameters and model architecture provided in the corresponding paper and code.



























  §.§.§ Results
 The results are presented in Table <ref>, where we present
the average and standard deviation over 10 runs for all metrics, and highlight the highest score in bold, and the second-highest score by an underscore. Our method outperforms the existing methods from two perspectives:

1) Our method achieves the best performance across all the evaluation metrics. Specifically, our method outperforms baseline methods by a considerable margin on Explicitness, Modularity and SAP scores. And on the other two metrics JEMMIG and Z-diff scores, even though existing methods already performed well, our method also outperforms baseline methods by a reasonable margin. 

2) Our method exhibits consistency across the evaluation metrics. Other methods, in contrast, often lack this consistency. For instance, IB-GAN performs well on Explicitness and Modularity Score but performs poorly on JEMMIG and SAP. This inconsistency arises from the fact that different metrics perform their evaluation from different perspectives as introduced in Section <ref> and the Metrics section above. Therefore, the consistency of our method shows the effectiveness of our method in enhancing the quality and generalizability of Disentangled Representation Learning algorithms.









 §.§ Qualitative Evaluation by Latent Space Traversal Test


While the datasets suitable for quantitative evaluation are limited, we further evaluate our method on other datasets by conducting Latent Space Traversal Tests. Latent space traversal test is a commonly used technique to investigate the semantic meaning of latent variables. It traverses one latent variable while keeping all the other variables invariant, and generates a sequence of images with these features. The semantic meaning of the traversed variable can be obtained by inspecting the changes in the images.

In our experiments, since we aim to improve the quality of disentanglement, we examine whether the changes in one variable affect more than one generative factor. If the traversed variable affects only one semantic meaningful factor, it means the quality of disentanglement is desirable. In contrast, if the traversed variable affects more than one semantic meaningful factor, it means the factors are still entangled in the latent space.

To this end, we make comparisons between the cases with/without the enforcement of the proposed independence constraint and directly observe the impact of implementing our method. To ensure fair comparisons, all the settings remain the same except for the total correlation loss ℒ_TC (Equation <ref>) in each pair of comparisons. These comparisons are conducted on three datasets: MNIST, FashionMNIST and dSprites. For all three datasets, the settings remain unchanged as introduced in Section <ref>, except for the dimension settings of the latent space, because the number of generative factors contained in each dataset is different. This will be further elaborated in each paragraph below.












  §.§.§ MNIST
 
We trained the models with 1 ten-dimensional discrete variable, 2 continuous variables, and 62 noise variables. The ideal outcome of Disentangled Representation Learning is that the data encoder will map the discrete variable to the digit class, and the two continuous variables will correspond to the width and rotation of the digit. The results of our experiment are provided in Figure <ref>. In each row, we keep the discrete variable digit invariant, and traverse on the continuous variable rotation. When the model is trained without the independence constraint (Figure <ref>), we observe that: 1) The variables digit class and rotation are not fully disentangled in the latent space. For example, while we control the digit to be 5 on the fifth row, some 0 and 6 are generated when traversing on rotation; and 2) the variables width and rotation of the digit are not fully disentangled in the latent space. For example, as highlighted in the first row of Figure <ref>, while we only traverse the variable rotation, the width of the digit is also affected. We highlight this trend on the first row, and similar patterns can be observed on other rows. In contrast, with the enhancement of the independent constraint (Figure <ref>), both digit and width remain unchanged when traversing on rotation.



  §.§.§ dSprites
 
We trained the models with 5 continuous variables, and 5 noise variables. Ideally, the five continuous variables will be mapped to the five generative factors of the dataset, which include Shape, Scale, Rotation, Pos X and Pos Y. The results of our experiment are provided in Figure <ref>. On each row of the images, we traverse one factor while keeping all other factors invariant as noted on the left side of each row. When the model is trained without the independence constraint (Figure <ref>), we observe that the factors are entangled in the latent space. For example, on the third row of the image, while traversing the factor of rotation, the shape of the figures are affected. And on the fourth row, rotation is affected while traversing the Position X. In contrast, with the enhancement of the independent constraint (Figure <ref>), these factors are not affected, as highlighted by red boxes in Figure <ref>.







  §.§.§ FashionMNIST
 
We trained the models with 1 ten-dimensional discrete variable, 1 continuous variable, and 62 noise variables. Ideally, the discrete variable and the continuous variable will correspond to the item class and the thickness of the image. The results of our experiment are provided in Figure <ref>. A similar conclusion can be drawn as we did on other datasets above. On each row, we keep the discrete variable item class invariant, and traverse on the continuous variable thickness of the image. When the model is trained without the constraint of the independence between latent variables (Figure <ref>), we observe that the item is affected by variable thickness, as highlighted on the second row and the fourth row. In contrast, the item type remains unaffected when the model is trained with the enhancement of the independent constraint (Figure <ref>).








  §.§.§ Summary
 Based on these comparisons, we conclude that our method could consistently enhance the quality of disentanglement. Note that this does not mean our method could always disentangle all the factors perfectly, however, while some factors may still exhibit slight entanglement in the given images, the differences between the cases with/without the independence constraint are nontrivial, which validates the effectiveness of our method.







§ RELATED WORKS



 §.§ Disentangled Representation Learning

Disentangled Representation Learning aims to learn a data encoder that can identify true latent variables that are semantically meaningful. <cit.> suggested that increasing the weight of the KL regularizer in VAE <cit.> can benefit the quality of disentangled representation learning. <cit.> proposed that disentanglement quality can be improved by progressively increasing the bottleneck capacity. FactorVAE <cit.> and β-TCVAE <cit.> both penalize the total correlation <cit.> between latent variables, while FactorVAE uses density-ration trick for total correlation estimation, β-TCVAE proposed a biased Monte-Carlo estimator to approximate total correlation. Several other methods were also proposed in the paradigm of VAE <cit.>. However, <cit.> claimed that unsupervised disentangled representation learning is impossible without inductive biases. 

On the other hand, some methods are proposed to learn disentangled representation in the paradigm of GAN <cit.>. InfoGAN <cit.> proposed a method to learn disentangled representation by maximizing the mutual information between latent variables and the generated image. InfoGAN-CR <cit.> claimed that self-supervision techniques can be used to improve the quality of disentanglement. IB-GAN <cit.> utilized the Information Bottleneck framework for the optimization of GAN. Besides, some methods attempted to learn disentangled representations without utilizing generative models<cit.>.

Recently, diffusion models have been applied to the domain of disentangled representation learning <cit.>. Additionally, disentangled representation learning has found broad applications in areas such as graph representation learning <cit.>, graph neural architecture search <cit.>, recommendation systems <cit.>, and out-of-distribution generalization <cit.>.




 §.§ Causal Representation Learning

Recent studies are aimed at connecting the field of causal inference and disentangled representation learning. <cit.> introduced a causal perspective of disentangled representation learning by modelling the data generation process as a Structural Causal Model (SCM) <cit.>, where they introduced a set of confounders that causally influence the generative factors of observable data. <cit.> further developed this idea and studied the role of intervention and counterfactual effects. CausalVAE <cit.> introduced a fully supervised method that builds a Causal Layer to transform independent exogenous factors into causal endogenous factors that correspond to causally related concepts in the observed data. And DEAR <cit.> proposed a weakly supervised framework, which learns causally disentangled representation with SCM as prior.






§ CONCLUSION

In this paper, we investigated the prior disagreement on the interrelationships between latent variables in Disentangled Representation Learning, and proposed a novel method to improve the quality of disentanglement. First, we build a conceptual bridge between epistemology and disentangled representation learning, thus clarifying what should and should not be independent in the latent space by introducing a two-level latent space framework based on interdisciplinary theories. Then, after clarifying the legitimacy of applying the independence constraint on the problem of Disentangled Representation Learning, we introduce a novel method that applies the mutual information constraint and independence constraint within the Generative Adversarial Network (GAN) framework. Experiments show that our method consistently achieves better disentanglement performance on multiple evaluation metrics, and Qualitative Evaluation results show that our method leads to an improved quality for controllable generation. Besides, our paper introduced a novel perspective to apply causal models to the field of representation learning, which facilitates the development of explainability of deep learning and holds potential for wide-ranging applications that value explainability, transparency and controllability.









splncs04






