Paper: Non-negative Contrastive Learning (ICLR-2024)

Reviewer comment (Evaluation):
In my opinion, running experiments over multiple seeds and reporting the mean and standard deviation is essential and necessary. For me, this is an important point. And to me, it has to be fulfilled to be accepted.

Author response:
Following your suggestion, we have replaced **all benchmark results** with mean and std values obtained from 3 random trials (see **updated Tables 1-4**). It can be seen that **NCL indeed outperforms CL significantly in most feature selection and downstream tasks.**

Reviewer comment (Evaluation):
The y-axes in Figure 5 give a biased/wrong impression of the performances of the different models, in my opinion. In combination with the lack of standard deviations, it is difficult to evaluate the performance differences of the two methods.

Author response:
Thanks for pointing it out. To be clearer, we have replaced Figure 5 with **Table 2** to better illustrate the results, together with **error bars calculated over 3 random trials**. It can be seen that with the proposed selection criterion (TA with absolute values), NCL indeed outperforms CL significantly in most cases.

Reviewer comment (Evaluation):
I understand that evaluating disentanglement on real-world datasets is challenging given the lack of ground truth. Another possible way of really evaluating the disentanglement of the learned representations would have been the use of a toy dataset for this experiment. The known problems with estimating MI and not only a lower bound of it make it difficult to evaluate the results for this experiment.

Author response:
Following your suggestion, we conduct additional experiments on Dsprites, a toy dataset with ground truth latent vectors that is widely adopted in the disentanglement literature. We train a small CNN encoder with CL and NCL, respectively, and measure feature disentanglement with a common metric Mutual Information Gap (MIG) proposed in [1]. For simplicity, we adopt the default training configuration and augmentation strategy as in SimCLR.

**Results.** The preliminary results are shown below. We can see that NCL features show much better disentanglement than CL (higher the better), which further shows the advantages of NCL. We have included this result in **Appendix F.3**. Since Dspirtes is a toy model that is very different from real-world images, the default SimCLR augmentation could be suboptimal to obtain good positive samples. We leave more finetuning of NCL on these toy datasets for future work. 

*Comparison of feature disentanglement on Dspirtes.*

| Metric | CL | NCL |
| --- | --- | --- |
| MIG | 0.037 | 0.065 |

[1] Chen, Ricky TQ, et al. "Isolating sources of disentanglement in variational autoencoders." In NeurIPS. 2018.

Reviewer comment (Theory):
What is the connection/link between semantic consistency and clustering accuracy? I could not find any details on that in the manuscript.

Author response:
As defined in Figure 4a caption, semantic consistency measures belonging to the most frequent class $c$ activated in each dimension $x$. It means that if we assign all activated samples in dimension $x$ to class $c$ (as a super naive clustering method), the expected clustering accuracy is  semantic consistency. But indeed, this naive method may not fully reflect the true clustering accuracy. To be more rigorous, we have removed the lines discussing their connections in the revision. For a better measure of clustering performance, we believe the linear probing classification accuracy (Table 3) is a better surrogate.

Reviewer comment (Experiments):
Is the CL objective also trained with the spectral loss function? The results in the original paper seem to indicate that it does not lead to the same performance as in the original SimCLR paper. Maybe it would make sense to include the results generated by the standard SimCLR objective.

Author response:
As discussed in Sec 2.3, the NCL reparameterization trick also applies to other CL objectives, such as InfoNCE. Due to its wide popularity, we adopt the SimCLR framework (with **InfoNCE** loss) by default in our paper (mentioned at the beginning of Sec 4). 

For completeness, we also add the results of SCL loss in revision (**Appendix F.1**). As quoted in the following table, with the SCL loss, NCL also yields clear gains over CL on both feature interpretability and downstream performance.

*Comparison of SCL and its NCL version on CIFAR-10.*

|  | Linear Accuracy  | Semantic Consistency | Sparsity | Correlation Error |
| --- | --- | --- | --- | --- |
| SCL | 88.0 | 19.0 | 0.002 | 0.117 |
| NCL | 88.6 | 24.0 | 64.654 | 0.004 |

Reviewer comment (Experiments):
Are there more interpretability results than the qualitative results provided in Fig. 1?

Author response:
Yes, we have! On the one hand, during revision, we add more qualitative results on other datasets in Appendix F.2. On the other hand, in Fig 4a, we have designed the **Semantic Consistency  (SC) to measure the dimension-wise feature interpretability, which is exactly the quantitative version of Figure 1**. As described in Fig 4a caption, SC measures the proportion of activated samples that belong to their most frequent class along each feature dimension. Since Fig 4a shows that NCL obtains much higher Semantic Consistency, it means that **quantitatively, NCL indeed has more consistent semantics along each feature dimension**. Other than that, we also measure the **feature sparsity and correlation in Fig 4b and Fig 4c,** as another two desirable properties of interpretable features. Please let us know if there is more to clarify.

Reviewer comment (Evaluation):
In sec. 4.2 you describe the feature selection procedure based on the TA. Do the results hold if you take the sum over absolute feature values, e.g. $ TA_i (f) = \sum_x \tilde{f}_i (x)$? Given the nonnegative constraints of the NCL features, the metric seems more tailored towards NCL than CL.

Author response:
That is a good observation. In fact, we have also tried taking the sum over the raw feature values, and found that it leads to even worse performance on CL (table below). Thus, it seems that the absolute feature value is also a better indicator for feature importance in CL. In either case, NCL with TA (abs) can outperform CL by a large margin.

| CIFAR-10 | Linear Probing |  | Image Retrieval |  | Transfer Learning |  |
| --- | --- | --- | --- | --- | --- | --- |
|  | CL | NCL | CL | NCL | CL | NCL |
| all(512) | 67.2$\pm$0.2 | 68$\pm$0.2 | 10.3$\pm$0.1 | 11.4$\pm$0.2 | 27.5$\pm$0.1 | 30.6$\pm$0.1 |
| Random (256) | 65.7$\pm$0.1 | 65.3$\pm$0.2 | 9.7$\pm$0.1 | 7.8$\pm$0.2 | 26.2$\pm$0.4 | 24.7$\pm$0.1 |
| TA (256, raw) | 65.9$\pm$0.2 | 66.2$\pm$0.2 | 9.8$\pm$0.2 | 8.4$\pm$0.1 | 26.1$\pm$0.1 | 27.3$\pm$0.2 |
| TA (256, abs) | 66.3$\pm$0.2 | **67.5$\pm$0.1** | 9.8$\pm$0.1 | **11.2$\pm$0.1** | 26.9$\pm$0.2 | **30.5$\pm$0.1** |

Reviewer comment (Writing):
A few sections required re-reading and/or reading other related papers to fully comprehend. For example, in Section 2.1 Preliminary on Contrastive Learning, the notation, the ideas about the natural data vs. augmentation data, population data vs. empirical data, positive samples and negative samples could be introduced more thoroughly, as is done in HaoChen et al. (2021). I appreciate that this may be due to lack of available space.

Author response:
**A1**. Indeed, in the preliminary, we mainly introduce the population data version for simplicity. We have revised the writing to be clearer on introducing the natural and augmented data, and the positive and negative samples.

Reviewer comment (Evaluation):
In section C.1, it is stated that the feature transferability to downstream classification is evaluated without using the projector. Does this mean that the features used are not non-negative? Section 4.3 claims that the downstream classification “aligns well with the common belief that disentangled features are more robust against domain shifts”, and yet the empirical and theoretical justification for the features being disentangled is based on the non-negative features (after the projector). This appears inconsistent.

Author response:
**A2**. Yes. Following the common practice as in SimCLR, MoCo, etc, feature transferability is also evaluated based on the encoder features (before projector) to attain better downstream performance. Thus, it would be more precise to change the claim to *“[the downstream performance] shows that disentangled feature learning can yield representations that are more robust against domain shifts”*. 

For completeness, we also evaluate the features of projector outputs, and add the results to **Table 6** (**Appendix F.5**). As quoted below, we can see that NCL (w/ ReLU) output can achieve comparable performance to CL outputs (w/o ReLU) while **providing much better feature interpretability as shown in Figure 4**. Besides, Table 3 shows that when pursuing interpretability, NCL can also **induce better encoder features** than CL. Overall, we believe that NCL is indeed favorable since it attains better feature interpretability while maintaining feature usefulness.

*Downstream performance with projector outputs.*

|  | CIFAR-10 |  | CIFAR-100 |  |
| --- | --- | --- | --- | --- |
|  | LP | FT | LP | FT |
| CL (w/o ReLU) | 85.6$\pm$0.1 | 92.1$\pm$0.1 | 53.6$\pm$0.3 | 71.4$\pm$0.2 |
| NCL (w/ ReLU) | 85.4$\pm$0.3 | 92.4$\pm$0.1 | 53.7$\pm$0.2 | 71.5$\pm$0.2 |

Reviewer comment (Theory):
The theoretical guarantees derived in the paper are based on assumptions. There is insufficient discussion of the applicability of these assumptions, and the guarantees, when real world data is used and the learned features are not ideal. For example, for each feature (representing a latent class), is there at least one sample in the data sets used that (approximately) only has that feature activated? Is learning something close to the ideal features reliant on a feasible amount of training data and a feasible amount of augmentations?

Author response:
**A3**. That’s a good question! Since latent classes $C$ are not observable, it would be hard to actually verify the assumptions and the guarantees. We note that the original paper Arora et al. (2019) also uses intuitive justification for this assumption. Nevertheless, we can justify this assumption under some special cases, when we know their exact meanings:

- **Latent Class = Observed Class.** When $C$ corresponds to the observed labels $\mathcal{Y}$ (i.e., supervised contrastive learning), it is easy to see that this assumption holds, as it only requires a very mild condition: for each class (e.g., dog), there is indeed one image that only contains a dog, and no objects from the other classes. It is easy to see that ImageNet and CIFAR datasets all fit this criterion.
- **Latent Class =  Individual Sample**. If each sample represents a latent class, this assumption would require this example is not equivalent to any other samples in this dataset. This is also very mild since any dataset with no duplicated samples satisfies this condition.

Therefore, when we know the ground truth labels, it is easy to see that our assumptions are very natural and are very likely to hold in practice.

> Is learning something close to the ideal features reliant on a feasible amount of training data and a feasible amount of augmentations?
> 

We note that practical NN training is highly stochastic, non-convex, and influenced by many factors (architectures, optimizers, augmentations, etc), so it is generally hard to attain the exact optimal solution. To examine the general trend, we consider the supervised contrastive learning setting, when we can observe the latent classes as the ground-truth labels. As shown in **Figure 6 in Appendix 4**, the learned features of CL and NCL have clear differences. In particular, **NCL features are more concentrated on the top 10 features**, which roughly aligns with our theoretical analysis that the optimal features are located at $C$ dimensions ($C=10$ for CIFAR-10).

Reviewer comment (Experiments):
It is unclear to me why the feature selection task is chosen to show the sparsity of the NCL solution. Why is the sparsity evidenced by performance with a subset of the original features rather than a subset of the learned features?

Author response:
**A4**. As mentioned in Section 4.2, we explore *“utilizing this property for selecting a few important feature dimensions among the learned representations". Thus*, the feature selection task indeed refers to **selecting a subset of the learned features**, instead of from the original input features.

Reviewer comment (Theory):
In Appendix C.3, the derivation of lower bound of mutual information as the NCE loss should be more thorough, or cite a paper with a more closely aligned derivation, as it has a different form to the original paper (Oord et al., 2018). Also, the NCE loss does not include positive samples as it does in the main text. Is this intentional?

Author response:
**A5**. Thanks for pointing it out, this is a typo. We have fixed it in the revision.

Reviewer comment (Theory):
The expectation in equation 1 appears to be over just positive samples.

Author response:
**A6**. Thanks for pointing it out. We have added the negative samples in the revision.

Reviewer comment (Reproducibility):
The paper would be more reproducible if the code were made public.

Author response:
**A7**. We will definitely publish the source code if accepted.

Reviewer comment (Novelty):
**Novelty:** While the author has made a great effort to establish a connection between NMF and contrastive learning in the NCL approach, it appears that NCL can be seen as an extension of SCL with non-negativity constraints and similar justifications and proofs.

Author response:
**A1**. We are afraid that we do not think that our analysis uses “similar justifications and proofs” to SCL. Indeed, NCL is a variant of SCL by incorporating the non-negative constraint. However, we highlight that **adding this constraint makes this problem have very different structures (optimal solutions,  theoretical properties, empirical behaviors), and thus requires very different techniques to deal with**. 

**Differences.** Note that the extension from MF to NMF is highly nontrivial. The two problems have very different properties and require different algorithms, leading to a new branch of research area. Because of the equivalence between MF/NMF and CL/NCL, our extension from CL to NCL is also technically non-trivial and has practical significance. To be more specific, 

- **Different optimal solutions.** CL optimal features are **eigenvectors** of the augmentation graph [1], which usually contain negative values that are infeasible solutions for NCL; in turn, it also means that NCL optimal features enforcing the non-negativity constraint might be non-optimal for CL. Thus, **the old techniques for analyzing CL through eigendecomposition [1] cannot be applied to NCL.**
- **Different theoretical properties.** CL optimal features are eigenvectors that are non-unique (no identifiability), dense (no sparsity), and rotationally symmetric (no dimensional semantic consistency). In comparison, NCL optimal features enjoy these properties, showing their clear difference.
- **Different empirical properties.** As also verified in practice, CL features do not preserve these interpretability-related properties as NCL features, including semantic consistency, sparsity, and feature disentanglement.

**Solutions.** To account for their differences, in Sec 3, we **have developed a new latent-class-based theoretical framework** to derive and analyze the optimal solutions of NCL, and guarantee its downstream performance and interpretability. This is not possible within the original analysis framework of Haochen et al [1] or Arora et al [2] alone. Instead, it requires us to bridge two frameworks and characterize optimal solutions of the constrained problem under this new framework, which may be of independent interest.

Overall, we believe that our theoretical analysis is also technically novel, since it builds a new framework for analyzing non-negative constrained CL methods for the first time. Although simple, the non-negative constraint extension could be deep and meaningful to the field.

**References:**

[1] Haochen et al. Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive Loss. In NeurIPS. 2021.

[2] Arora et al. A Theoretical Analysis of Contrastive Unsupervised Representation Learning. In ICML. 2019.

Reviewer comment (Experiments):
**Contribution:** The reported results in Table 2, and Figure 5 do not convincingly support a significant improvement brought about by NCL compared to the classical contrastive learning method. Furthermore, the absence of a direct comparison between NCL and SCL is notable.

Author response:
**A2**. **Main Contribution.** As we emphasized extensively in the paper (esp. Abstract and Introduction), **the** **main focus of this paper is NOT to improve downstream performance, but to resolve the feature interpretability problem** of contrastive learning. Interpretability is an important aspect of representation learning, as acknowledged by Reviewer kpGZ, *“Interpretability of ML methods and learned representations is an important problem.”*. 

**Comparison.** Therefore, the comparable performance of Table 2 does not conflict with the effectiveness of NCL on improving feature interpretability. Instead, since many interpretability methods often come at the cost of not-so-good representation quality (such as, disentangled/identifiable VAE methods), the fact that NCL can maintain the same level of performance as canonical CL while attaining interepretability makes it **a simple and desirable solution to attain interpretability with no sacrifice on performance**.

To this end, we respectfully suggest that you could evaluate our work based on its contribution on enhancing feature interpretability in representation learning.

**Comparison between SCL and NCL**. Following your suggestion, we further compare SCL and NCL in terms both feature interpretability, and results are included in **Appendix F.1**. As quoted below, NCL can also attain slight improvement over SCL, while bringing clear interpretability improvements in terms of class consistency, sparsity, and correlation. It shows that NCL indeed works well across different CL objectives.

*Comparison of SCL and its NCL version on CIFAR-10.*

| Objective | Linear Accuracy | Semantic Consistency | Sparsity | Correlation Error |
| --- | --- | --- | --- | --- |
| SCL | 88.0 | 19.0 | 0.002 | 0.117 |
| NCL | 88.6 | 24.0 | 64.654 | 0.004 |

Reviewer comment (Theory):
**Generality and applicability of NCL's representation:** While the authors have theoretically demonstrated that NCL can yield sparse and less entangled representations suitable for downstream tasks like clustering and classification, the critique is that the suggested definition for an optimal and interpretable representations does not necessarily cover the broader goal of capturing all latent factors within the data structure. In many practical applications, e.g. in VAE studies or mixture modeling, the aim is to obtain comprehensive representations that also cover continuous and non-sparse variabilities, which remains unaddressed in this work.

Author response:
**A3**. Good question! In this paper, following the convention of CL theory, we also consider linear classification as the downstream task and thus consider sparse features. Nevertheless, **our theoretical framework in Sec 3 can be easily extended to continuous and non-sparse features as well as mixture modeling**. In fact, the latent variable $c$ is generally defined and can also take continuous values. As long as the data generation process holds (Assumption 1) and $c$ is non-negative, Theorem 3 still gives a characterization of the optimal solutions, showing that NCL can recover the ground-truth posterior distribution of latent classes $c$. 

Thus, NCL is not limited to learning discrete classes, but also applies to continuous settings as long as the latents are non-negative. We have added a footnote on **page 6** to discuss this part.

Reviewer comment (Theory):
It seems there might be a typo error in the proof of Theorem 2. It appears that the negative sample $x^-$ should be the positive one, $x^+.$ right?

Author response:
**A4**. Thanks! We have fixed it.

Reviewer comment (Experiments):
If the primary objective of introducing non-negativity constraints is to encourage sparser representations, have you considered whether regularizing SCL loss with a sparsity regularizer might produce similar results?

Author response:
**A5**. Indeed, it is an interesting idea to encourage sparser representations with a sparsity regularizer. To compare it with NCL, we conduct additional experiments by adding the l1 norm to the original contrastive objective. As shown in the following table, by simply adding a sparsity regularizer, the feature sparsity (calculated as in Figure 5(b)) is much lower than NCL. Meanwhile, the downstream performance even performs worse than original contrastive learning. We have included this discussion in **Appendix F.2**.

*Comparing NCL with $\ell_1$ regularization on CIFAR-10.*

| Objective | Linear Accuracy | Feature Sparsity |
| --- | --- | --- |
| SCL | 88.0 | 0.002 |
| NCL | 88.6 | 69.654 |
| SCL+l1 norm | 87.2 | 0.031 |

Reviewer comment (Reproducibility):
Could you clarify whether the results presented in Tables 1 and 2, as well as Figure 5, are based on a single round of experimentation or multiple iterations? When the text mentions *"on average"* it would be helpful to specify the number of runs that the average is calculated over.

Author response:
**A6**. To be more rigorous, we have replaced all benchmark results with mean and stdev values obtained from multiple runs (see updates in Tables 1-4). Due the limit of time, we run 3 random trials. It can be seen that NCL indeed often outperforms CL significantly on feature selection and downstream tasks. 

In Sec 4.3, “on average” means that the score is taken over three different datasets (as an overall improvement) in Table 3, not over random trials. We have added explanations in the revision.

Reviewer comment (Evaluation):
The results in Table 2 of the article indicate that the improvement from the proposed method is rather limited. I remain uncertain about the method's true efficacy.

Author response:
**A2**. As we emphasized extensively in the paper (esp. Abstract and Introduction), **the** **main focus of this paper is NOT to improve downstream performance, but to resolve the feature interpretability problem** of contrastive learning. Interpretability is an important aspect of representation learning, as acknowledged by Reviewer kpGZ, *“Interpretability of ML methods and learned representations is an important problem.”*. 

Therefore, the comparable performance of Table 2 does not conflict with the effectiveness of NCL on improving feature interpretability. Instead, since many interpretability methods often come at the cost of not-so-good representation quality (for example, VAEs only get ~70% linear probing accuracy on CIFAR-10 [1]), the fact that NCL can maintain the same level of performance as canonical CL (87.8% linear accuracy) while attaining feature interpretability makes it **a simple and desirable solution to attain interpretability with no sacrifice on performance**.

To this end, we respectfully suggest that you could evaluate our work based on its contribution on enhancing feature interpretability in representation learning.

**Reference:**

[1] Zhang et al. Improving VAE-based Representation Learning. arxiv 2022.

Reviewer comment (Evaluation):
In the first paragraph of sec 1, the authors show top activated examples along each feature dimension to demonstrate the interpretability of the features. Is this a common practice? Why is this approach considered reasonable?

Author response:
**A3**. As discussed in Bengio et al. [1], each feature dimension should be disentangled and has its own meaning. Encoder-decoder methods (like VAEs) usually validate this point by generating samples with varying latent factors. For encoder-only methods (like CL), a viable approach is to **examine whether training samples activated in each dimension have similar semantics**. In our paper, we have used two approaches to examine this:

- **Qualitative visualization**. Since samples with top activations indicate strong signals of this feature, we select 10 top activated samples for a clear demonstration in **Figure 1**. If these top activated samples even have distinct semantics (like CL), it means a lack of feature interpretability. We notice that a recent NeurIPS paper [2] ***also uses this approach to inspect the semantics of each feature*** (see Figure 1 in [2]). We have further added **CIFAR-100 and ImageNet-100 examples in Appendix F.6**, where NCL also has clear advantages over CL on feature interpretability.
- **Quantitative measure**. To quantitatively measure this interpretability property, we also design a metric called **“Semantic Consistency”,** which calculates the proportion of all activated samples that belong to their most frequent class along each feature dimension (see Fig 4a caption). As shown in Fig 4a, NCL also outperforms CL by a large margin on semantic consistency. Besides, we have also **quantitatively evaluated feature sparsity, correlation, and disentanglement** for a comprehensive analysis (Sec 3 & 4). These measures all show that NCL has much better interpretability than CL.

**Reference:**

[1] Bengio et al. Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1798–1828, 2013.

[2] Zhang et al. Identifiable Contrastive Learning with Automatic Feature Importance Discovery. In NeurIPS. 2023.

Reviewer comment (Theory):
In the second paragraph of sec 2.2, why does the rotational symmetry in the optimal solution hurt the performance?

Author response:
**A4**. We are afraid that there are some misunderstandings here. **The problem of rotational symmetry is that it causes the loss of CL’s feature interpretability, not downstream performance.** Theoretically, rotational symmetry has no influence on downstream performance since these solutions are equivalently optimal [1]. However, this property also makes CL features lack semantic consistency, sparsity, and disentanglement (elaborated in Sec 2.2). By introducing the non-negative constraint, we show that **NCL can restore these interpretability properties while retaining downstream performance, both theoretically and empirically.** 

**References:**
[1] Haochen et al. Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive Loss. In NeurIPS. 2021.