Manuscript Offprint
arXiv:2610.32729Internal Discrepancy for Contrastive Learning: Generalization Bounds and Downstream Behaviors
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Jialiang Wang
Qing Ma
Xiong Zhou
Gangfeng Hu
Haoliang Li
Xianming Liu
Harbin Institute of Technology, Harbin, China
City University of Hong Kong, Hong Kong, China
Editor: My editor
Abstract
Contrastive learning has emerged as a popular paradigm for training representation models. While prior studies pursue more practical and less restrictive assumptions to enhance theoretical understanding of contrastive learning, they essentially describe the interconnections among representations within the data or induced by the function class. To encapsulate these assumptions, we propose the measure of internal discrepancy that quantifies the difference between the mean representation of positive samples and latent cluster centers. We then prove an internal discrepancy-aware generalization bound for downstream supervised tasks following contrastive learning, without requiring additional assumptions. This generalization bound not only serves as a unifying framework connecting various assumptions but also motivates us to further reduce the internal discrepancy, thereby introducing the relaxed k-means loss as an approximation. Moreover, we investigate the downstream behaviors of contrastive learning from the perspective of contrastive learning-incurred supervised losses. In the presence of class imbalance, we shed light on why contrastive learning can facilitate imbalanced learning. Finally, we investigate the optimality of these incurred supervised losses, proving several intriguing properties.
Keywords: contrastive learning, generalization bound, imbalanced learning, optimality
1 Introduction
In the past decade of machine learning research, many classification models have relied heavily on the availability of a large amount of labeled data (Krizhevsky et al., 2012; He et al., 2016; Vaswani et al., 2017). However, it is not always possible to obtain sufficient labeled data for scaling up models, prompting researchers to leverage vast amounts of unlabeled data (Misra and Maaten, 2020; Grill et al., 2020; Goyal et al., 2021; Tomasev et al., 2022; He et al., 2022; Kong and Zhang, 2023; Dehghani et al., 2023; Zhang et al., 2025), with self-supervised learning emerging as a promising path to advance machine learning (Balestriero
*. Equal contribution
†. Corresponding author
©year Jialiang Wang, Qing Ma, Xiong Zhou, Gangfeng Hu, Haoliang Li and Xianming Liu.
License: CC-BY 4.0, see https://creativecommons.org/licenses/by/4.0/. Attribution requirements are provided at http://jmlr.org/papers/vvolume/paperid.html.
et al., 2023). In particular, we focus on contrastive learning that captures semantically relevant and discriminative information from the data by bringing the representations of positive pairs closer together while pushing the representations of negative samples apart (Gutmann and Hyvärinen, 2012; He et al., 2020; Tian et al., 2020a; Caron et al., 2021; Hieu et al., 2025; Rusak et al., 2025).
Despite the empirical success of contrastive learning (Mikolov et al., 2013; Logeswaran and Lee, 2018; Radford et al., 2021; Yu et al., 2022; Xu et al., 2023), there remains a lack of comprehensive understanding regarding how this paradigm effectively learns meaningful representations that facilitate downstream tasks (Tian et al., 2020b; Garrido et al., 2023; Chen et al., 2024; Tan et al., 2024; Wang, 2025). For instance, Kang et al. (2021) observed that contrastive learning can achieve a balanced representation space in the presence of class imbalance, but there has been limited theoretical analysis of this phenomenon. Due to the absence of supervision, contrastive learning primarily relies on the intrinsic structure within the data (Tian et al., 2020b; Li and Neuman, 2026), and the inductive biases of the function class and training algorithm (Wen and Li, 2021; Saunshi et al., 2022; HaoChen and Ma, 2023; Parulekar et al., 2023). However, without further assumptions on the data or inductive biases, relying solely on contrastive losses may not adequately establish relevant associations for downstream behaviors.
Prior studies have introduced various data assumptions to bridge this gap, including the (nearly) conditional independence between positive samples (Saunshi et al., 2019; Lee et al., 2021; Zou and Liu, 2023), the overlap of augmentation sets for semantically similar samples (HaoChen et al., 2021; Wang et al., 2022), the expansion or concentration within augmentation sets (Wei et al., 2021; Huang et al., 2023), and the label consistency of positive pairs (Zhang et al., 2025). While these studies pursue more practical and less restrictive data assumptions to understand contrastive learning, Saunshi et al. (2022) pointed out that data assumptions alone, even with a small contrastive loss, are insufficient to capture the success of contrastive learning in realistic scenarios. They further argue that understanding contrastive learning requires incorporating inductive biases of the function class. This has motivated studies to investigate constrained function classes, such as assumptions regarding the ability to implement stronger inner-cluster connections (HaoChen and Ma, 2023), cluster-preserving representations (Parulekar et al., 2023), and centered representations (Cui et al., 2025). In light of these two lines of research, several critical questions arise:
-
Do prior data assumptions that appear distinct essentially characterize or constrain a common aspect? Is there a measure that connects these data assumptions?
-
Can this measure effectively describe the inductive biases of the function class or training algorithm?
-
Can we further establish a generalization bound based on this measure without requiring additional assumptions, thus providing a unified framework for studying both data assumptions and inductive biases?
-
Can we further explore the downstream behaviors of contrastive learning, including its handling of class imbalance and its optimality?
We answer these questions affirmatively. The core insight lies in the observation that prior assumptions essentially or partially describe the interconnections among representations of samples, augmentations, and latent clusters. To quantify these interconnections, we propose the measure of internal discrepancy, denoted by , which characterizes the discrepancy between the mean representation of positive samples and latent cluster centers. Without relying on specific assumptions, we prove an internal discrepancy-aware generalization bound on downstream supervised performance for contrastive learning, expressed informally as for any . Here, is a supervised loss w.r.t. the empirical minimizer , represents the contrastive loss, and denotes the generalization error. This bound suggests that downstream performance will be determined by both the value of the contrastive loss and the internal discrepancy. By further establishing the association between specific assumptions and the internal discrepancy, we can readily develop theoretical insights into downstream tasks with those assumptions. Replacing with the intra-class discrepancy of and the positive-pair alignment of in the bound motivates us to minimize an approximation of the internal discrepancy, namely the relaxed -means loss, which aims to reduce the distance between representations within a truncated range.
Moreover, the supervised loss corresponds to a specific supervised loss function, which we refer to as a contrastive learning-incurred supervised loss. Based on the incurred supervised loss, we provide insights into the downstream behaviors of contrastive learning, specifically through the InfoNCE loss (Oord et al., 2018) and the spectral contrastive loss (SpeCL) (HaoChen et al., 2021). In class-imbalanced scenarios, we prove that the InfoNCE-incurred loss approximates the balanced softmax loss (Ren et al., 2020) that accommodates class distribution shifts to mitigate class imbalance, and that the cosine similarities between representations learned by the SpeCL-incurred loss remain consistent regardless of the class distribution. These results help explain why contrastive learning can facilitate class-imbalanced learning. Furthermore, we explore the optimality of these contrastive learning-incurred supervised losses, proving that representations learned under the InfoNCE-incurred loss exhibit variability collapse and converge to a simplex equiangular tight frame. Additionally, the SpeCL-incurred loss leads to optimal features that achieve the best approximation of the identity matrix.
Our main contributions are as follows:
-
We introduce internal discrepancy, a measure that characterizes the discrepancy between the mean representation of positive samples and latent cluster centers and can be associated with various data assumptions.
-
We derive the internal discrepancy-aware generalization bound on downstream performance for contrastive learning without requiring assumptions on the data. The generalization bound motivates us to propose the relaxed k-means loss to approximately minimize the internal discrepancy.
-
We investigate the role of contrastive learning in mitigating class imbalance, revealing that the InfoNCE-incurred loss approximates the balanced softmax loss and that class imbalance only scales representations under the SpeCL-incurred loss.
-
We prove the optimality of contrastive learning through its incurred supervised losses, including variability collapse and convergence to a simplex equiangular tight frame for the InfoNCE-incurred loss, and the best approximation to the identity matrix by optimal representations for the SpeCL-incurred loss.
Supervised Loss. The loss incurred by the classifier on a point is defined as , typically tailored for enlarging the prediction of the target class while reducing the predictions for non-target classes . Consequently, the supervised loss w.r.t. the classifier is
Linear Probing. To evaluate the downstream classification performance of the representation model , we train a linear classifier and use to calculate the classification loss . By fixing and optimizing the linear classifier, we use a slight abuse of notation and define the supervised loss of on as the infimum over :
Since for any , we focus on bounding a surrogate classification loss with the mean classifier that comprises class means of representations (Saunshi et al., 2019; Wang et al., 2022; Huang et al., 2023; Joshi and Mirzasoleiman, 2023). Throughout this paper, unless otherwise specified, is the mean classifier, i.e., for all .
Contrastive Learning. Contrastive learning is based on the fundamental idea of bringing representations of positive pairs closer while pushing representations of negative samples apart. We model an anchor and its positive sample by the joint distribution , and negative samples are drawn i.i.d. from
-
For ease of exposition, we consider a distribution over original samples and their augmentations.
-
In supervised contrastive learning, specifically includes samples that belong to the same class as . In the unsupervised setting, covers the distribution of random views (or augmentations) of .
. The population contrastive loss is defined as
where represents the contrastive loss function. For the sake of brevity, we will use to denote . Additionally, we might abbreviate as or in certain contexts. Intuitively, the essence of minimizing the contrastive loss lies in amplifying the similarity between positive-pair representations and , while striving to separate the representations of negative samples. Correspondingly, Wang and Isola (2020) have identified two properties related to this process: the alignment of positive pairs and the uniformity of features.
We exemplify two contrastive loss functions below. The first is the widely used InfoNCE loss:
Example 1 (InfoNCE). The InfoNCE loss in contrastive learning (Oord et al., 2018; Chen et al., 2020; He et al., 2020) is defined as .
The second is the spectral contrastive loss that is both sample-contrastive and dimension-contrastive (HaoChen et al., 2021; HaoChen and Ma, 2023; HaoChen et al., 2022; Balestriero and LeCun, 2022; Zhou et al., 2024), acting as a well-established theoretical surrogate for the InfoNCE loss:
Example 2 (Spectral Contrastive Loss (SpeCL)). The spectral contrastive loss (HaoChen et al., 2021) is formulated as .
As detailed in Appendix A.1, the separate convexity of the InfoNCE loss and the spectral contrastive loss can be easily verified w.r.t. the representations , , and . Furthermore, these two loss functions are also Lipschitz continuous when f adheres to bounded norm constraints. Therefore, we consider contrastive loss functions with both convexity and Lipschitzness.
For the tuples drawn i.i.d. according to the sampling scheme above, the empirical counterpart is defined as
The goal of contrastive learning is to identify the risk minimizer . In practical scenarios, where access is limited to a finite number of samples, our focus pivots towards finding the empirical risk minimizer . As in supervised learning, the generalization bound for contrastive learning is measured by the difference between and , but with a greater emphasis on bounding the downstream supervised loss for some .
- For supervised contrastive learning, is characterized by , which represents samples from classes other than the class of . In the unsupervised scenario, describes the overarching data distribution, encompassing all classes without using label information.
Wang, Ma, Zhou, Hu, Li, Liu
3 Internal Discrepancy for Contrastive Learning
In this section, we begin by introducing the concept of internal discrepancy and its relationship to various assumptions outlined in the literature. Following this, we establish an internal discrepancy-aware generalization bound for contrastive learning, which does not rely on any specific data assumptions. Moreover, we propose the relaxed k-means loss as a means to approximate the minimization of internal discrepancy. Additional results for scenarios involving a single negative sample are provided in Appendix B.
3.1 Internal Discrepancy
Despite the empirical success of contrastive learning, a significant gap persists in theoretical understanding of how this paradigm effectively learns meaningful relationships between data points. Due to the absence of labels in the data, contrastive learning primarily relies on the associations within the data and their augmentations, and the inductive biases of the function class. Prior studies have presented various data assumptions to establish relevant theories, such as conditional independence of positive pairs (Saunshi et al., 2019; Lee et al., 2021; Zou and Liu, 2023) and the overlap of augmentation sets (HaoChen et al., 2021; Wang et al., 2022). They have also considered assumptions on the function class, including centered representations (Cui et al., 2025). While diverse, these assumptions essentially or at least partially describe interconnections between samples, augmentations, and latent clusters.
To essentially measure these interconnections, we define the internal discrepancy as follows:
Definition 1 (Internal Discrepancy). For the data distribution D with latent classes T, the internal discrepancy is defined as follows:
where denotes the -norm.
Internal discrepancy quantitatively characterizes the alignment between the mean representation of positive samples of a data point and the classwise mean representation. Moreover, we have:
which implies that internal discrepancy is further governed by two key components: the positive-pair alignment term , also referred to as the alignment loss (Wang and Isola, 2020), and the intra-class discrepancy that measures the discrepancy between the representations of individual samples and their respective latent class means. While prior works often posit specific assumptions that appear distinct, we demonstrate that they essentially serve as conditions to constrain the value of internal discrepancy or the two terms in its upper bound. Figure 1 illustrates a configuration in which more compact class clouds and local positive-pair regions accompany a smaller distance between the conditional positive mean and the class mean, reducing internal discrepancy.
(a) Large Disc(f)
(b) Small Disc(f)

Figure 1: Schematic comparison of large and small internal discrepancy. Colors denote latent classes, while dashed regions highlight local positive pairs. The filled and open circles indicate and . The diamond and star mark and , respectively. The expected distance between the conditional positive mean and the class mean equals . The right panel depicts more compact class and local regions, accompanied by a shorter segment in the illustrated configuration.
Association with Previous Assumptions. The internal discrepancy metric provides a novel perspective for integrating and expanding upon assumptions made in prior literature regarding data characteristics (Saunshi et al., 2019; Wang et al., 2022; Huang et al., 2023; Zhang et al., 2025) and the function class (HaoChen and Ma, 2023; Parulekar et al., 2023; Cui et al., 2025):
(i) The assumption of conditional independence of positive-pair draws (Saunshi et al., 2019) states that . This leads to a zero internal discrepancy (Disc(f) = 0), as .
(ii) The perfect alignment assumption between positive pairs (or the augmentation-invariant assumption) (Wang et al., 2022, Assumption 4.6) implies for all , that is, . Moreover, the internal discrepancy simplifies to the intra-class discrepancy ,quantified as the expected distance between each sample and its corresponding class mean.
(iii) The -augmentation described by Huang et al. (2023, Definition 1) means that for each class, whose sample set is , there exists a subset such that with and , where for augmentation . Under the additional assumptions of -close representations among augmented data for all ) and -Lipschitzness of in Huang et al. (2023), we obtain .
(iv) The -implementable inner-cluster connection larger than assumption (HaoChen and Ma, 2023, Assumption 3.3) implies for any . Then we can derive that , which measures the divergence between representations of positive pairs.
(v) For the cluster-preserving function class (Parulekar et al., 2023, Definition 4.1) satisfying for all , and , , which means that the internal discrepancy is bounded by the positive-pair alignment term.
(vi) For the label consistency assumption (Zhang et al., 2025, Assumption 4), positive pairs satisfy for some , which yields when also follows the marginal distribution . This implies that the internal discrepancy is bounded by the intra-class discrepancy and an additional term accounting for positive pairs from different classes. Moreover, the connected intra-class augmentation graphs and -alignment conditions in Zhang et al. (2025, Assumptions 8 and 9) provide a means to control the intra-class discrepancy by propagating alignment along paths within each class.
(vii) For the centered representation assumption (Cui et al., 2025, Assumption 2.2), the original sample satisfies . When denotes the distribution of original samples in class and is induced by augmenting the original anchor , we obtain directly from the definition. This assumption constrains the mean representation of augmented samples while allowing , so that the internal discrepancy reduces to the intra-class discrepancy without requiring the perfect alignment in (ii).
In essence, by formulating a generalization bound that takes into account internal discrepancy as the intermediate bridge, we can readily use specific data assumptions to develop theoretical insights into downstream tasks. This only requires us to establish the association between internal discrepancy and these data assumptions.
3.2 Internal Discrepancy-Aware Generalization Bound
We first show that there exists a supervised loss bounded by the population contrastive loss and internal discrepancy:
Theorem 2. For the loss function that is convex with respect to each of and and -Lipschitz w.r.t. the positive representation , and the distribution with latent classes , for all , there exist a linear classifier and a supervised loss such that
where equality holds if for all and . And is the incurred supervised loss.
The following proposition shows that the internal discrepancy term in Theorem 2 cannot be dropped, even for a near-minimizer of the contrastive loss:

(a) CIFAR-10

(b) CIFAR-100

(c) ImageNet-100
Figure 2: Illustration of validation accuracies (%) on CIFAR-10, CIFAR-100, and ImageNet-100 using cross entropy, InfoNCE-incurred loss as per Theorem 2, and multi-class binary cross entropy defined in Equation 31. The depicted results demonstrate that these three loss functions deliver comparable performance.
Proposition 3. For any , class distribution , and with , there exist a distribution with latent classes and a representation with such that, for the InfoNCE loss with , positive samples , and negative samples drawn from , we have , the mean classifier , with the infimum over all satisfying , and
Since , the bound in Theorem 2 becomes tight in this example as grows, with the gap approaching .
Contrastive Learning-Incurred Supervised Loss. The supervised loss incurred by contrastive learning involves an expectation over i.i.d. class draws from and may suffer from class collisions due to the presence of the target-class weight among the negatives. Moreover, the specific form of is intricately tied to factors such as the number of negatives and the latent class distribution , posing practical challenges in its application. Nevertheless, the incurred loss can be effective for classification problems. For instance, the InfoNCE-incurred supervised loss can be reformulated as (where denotes the class distribution excluding class ), which explicitly accounts for class collision. This formulation bears similarity to the cross entropy (CE) loss . In Figure 2 and Table 1, we demonstrate that the InfoNCE-incurred loss (we randomly sample classifier weights times) can yield comparable results to CE. Additionally, we prove below that they share the same global minimizers under mild conditions. Further analysis of the incurred loss will be developed in Section 4.
Lemma 4. Consider the class-balanced distribution and the InfoNCE-incurred supervised risk . If , then
Table 1: Validation accuracies (%) on the CIFAR-10 and CIFAR-100 datasets. These results are obtained through supervised learning using cross entropy (CE) or InfoNCE-incurred loss (with the number of negatives and the number of sampling repetitions ). As is evident from the results, the InfoNCE-incurred supervised loss, when optimized with suitable values of and , can yield performance that is on par with or even surpasses that of the traditional CE approach.
| Dataset | Method | Sampling repetitions | |||
|---|---|---|---|---|---|
| 10 | 20 | 40 | 100 | ||
| CIFAR-10 | CE | 94.79 | |||
| 94.79 | 94.93 | 94.83 | 94.91 | ||
| 95.20 | 94.87 | 95.05 | 94.71 | ||
| 94.81 | 94.82 | 94.85 | 94.65 | ||
| 94.76 | 94.73 | 94.79 | 94.73 | ||
| 94.49 | 95.07 | 94.66 | 94.70 | ||
| CIFAR-100 | CE | 76.37 | |||
| 74.68 | 75.03 | 75.00 | 74.87 | ||
| 76.79 | 76.76 | 76.79 | 76.84 | ||
| 77.18 | 77.53 | 76.74 | 76.82 | ||
| 76.77 | 77.27 | 76.86 | 76.91 | ||
| 76.56 | 76.64 | 76.76 | 76.77 | ||
and the CE loss share the same global minimizers over all representation functions satisfying .
While a variety of works have studied the capacity of contrastive learning to recover meaningful representations or latent clusters under certain data assumptions, we put forth a generalization bound for Lipschitz convex losses, which holds without any additional assumptions.
Theorem 5 (Generalization Bound). Under the conditions in Theorem 2, assume further that is -Lipschitz w.r.t. and has a range of length at most . With probability at least , for all , there exist a linear classifier and a supervised loss such that
where and is the (unnormalized) empirical Rademacher complexity of on i.i.d. training tuples .
Remark. Theorem 5 supports the observation of Saunshi et al. (2022) that achieving a low contrastive loss alone may not guarantee good downstream performance, as exemplified by Proposition 3. A low contrastive loss and a small internal discrepancy provide sufficient control of the incurred supervised risk. This theorem also highlights several insights: (i) The inductive biases of the function class and optimization algorithm should lead to the learned model exhibiting both a low contrastive loss and a small internal discrepancy . Given that , improving positive-pair alignment and reducing intra-class discrepancy tighten this upper bound. (ii) In alignment with classical learning theory principles, an adequately large number of independent training tuples aids in reducing when the complexity term grows sublinearly in . This perspective may help explain the empirical effectiveness of rich data augmentation in contrastive learning (Chen et al., 2020; Huang et al., 2023).
The incurred supervised loss further controls the classification error of the linear classifier and its balanced error that weights all classes equally:
Corollary 6. Let be the InfoNCE-incurred loss in Theorem 2. For , write for , and define and for . Then for any and , with any fixed rule for breaking ties, the prediction satisfies
(10)
With probability at least , Theorem 5 further bounds both numerators for the mean classifier of by for all .
Extension to Supervised Contrastive Learning. In unsupervised contrastive learning, positive pairs usually consist of two randomly augmented views, whereas in supervised contrastive learning, positive pairs are drawn i.i.d. from the same class , embodying the principle of class-conditional independence between positive pairs (i.e., , and ). Consequently, all results about random negative samples presented by Saunshi et al. (2019) are relevant to the present setting.
In the supervised scenario, negative samples can instead be drawn from classes other than that of the anchor, that is, . Then supervised contrastive learning aims at minimizing
(11)
and its empirical counterpart is . By an argument analogous to that of Theorem 5, we obtain the following result:
- For the purpose of simplifying our analysis, we omit positive pairs arising from the augmentations of the same sample.
Theorem 7. Under the loss conditions in Theorem 5, with probability at least , for all , there exist a linear classifier and a supervised loss such that
where , and the incurred supervised loss is formulated as .
3.3 The Relaxed K-Means Loss on Representations
As mentioned above, Theorem 2 shows that the population supervised loss is bounded by the contrastive loss and the internal discrepancy . However, the generalization bound in Theorem 5 is limited by , which depends on the empirical risk minimizer . Since and the positive-pair alignment is already encouraged by contrastive learning (Wang and Isola, 2020), we may also consider minimizing the empirical counterpart of the intra-class discrepancy :
where denotes the label of sample , , and is the number of samples within class .
Combining Theorem 2 with a uniform bound on the estimation error of over , we can derive the following proposition:
Proposition 8. Under the notation and conditions in Theorem 5, with probability at least , any satisfies
where is the incurred supervised loss in Theorem 2, , and is the (unnormalized) empirical Rademacher complexity of on .
The Relaxed K-Means Loss. Due to the absence of specific labels for calculating , we resort to using a surrogate. One intuitive approach is to employ k-means clustering to obtain centroids from the representations , followed by computing the minimal distance between each representation and these centroids, i.e., . However, this loss is not only inefficient but also requires a predetermined number of clusters. Moreover, the uniformity property of contrastive learning and stochastic batch training would make clustering challenging and potentially imprecise. To alleviate this issue, we consider reducing the distance between representations within a certain distance range. That is, we treat each representation as a center and reduce the

(a) CIFAR-10
(b) CIFAR-100
(c) ImageNet-100
Figure 3: Linear probing accuracies (%) on CIFAR-10, CIFAR-100, and ImageNet-100 using unsupervised contrastive learning with the InfoNCE loss and the relaxed k-means loss, i.e., , where .
distance from neighboring representations to it. This can be straightforwardly implemented with a truncation as follows:
where is a threshold to filter overly large pairwise distances. Although it requires no labels, the relaxed k-means loss controls the intra-class discrepancy as follows:
Proposition 9. Suppose that is computed on the sample in , i.e., in Equation 14, and that . Write and . Then for all ,
If, in addition, for all with , then
As shown in Figure 3, the incorporation of relaxed k-means loss contributes to an improvement in linear probing, especially on the ImageNet-100 dataset (the complete experimental results can be found in Appendix C.2). This underscores the feasibility of minimizing the internal discrepancy in this manner. We hope that the relaxed k-means loss can stimulate new insights into unsupervised representation learning.
4 On the Supervised Losses Incurred by Contrastive Learning
In Section 3.2, contrastive learning-incurred supervised losses are central to analyzing the downstream performance of contrastive learning. These losses entail an expectation over k
Wang, Ma, Zhou, Hu, Li, Liu

(a) CIFAR-10-LT

(b) CIFAR-100-LT
Figure 4: Validation accuracies (%) on long-tailed CIFAR-10 and long-tailed CIFAR-100 datasets using supervised losses incurred by InfoNCE with different numbers of negatives and imbalance ratios , where the imbalance ratio denotes the sample size ratio between the largest and smallest classes.
i.i.d. class draws and differ in form from typical classification losses. In this section, we investigate the behavior of the supervised losses incurred by contrastive learning, focusing specifically on InfoNCE and SpeCL.
4.1 Implications for Mitigating Class Imbalance
Real-world data often exhibits an imbalanced class distribution, primarily because some classes have an abundance of examples, while many others are associated with only a few. This class imbalance can make naive learning biased towards the majority classes, leading to poor performance and a narrow feature space for minority classes (Ren et al., 2020). However, several studies have underlined the potential of contrastive learning to improve imbalanced learning. For instance, Kang et al. (2021) observed that contrastive learning helps learn a balanced feature space, even in the presence of a highly skewed class distribution. Similarly, Li et al. (2022) argued that supervised contrastive learning can offer benefits to imbalanced learning. Nevertheless, neither study fully elucidates the underlying mechanisms driving the benefits of contrastive learning for imbalanced learning. In what follows, we theoretically demonstrate that contrastive learning implicitly mitigates class imbalance.
InfoNCE-Incurred Loss Approximates Balanced Softmax Loss. We demonstrate that the loss incurred by InfoNCE closely approximates the balanced softmax loss (Ren et al., 2020), which accommodates class distribution shifts to mitigate class imbalance. The balanced softmax loss is expressed as , where we omit the term that is independent of and . We also note that the InfoNCE-incurred loss in Theorem 5 is defined as , which can be interpreted as an approximation of that resembles . Theoretically, we confirm that
Table 2: Validation accuracies (%) on long-tailed CIFAR-10 and long-tailed CIFAR-100 datasets. These results are obtained through supervised learning using cross entropy (CE), balanced softmax (BS), the InfoNCE-incurred loss (with the number of negatives and the number of sampling repetitions ), and the SpeCL-incurred (SPECL-I) loss, where SPECL-I denotes the results with normalized features and classifier weights. It is evident that the supervised loss incurred by InfoNCE outperforms CE, and SPECL-I demonstrates superior performance compared to SPECL-I. Furthermore, the performance of the InfoNCE-incurred loss generally improves as the number of negatives increases, particularly in scenarios with larger imbalance ratios.
| Dataset | Method | Imbalance Ratio | |||
|---|---|---|---|---|---|
| 10 | 20 | 50 | 100 | ||
| CIFAR-10-LT | CE | 87.85 | 83.26 | 75.12 | 66.19 |
| BS | 89.33 | 86.22 | 81.99 | 76.12 | |
| 89.35 | 85.55 | 79.90 | 74.34 | ||
| 89.44 | 86.42 | 79.90 | 73.72 | ||
| 88.43 | 86.38 | 81.13 | 74.64 | ||
| 89.18 | 86.29 | 81.42 | 75.94 | ||
| SPECL-I | 88.14 | 84.12 | 76.20 | 69.62 | |
| 88.68 | 85.26 | 78.41 | 72.95 | ||
| CIFAR-100-LT | CE | 59.62 | 52.71 | 43.65 | 37.69 |
| BS | 62.30 | 55.80 | 48.91 | 43.80 | |
| 60.86 | 54.56 | 46.07 | 40.57 | ||
| 60.56 | 55.39 | 45.64 | 41.28 | ||
| 62.00 | 55.34 | 48.44 | 42.59 | ||
| 61.52 | 55.55 | 48.45 | 44.06 | ||
| SPECL-I | 59.34 | 51.27 | 43.99 | 38.50 | |
| 61.03 | 53.61 | 46.51 | 41.11 | ||
Theorem 10. For the InfoNCE-incurred loss and the balanced softmax loss , we have , and with probability at least , for all , .
The theorem above demonstrates that the loss incurred by InfoNCE approximates the balanced softmax loss, with an error term that converges to zero at a rate of . In other words, this approximation becomes progressively more accurate as the number of negatives increases. As shown in Figure 4 and Table 2, the performance of the InfoNCE-incurred loss usually improves for highly skewed class distributions (imbalance ratios of 50 and 100) as increases, which suggests that contrastive learning with more negative samples can mitigate class imbalance.
Class Imbalance Only Scales Representations by SpeCL-Incurred Loss. For the SpeCL-incurred supervised loss , we focus on the representations that minimize the population risk . We demonstrate that an imbalanced class distribution only scales the norms of corresponding optimal representations and classifier weights by factors and , respectively (see Appendix C.3), while preserving their angular geometry. To elucidate this, we prove that
Theorem 11. For the risk , minimized over all representations and classifier weights without constraints, let and jointly be a global minimizer under the condition that is uniform. Then for any and any constant , the representations and classifier weights , defined for all and , form a global minimizer of , where we further have for . Conversely, for any , every global minimizer under arises in this way from a global minimizer under the uniform .
Since the risk depends on and only through the logits , it is invariant under and for any invertible , so its global minimizers do not have a unique geometry. Normalizing features and classifier weights allows only orthogonal , which preserve the geometry, and we further prove that
Proposition 12. For the risk , minimized over all representations and classifier weights satisfying and , assume that and . Then and jointly form a global minimizer if and only if is orthonormal and almost surely, and the minimum is . The same holds under the normalization .
Remark. Theorem 11 suggests that cosine similarities between features or classifier weights optimally learned by SpeCL-incurred losses remain consistent regardless of the class distribution. Hence, after projection onto the unit sphere , the nonzero optimal features and classifier weights share the same geometry as their counterparts in the class-balanced case. Moreover, we can obtain a rebalanced feature space and make balanced decisions by simply normalizing features and classifier weights within SpeCL, as guaranteed by Proposition 12 and demonstrated in Table 2.
4.2 The Optimality of Contrastive Learning-Incurred Losses
The optimal solutions of the CE loss, the MSE loss, and other losses usually exhibit neural collapse, an intriguing empirical phenomenon (Papyan et al., 2020; Mixon et al., 2020; Fang et al., 2021; Han et al., 2022; Zhou et al., 2023; Wu and Mondelli, 2025), where specific manifestations in the classifier and last-layer representations are characterized. Graf et al. (2021); Jiang et al. (2024) also established neural collapse results in the empirical setting of supervised contrastive learning. Our objective here is to analyze the optimality of unsupervised or supervised contrastive learning by analyzing their incurred supervised losses.
Theorem 13. For the class-balanced distribution and the InfoNCE-incurred supervised losses in Theorem 2 and
in Theorem 7 (where for ), if , then minimizes or over all representations satisfying if and only if almost surely, where for and .
Theorem 13 shows that the InfoNCE-incurred loss possesses an optimal structure that aligns with the structures demonstrated for CE (Papyan et al., 2020) and MSE (Zhou et al., 2022). Specifically, these representations exhibit two critical properties of neural collapse (Papyan et al., 2020): (i) variability collapse, where the representations equal their class means; (ii) a simplex equiangular tight frame (ETF), wherein the class means have equal length, form equal-sized angles between any given pair, and attain the maximal minimum pairwise distance.
Corollary 14. Under the conditions of Theorem 13, let , let be the Gram matrix of the class means, and let be that of the simplex ETF in Theorem 13.
(i) If or is within of its global minimum, then
(17)
(ii) For the empirical minimizer in Theorem 5, assume additionally that contains a class-constant simplex ETF of radius and that with following the marginal distribution . Writing for the unprimed mean-classifier risk in Theorem 13 and for its global minimum, with probability at least ,
Equation 17 therefore holds for with equal to this upper bound.
Corollary 14 extends Theorem 13 in two aspects: (i) any near-optimal representation approximately exhibits variability collapse with nearly centered class means, and the Gram matrix of its class means approximates that of a simplex ETF. (ii) by taking a class-constant simplex ETF in as the comparator in Theorem 5, we show that the empirical minimizer is near-optimal, with its excess risk controlled by the internal discrepancy , the generalization error , and the term accounting for positive pairs from different classes. Consequently, the representations learned by InfoNCE approximately exhibit variability collapse and a simplex ETF when these terms are small.
The SpeCL-incurred loss also admits optimal representations exhibiting variability collapse. Its optimal class means minimize the error in a constrained approximation of the identity matrix I, which becomes a best rank-d approximation under the condition in Equation 19:
Theorem 15. For the SpeCL-incurred supervised loss in Theorem 2, where
, a global minimum is attained by a representation satisfying almost surely under for all , where minimizes subject to . More specifically, writing , the minimum of equals if and only if
In this case, for every global minimizer , the matrix built from its class means satisfies that is a rank- orthogonal projection: when , and is a best rank- approximation of when . For uniform , the minimum is
When , the condition in Equation 19 is equivalent to . In this case, means that the optimal class means are mutually orthogonal with for any , which is the counterpart of Theorem 11 for the mean classifier: class imbalance only scales the optimal class means.
5 Conclusion
This paper introduces the novel concept of internal discrepancy as a unifying measure for various assumptions. This measure effectively captures the relationships between representations of positive pairs and latent clusters. By establishing an internal discrepancy-aware generalization bound, we provide a bridge for understanding contrastive learning without requiring additional assumptions, while also yielding practical strategies like the relaxed k-means loss. Furthermore, we delve into the behaviors of contrastive learning-incurred supervised losses. We show that under class imbalance, the InfoNCE-incurred loss approximates the balanced softmax loss, while features learned by the SpeCL-incurred loss maintain consistent cosine similarities regardless of class distributions. This helps explain why contrastive learning can mitigate class imbalance. The optimality of contrastive learning-incurred losses also involves some intriguing properties, including neural collapse properties for InfoNCE and the best approximation to the identity matrix for SpeCL. These results not only enhance our understanding of contrastive learning but also pave the way for exploring downstream behaviors.
Acknowledgments and Disclosure of Funding
This work is supported by National Natural Science Foundation of China under Grant 62525107.
Appendix: Internal Discrepancy for Contrastive Learning
Appendix A. Proofs of Theorems, Lemmas and Propositions
A.1 The Convexity and Lipschitzness of the InfoNCE Loss and Spectral Contrastive Loss
For fixed remaining representations, the InfoNCE loss is a log-sum-exp of affine functions, and the spectral contrastive loss is a linear function plus nonnegative quadratic terms. Thus both losses are separately convex in each representation. Their Lipschitz constants with respect to the positive representation can be taken as and , respectively, by differentiating with respect to that representation.
Lemma 16. The margin function with is -Lipschitz continuous when .
Proof The nonzero blocks in row of the Jacobian are , , and , corresponding to , , and . Hence
Integrating the Jacobian along line segments in the convex product of norm balls proves the claim.
Lemma 17. The spectral contrastive function with is -Lipschitz continuous when .
Proof To show that is Lipschitz continuous, we only need to prove that its Jacobian is bounded. Indeed, for all ,
The Frobenius norm of the Jacobian J therefore satisfies
Since and the domain is convex, the stated Lipschitz bound follows.
Direct differentiation gives sharper tuple Lipschitz constants. For InfoNCE, write and . Then
so and . Its values lie in , an interval of length at most . For SpeCL, differentiation gives
and hence . Thus , and its values lie in . The conditions of Theorem 5 hold with for InfoNCE and for SpeCL.
A.2 Generalization Bounds for Contrastive Learning
A.2.1 PROOF OF THEOREM 2
Proof The key idea in the proof is the use of the Lipschitzness of the loss function and Jensen's inequality based on the convexity of with respect to and . The unsupervised loss uses a random point from a class as a classifier; using the mean of the class as the classifier should only make the loss lower. Let be the mean representation of the class and denote the mean representation of the class of the sample . Then we have
where and . The first and second inequalities follow by applying Jensen's inequality and the convexity of with respect to and , and the third inequality follows from the Lipschitzness of . Under the stated class-constant condition, and all three inequalities are equalities.
A.2.2 PROOF OF PROPOSITION 3
Proof For any satisfying , let . Since , the InfoNCE loss is with , which is convex in .
Applying Jensen's inequality to the negatives and then to the anchor gives
Let , and let be orthonormal vectors in , which exist since . Let assign probability to each of 2m distinct points and , , of class , and set and . Then for every , so the mean classifier is and . Moreover, and give . For an anchor and defined by , we have if and otherwise. Letting be the number of negatives equal to , we obtain
Since , we have . Finally, , which rearranges to the stated inequality.
A.2.3 PROOF OF LEMMA 4
Proof Write , , , and . Define
Conditioning on the number of negative classes equal to the target class, and applying Jensen's inequality to the other negative classes, the anchor, and the target class, gives
Every class-constant representation whose class means form a simplex ETF of radius attains this bound, and such representations exist since their Gram matrix is positive semidefinite of rank . Since is strictly increasing, every global minimizer has , hence and for every . Moreover, , so almost surely. The event with exactly negatives in the target class has positive probability. Equality in its strictly convex scalar Jensen step implies that is constant over . As , this constant is . Hence minimizes if and only if almost surely, where and for .
Applying Jensen's inequality in the same way to the CE risk gives
Every minimizer characterized above attains this bound over the same mean-classifier representations. Conversely, equality in this chain requires , which again implies , , and almost surely. Equality in the strictly convex Jensen step over then implies that is constant over , so every minimizer of the CE risk is also a minimizer of , completing the proof.
A.2.4 PROOF OF THEOREM 5
Proof Let and let have rows . Then . According to Theorem 2, we have
We further apply Theorem 19. Then, with probability at least , for all ,
which finishes the proof.
The vector-contraction inequality is as follows:
Lemma 18 (Corollary 4 in Maurer (2016)). Let be any set and . Let be a class of functions and be -Lipschitz. For all , let . Then
where and all signs are independent Rademacher variables.
Proof Apply Corollary 4 of Maurer (2016) to the finite-sample restrictions with the Euclidean Lipschitz constant . The independent coordinate signs in that corollary give exactly the right-hand side. If is only defined on the relevant representation domain, a scalar -Lipschitz extension to gives the same values on those restrictions.
Theorem 19. Let the loss on representation tuples be L-Lipschitz with respect to the Euclidean norm and take values in for some on the domain where each representation has norm at most . For , with probability at least over i.i.d. training tuples , the empirical minimizer satisfies, for all ,
where and .
Proof First, we use the classical empirical Rademacher bound. For a class of functions from to and an i.i.d. sample , with probability at least , for all ,
Here is unnormalized. Apply this bound with and
Apply it also to and use a union bound. These two classes have the same empirical Rademacher complexity by symmetry of the signs.
To bound this complexity, set and
The normalized loss is -Lipschitz on the representation domain. Lemma 18 gives . Therefore, with probability at least , simultaneously for all ,
Finally, empirical optimality gives for every , completing the proof. Substituting and gives up to universal constants.
The Rademacher complexity depends on through the representation tuples.
For a concrete capacity bound, consider with , , and . Enumerate the input occurrences in as , and let have independent coordinates. Frobenius duality and Cauchy–Schwarz give
A.2.5 PROOF OF COROLLARY 6
Proof Fix and write . Grouping the negative classes by their values gives
If , then for , and dropping the other nonnegative terms gives . Hence . Taking expectations over and summing over with weights yield
Lower bounding by , or by , proves the two bounds. The final claim follows from Theorem 5 with .
A.2.6 PROOF OF THEOREM 7
Proof Let , and let have rows . Class-conditional independence of positive pairs gives . Conditioning on the anchor and the sampled negative classes, Jensen's inequality gives
where h is the incurred supervised loss stated in the theorem.
For i.i.d. supervised training tuples , the argument based on Rademacher complexity and vector contraction in Theorem 19 applies to the empirical minimizer . Thus, with probability at least , for all ,
where is as in Theorem 5, with the empirical Rademacher complexity evaluated on S. Combining the inequalities completes the proof.
A.2.7 PROOF OF PROPOSITION 8
Proof We first bound the estimation error of uniformly over . For , write and , and let , whose expectation is . Since , the triangle inequality and give
where is the unit ball in and every summand has zero mean. We apply the classical empirical Rademacher bound in the proof of Theorem 19, with in place of , to in both directions and to in one direction. Their values lie in intervals of length and , so with probability at least , for all ,
To bound these complexities, let have independent Rademacher coordinates. Since , , and , we have
and similarly . The classes and are obtained by applying the 1-Lipschitz map to and the map , which is -Lipschitz on , to . By Lemma 18, and . Hence, with probability at least ,
By Equation 23 with in place of , with probability at least , . On the intersection of both events, the definition of implies, for every ,
By the triangle inequality and Jensen's inequality, as in Section 3.1. Applying Theorem 2 to , we obtain
Combining it with the previous display, taking the infimum over , and noting that and up to universal constants complete the proof.
A.2.8 PROOF OF PROPOSITION 9
Proof Let for , and split , where sums over the pairs from the same class and over the pairs from different classes. Each summand of lies in , so , and the upper bound holds with equality under the additional condition. It therefore suffices to show that
Since , all pairwise distances lie in , on which as . For , Jensen's inequality gives . Hence
Conversely, for , the triangle inequality gives . Summing over and yields
which completes the proof.
A.3 Implications for Mitigating Class Imbalance
A.3.1 PROOF OF THEOREM 10
To prove that under the condition that , we introduce . We bound the Jensen gap using a second-order bound on the logarithm, as detailed in Lemma 20 below. Its lower bound gives , where . Combining this with Theorem 5, we can deduce
Lemma 20. Assume . For , we denote its (biased) Monte Carlo estimate with i.i.d. random samples , , by . Then . Let and . Then
Consequently, since , .
Proof Fix and let , and . Writing , , and , the norm constraints imply , so with . Hence
Let and , so that and . For , integrating between and gives . Applying it with and taking expectations, the linear term vanishes. Together with Jensen's inequality, this gives
(26)
where independence gives , taking expectations in gives , and gives the last inequality. Also, using and , which holds as whenever , we have
Since , Equations 26 and 27 prove the claimed bounds.
The order cannot in general be improved under these assumptions: when all logits are zero, and .
A.3.2 PROOF OF THEOREM 11
Proof The SpeCL-incurred supervised loss is formulated as .
Let for . Then the population risk is
Let and . Since the matrix product above has rank at most , . This lower bound is attained: choose classes , set for and , and set the representations and classifier weights of the remaining classes to zero. Here are standard basis vectors. Therefore, the minimum risk is for every strictly positive class distribution, including the uniform distribution.
Writing for the risk under and for the risk under the uniform distribution, direct substitution of the stated transformations gives, for every pair ,
For a global minimizer under the uniform distribution, this value is , so the transformed pair is a global minimizer for every . The stated identity for the logits follows by multiplying the two scaling factors for .
Conversely, let be a global minimizer under and let . Define for and for . Then the identity above gives . Hence is a global minimizer under the uniform distribution, and its transformation with this is exactly .
A.3.3 PROOF OF PROPOSITION 12
Proof Fix and write for . By the Cauchy-Schwarz inequality, . Since is strictly decreasing on , we have
Taking expectations gives . Equality holds if and only if, for almost every , for all and . By the equality condition of the Cauchy–Schwarz inequality, holds if and only if and , in which case . Since for all , equality therefore holds if and only if is orthonormal and almost surely. Such minimizers exist since . As they satisfy , the same characterization and minimum hold under the normalization.
A.4 The Optimality of Supervised Losses Incurred by Contrastive Learning
A.4.1 PROOF OF THEOREM 13
Proof With the mean classifier, is the risk in Lemma 4. The proof of that lemma shows that minimizes if and only if almost surely, where and for , which is the claim for . The case of is proved in Appendix A.4.4.
A.4.2 PROOF OF COROLLARY 14
Proof Write , , and define
Use for and for . Set
The Jensen inequalities in the proof of Lemma 4, with all negatives from other classes for , bound the respective risk below by . The feasible simplex ETF attains . Convexity of therefore gives . Since
the first bound follows from . Indeed, each denominator in is at most , and has mean under the binomial weights of , so for both choices of .
For the Gram matrix, let and . Write for the corresponding risk with the anchor representation replaced by its class mean. Jensen's inequality bounds the original risk below by , with equality at . Every matrix on the segment joining and is positive semidefinite with diagonal at most . For any such matrix, fix a class vector of norm in a Gram factorization and write for its sampled inner products, with margins . Since , the softmax weights and satisfy
For and the margin direction with defined below, the identity
gives, after i.i.d. negative-class sampling, an expected curvature of at least , where
Here and ; the term also covers .
Set for , and . Let and . Since , symmetry gives the linear term in the expansion of at . For uniform sampling over all classes, the variance of is at least times its variance over the other classes. Taylor's formula along the Gram segment consequently gives, for both sampling schemes,
Finally, let and . The off-diagonal row mean of is , while . Decomposing each row into its mean and centered part and applying Cauchy–Schwarz yields
Combining these two bounds gives
Since and for both choices of , the coefficient is at most for all .
For Equation 18, choose a class-constant simplex ETF as the comparator in Theorem 5. At , replacing negatives by their class means is exact. Replacing the positive representation by its target-class mean changes the loss only when , and then by at most , since InfoNCE is R-Lipschitz in that representation and distinct class means of are at distance . Since follows the marginal distribution , is class-constant almost surely for both views. Thus , and substitution into Theorem 5 gives Equation 18. Both stability bounds above apply with .
A.4.3 PROOF OF THEOREM 15
Proof Let . For the spectral contrastive loss, we have
where is the identity matrix, and the inequality follows from Jensen's inequality. More precisely, its gap is
Hence the global minimum is attained by class-constant representations whose means minimize the Gram objective subject to . The feasible set is compact, so such means exist. Equality only requires almost surely; it does not in general imply variability collapse for every minimizer.
Write , , and . The Gram objective minus is at least , with equality if and only if is a rank- orthogonal projection. Its diagonal must satisfy and , so the stated sum condition is necessary. Conversely, that condition allows a choice of such . By the Schur–Horn theorem (Horn, 1954), there is a real rank- orthogonal projection with this diagonal. A Gram factorization in dimension gives class means with , proving sufficiency. When , the rank- projection is . Since the gap above is nonnegative, every global minimizer in this case has such a for its class means. When , such a satisfies , the smallest error of any rank- approximation of , as all singular values of equal one.
For uniform , let . Since , Cauchy–Schwarz gives , and the risk is at least . Its minimum over is attained at . Again by Schur–Horn, choose a rank-r orthogonal projection with constant diagonal . Then has diagonal at most and attains this lower bound, giving the stated minimum.
A.4.4 OPTIMALITY OF SUPERVISED CONTRASTIVE CASES
The supervised contrastive loss is formulated as
and its incurred supervised loss is formulated as
We now prove the case of in Theorem 13.
Proof Since is uniform, let . Then we have , and
As in the proof of Lemma 4, equality in the last inequality requires and , which imply almost surely under . The function is strictly convex, so equality in the first inequality requires to be constant over . Their sum is , hence each equals . Conversely, the feasible simplex Gram matrix in the proof of Lemma 4 attains equality throughout, completing the proof.
Theorem 21. Consider the supervised spectral loss L_{\sup} = \mathbb{E}_{x \sim \mathcal{D}} \mathbb{E}_{\{c_i\}_{i=1}^k \sim \rho_{\mathcal{T}}^y_x} \ell(f(x), \mu_{y_x}, \{\mu_{c_i}\}_{i=1}^k), that is, . Then minimizes over all representation functions satisfying if and only if almost surely, where minimizes subject to .
Proof For the spectral contrastive loss, we have
Denote the last expression by . It has a minimizer on the compact set , and the corresponding class-constant representations attain the lower bound. Moreover,
Any minimizer must therefore minimize and satisfy almost surely for every . If a class has nonzero within-class variance, then and there exists a nonzero orthogonal to all . Replacing by for sufficiently small preserves feasibility and all cross-class inner products. Choosing the sign of so that strictly decreases through its term , a contradiction. Thus every minimizer is class-constant almost surely, proving both directions.
Appendix B. One Negative Sample Case
To better understand the supervised loss incurred by contrastive learning, we also explore the special case where only one negative sample is used (i.e., ). Negative sampling is also used in Word2Vec (Mikolov et al., 2013). Here, we consider the contrastive objective with one negative sample, defined as follows:
In this case, the incurred loss in Theorem 2 can be precisely characterized when class collision results in a constant loss value. Let . For losses satisfying for all , where is constant, we can derive a similar bound to that of Saunshi et al. (2019) without relying on the assumption of conditional independence of positive pairs.
Proposition 22. Under the notation and conditions in Theorem 2, suppose and is constant for , . Then, for all , there exist a linear classifier and a supervised loss such that
where the incurred loss .
Proof Let . Splitting the mean-classifier loss according to whether the negative class equals the anchor class gives
Theorem 2 bounds the left-hand side by , completing the proof.
Multi-Class Binary Cross Entropy. For the InfoNCE loss with only one negative sample, we have the incurred loss
which can be viewed as a multi-class binary cross entropy that trains the binary classifiers with weighted logistic losses for each sample drawn from .
Taking in Proposition 22 gives the deterministic InfoNCE bound for the loss in Equation 31.
For a direct classification guarantee, let denote the InfoNCE-incurred loss in Theorem 2, including target-class negatives, and set . With any fixed rule for breaking ties, the classification error under satisfies
This is the case of the first bound in Corollary 6, since then and , and that corollary also bounds its numerator for the mean classifier of .
Table 3: Linear probing accuracies (%) on CIFAR-10, CIFAR-100, and ImageNet-100 using unsupervised contrastive learning with the InfoNCE loss and the relaxed k-means loss, i.e., , where and .
| 0 | 0.01 | 0.02 | 0.05 | |
|---|---|---|---|---|
| CIFAR-10 | ||||
| CIFAR-100 | ||||
| IMAGENET-100 | ||||
| 0.1 | 0.2 | 0.5 | 1 | |
| CIFAR-10 | ||||
| CIFAR-100 | ||||
| IMAGENET-100 |
Table 4: Illustration of and on long-tailed CIFAR-10 with an imbalance ratio of 10.
| CLASS INDEX | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| 4.09 | 5.28 | 6.82 | 8.81 | 11.38 | 14.69 | 18.97 | 24.50 | 31.68 | 40.86 | |
| (TRAIN) | 4.08 | 5.21 | 6.50 | 8.12 | 10.54 | 12.36 | 17.17 | 21.79 | 27.12 | 34.11 |
| (TEST) | 4.08 | 5.21 | 6.51 | 8.06 | 10.46 | 12.37 | 17.17 | 21.79 | 27.12 | 34.11 |
Appendix C. Experiments
C.1 Experimental Details
In this section, we present the training details and experimental results across various tasks, encompassing unsupervised contrastive learning and supervised learning on CIFAR-10, CIFAR-100 (Krizhevsky, 2009), and ImageNet-100 (the first 100 classes of ImageNet) (Deng et al., 2009). The chosen network architectures are ResNet-18 (He et al., 2016) for CIFAR-10/CIFAR-100, and ResNet-50 for ImageNet-100. All models are trained for 200 epochs using the SGD optimizer and a cosine decay learning rate schedule, with an initial learning rate of 0.2, a batch size of 512, and a weight decay of 5e-4.
C.2 More Experimental Results
More Results on the Relaxed K-Means Loss. We conduct experiments with independent runs and report standard deviations to illustrate the performance of the relaxed k-means loss. For Table 3, we run 3 trials with random seeds for each . As is evident in the table, the performance in linear probing deteriorates when is too large, suggesting inherent limitations of the relaxed k-means loss. This could be attributed to the fact that it only focuses on reducing distances between representations within a specific range rather than rigorously shrinking the distance to cluster centers. Consequently, this relaxation would inevitably cause representations of semantically inconsistent samples to become close, particularly in the early stage of training. Despite these limitations, we still observe an improvement, particularly on ImageNet-100.
C.3 Validation of Theorem 11
In the proof of Theorem 11, a global minimizer is obtained by minimizing over class means and classifier weights, where . For , let and . The matrix objective then equals for the class-balanced case. Both distributions attain the same minimum, so this scaling maps corresponding global minimizers while preserving cosine similarities between their nonzero features and classifier weights.
To illustrate this point, we conduct experiments on long-tailed CIFAR-10 using ResNet-18 with a feature dimension of 512, and . Since , we can derive that the global minimizer of satisfies , for . The results are presented in Table 4. As observed, the logits of the representation model roughly align with across the board.
References
Randall Balestriero and Yann LeCun. Contrastive and non-contrastive self-supervised learning recover global and local spectral embedding methods. In Advances in Neural Information Processing Systems, 2022.
Randall Balestriero, Mark Ibrahim, Vlad Sobal, Ari Morcos, Shashank Shekhar, Tom Goldstein, Florian Bordes, Adrien Bardes, Gregoire Mialon, Yuandong Tian, et al. A cookbook of self-supervised learning. arXiv preprint arXiv:2304.12210, 2023.
Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 9650–9660, October 2021.
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
Zihao Chen, Chi-Heng Lin, Ran Liu, Jingyun Xiao, and Eva L Dyer. Your contrastive learning problem is secretly a distribution alignment problem. Advances in Neural Information Processing Systems, 37:91597–91617, 2024.
Jingyi Cui, Hongwei Wen, and Yisen Wang. An augmentation-aware theory for self-supervised contrastive learning. In International Conference on Machine Learning, pages 11585–11603. PMLR, 2025.
Mostafa Dehghani, Josip Djolonga, Basil Mustafa, Piotr Padlewski, Jonathan Heek, Justin Gilmer, Andreas Peter Steiner, Mathilde Caron, Robert Geirhos, Ibrahim Alabdulmohsin, et al. Scaling vision transformers to 22 billion parameters. In International Conference on Machine Learning, pages 7480–7512. PMLR, 2023.
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. IEEE, 2009.
Cong Fang, Hangfeng He, Qi Long, and Weijie J Su. Exploring deep neural networks via layer-peeled model: Minority collapse in imbalanced training. Proceedings of the National Academy of Sciences, 118(43):e2103091118, 2021.
Quentin Garrido, Yubei Chen, Adrien Bardes, Laurent Najman, and Yann LeCun. On the duality between contrastive and non-contrastive self-supervised learning. In The Eleventh International Conference on Learning Representations, 2023.
Priya Goyal, Mathilde Caron, Benjamin Lefaudeux, Min Xu, Pengchao Wang, Vivek Pai, Mannat Singh, Vitaliy Liptchinsky, Ishan Misra, Armand Joulin, et al. Self-supervised pretraining of visual features in the wild. arXiv preprint arXiv:2103.01988, 2021.
Florian Graf, Christoph Hofer, Marc Niethammer, and Roland Kwitt. Dissecting supervised contrastive learning. In International Conference on Machine Learning, pages 3821–3830. PMLR, 2021.
Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. Advances in neural information processing systems, 33:21271–21284, 2020.
Michael U Gutmann and Aapo Hyvärinen. Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of machine learning research, 13(2), 2012.
XY Han, Vardan Papyan, and David L Donoho. Neural collapse under MSE loss: Proximity to and dynamics on the central path. In International Conference on Learning Representations, 2022.
Jeff Z HaoChen and Tengyu Ma. A theoretical study of inductive biases in contrastive learning. In The Eleventh International Conference on Learning Representations, 2023.
Jeff Z HaoChen, Colin Wei, Adrien Gaidon, and Tengyu Ma. Provable guarantees for self-supervised deep learning with spectral contrastive loss. Advances in Neural Information Processing Systems, 34:5000–5011, 2021.
Jeff Z HaoChen, Colin Wei, Ananya Kumar, and Tengyu Ma. Beyond separability: Analyzing the linear transferability of contrastive representations to related subpopulations. arXiv preprint arXiv:2204.02683, 2022.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9729–9738, 2020.
Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16000–16009, 2022.
Nong Minh Hieu, Antoine Ledent, Yunwen Lei, and Cheng Yeaw Ku. Generalization analysis for deep contrastive representation learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pages 17186–17194, 2025.
Alfred Horn. Doubly stochastic matrices and the diagonal of a rotation matrix. American Journal of Mathematics, 76(3), 1954. doi: 10.2307/2372705.
Weiran Huang, Mingyang Yi, Xuyang Zhao, and Zihao Jiang. Towards the generalization of contrastive self-supervised learning. In The Eleventh International Conference on Learning Representations, 2023.
Ruijie Jiang, Thuan Nguyen, Prakash Ishwar, and Shuchin Aeron. Supervised contrastive learning with hard negative samples. In 2024 International Joint Conference on Neural Networks (IJCNN), pages 1–8. IEEE, 2024.
Siddharth Joshi and Baharan Mirzasoleiman. Data-efficient contrastive self-supervised learning: Most beneficial examples for supervised learning contribute the least. In International conference on machine learning, pages 15356–15370. PMLR, 2023.
Bingyi Kang, Yu Li, Sa Xie, Zehuan Yuan, and Jiashi Feng. Exploring balanced feature spaces for representation learning. In International Conference on Learning Representations, 2021.
Xiangwen Kong and Xiangyu Zhang. Understanding masked image modeling via learning occlusion invariant feature. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6241–6251, 2023.
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
Jason D Lee, Qi Lei, Nikunj Saunshi, and Jiacheng Zhuo. Predicting what you already know helps: Provable self-supervised learning. Advances in Neural Information Processing Systems, 34:309–323, 2021.
Chenghui Li and A. Martina Neuman. Consistency of augmentation graph and network approximability in contrastive learning. Journal of Machine Learning Research, 27(178): 1–68, 2026. URL https://jmlr.org/papers/v27/25-1466.html.
Tianhong Li, Peng Cao, Yuan Yuan, Lijie Fan, Yuzhe Yang, Rogerio S Feris, Piotr Indyk, and Dina Katabi. Targeted supervised contrastive learning for long-tailed recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6918–6928, 2022.
Lajanugen Logeswaran and Honglak Lee. An efficient framework for learning sentence representations. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJvJXZb0W.
Andreas Maurer. A vector-contraction inequality for Rademacher complexities. In Algorithmic Learning Theory: 27th International Conference, ALT 2016, Bari, Italy, October 19-21, 2016, Proceedings 27, pages 3–17. Springer, 2016.
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems, 26, 2013.
Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6707–6717, 2020.
Dustin G Mixon, Hans Parshall, and Jianzong Pi. Neural collapse with unconstrained features. arXiv preprint arXiv:2011.11619, 2020.
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
Vardan Papyan, XY Han, and David L Donoho. Prevalence of neural collapse during the terminal phase of deep learning training. Proceedings of the National Academy of Sciences, 117(40):24652–24663, 2020.
Advait Parulekar, Liam Collins, Karthikeyan Shanmugam, Aryan Mokhtari, and Sanjay Shakkottai. InfoNCE loss provably learns cluster-preserving representations. In Proceedings of Thirty Sixth Conference on Learning Theory, volume 195 of Proceedings of Machine Learning Research, pages 1914–1961. PMLR, 12–15 Jul 2023.
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pages 8748–8763. PMLR, 2021.
Jiawei Ren, Cunjun Yu, Xiao Ma, Haiyu Zhao, Shuai Yi, et al. Balanced meta-softmax for long-tailed visual recognition. Advances in neural information processing systems, 33: 4175–4186, 2020.
Evgenia Rusak, Patrik Reizinger, Attila Juhos, Oliver Bringmann, Roland S Zimmermann, and Wieland Brendel. InfoNCE: Identifying the gap between theory and practice. In International Conference on Artificial Intelligence and Statistics, pages 4159–4167. PMLR, 2025.
Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khan-deparkar. A theoretical analysis of contrastive unsupervised representation learning. In International Conference on Machine Learning, pages 5628–5637. PMLR, 2019.
Nikunj Saunshi, Jordan Ash, Surbhi Goel, Dipendra Misra, Cyril Zhang, Sanjeev Arora, Sham Kakade, and Akshay Krishnamurthy. Understanding contrastive learning requires incorporating inductive biases. In International Conference on Machine Learning, pages 19250–19286. PMLR, 2022.
Zhiquan Tan, Yifan Zhang, Jingqin Yang, and Yang Yuan. Contrastive learning is spectral clustering on similarity graph. In The Twelfth International Conference on Learning Representations, 2024.
Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XI 16, pages 776–794. Springer, 2020a.
Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning? Advances in neural information processing systems, 33:6827–6839, 2020b.
Nenad Tomasev, Ioana Bica, Brian McWilliams, Lars Holger Buesing, Razvan Pascanu, Charles Blundell, and Jovana Mitrovic. Pushing the limits of self-supervised ResNets: Can we outperform supervised learning without labels on ImageNet? In First Workshop on Pre-training: Perspectives, Pitfalls, and Paths Forward at ICML, 2022.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
Shulei Wang. Linear separation capacity of self-supervised representation learning. Journal of Machine Learning Research, 26(194):1–48, 2025. URL https://jmlr.org/papers/v26/24-2032.html.
Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pages 9929–9939. PMLR, 2020.
Yifei Wang, Qi Zhang, Yisen Wang, Jiansheng Yang, and Zhouchen Lin. Chaos is a ladder: A new theoretical understanding of contrastive learning via augmentation overlap. In International Conference on Learning Representations, 2022.
Colin Wei, Kendrick Shen, Yining Chen, and Tengyu Ma. Theoretical analysis of self-training with deep networks on unlabeled data. In International Conference on Learning Representations, 2021.
Zixin Wen and Yuanzhi Li. Toward understanding the feature learning process of self-supervised contrastive learning. In International Conference on Machine Learning, pages 11112–11122. PMLR, 2021.
Diyuan Wu and Marco Mondelli. Neural collapse beyond the unconstrained features model: Landscape, dynamics, and generalization in the mean-field regime. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pages 67499–67536. PMLR, 2025. URL https://proceedings.mlr.press/v267/wu25u.html.
Lingling Xu, Haoran Xie, Zongxi Li, Fu Lee Wang, Weiming Wang, and Qing Li. Contrastive learning models for sentence representations. ACM Transactions on Intelligent Systems and Technology, 14(4):1–34, 2023.
Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. CoCa: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
Qi Zhang, Yifei Wang, and Yisen Wang. An augmentation overlap theory of contrastive learning. Journal of Machine Learning Research, 26(228):1–42, 2025.
Jinxin Zhou, Xiao Li, Tianyu Ding, Chong You, Qing Qu, and Zhihui Zhu. On the optimization landscape of neural collapse under MSE loss: Global optimality with unconstrained features. In International Conference on Machine Learning, pages 27179–27202. PMLR, 2022.
Xiong Zhou, Xianming Liu, Hanzhang Wang, Deming Zhai, Junjun Jiang, and Xiangyang Ji. On the dynamics under the unhinged loss and beyond. Journal of Machine Learning Research, 24:1–62, 2023.
Xiong Zhou, Xianming Liu, Feilong Zhang, Gang Wu, Deming Zhai, Junjun Jiang, and Xiangyang Ji. Zero-mean regularized spectral contrastive learning: Implicitly mitigating wrong connections in positive-pair graphs. In The Twelfth International Conference on Learning Representations, 2024.
Xin Zou and Weiwei Liu. Generalization bounds for adversarial contrastive learning. Journal of Machine Learning Research, 24(114):1–54, 2023. URL http://jmlr.org/papers/v24/22-0866.html.