arXiv:2610.32729cs.LGOct 2026

Manuscript Offprint

arXiv:2610.32729

Internal Discrepancy for Contrastive Learning: Generalization Bounds and Downstream Behaviors

Jialiang Wang, Qing Ma, Xiong Zhou, Gangfeng Hu, Haoliang Li, Xianming Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Jialiang Wang 12∗^{12*}

Qing Ma 2∗^{2*}

Xiong Zhou 1^{1}

Gangfeng Hu 1^{1}

Haoliang Li 2^{2}

Xianming Liu 1†^{1\dagger}

1^{1}Harbin Institute of Technology, Harbin, China

2^{2}City University of Hong Kong, Hong Kong, China

CSWJL@STU.HIT.EDU.CN

QINGMA2016@GMAIL.COM

CSZX.HIT@GMAIL.COM

CSGF@HIT.EDU.CN

HAOLIANG.LI@CITYU.EDU.HK

CSXM@HIT.EDU.CN

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:

  1. Do prior data assumptions that appear distinct essentially characterize or constrain a common aspect? Is there a measure that connects these data assumptions?

  2. Can this measure effectively describe the inductive biases of the function class or training algorithm?

  3. 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?

  4. 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 Disc(f)\text{Disc}(f), 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 Lsup(f^)≲Lcon(f)+Disc(f^)+GenML_{\text{sup}}(\widehat{f}) \lesssim L_{\text{con}}(f) + \text{Disc}(\widehat{f}) + \text{Gen}_M for any f∈Ff \in \mathcal{F}. Here, Lsup(f^)L_{\text{sup}}(\widehat{f}) is a supervised loss w.r.t. the empirical minimizer f^\widehat{f}, Lcon(f)L_{\text{con}}(f) represents the contrastive loss, and GenM\text{Gen}_M 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 Disc(f^)\text{Disc}(\widehat{f}) with the intra-class discrepancy of ff and the positive-pair alignment of f^\widehat{f} in the bound motivates us to minimize an approximation of the internal discrepancy, namely the relaxed kk-means loss, which aims to reduce the distance between representations within a truncated range.

Moreover, the supervised loss Lsup(f^)L_{\text{sup}}(\widehat{f}) 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.

References (59)