An Empirical Study on Disentanglement of Negative-free Contrastive Learning
Abstract
Negative-free contrastive learning methods have attracted a lot of attention with simplicity and impressive performances for large-scale pretraining.
However, its disentanglement property remains unexplored.
In this paper, we examine negative-free contrastive learning methods to study the disentanglement property empirically.
We find that existing disentanglement metrics fail to make meaningful measurements for high-dimensional representation models, so we propose a new disentanglement metric based on Mutual Information between latent representations and data factors.
With this proposed metric, we benchmark the disentanglement property of negative-free contrastive learning on both popular synthetic datasets and a real-world dataset CelebA. Our study shows that the investigated methods can learn a well-disentangled subset of representation.
As far as we know, we are the first to extend the study of disentangled representation learning to high-dimensional representation space and and introduce negative-free contrastive learning methods into this area. The source code of this paper is available at https://github. com noahcao disentanglement
Introduction
Existing disentangled representation learning methods are mostly generative models (25; 15; 24; 10; 8; 31).
They are evaluated only on simple synthetic datasets (36; 5) and low representation dimensions, e.g., no more than 20-d.
In contrast, contrastive learning is a class of discriminative methods, trained by pulling the representation of two augmentations of the same image close.
This usually requires a much higher representation dimension, e.g., often at least 1000-d.
Despite the success of contrastive learning it remains unknown whether it can lead to disentangled representations.
Recently, some works (50; 53) reveal that contrastive learning can approximately invert the data generation process and allow the learned representation have identifiability, which is related to the disentanglement property.
However, all these advances necessarily rely on the contrast provided by negative samples.
The disentanglement property of contrastive learning without negatives, or “non-contrastive self-supervised learning”, remains unexplored.
And no contrastive learning methods have been evaluated on the standard disentanglement benchmarks (36; 5) yet.
Representation disentanglement requires different dimensions of a representation vector to be correlated to only one independent variable of the input data, which we call a data factor.
There lacks a uniform convention of measuring of “correlation” here, so multiple disentanglement metrics (9; 15; 13) have been proposed for the quantitative evaluation. Their shared principle is that a well-disentangled representation model should not have a representation dimension responding to the change of more than one data factor.
We find although multiple disentanglement metrics’ (15; 24; 6; 9; 27) evaluations are in agreement for low-dimensional space (34), they disagree in high-dimensional space.
Moreover, their design limitation makes the measurement not meaingful in high-dimensional space.
We thus propose a new disentanglement evaluation metric that is robust to representation dimension scaling and is thus adaptable to a high-dimensional representation model.
The new metric is named as “ M utual information based E ntroy D isentanglement” and MED for short.
With the proposed metric, we find that negative-free contrastive learning methods can achieve good disentanglement in a subset of latent dimensions.
Given that the recent disentanglement studies are limited to simple synthetic datasets but contrastive learning is especially powerful for complicated and large-scale datasets, we also extend the quantitative benchmarking to a real-world dataset CelebA (33).
On CelebA, existing low-dimensional generative disentangled learning methods are unable to learn good representations, demonstrating the gap between current disentangled learning research and the real-world data complexity.
To summarize, our contributions in the work are three-fold:
We find that existing disentanglement metrics fail to extend to high-dimensional representation space, and we propose a new metric MED to extend this area to high-dimensional space.
We extend the study of disentangled representation learning to real-world complicated datasets and high-dimensional representation space, revealing the gap between current disentangled representation learning and real-world data complexity.
We empirically study the disentanglement property of contrastive learning without negatives.
We find it can learn a well-disentangled subspace of latent representation.
Related Works
Disentangled Representation Learning.
Learning a disentangled representation is a long-desired goal in the deep learning community (4; 37; 11; 3; 42; 28; 47). A disentangled representation matches how humans understand the world and allows us to use much fewer labels to learn challenging downstream tasks (49).
There are two lines of work related to this goal, i.e., the Independent
Component Analysis (ICA) and the Disentangled Deep Representation Learning.
ICA (18) usually assumes that the pattern of noise (17; 22) or some additional auxiliary variables (19; 23) can be observed.
On the other hand, deep representation learning makes no explicit assumption on the noise distribution or representation prior and usually emphasizes unsupervised learning.
Under this setting, deep representation learning is usually based on deep generative models such as VAE-based methods (15; 24; 6; 27) and Generative Adversarial Networks (GAN) (10; 8).
These two lines of study focus on different but relevant (26) aspects of a learned representation.
In this paper, we focus on empirically studying the disentanglement property of negative-free contrastive learning methods to introduce them into the scope of disentangled representation learning.
Disentanglement Metrics.
The variation in the metric used also shows the difference between ICA and Disentangled Deep Representation Learning.
ICA aims to achieve good identifiability and uses Mean Correlation Coefficient (MCC) as the common metric.
On the other hand, the metrics used in the deep disentangled representation learning community are very diverse.
Until now, no widely accepted definition of “disentanglement” is available.
So the empirical agreement of metrics makes the basis of quantitatively evaluating disentanglement. DisLib (34) summarizes six popular disentanglement metrics, i.e., DCI (9), SAP (27), MIG (6), BetaVAE score (15), FactorVAE score (24) and Modularity (41).
DisLib finds that the five metrics except for Modularity have good agreement in evaluating disentanglement quality.
However, all of the metrics are evaluated on low-dimensional latent space, which is around 10 dimensions.
We find severe problems when applying those metrics to high-dimensional latent spaces where they show significant disagreement.
To make meaningful evaluation of the disentanglement property of contrastive learning methods, we thus propose a new metric, which is more applicable to high-dimensional representation space.
Contrastive Learning and Representation Disentanglement.
Contrastive learning (CL) creates “views” by augmentations over images.
Views of the same image serve as positives, and views of other images as negatives.
Recently, some works try to understand contrastive learning theoretically (50; 1; 46; 45; 30) or empirically (43; 52; 38).
Zimmermann et al.
suggests that the contrastive method inverts a data generation process when infinite negative samples are available (50), which is related to the disentanglement property.
However, there is still no work connecting CL methods with standard disentanglement benchmarks.
On the other hand, negative-free CL methods (40; 7; 51) do not use the contrast between positive and negative samples to encourage discriminative representations.
They generate positive “views” of data by applying different augmentations to the same input data, and the pair of views is forwarded into two network streams.
Recent works on this line have their own unique designs.
BYOL (40) discovers that self-supervised learning can avoid trivial solutions, i.e., “model collapse”, even without using negative samples to provide contrast.
The key of BYOL is to add a predictor layer following the commonly adopted “encoder-projector” network of contrastive learning methods (14).
This provides additional asymmetry.
As a follow-up, SimSiam (7) removes the momentum update from BYOL and proves that “predictor+stop-gradient” is enough for selfsupervised learning to learn non-trivial representation.
More recently, Barlow Twins (51) shows that even the predictor or the trick of stop-gradient is not necessary.
Negative-free CL methods have their own advantages, such as avoiding model collapse (44; 16; 21), but its disentanglement property remains unexplored, either empirically or theoretically.
In this paper, our focus thus to benchmark the disentanglement property of these methods for the first time which is possible after we propose a new disentanglement metric applicable to the high-dimensional representation models.  The Proposed Disentanglement Metric: MED
Positive-negative contrast in self-supervised learning is seen to encourage learned representation to have uniformity on a hyper-sphere (50).
When negative views are not available, the disentanglement property of the learned representation remains a mystery.
Therefore, we examine the mentioned negative-free contrastive learning methods in an empirical study to reveal this property of interest.
However, we demonstrate in Section 3.1 that existing disentanglement metrics can not evaluate CL methods in high-dimensional space fairly nor meaningfully. Therefore, we introduce our proposed MI-based Entropy Disentanglement score (MED) in Section 3.2 and its variant to evaluate disentanglement of a subspace of representation in Section 3.3. 3.1 Failure of Existing Metrics on High-Dimensional Space
Typical contrastive learning methods need a high dimensional representation space (“latent space”) to train well.
However, the previous study of disentangled representation learning only deals with low-dimensional representation space.
For example, in Locatello et al., the latent space dimension is set to 10 .
So, existing disentanglement metrics (see Appendix C for details) are designed for low-dimensional representation model and have intrinsic flaws when evaluating models in highdimensional space.
To be precise, we have observations as below:
• Metrics based on learnable classifiers, such as BetaVAE score and FactorVAE score , allow unfair advantages to high-dimensional model whose redundant parameters can trick the classifier more easily.
For example, a randomly initialized 1000-d model could reach a FactorVAE score of 61. on dSprites, close to many well-trained 10-d VAE-based models’ scores (see Table 4 in Appendix). • Metrics taking only one or two dimensions into score calculation, such as SAP and MIG , are biased to representations of different dimensions.
Because a higher dimension makes it harder for an informative dimension to stand out and enjoy a large informativeness gap over other dimensions.
• DCI Disentanglement score uses a learnable regressor to score the importance of each latent dimension to each data factor.
The learnable regressor, such as Gradient Boosting Tree (GBT), encourages sparsity in the output importance matrix (see Figure 7 in Appendix).
So, it also gives an advantage to high-dimensional models, making it unfair to compare models of different latent dimensions.
Moreover, the construction of regressors is time-intensive in high-dimension space.
For example, it usually takes hours to evaluate a 1000-d representation model by DCI using GBT.
These flaws are demonstrated by our experiments, showing that existing metrics disagree for highdimensional representations.
Besides our conceptual justification of the failure of these existing disentanglement metrics, we also construct some scenarios where their failure is theoretically demonstrated in Appendix F. Overall, through our experimental evidence and theoretical justification, existing disentanglement metrics can no longer make meaningful disentanglement measurements in the
high-dimensional representation space.
Given the bias and limitations of existing disentanglement metrics and the necessity of highdimensional representations for contrastive learning, we propose a new disentanglement metric for high dimensional latent spaces, which we name as “ M utual Information based E ntropy D isentanglement", or MED in short.
The calculation of MED is based on mutual information (MI) between latent dimensions and the set of data factors of input samples. MI is a widely accepted tool to measure correlation of variables and is not biased to models of different dimensions.
Given a dataset generated with K ground truth factors v ∈ R K and a representation vector c ∈ R D , we construct an importance matrix
R ∈ R D × K defined by
[Equation]
where I ( c i , v j ) denotes the mutual information between the i th latent dimension c i and the j th ground truth factor v j .
Here, each row denotes a representation dimension and each column represents a ground truth factor.
We normalize the mutual information by columns, such that an entry in the matrix indicates the relative importance of one dimension over all dimensions regarding a certain data factor.
This normalization is necessary since different dimensions may have different overall informativeness to all factors.
This operation fixes the gap between models of different dimensions by estimating the relative importance of a single dimension.
After normalizing over the columns, we evaluate the contribution of a dimension to different factors, which is described by a row of R .
If one dimension is informative to only one ground truth factor, then this dimension is perfectly disentangled.
This matches the mechanism of entropy.
So we use the entropy to describe the disentanglement level of a dimension.
We treat each row as a discrete distribution over factor index by normalization: P ij = R ij / (cid:80) K − 1 k =
R ik , where higher probability P ij indicates that the dimension c i encodes more information of the factor v j .
Then the disentanglement score S i for a latent dimension
c i is calculated as
[Equation]
where H K ( P i · ) = − (cid:80) K − 1 k =
P ik log P ik is the entropy.
S i will be higher if c i exhibits more informativeness to one factor while less relevance to other factors.
Finally, to summarize the overall disentanglement of a representation model, MED score is the weighted average of the disentanglement scores for all dimensions as
[Equation]
where ρ i = (cid:80)
j R ij / (cid:80) ij R ij is the relative importance of each dimension.
Our proposed MED does not use a learnable classifier nor a regressor.
Further, it inherits a DCI-style normalized importance matrix by taking all dimensions into account instead of using only one or two dimensions.
These characteristics allow MED to be more robust to the latent dimensionality and to be better suited meaningful disentanglement measurement in high-dimensional space.
Besides the advantages MED has, it is also very computationally efficient: for a 1000-d BYOL representation model on Cars3D, the evaluation with DCI with Gradient Boost Tree by DisLib takes more thanhours, while MED only takes less than 20 seconds on the same machine.
3.3 Partial Disentanglement Evaluation Metric
It is challenging to learn a fully disentangled representation by high-dimensional models without explicitly encouraging disentanglement, especially when there are fewer independent data factors than the number of latent dimensions.
However, if a high-dimensional model has a subset of dimensions that disentangle well, it is still worth studying.
Such a subset can serve as a proxy to build a more compact representation model when it is hard to train such a model directly.
This motivates us to design a version of MED to evaluate the partial disentanglement, which we name it as “Top-k MED".
The main difference is that we pick the most disentangled k dimensions for each factor and compute MED on this subset of representations.
For each ground truth factor v j , G j = { i | arg max m R im = j } is the set of latent dimensions emphasizing this factor.
Then we pick the top k latent dimensions with the highest disentanglement scores in each G j to construct a subset
P j = (cid:8) i | S
i ≥ S k , i ∈
G j (cid:9) .
Here, S i is the disentanglement score of the latent dimension c
i defined in Equation 2.
S k is the k th highest disentanglement score in G j .
Finally we obtain the subset
P = ∪ j P j .
We take the sub-vector after selection ˜ c
= { c i } i ∈P as the representation to evaluate the
MEDscore.
The top-k MED is defined as MED (˜ c ) .
Understanding the learned representation
In this part, we qualitatively study the disentanglement of the learned representation by negative-free contrastive learning with BYOL as an example.
Since contrastive methods are not generative models, it is hard to directly do factor-controlled pixel-wise reconstruction for visualization.
Instead, we
[Figure]
S h a p e
S ca l e
P o s iti on_ X
P o s iti on_ Y
F ac t
o r
[Figure]
E l e v a ti on
A z i m u t h
O b j ec t t yp e F ac t o r
[Figure] measure the mutual information between the learned representations and ground truth factors, which is also the foundation of our proposed MED metric. More qualitative study is available in Appendix B. 4.1 Correspondence of Representation and Factor
[Figure] To understand the disentanglement of a representation model [Figure] a basic question is how the representation dimensions correspond to data factors.
After encoding an input image to a representation vector, we compute the normalized mutual information (MI) between each ground truth factor and each representation dimension, i.e. R in
MED defined as in Equation 1, to measure the correspondence.
The mutual information between dimensions and the factors is included in Figure 1.
The heatmaps are actually the transpose of the importance matrix R ⊤ .
As shown by the brightness of the entries, the informativeness of the latent dimensions varies greatly.
In fact, we can identify three types of columns: columns with single , multiple and no bright elements, corresponding to three types of latent dimensions: disentangled dimensions, entangled dimensions and uninformative dimensions.
The disentangled dimensions only capture information of one factor while the entangled dimensions encode multiple factors.
In contrast, the uninformative dimensions cannot represent factors independently.
As there are still entangled and uninformative dimensions, the representations are not fully disentangled.
However, by extracting the subset of disentangled dimensions we can derive a well-disentangled subspace.
First, we analyze the model on dSprites dataset (36).
dSprites has five factors (shape, scale, orientation, position_x, and position_y).
But the orientation is ill-defined with ambiguity.
For example, it is impossible to distinguish if a square rotates 0 degrees or 180 degrees.
As shown in Figure 1a, the disentangled dimensions occupy a significant proportion, indicating an evident partially disentangled pattern.
We note that the degree of disentanglement varies on different datasets.
An example on
Cars3D is shown in Figure 1b.
Cars3D is a dataset with 183 different car objects rendered from 4 elevations and 24 azimuths and the ground truth factors are not fully independent of Cars3D (see Appendix B).
It is extremely hard to represent its azimuth and the type of cars with few dimensions.
Thus its object-type row and azimuth row in Figure 1b are more spread out among multiple latent dimensions.
This also shows the difficulty of understanding the disentanglement of the high-dimensional representation model on complicated datasets.
Therefore, we will continue to conduct a quantitative evaluation with our proposed MED metric in Section 5.
Further quantitative studies on more datasets is available in Appendix B.
4.2 Uniqueness of Factor-Representation Correspondence
In the ideal pattern of disentanglement, a representation dimension should uniquely correspond to only one factor.
Now we show to what extent multiple factors are responded to by a single representation dimension in a well-disentangled subspace.
Given the mutual information between the representation and the i th factor, noted as I i , i.e., the i th row in the top-k version of Figure 1a, a good indicator of the uniqueness of factor-representation correspondence is the normalized co-occurrence of mutual information between the i th 1 factor and the i th 2 factor, which is defined as
[Equation]
where ˜ c is the representation after the selection process in Section 3.3.
We visualize the normalized co-occurrence of mutual information among the four factors by the learned representation in Figure 2.
It agrees that a dimension usually encodes only one factor.
Moreover, it indicates that the learned representation tends to encode shape and scale together, which also agrees with the intuitive analysis of the independence of factor pairs.
For example, the shape and scale of dSprites objects are not disentangled and independent because objects with the same scale value but in different shapes have different pixel area.
[Figure]
4.3 Influence by Manipulating Factors
Another intuitive direction to study the relationship between representations and factors is the influence on representations when manipulating the factors.
Given that the original representation vector dimension is much higher than the number of factors, we first make the representation more compact to have a more concise illustration.
Here, we reduce the representation dimension by the selection process of top-k MED described in Section 3.3.
Figure 3 shows the result of representation vector variation when changing only one factor at once.
We take BYOL on dSprites as a representative.
Here we set k = 2 for top-k MED, i.e., we pick the 2 most disentangled dimensions for each factor and derive a 10-dim representation.
We sample a set of images regarding a specific data factor. These images have all possible values of this data factor while having the same value for all other data factors. We get 10-d representations from these generated images by a shared model.
Then, we compute the variance of each of the 10 dimensions across the images, leading to 10 scalars.
The larger the variance is, the more that dimension responds to the factor.
Figure 3(a), (b) and (c) show how the reduced representation vector changes when manipulating the position_x , position_y , and scale factors respectively.
Note that we set k = 2 , therefore we see good disentanglement, with only exactly two representation dimensions having high variation.
However, in Figure 3(d) we show a failure mode of the ill-defined factor orientation that the change of factor causes multiple dimensions of reduced representation to have large variations, indicating that this factor is represented in an entangled way.
From the results, we observe that manipulating different well-defined independent factors causes evident variance on disjoint sets of dimensions.
Further, these results demonstrate the existence of a well-disentangled subset of latent dimensions.
We also conduct a similar qualitative study where the representation dimension is reduced by the unsupervised PCA technique and observe a similar pattern.
The details are provided in Appendix B.4. [Figure]
Quantitative Evaluation
In this section, we conduct quantitative studies on the disentanglement property of contrastive learning methods.
We first introduce the experiment setup in Section 5.1.
Then we show quantitative results under both MED and existing disentanglement metrics in Section 5.2 which shows the disagreement of existing metrics to support the necessity of proposing MED.
Finally, we make a full quantitative benchmark of methods of interest with MED in Section 5.3 and ablation study about the dimension of the representation model in Section 5.5.
More quantitative studies are available in Appendix C.
5.1 Experiments Setup
The details for reproducibility are introduced in Appendix A.
Here we provide a brief description of the setup of the experiments.
Datasets.
Representation disentanglement is usually evaluated on synthetic datasets, such as dSprites (36), Cars3D (39), Shapes3D (5), and SmallNORB (29).
Besides those datasets, we also include a real-world dataset CelebA (32).
CelebA contains human face images with 40 binary attributes.
The attributes include fine-grained properties of the human face, such as whether wearing glasses or having wavy hair.
We include the details of dataset factors in the appendix.
Evaluation Protocol.
We conduct experiments with both MED and the existing metrics to reveal the disagreement between existing metrics.
Then we use MED as the main metric to study the disentanglement of contrastive learning methods.
The implementation of evaluation metrics is adapted from the protocol provided by DisLib (34).
All results are calculated with three random seeds and we report both the average score and the standard deviation.
More details are introduced in
Appendix A.2.
Reference Methods.
We investigate most of the popular disentangled representation learning methods as studied in the standard benchmark of DisLib (34).
Besides, we also compare with a recently proposed ICA method called ICE-BeeM (23).
Since we do not assume the ground truth factors are known during the training, we use its unconditional version.
We term it EBM (energy-based model).
For the contrastive learning methods, we evaluate not only negative-free methods such as
BYOL (40), Barlow Twins (51) and SimSiam (7), but also those using negative samples such as MoCo and MoCov2 (14).
Model Implementation.
All methods use a shared architecture of encoder network as explained in the appendix.
The latent dimension of contrastive learning methods is set to 1000 since they require a high-dimensional latent space to work.
For other methods, the latent dimension is set to be 10 on synthetic datasets as in DisLib and 128 on CelebA dataset when evaluating with MED.
For the evaluation with Top-k MED, the dimension of all methods is set to be 1000-d for fairness.
On dSprites, Cars3D and SmallNORB, we acquire checkpoints from DisLib if they are provided.
We train our checkpoints on CelebA and Shapes3D.
5.2 Disagreement of Existing Metrics
As there is not a uniform definition of the “disentanglement”, existing disentanglement metrics are motivated by different desired properties of a disentangled representation.
These metrics had previously shown good agreement in the large-scale experiments of DisLib (34).
However, when we extend the disentanglement study beyond low-dimensional scenarios, these metrics disagree significantly.
We select representative low-dimensional VAE-based methods and a high-dimensional BYOL model to evaluate on a representative dataset, the SmallNORB dataset.
The results are in Figure 4, which show a significant disagreement among metrics on BYOL, while they agree on the low-dimensional VAE methods.
Aligned with our analysis in Section 3.2, BetaVAE score, FactorVAE score, and DCI overestimate the disentanglement degree of the high-dimensional model while MIG and SAP underestimate it.
Since existing metrics fail to evaluate high-dimensional models, we opt to use MED as the main evaluation metric in the following sections.
Please refer to Appendix C and E for more evidence of the disagreement of existing metrics.
Moreover, in Appendix F, we provide the analysis by constructing scenarios where MED can still output the result aligned with human intuition while existing metrics fail to do meaningful measurement of disentanglement degree
[Table]
[Table]
5.3 Disentanglement Benchmark with Contrastive Learning Methods
For the benchmarking of disentanglement, we use both MED and the partial version of MED, i.e.
Top-k MED.
For Top-k MED, we set the MED partial evaluation hyperparameter k = 2 for dSprites,
Shape3D, and SmallNORB, and k = 3 for Cars3D and CelebA. The values of k are chosen such that the selected dimensions are roughly close to the latent space dimension of the low-dimensional reference methods.
And we extend the latent dimension of all methods to 1000 when evaluating
Top-k MED for fairness.
We note that despite our hyperparameter search, we were unable to train good EBM weights on Cars3D and CelebA, so we keep that section empty.
The results are in Table 1.
We also encourage readers to read the results of existing metrics in Table 4 in Appendix C.
In the upper part of Table 1, we show the MED score for previous disentangled methods as well as contrastive methods.
We find that contrastive methods achieve significantly lower disentanglement scores on 3 of the 5 datasets (Shapes3D, Cars3D, SmallNORB).
Contrastive methods achieve slightly higher disentanglement scores on CelebA. On dSprites, some negative-free contrastive methods (SimSiam, BYOL) achieve scores close to SOTA, but the other contrastive methods’ score is much lower.
In summary, in most cases, contrastive methods have inferior disentanglement properties compared to the best methods; only in a few settings do contrastive methods achieves scores comparable to SOTA scores.
These results are disappointing but not surprising, since contrastive methods are not explicitly designed to maximize the feature disentanglement.
Further, since the underlying number of factors is usually quite small, on the order of 10, the 1000-d feature space will likely have dimensions that are either not related to the ground truth factors, or capture a combination of the ground truth factors. [Figure] [Figure] [Figure]
This result does not contradict with Zimmermann et al.
(53) since (1) they find that the learned feature is a linear transformation of the ground truth factors, which doesn’t necessarily disentangle and (2) they use augmentations on factors that cannot be done in practice
The lower part of Table 1 shows top-k MED measurements on various methods.
We find that contrastive learning methods (especially the negative-free ones) in general show a better disentanglement in a selected subspace and the disentanglement is stronger than the reference methods.
This shows that there exists a subspace in the learned representation that is well disentangled.
Moreover, when we compare the subspace in contrastive methods (gray part in the lower section of Table 5.3) to the traditional approach that directly trains a low-dimensional latent space (non-gray part in the upper section of Table 5.3), we find that the disentanglement of the former is usually better than or on par with that of the latter.
This means that we probably should not constraint the dimension of the latent space and require it to be fully disentangled, but rather should encourage to use high dimensional latent spaces and only require it to have a subset with good disentanglement properties.
To conclude, we find that the high-dimensional contrastive methods, including negative-free ones, do not learn a fully disentangled representation. However, there exists a subspace in the learned representation that is well disentangled. Such a subspace can show much better disentanglement property than previous SOTA approaches. Despite the fact that these methods require a high dimension to train, such a subspace can serve as proxy between contrastive learning methods and a more compact and disentangled low-dimensional representation.
5.4 Latent Traverse on Shapes3D
Now, we provide visualizations to show that MED can provide evaluation results aligned with human intuition about the disentanglement degree regarding data factors.
Because CL methods are not
[Figure]
generative models and have high dimensions, they are hard to be adopted for visualization with latent traversal.
We thus adopt VAE-based generative models here to perform latent traverse.
We follow the practice in DisLib (34) to use Shapes3D for the latent traverse.
For fairness and reproducibility, we trained VAE models on Shapes3D with the published configurations provided by Van Steenkiste et al.
because DisLib (34).
The results are shown in Figure 5.
For each column in each subfigure, only the value of one dimension of the latent code is manipulated.
The manipulation is performed the same way as the default setup for traverse visualization in DisLib.
Given the six factors on Shapes3D with index, we indicate under each subfigure if (1) red arrow: a dimension is entangled to more than one factor or (2) green arrow: a dimension is disentangled and responsive to only one factor.
Through the visualizations and the corresponding MED scores, we can clearly see that MED can well represent the disentanglement degree.
We could observation a clear pattern that model with higher
MED score has more disentangled representations.
This demonstrates that the results from MED scores are aligned with the intuition of humans.
5.5 Influence of Dimension
As representation dimension is found as a core variable in disentangled representation learning, we evaluate the influence of dimension over disentanglement by both MED and top-k MED on dSprites with BYOL as an example versus VAE-based methods.
The results are shown in Figure 6.
We find that the BYOL’s MED score and top-2 MED score increase along with the latent dimension. The scores plateau at around 512 dimensions.
This is consistent with previous literature on the difficulty to train informative contrastive models with low latent dimensions (12).
We further show that a lower latent dimension leads to a less disentangled subspace as well.
On the contrary, we also note that the VAE methods fail to scale to higher latent dimensions.
We find a large gap between higher-dimensional VAEs and their 10-dim versions.
This suggests the gap between existing disentangled representation methods and the real-world data complexity, which can not be represented in a limited dimension.
Conclusion
In this paper, we provide an empirical study of the disentanglement property of contrastive learning without negatives for the first time.
In the high-dimensional space, we find the difficulty of adopting the existing disentanglement metrics.
Therefore, we propose a new metric, MED and top-k MED, to evaluate disentanglement based on mutual information.
The evaluation shows that even without negative samples, contrastive learning can learn a well-disentangled subset of representation.
Recently, the study of contrastive learning, or general self-supervised learning, is still motivated by empirical observations.
We hope our work can reveal some clues to motivate future theoretical justifications.
Acknowledgement
We appreciate the help from Jinhyung Park on paper writing.
This work is supported by the Ministry of Science and Technology of the People’s Republic of China, the 2030 Innovation Megaprojects "Program on New Generation Artificial Intelligence" (Grant No. 2021AAA0150000).
This work is also supported by a grant from the Guoqiang Institute, Tsinghua University.
A Reproducibility
In this section, we provide the information required to reproduce our results reported in the main text.
And we commit to making the code implementation and evaluating checkpoints public.
Our experiments are run on a machine with an AMD Ryzen Threadripper 3970X 32-Core Processor and a
GeForce RTX 3090 GPU.
VAE methods implementation.
For the results on synthetic datasets, i.e., dSprites, Cars3D, SmallNORB, and Shapes3D, the disentanglement score is from the original logs of DisLib (34) 2 .
In the released logs, each method has different training configurations, and our reported result is from the configuration with the highest average performance overall the provided random seeds.
For the evaluation on the CelebA dataset, we follow an open-sourced implementation in Pytorch 3 and align the encoder architecture of all methods to be the same as described in Appendix A.1.
For the results on Shapes3D, because DisLib does not release the pretrained checkpoints, we use the same open-sourced implementation to reproduce with the configuration indicated by DisLib.
Parameters are kept as the default well-tuned version in the provided implementation.
When the latent dimension is 1000, training of BetaTC VAE will collapse with the default hyperparameters, we have to decrease the β to 3.0 to work it around.
GAN methods implementation. Limited by the text length, we do not include the performance of GAN methods in the main text, but we will report some in the following appendix content.
It is hard to include GAN methods’ performance in the benchmark as the training is not always stable and the discriminator weights are usually not provided in many public codebases.
When evaluating the methods on synthetic datasets, the FactorVAE scores of InforGAN, IB-GAN, and InfoGAN-CR are provided in the paper of Lin et al..
But the evaluation of other metrics in Lin et al.
uses a not aligned settings with Locatello et al.
, so we check its officially release 4 to evaluate the provided implementation and model weights under the unified evaluation setup.
We perform the same evaluation process for results on the CelebA dataset.
Energy-based Model (EBM).
We refer to the implementation of ICE-BeeM (23) for this method.
We use the officially released codebase for it 5 .
The encoder implementation has been aligned with our default already.
The only modification we make is to use the unconditional version instead of its default conditional version in loss computation to satisfy the fully unsupervised settings.
Contrastive Learning implementation. Our implementations are based on the public and official implementations of MoCo/MoCov2 6 , BYOL/SimSiam 7 and Barlow Twins 8 . The details of implementation are explained in Appendix A.1.
Evaluation Protocol. For MED, we first compute MI following the implementation of MIG by DisLib (34).
Then we calculate the entropy disentanglement score in the same way as the DCI Disentanglement score in DisLib.
For other disentanglement metrics evaluation, we use the implementation of DisLib.
The settings of some important parameters are provided in Appendix A.2.
A.1 Implementation of contrastive learning model
Architecture. To make a fair comparison with previous methods, we follow the encoder architecture in Factor VAE (24).
The pipeline details are shown in Table 2.
After each convolutional layer in the figure, there is a ReLU activation layer and a group normalization (group number = 4) layer for BYOL.
So, the encoder is a stack of (Conv-ReLU-GN) blocks.
For other contrastive learning methods, we keep the default batch normalization to replace GN.
By default, the final output channel number is 1000, i.e, D = 1000 .
For other details of contrastive learning methods, we follow the convention in their official implementations.
Besides the representation network (encoder), BYOL also has a projector network and a predictor network.
Both of them consist of a pipeline “Linear −→ BN −→ ReLU −→ Linear”.
The projection dimension is 256, and the hidden dimension of the projector is 4096.
The predictor keeps a 256dimensional feature vector in its pipeline.
[Table]
Training settings. We make minor modifications to the training setting of default BYOL to apply to contrastive learning methods without negative samples.
For training on all datasets, the images are resized to 64x64.
For data preprocessing, we copy 1-channel images of dSprites and SmallNORB to be 3-channel.
During the training stage, we use such a pipeline of augmentation (in PyTorch -style):
RandomApply(transforms.
ColorJitter(0.8, 0.8, 0.8, 0.2), p=0.3) 2.
RandomHorizontalFlip() 3.
RandomApply(transforms.
GaussianBlur((3,3), (1.0, 2.0)), p=0.2) 4.
RandomResizeCrop(size=(64, 64), scale=(0.6,1.0)) 5. normalization.
For the normalization, the pixel value of images from dSprites and SmallNORB is uniformly normalized from [0,255] to [0,1.0].
For Cars3D, Shapes3D, and CelebA, we adopt the commonly used
Imagenet-statistic normalization for preprocessing the RGB image pixel values.
During training, we use Adam optimizer by default, whose learning rate is 3 e − 4 without weight decay.
The batch size is set to 512 by default.
For evaluation on dSprites, Shapes3D, and CelebA, we select the weights after training for 15 epochs for evaluation.
We select the weights after training for 140 epochs for evaluation on Cars3D and the weights of the 200th epoch on SmallNORB considering the small scale of these two datasets.
To decrease the influence of randomness, we train each model configuration multiple times with different random seeds (seed=0, 1, 2).
We report the average and standard deviation.
To be precise, as our implementation is based on Pytorch, we initialize the libraries of numpy , torch , torch.cuda , and random with the same random seeds. [Table] [Figure] S h a p e
S ca l e
P o s iti on_ X
P o s iti on_ Y F ac t o r [Figure]
[Figure]
A.2 Evaluation Metrics
In the main text, we compare the evaluation metrics provided in the DisLib protocol with our proposed
MED metric.
Here we provide more details about them.
Moreover, we would conduct evaluations under all of them in the next section.
BetaVAE Metrics. Introduced in Higgins et al.
(15), BetaVAE score assumes each dimension corresponds to one category in a linear classifier.
Representations are obtained after the generated samples with only one factor fixed.
Then we calculate the summation of the divergence between different representations and put it into a linear classifier. The classifier is trained to predict the index k for the fixed data factor.
The accuracy of this linear model is the value of the BetaVAE score.
FactorVAE Metrics.
Kim and Mnih (24) argues the BetaVAE score has the tendency to fail into a spurious disentanglement and proposes a new metric based on a majority vote classifier.
Representations are obtained after the generated samples with only the k -th factor fixed.
Normalizing each dimension in representations in terms of standard deviation.
The index of dimension with the lowest variances of normalized representation and the factor index k are the input and the output of the linear classifier.
The accuracy of the classification is the FactorVAE score.
Mutual Information Gap. Chen et al.
(6) assumes the disentanglement model has the property that most information of one specific factor is contained in one dimension or a group of certain dimensions.
The mutual information gap is the summation of the difference between the highest and second-highest normalized mutual information between a fixed factor and the dimensions of the output representation vector.
The formula can be illustrated below:
[Equation]
where K is the overall number of ground truth factors.
v is the latent representation and z k is the factors of latent variables and j k = arg max j I ( v j , z k ) .
DCI disentanglement. As Eastwood and Williams (9) suggest, the disentanglement can also be measured by the entropy of relative importance for each dimension in predicting factors.
First, we have to know the importance of each dimension of the representation for predicting each factor.
The importance is determined by a regressing model such as Lasso or Random Forest in the original
DCI implementation (9) or Gradient Boosting Tree in DisLib implementation (34).
We note the importance matrix R where R ij is the importance of the i-th dimension in prediction the j-th factor.
Then the disentanglement score for the i-th dimension is defined as D i =
(1 − H K ( P i )) where H K ( P i ) =
− (cid:80) K − 1 k =
P ik log K P ik denotes the entropy and P ij =
R ij / (cid:80) K − 1 k =
R ik denotes the normalized importance of the i-th dimension in prediction the j-th factor.
Finally the overall disentanglement score is calculated as D =
(cid:80) i ρ i D i where ρ i = (cid:80) j R ij / (cid:80) ij R ij is the weighting factor of the each dimension’s informativeness in representing factors.
SAP. Kumar et al. (27) proposes the Separated Attribute Predictability (SAP) score.
SAP is computed with classification score of predicting j th factors on i th dimension as the ij th entry.
SAP is the mean of the difference between the highest and second-highest scores for each column.
We follow the implementation provided by DisLib (34) for the evaluation protocol.
Despite exceptions, the evaluation batch size is 64, the prune_dims.threshold is 0.06.
If a classifier is required to be trained
[Figure]
SmallNORB [Figure] [Figure] during evaluation, num_train is 10000, and num_eval is 5000.
For Mutual information computation, the discretizer function is the histogram discretizer, and the number of bins in the discretization is 20.
For the evaluation of MIG and SAP on dSprites, SmallNORB, Cars3D, and Shapes3D, BYOL representation vectors are reduced to 10 dimensions by PCA to be aligned with other methods.
For the evaluation of MIG and SAP on CelebA, to have a fair comparison, the representation vectors of all methods are reduced to 40 dimensions.
For the implementation of our proposed MED, the basic logic is the same as DCI Disentanglement, but we replace the classifier output with the mutual information based scores.
B More Qualitative Study
We provide more qualitative studies about the disentanglement property shown by the contrastive learning here.
We still use BYOL as an example of the negative-free contrastive learning methods.
B.1 Importance Distribution by DCI
In the main text, we concisely talked about the potential variables introduced by the learnable model under some metrics.
Here we show an example for the widely used DCI Disentanglement metric.
We follow DisLib to use Gradient Boosting Tree to estimate the importance matrix between each factor and each latent dimension.
All parameters are set the same as its default protocol.
The visualization is shown in Figure 7.
Compared with the mutual information distribution shown in
Figure 1a, the importance distribution is much more sparse.
This is because the construction of the GBT regressor encourage the sparsity of the output importance matrix.
Such a sparsity can lead to the misunderstanding that the correlation between factors and latent dimensions is also sparse which is not true.
By using pure measurement without involving additional adaptive models, such a problem will not be raised in the proposed MED metric.
B.2 Mutual Information Heatmaps
We compute MI between each latent dimension and each data factor and visualize them by heatmaps. The heatmaps offer us an intuitive picture of the learned representation space.
For completeness, we show the MI heatmaps on SmallNORB, Shapes3D, and dSprites with all factors in Figure 8a,
Figure 8b and Figure 8c respectively.
We can see that the disentangled pattern described in the main text still emerges.
There is a group of columns brighter than others in each row, and these groups do not overlap for most rows.
However, we find that some latent dimensions emphasize more than one factor.
We provide a more detailed analysis from the perspective of factor co-occurrence on this phenomenon in B.3 below.
B.3 Co-occurrence of Factors
To understand to what extent one dimension of the learned representation would respond to more than one factor, we make the co-occurrence of mutual information to factors on more datasets here.
The visualizations are shown in Figure 9 for the results on Cars3D, SmallNORB, Shapes3D, and dSprites respectively.
Moreover, we now analyze the definition of data factors of these datasets to discuss whether they are defined to be fully independent or not. [Figure]
SmallNORB Though most non-diagonal entries have very low co-occurrence of mutual information, two pairs of factors show slightly higher co-occurrence.
They are “azimuth-elevation” and “instance categorylighting”.
After investigating the dataset, we find the two pairs of factors are not fully independent.
Figure 10 show some samples with corresponding factors manipulated.
We could see that the elevation and azimuth are not fully independent.
And the correlation between the instance category and the lighting factor is even more obvious because the lighting condition is sensibly related to the shadow around the object, whose distribution and shape are highly determined by the instance category.
Cars3D Only one pair of factors show some co-occurrence, i.e. “elevation-object type”.
We randomly selected samples from Cars3D by different object types and elevations, as shown in Figure 11.
It shows that with the same value of elevation, samples of different object types have different visual elevations.
So these two factors are not fully independent.
This explains the slightly higher co-occurrence of mutual information between this pair of factors.
Shapes3D
The result shows relatively bad disentanglement.
To be precise, some factor pairs show low mutual information co-occurrence as expected, such as the color factors of floor, wall, and object and the pair of “object color - azimuth”.
But the MI co-occurrence of “wall color - object size” and “object color - object size;” are higher than we expected as we did not recognize their high dependence.
This result might relate to our model’s relatively poor performance on Shapes3D. dSprites We omit the factor orientation in the visualization at main text for clarity.
Here we show the results including all factors.
For dSprites dataset, the value of orientation is highly correlated with shape .
This is because that different shape has different symmetry properties for rotation.
As a result, dimensions that encode information of shape tend to capture information of orientation simultaneously.
This explains that, in Figure 8c, some dimensions have two brighter entries at “shape” and “orientation” rows.
Thus, it is not surprising that the “shape - orientation” cell is brighter than other off-diagonal elements in Figure 9d.
B.4 Manipulating Factors
[Figure]
In the main paper, we studied the influence on the generated representation by manipulating the factors, where the representation is reduced by selecting dimensions as in calculating Top-k MED.
Here, we do the qualitative study of the influence on representation by manipulating factors in another way but still on dSprites.
To make the original high-dimensional representation space more compact, we use the unsupervised dimension reduction by PCA instead, which is more general when the data factor pattern is unknown.
Here, we reduce the representation dimension by PCA to 10.
Note that since the PCA operation mixes the original latent space with a linear combination, it might destroy the existing disentanglement property in the high dimensional space, or enhance the disentanglement if the original high dimensional space is a linear combination of the ground truth factors.
But such influence is usually considered secondary to the disentanglement learned by a model.
No matter which case, if the dimension-reduced representation shows disentangled properties, the original space at least captures linearly transformed ground truth factors, and the dimension reduction techniques such as PCA can make the representation more compact in a qualitative study.
Figure 12 shows the result of representation vector variation when changing only one factor at once.
Given three images with only one factor’s value being different, we generate the 10-dim representation vectors from them.
Then, we compute the variance across the three vectors, leading to 10 scalars.
The larger the variance is, the more that dimension responds to the factor change.
Figure 12(a) and (b) show how reduced representation vector changes when manipulating position_x and position_y factor respectively.
It shows good disentanglement that only one representation dimension has high variation.
However, in Figure 12(c) we show a failure mode of the ill-defined factor orientation that change of factor causes both the 6th and the 9th dimensions of reduced representation to have large variations.
From the results, we observe that manipulating one well-defined independent factor causes evident variance in only one dimension.
And it shows that we could make the learned representation vector more compact by unsupervised dimension reduction.
C More Quantitative Results C.1 Full Disentanglement Benchmark
In the main text, we evaluate the disentanglement under our proposed MED metric for full space and top-k subspace on multiple datasets.
In this section, to provide a more complete understanding of the disentanglement property of contrastive learning without negatives, we report the disentanglement scores with other metrics, including FactorVAE score, BetaVAE score, MIG, SAP, and DCI
Disentanglement.
For the results of VAE-based methods, as the large-scale benchmark of Locatello et al.
(34) provides the original logs on dSprites, Cars3D, and SmallNORB datasets, we simply report the performance of the best configuration.
The original logs on Shapes3D are not available, so we train and evaluate on Shapes3D by ourselves for the MED scores.
For scores under other metrics, we report the median disentanglement scores.
Some results are from Locatello et al.
(35) but the std error is not available.
The median performance of SlowVAE is from its original paper (26).
For the results of CelebA, the result of InfoGAN-CR is from its officially released checkpoint without availability to the std error.
For other methods, we report the mean value of our trained weights over three random seeds as default.
Because the evaluation of DCI is extremely time-consuming, around 14 hours for a 1000-d model, we only take BYOL as an example here for negative-free contrastive learning methods.
All results are combined and shown in Table 4.
We also include traditional metrics results on their selected top-k subspace for contrastive learning methods.
Aligned with the analysis we provide in the main text, the results show significant disagreement among the existing metrics.
To be precise, for those metrics (BetaVAE score, FactorVAE score, DCI
Disentanglement) using a learnable model such as a regressor or a classifier, the high-dimensional
BYOL model achieves a significant advantage.
However, for the metrics relying on only one or two dimensions to reveal the connection between a latent dimension and a factor (MIG and SAP),
BYOL’s performance is not that impressive anymore.
Finally, the result on CelebA shows the great robustness of BYOL’s learned representations to be disentangled on real-world datasets.
Yet, the large gap between the score of CelebA and those on synthetic datasets emphasizes the difficulty of learning disentangled factors on real-world images.
It is hard to empirically study whether it is the high dimension that gives BYOL advantages on some metrics because the nature of BYOL makes it hard to be trained with a small latent dimension to make a comparison.
In the last rows for each dataset, we show previous disentanglement metrics scores on the top-k subspaces of BYOL.
We find that BYOL (top-k) has performed better than or on par with unsupervised methods with low latent dimensions.
Note that Ada-GVAE, SlowVAE, and EBM are (weakly) supervised methods.
The SOTA performance justifies our claim of the well-disentangled subspaces.
MIG and SAP require a large gap between the two most vital representation dimension-factor responses, measured by mutual information and classification accuracy.
But out of 1000 dimensions, we choose the k most relative ones.
Hence, the gap ought to be minimal.
Consequently, BYOL (top-k) receives lower MIG and SAP scores.
Except for dSprites and CelebA, BYOL (top-k) have lower DCI scores.
The primary cause of this is the massive information loss during the selection of the top-k dimensions, which completely obliterates the original encoding pattern.
As a result, the gradient boosting tree (GBT) developed throughout the DCI process tends to “borrow" information from latent dimensions that emphasize additional relative factors to classify some complex factors.
The “information-lending" dimensions then become less disentangled since they are also important for predicting those complex factors.
Taking the Cars3D dataset as an example, we set k = 3 for top-k MED.
To predict the factor object type , the GBT needs to classify 183 types of cars from only 9 dimensions with only 3 emphasizing object type .
This forces GBT to utilize information from elevation since these two attributes are correlated (see Appendix B.3).
However, we keep all they have learned from training for other low-dimensional methods.
Therefore, the information loss problem does not apply to them.
[Table]
D Ablation Study about the Normalization Choice
In this section, we put ablation studies here about the choice of normalization layers in the model architecture.
[Table]
We experiment with five types of normalization layers in the encoder network on the dSprites dataset.
The results are shown in Table 5.
For the group normalization, we set the group number to 4.
On the dSprites dataset, we find the commonly used BN decreases the disentanglement performance.
By keeping the batch norm in the projector and the predictor, removing the batch norm in the encoder will not cause the model to collapse, which agrees with the observation in previous works (40).
On the contrary, replacing batch norm in the encoder with group norm or layer norm will increase the representation disentanglement while achieving similar accuracy in downstream factor prediction.
We notice that a similar phenomenon has been discovered before in supervised representation disentanglement.
For example, Bau et al.
(2) discovered that a network trained with batch normalization layers has less interpretable (disentangled) neurons.
On the other hand, the instance norm (48) completely breaks the contrastive learning process.
We still do not fully understand this behavior, but we hypothesize that it may be caused by the shared batch statistics that make it hard for a feature to be aligned with the ground truth factor.
[-R ij / (cid:80) K − 1 k =
-]
E Disagreement of Existing Metrics
Without a uniformly recognized definition of “disentanglement”, the validity of existing metrics is backed up with their shared expectation of “disentanglement” and consistency of experimental results, as suggested in DisLib (34).
However, the results in Figure 4 break the belief.
The disagreement arises when the high-dimensional representation model joins the comparison.
We provide an in-depth view of the disagreement by ranking different methods.
The results are shown in Figure 13.
If all metrics agree perfectly, there should be no relative ranking switch.
However, the frequent switch, especially with BYOL being taken into comparison, strongly suggests their disagreement.
Results in
Table 4 further show that different metrics may make completely different rankings with large value gaps.
We also provide logistic analysis in Appendix F and quantitative results in Appendix C. Given the fact that self-supervised representation learning always requires a high dimension to train, MED is necessary to extend the study of disentangled representation learning to complicated real-world datasets and self-supervised representation learning methods.
F The Superiority of MED
Here, we provide both experimental observations and theoretical analysis in synthetic scenarios to show the superiority of MED: in what cases other metrics outputs meaningless or even opposite results but MED can still perform a meaningful evaluation.
F.1 Experimental Observations
As we discuss throughout the paper, the five existing metrics we investigate, i.e. BetaVAE score,
FactorVAE score, SAP, MIG, and DCI Disentanglement, are unfair to models of different dimensions.
So we extend the results mentioned in Section 3.2 to show the superiority of MED by confirming its stability under different dimensions.
We conduct a sanity check on randomly initialized models. For a good disentanglement metric, we do not expect a high score whatever the representation dimension is.
The following results reveal the malfunction of these metrics
• MED vs MIG/SAP : First of all, we emphasize that SAP/MIG is designed not just for disentanglement but also completeness .
They encourage a strict one-to-one mapping between latent dimensions and factors.
So they tend to reward models whose dimension is close to the factor number.
On the popular synthetic datasets with only a limited number of factors, low-dimensional models have an unfair advantage with MIG/SAP metrics.
We compare a well-trained 1000-d BYOL model and a 10-d randomly initialized encoder in Table 6. The results show that the 10-d randomly initialized model can achieve higher scores than the BVAE FVAE
MIG SAP DCI MED
BYOL
DIP VAE II
Beta TC VAE
DIP VAE
I
[Figure]
1000-d BYOL model by SAP and MIG.
But MED keeps a reasonable comparison that the trained high-dimensional model can still enjoy higher scores than low-dimensional random weights.
[Table]
• MED vs BetaVAE/FactorVAE score : BetaVAE and FactorVAE prefer high-dimensional models as they have more parameters to trick the learnable classifier.
In Table 7, we find even randomly initialized high-dimensional (1000-d) model can achieve higher BetaVAE/FactorVAE score than a well-trained 10-d model (DIP-VAE-II).
In contrast, MED provides results in line with our expectations.
[Table]
• MED vs DCI : Similar to BetaVAE/FactorVAE scores, DCI also overestimate highdimensional models as they have a higher chance to get lottery dimensions, especially with the sparsity encouraged by GBT.
Also, another huge drawback of DCI is the computation efficiency: for a 1000-d model, DCI takes more than 14 hours for evaluation while
MED only takes less than 20 seconds.
The computation of MED is more than 2000 times faster than DCI.
Through the experimental observations, we find the abnormals from existing metrics when comparing models of different dimensions.
Compared to them, the results of MED are consistent with human knowledge. [Figure]
F.2 Theoretical Analysis
In this part, we construct synthetic scenarios to investigate the validity of MED and existing metrics.
We will show that in such situations, existing metrics will fail to reflect the real disentanglement quality but MED can show superiority to maintain reasonable evaluations.
For the following cases, we assume there are two data factors F 0 , F 1 on the data.
We note their value as v 0 , v 1 ∈ { 0 , 1 } .
And they are sampled independently and uniformly, i.e., p ( v j = 1) = p ( v j = 0)
= 0 .
Then we construct linear cases to simplify the analysis that the value of latent dimensions is the combination of factor values.
F.2.1 MED vs MIG/SAP.
As mentioned, MIG and SAP require not just disentanglement but also completeness .
So, for a 1000-d model whose latent code value is c i
=
v i mod 2 , 1 ≤ i ≤ D, D = 1000 .
I.e. half of the latent code is the true first factor, and the other half latent code is the second factor.
It is clear that each dimension perfectly correlates to a single factor.
But its MIG/SAP scores turn out to be 0, which is significantly opposite to our intuition.
But in this case, for MED we have
[Equation]
[Equation] So MED ( c ) = 1 , indicating that every dimension is perfectly disentangled to a single factor and fully responsive to it.
Also, this conclusion applies to different values of D , showing the robustness of MED with models of different dimensions.
F.2.2 MED vs DCI.
With a constructed latent code as
[Equation]
> [Equation] To simplify, we assume the importance matrix output by GBT in DCI metric is the absolute of first-order derivative, namely | ∂c
i ∂v j | of the dimension i with respect to the factor F j .
GBT encourages sparsity in the output importance matrix.
To reflect this, we assume the desired sparsity of the GBT is 2.
Thus, we have the dimensions beyond the sparsity limit are given 0 importance.
Then the importance matrix value R ij is
[Equation]
, otherwise
[Equation] [Equation] d j is a randomly selected dimension between [2 , D − 1] .
For the two factors F 0 and F 1 , d j is selected independently.
So that chance that d 0 = d 1 is p ( d 0 = d 1 ) =
[Equation]
If d 0 = d 1 =
k , we have
[Equation]
(2) If d 0 ̸ = d 1 , we have
[Equation]
And DCI Disentanglement score is DCI ( c )
= (cid:80) D − 1 i =
ρ i S i .
We have DCI ( c ) = 1 − log 2 = 30 .
7% in situation (1) and DCI ( c ) = 1 in situation (2).
So, in such a simplified version, the expectation of DCI
Disentanglement score is
[Equation]
On the other hand, similarly we can derive the MED score is
[Equation]
which is quite consistent along the change of D .
Note that the drastic difference between MED and DCI is caused by the GBT used in DCI. The GBT leads to a sparse importance matrix M , while the mutual information in MED won’t.
This difference doesn’t make much difference in low-dimension latent codes, but DCI will be high even if the latent code doesn’t disentangle at all in the high-dimensional case.
We plot the curves of MED score and the expectation of DCI score in Figure 14.
It shows that when the latent dimension D increases, the expectation of the DCI score increases and approaches 1.
For instance, if D = 3 , we have E [ DCI ( c )] = 30 .
7% ; if D = 1000 , we have E [ DCI ( c )] = 99 .
Such an abnormality from DCI Disentanglement alerts us that it can not give a meaningful and fair comparison between methods of different dimensions.
However, MED is much more robust with the change of model dimension.
For instance, if D = 3 , we have MED ( c ) =
9% and if D = 1000 , we have MED ( c ) = 30 .
F.2.3 MED vs BetaVAE/FactorVAE score.
Situation 1 We construct a situation where the first two dimensions are a weighted combination of the factors and the value of all following dimensions are the average of the factor values.
Thus we have the latent code as
[Equation]
We can justify it as a very entangled representation.
But the latent code value change with respect to the factor value is what BetaVAE and FactorVAE scores care about.
FactorVAE calculates the variance of latent code, i.e. V ar ( c ) , when changing the factors to represent the factor-dimension response degree.
During calculating the FactorVAE score, one factor is always fixed.
So we have
[Equation]
so for each factor, we have a single dimension that gives the minimum variance.
In this case, the
FactorVAE score uses a majority vote to determine the dimension with the smallest variance with respect to the value change of a factor as the “most disentangled” dimension to it.
And the vote accuracy is regarded as the FactorVAE score.
So, it is clear that because of the existence of the lucky dimension j = i , the FactorVAE score can be expected to approach 100, indicating “perfectly disentangled”!
With the increase of model dimension, the chance of having such a lucky dimension increases as well in real cases.
The bias is that FactorVAE only needs one dimension which has a low response to all other factors except for one factor to get high scores. [Table]
On the other hand [Table] the BetaVAE score calculates the latent code value change to represent the response between factors and dimensions.
This is represented by the absolute value of the first-order derivative.
So for the i -th dimension with respect to the j -th factor as R ij , we have
[Equation] [Equation]
, otherwise .
BetaVAE score uses a learnable linear classifier to determine the dimension.
In this case, prediction j from R · j can achieves 100% accuracy.
So similarly, it also requires one “lucky” dimension to make the prediction, offering an advantage to high-dimensional models.
Moreover, because of the powerful capacity of a learnable linear classifier, the BetaVAE score is close to 100 for many cases as in Table 4.
It thus has another flaw of low distinguishability of methods’ disentanglement properties.
On the other hand, we could now calculate the MED score for this situation.
The results turns out to be MED ( c )
= 1 − log 2 = 30 .
7% for any value of D .
This is a relatively low score and we think it makes better sense in such entangled cases compared to the falsely high score from BetaVAE and
FactorVAE scores.
Situation 2 Let us build another case as in the discussion of DCI above
[Equation]
FactorVAE and BetaVAE scores can still give a “perfect” score over such a representation.
However, when the dimension D is very large, only a small subset of the representation dimensions is disentangled while most are highly entangled.
As a higher-dimensional model has a better chance to get a lucky dimension, maintaining the perfect scoring with increasing dimension is not aligned with our intuition and expectation.
From this sense, Top-K MED has its special use.
When D = 1000 , we know MED ( c ) = 30 . 8% , but we can still get a subset of the 1000 dimensions to get a high Top-K MED score.
Such a subset of representations is more compact and has better explainability to the factor variance.
With all the situations constructed and analyzed above, we could notice the failure of existing metrics to achieve evaluation results (1) meaningful, (2) fair, and (3) aligned with the human sense to disentanglement in some scenarios.
On the other hand, our proposed MED always keeps the evaluation and comparison reasonable and aligned with the expectation from the human high-level institution.
G Properties of the Top-k Subspace
We propose the top- k selection process to study the partial disentangle properties.
Here we provide more details.
We first visualize the top- k selection process based on the heatmap of the importance matrix.
Then we will discuss the effects of k and the downstream performance comparison of the top- k subspace and full space.
Visualization of the top- k Process We describe the top- k process in the Section 3.3.
Correspondingly, here we colored the picked dimensions yellow in the Figure 15.
It shows that most picked dimensions only have one entry much brighter than the others, indicating they are well-disentangled.
Since orientation is ill-defined in dSprites, BYOL tends to encode it with shape .
Hence the most disentangled dimensions for shape also capture information of orientation .
[Figure]
S h a p e
S ca l e
O r i e n t a ti on
P o s iti on_ X
P o s iti on_ Y
[Figure]
Ablation on k
The parameter k is designed as an evaluation choice.
For analytical purposes, we choose the value of k to match the dimension of VAE methods in the main text.
To investigate the influence of k , we set k = 1 , 2 , 10 , 50 , 100 and evaluate the top- k MED scores of 1000-d VAEs and
BYOL on dSprites.
The results are shown in Figure 16.
We find that with different values of k , the ranks of top- k MED scores remain unchanged.
Since the top- k process is a supervised greedy selection, as k grows the scores decrease.
In conclusion, top- k MED can measure the subspace disentangle properties with a wide range of k .
Therefore we can choose k according to actual needs.
[Figure]
Downstream performance of top- k subspace We study the disentangle properties of the full space and top- k subspace in 5.3.
Here we analyze the downstream performance of these spaces.
We train a
Logistic Regressor to predict each factor from the full representation or the top- k picked representation.
Then we take the mean prediction accuracy of all factors as the measure of downstream performance.
We compare the downstream performance of the full space of VAEs and BYOL, and top- k subspace of BYOL on multiple datasets.
Here we set k = 2 for dSprites, Shape3D, and SmallNORB, and k = 3 for Cars3D and CelebA to match the dimension of VAEs.
The results are in Table 8.
We note that, except on CelebA, performance drops non-negligibly when completing downstream tasks with the top- k representations.
This suggests that the top- k subspace is well-disentangled but other dimensions also contain factor-related information.
It is unsurprising because we cut down the dimension drastically (from 1000 to 10 on synthetic datasets and from 1000 to 100 on CelebA).
However, we find that the top- k spaces learned by contrastive methods achieve better or compatible performance compared with the full spaces of VAEs on 3 out of 5 datasets (dSprites, Shapes3D, and CelebA).
It is reasonable that a high-dimensional model can be better for downstream tasks as the downstream model can be trained to leverage each little piece of information from the input representations.
But we get a message from the results that by drawing a subspace from the powerful
CL-trained model, its performance on downstream tasks can be comparable to or superior to the low-dimensional models.
And the selected low-dimensional model can have much better compactness and interpretability.
H Limitations
Our work still has some limitations.
Firstly, the design of contrastive learning methods still depends on empirical practice.
Therefore there lacks a widely accepted theoretical framework to analyze its disentanglement properties.
As for the experiment setups, the inductive biases of different methods may potentially affect the results (such as normalization in Section D).
Instead of exhaustive search, we inherit the available best settings, i.e., the settings from DisLib (34) and the public official implementations of other methods.
All hyperparameters and details have been indicated in the
Section A.