H OW
W EAKLY S UPERVISED I NFORMATION HELPS
C ONTRASTIVE L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Contrastive learning has shown outstanding performances in both supervised and unsupervised learning.
However, little is known about when and how weakly supervised information helps improve contrastive learning, especially from the theoretical perspective.
The major challenge is that the existing theory of contrastive learning based on supervised learning frameworks failed to distinguish between supervised and unsupervised contrastive learning.
Therefore, we turn to the unsupervised learning frameworks, and based on the posterior probability of labels, we translate the weakly supervised information into a similarity graph under the framework of spectral clustering.
In this paper, we investigate two typical weakly supervised learning problems, noisy label learning, and semi-supervised learning, and analyze their inﬂuence on contrastive learning within a uniﬁed framework.
Speciﬁcally, we analyze the effect of weakly supervised information on the augmentation graph of unsupervised contrastive learning, and consequently on its corresponding error bound.
Numerical experiments are carried out to verify the theoretical ﬁndings.
I NTRODUCTION
Contrastive learning has shown state-of-the-art empirical performances in both supervised and unsupervised learning.
In unsupervised learning, contrastive learning algorithms (Chen et al., 2020;
He et al., 2020; Chen et al., 2021; Chen and He, 2021) learn good representations of high-dimensional observations from a large amount of unlabeled data, by pulling together an anchor and its augmented views in the embedding space.
On the other hand, supervised contrastive learning (Khosla et al., 2020) uses same-class examples and their corresponding augmentations as positive labels, and achieves signiﬁcantly better performance than the state-of-the-art cross entropy loss, especially on large-scale datasets.
Recently, contrastive learning has been introduced to solve weakly supervised learning problems such as noisy label learning (Tan et al., 2021; Wang et al., 2022) and semi-supervised learning.
For noisy label learning, most methodological studies use contrastive learning as a tool to select conﬁdent samples based on the learned representations (Yao et al., 2021; Ortego et al., 2021; Li et al., 2022), whereas the theoretical studies focus on proving the robustness of downstream classiﬁers with features learned by self-supervised contrastive learning (Cheng et al., 2021; Xue et al., 2022).
For semi-supervised learning, contrastive loss is often used as a regularization to improve the precision of pseudo labeling (Lee et al., 2022; Yang et al., 2022).
However, none of the existing studies use weakly supervised information to improve contrastive learning.
Perhaps the closest attempt is Yan et al.
(2022), which leverages the negative correlations from the noisy data to avoid same-class negatives for contrastive learning.
Nonetheless, there are purely empirical results presented, without showing when and how the weakly supervised information helps improve contrastive learning.
Moreover, a proper theoretical framework of weakly supervised contrastive learning is especially lacking.
The major challenge lies in the fact that the existing theoretical frameworks compatible with both supervised and unsupervised contrastive learning (Arora et al., 2019; Nozawa and Sato, 2021; Ash et al., 2022; Bao et al., 2022) fail to distinguish between the two settings.
To be speciﬁc, in order to build a relationship with supervised learning losses, such studies assume that the positive pairs for unsupervised contrastive learning are generated from the same latent class, and this is exactly how positive samples for supervised contrastive learning are selected.
Consequently, such mathemati- cal modeling cannot tell the difference between supervised and unsupervised contrastive learning.
Therefore, in this paper, we in turn base our theoretical analysis on an unsupervised learning framework.
Based on the posterior probability of labeled samples, we translate the weakly supervised information into a similarity graph under the framework of spectral clustering.
This enables us to analyze the effect of the label information on the augmentation graph of the unsupervised spectral clustering (HaoChen et al., 2021), and consequently on its corresponding error bound.
The contributions of this paper are summarized as follows.
(cid:15) We for the ﬁrst time establish a theoretical framework for weakly supervised learning contrastive learning, which is compatible with both noisy label and semi-supervised learning. (cid:15)
By formulating the label information into a similarity graph based on the posterior probability of labels, we derive the downstream error bound of contrastive learning from both weakly supervised labels and feature information.
We show that both noisy labels and semisupervised labels can improve the error bound of unsupervised contrastive learning under certain constraints on the noise rate and labeled sample size. (cid:15)
We empirically verify our theoretical results.
R ELATED W ORKS
Theoretical Frameworks of Contrastive Learning.
The theoretical frameworks of unsupervised contrastive learning can be divided into two major categories.
The ﬁrst category is devoted to building the relationship between unsupervised contrastive learning and supervised downstream classiﬁcation.
Arora et al.
ﬁrst introduces the concept of latent classes, hypothesize that semantically similar points are sampled from the same latent class, and proves that the unsupervised contrastive loss serves an upper bound of downstream supervised learning loss.
Nozawa and Sato (2021); Ash et al.
; Bao et al.
(2022) further investigate the effect of negative samples, and establish surrogate bounds for the downstream classiﬁcation loss that better match the empirical observations on the negative sample size.
However, studies in this category have to assume the existence of supervised latent classes, and that the positive pairs are conditionally independently drawn from the same latent class.
This assumption fails to distinguish between supervised and unsupervised contrastive learning, and cannot be used to analyze the weakly supervised setting.
Another major approach is to analyze contrastive learning by modeling the feature similarity.
HaoChen et al.
ﬁrst introduces the concept of the augmentation graph to represent the feature similarity of the augmented samples, and analyzes contrastive learning from the perspective of spectral clustering.
Shen et al.
(2022) uses a stochastic block model to analyze spectral contrastive learning for the problem of unsupervised domain adaption.
Similarly, Wang et al.
(2021) proposes the concept of augmentation overlap to formulate how the positive samples are aligned.
Moreover, contrastive learning is also understood through other existing theoretical frameworks of unsupervised learning, such as nonlinear independent component analysis (ICA) (Zimmermann et al., 2021), neighborhood component analysis (NCA)
(Ko et al., 2022), variational autoencoder (VAE) (Aitchison, 2021), etc.
In this paper, we follow the second category of contrastive learning approaches, and formulate the weakly supervised information into a similarity graph based on both label and feature information.
Contrastive Learning for Noisy Label Learning.
Ghosh and Lan (2021)
ﬁrst ﬁnds that pretraining with contrastive learning improves robustness to label noise through empirical evidences.
Many methodological studies are carried out for noisy label learning with the help of contrastive learning.
Yao et al.
; Ortego et al.
; Li et al.
(2022) use representations learned from unsupervised contrastive learning to ﬁlter out conﬁdent samples from all noisy ones, and in turn use the conﬁdent samples to conduct supervised contrastive learning to generate better representations.
By contrast,
Yan et al.
(2022) follows the idea of negative learning (Kim et al., 2019; 2021), and leverage the negative correlations from the noisy data to avoid same-class negatives in contrastive learning.
For theoretical studies, Cheng et al.
(2021) analyzes the robustness of cross-entropy with SSL features, and Xue et al.
(2022) proves the robustness of downstream classiﬁer in contrastive learning.
Contrastive Learning for Semi-supervised Learning.
Lee et al.
; Yang et al.
(2022) use contrastive regularization to enhance the reliability of pseudo-labeling in semi-supervised learning.
Kim et al.
(2021) introduces a semi-supervised learning method that combines self-supervised contrastive pre-training and semi-supervised ﬁne-tuning based on augmentation consistency regularization.
Zhang et al.
(2022) uses contrastive loss to model pairwise similarities among samples, generates pseudo labels from the cross entropy loss, and in turn calibrates the prediction distribution of the two branches.
For both noisy label learning and semi-supervised learning tasks, the existing studies all focus on using contrastive learning as a tool to improve the weakly supervised learning performance, whereas to the best of our knowledge, none of the previous works show the effect of weak supervision to contrastive learning itself.
To ﬁll in the blank, in this paper, we establish a theoretical framework for weakly supervised contrastive learning, which is compatible with both noisy label and semisupervised learning tasks.
P RELIMINARIES
Notations.
Suppose that random variables (cid:22) X 2 (cid:22) X := R d , and Y 2 [ r ] := f 1 ; : : : ; r g .
Let the input natural data f ((cid:22) x i ; y i ) g i 2 [ N ] be i.i.d.
sampled from the joint distribution P( (cid:22) X; Y ) .
Given a natural data (cid:22) x 2 (cid:22) X , we use A ( (cid:1)j (cid:22) x ) to denote the distribution of its augmentations and use X to denote the set of all augmented data, which is assumed to be ﬁnite but exponentially large.
Denote n = jXj .
3. S PECTRAL C ONTRASTIVE L EARNING
In HaoChen et al.
(2021), an augmentation graph G is used to describe the distribution of augmented samples, where the edge weight w xx ′ :
=
E (cid:22) x (cid:24) (cid:22) P
[ A ( x j (cid:22) x ) A ( x ′ j (cid:22) x )] denotes the marginal probability of generating augmented views x and x ′ from the same natural data.
Due to the total probability mass, ∑ x;x ′ 2X w xx ′
= 1 .
The adjacent matrix of the augmentation graph is denoted as A :
= ( w xx ′ )
x;x ′ 2X 2 R n (cid:2) n , and the normalized adjacent matrix is denoted as (cid:22) A :
= D (cid:0) 1 {+= 
 A D (cid:0)+} 1 = 2 , where D := diag( w x ) x 2X , and w x := ∑ x ′ 2X w xx ′ .
In this paper, we consider the spectral contrastive loss proposed by HaoChen et al.
(2021), that is, for an embedding function f : X ! R k ,
[Equation]
Spectral contrastive loss is proved to be equivalent to the matrix factorization loss, i.e. for F
R n (cid:2) k :=
( u x ) x 2X , u x := w
[Equation]
2 x
[Equation]
[Equation]
3. N OISY L ABEL L EARNING
Recall that we denote the true label of an given instance x 2 X is y .
One common assumption of the generation procedure of label noise is as follows.
Given the true labels, the noisy label is randomly ﬂipped to another label ~
y with some probability.
In this paper, we take the widely adopted symmetric label noise assumption as an example.
For notational simplicity, we write the the symmetric label noise assumption in matrix form.
Denote
Y :=
( (cid:17)
j ( x i )) i 2 [ n ] ;j 2 [ r ] , (cid:17) j ( x ) =
P( Y = j j x ) , as the posterior probability matrix of the clean label distribution, and denote ~ Y :=
(~ (cid:17)
j ( x i ))
i 2 [ n ] ;j 2 [ r ] , ~ (cid:17) j ( x ) = P( ~ Y =
j j x ) , as the noisy label distribution.
In Assumption 1, we assume that the ﬂipping probability is conditional independent of the input data, and that the ﬂipping probability to all other classes are uniformly at random.
Assumption 1.
For symmetric label noise with noise rate (cid:13) 2 (0 ; 1) , we denote the transition matrix
T =
( t i;j )
i 2 [ r ] ;j 2 [ r ] , where t i [Equation] i = 1 (cid:0) (cid:13); and t i;j =
(cid:13)
[Equation]
(cid:0) [Equation] ; for
[Equation]
Then the noisy label posterior distribution is assumed to be
[Equation]
[Equation]
Under Assumption 1, T is symmetric.
Speciﬁcally, when (cid:13) = 0 , T degenerates to the identity matrix I r (cid:2) r .
Moreover, to guarantee the PAC-learnability, we usually assume the true label is the dominating class, i.e. (cid:13) < r (cid:0) 1 r .
3. S EMI -S UPERVISED L EARNING
For j 2 [ r ] , let n j be the number of labeled samples of Class j .
Let n L =
∑ j 2 [ r ] n L;j be the number of all labeled samples, and n U be the number of unlabeled samples.
Obviously, we have n L + n U = n .
Usually, the number of labeled samples is much smaller than that of the unlabeled because human annotation is costly and labor-intensive.
That is, we can naturally assume n L ≪ n U .
In the following parts of the paper, we analyze the settings of noisy label learning and semisupervised learning in a uniﬁed framework.
Without loss of generality, we assume ( x 1 ; : : : ; x n L ) is labeled with noise rate (cid:13) 2 [0 ; r (cid:0) 1 r ) , and denote the corresponding clean and noisy posterior probability matrices as Y L and ~ Y L , respectively.
Then we have ~ Y L = Y L T .
Speciﬁcally, when (cid:13) = 0 , our analyzing framework degenerates to the standard setting of semi-supervised learning, and when n L = n , our analyzing framework reduces to the standard noisy label learning.
M ATHEMATICAL F ORMULATIONS
We mention that our formulation of "similarity graph" is not a distributional assumption on the underlying similarity among data, but to formulate a possible probability of drawing positive samples in contrastive learning that takes both label and feature information into consideration.
Speciﬁcally, in Sections 4.1 and 4.2, we only discuss the similarity graph describing the weakly supervised labels and neglected feature similarity.
Then in Section 4.3, we take both label and feature similarity into consideration through convex combination.
4. S IMILARITY G RAPH D ESCRIBING N OISY L ABEL I NFORMATION
To leverage the labeled information in the form of similarity graph, we ﬁrst consider a simple example where noise rate (cid:13) = {+
+} and the label distribution is deterministic, i.e. for a sample x with true label y , the posterior probability (cid:17) y ( x ) = 1 and (cid:17)
j ( x ) = 0 for j ̸
= y .
In this case, we can naturally assume that in the similarity graph describing label information, the intra-class vertices are fully connected and the inter-class vertices are disconnected.
That is, w xx ′
=
if x and x ′ has the same label and otherwise w xx ′
= 0 .
Then we consider the more general stochastic label scenario.
Recall that for unsupervised spectral contrastive learning, the edge weight w xx ′ in an augmentation graph G describes the marginal probability of generating x and x ′ from the same natural data.
That is, w xx ′ describes the joint probability of a pair of positive samples.
Similarly, since the positive samples for supervised contrastive learning (Khosla et al., 2020) are selected as all same-class samples, we can naturally deﬁne the edge weight w xx ′ as the probability of two views x and x ′ generating from the same class, i.e. w xx ′
=
∑ j 2 [ K ] (cid:17) j ( x ) (cid:17) j ( x ′ ) , and therefore A L := Y L Y ⊤ L .
Moreover, we denote (cid:22)
A as the normalized adjacent matrix.
For the simplicity of notations, we consider the case where the data is class-balanced, i.e. n {+
+}
= : : = n r = n L =r .
Then we have ( cid:22) A = rn L A .
Next, we add label noise to the our mathematical formulations.
To be speciﬁc, when performing supervised contrastive learning based on noisy labeled data, we naturally select positive samples as the samples with the same noisy labeled data.
According to Assumption 1, we have ~ Y L = Y L T , where T is symmetric.
Then the adjacent matrix of the similarity graph induced by noisy labels is formulated as
[Equation]
Similarly, when data is class balanced, we have the normalized adjacent matrix (cid:22)~ A L = n L r ~
A L .
4. S IMILARITY G RAPH D ESCRIBING S EMI -S UPERVISED N OISY L ABEL I NFORMATION
Under the setting of semi-supervised learning, we have no prior knowledge about the label information of the unlabeled samples.
From the perspective of unsupervised contrastive learning, the unlabeled samples can be viewed as having unique class labels.
Therefore, to construct the similarity graph, we attach sample-speciﬁc labels to the unlabeled samples.
Thus, the posterior probability matrix of unlabeled samples Y U is an identity matrix I n U (cid:2) n U .
Note that here we only discuss the similarity graph describing supervised information, so the feature similarity between samples is not included in the similarity graph.
Combining both labeled and unlabeled samples, the posterior probability matrix of all semisupervised samples can be denoted as
[Equation]
Therefore, the similarity graph of samples with n L noisy labels can be denoted as
[Equation]
In Lemma 1 we present the inﬂuence of symmetric label noise with noise rate (cid:13) on the similarity graph ~ A .
Lemma 1.
Under Assumption 1, if the data is class balanced, i.e. n 1 = : : : = n r = n L r , then there holds
[Equation]
where (cid:11) ( (cid:13) ) :
= ( 1 (cid:0) rr (cid:0) 1 (cid:13) ) 2 and (cid:12) ( (cid:13) ) : = (cid:13)r (cid:0) [Equation]
Note that without label noise, i.e. (cid:13) = 0 , we have (cid:11) ( (cid:13) )[-= 
-]
= 1 and (cid:12) ( (cid:13) ) = 0 .
For the sake of simplicity, in the following we write (cid:11) and (cid:12) instead of (cid:11) ( (cid:13) ) and (cid:12) ( (cid:13) ) when no ambiguity aroused.
In Lemma 1, we show that the effect of symmetric label noise is to add a uniform weight to the edges between all labeled samples.
This uniform weight increase the confusion between intra- and inter-class similarities.
For example, under the deterministic label scenario, we have A L = I n L (cid:2) n L .
The original intra-class similarity is uniformly shrinked from 1 to (cid:11) and the inter-class similarity increases from 0 to (cid:12) .
Moreover, as the noise rate (cid:13) increases, (cid:11) decreases and (cid:12) increases, which results in severer confusion between the intra- and inter-class similarities.
4. S IMILARITY G RAPH D ESCRIBING BOTH L ABEL AND F EATURE I NFORMATION
In this part, we take both label and feature information into consideration.
For the feature information, we denote A
as the augmentation graph of arbitrary unlabeled samples.
For label information, we take the similarity graph describing the semi-supervised noisy labeled (augmented) samples ~
A as denoted in equation 7.
When leveraging the use of both label and feature information in contrastive learning, we mix the two similarity graphs by convex combination, i.e. for (cid:18) 2 (0 ; 1) , the mixed similarity graph of all augmented samples A (cid:18);(cid:13);n L is denoted as
[Equation]
where (cid:22) A 0 and (cid:22) ~ A denote the (by row) normalization of A 0 and ~ A , respectively.
Recall that edge weights of the similarity graphs represent the probability of two augmented views being drawn as a pair of positive samples.
The similarity graph in equation 9 can be understood as selecting positive pairs based on both weakly supervised labels and feature information.
T HEORETICAL R ESULTS
In this section, we ﬁrst compute eigenvalues of the similarity graph describing both label and feature information, which plays a key role in deriving the error bound of contrastive learning.
Then in
Section 5.3, we show that the weakly supervised information helps reduce the error of the best possible linear classiﬁer on the representations learned by weakly supervised contrastive learning.
5. E IGENVALUES OF S IMILARITY G RAPH D ESCRIBING W EAKLY S UPERVISED L ABEL I NFORMATION
We ﬁrst compute the eigenvalues of the similarity graph describing the semi-supervised noisy labels.
Proposition 1.
For arbitrary Y , assume that the labeled data is class-balanced, i.e. ∑ i 2 [ n L ] (cid:17) j ( x i ) =
n L =r for j 2 [ r ] .
Assume that the eigenvalues of (cid:22) A L are (cid:22) 1 ; : : : ; (cid:22) n (in descending order).
Then under Assumption 1, the eigenvalues of (cid:22)~ A are
[Equation]
In Proposition 1, we show that the eigenvalues of (cid:22)~ A rely on the eigenvalues of (cid:22) A and consequently rely on the posterior probabilities of clean labels.
Speciﬁcally, if the true label has higher posterior probability, i.e. max j 2 [ r ] P( Y =
j j x ) is larger, then the eigenvalues of (cid:22) A L are larger.
On the other hand, the existence of label noise uniformly shrink the eigenvalues of (cid:22)~ A except for the largest ones, and larger noise rate (cid:13) results in smaller (cid:11) and thus leads to smaller eigenvalues of (cid:22)~ A .
Moreover, the number of largest eigenvalues is decided by the number of unlabeled samples.
Note that rank( ~ A ) (cid:20) rank( Y L ) + n U (cid:20) n U + r , and therefore we have ~ (cid:22) n U + r +
= : : : = ~ (cid:22) n = 0 .
Speciﬁcally, under the deterministic label scenario, we have (cid:22) n U +
= : : : = (cid:22) n U + r = 1 .
Then the eigenvalues of (cid:22) ~ A become
[Equation]
5. E IGENVALUES OF S IMILARITY G RAPH DESCRIBING BOTH L ABEL AND F EATURE I NFORMATION
In the following proposition, we discuss the eigenvalues of the mixed similarity graph A (cid:18);(cid:13);n L describing both weak labels and feature information.
Proposition 2.
Denote (cid:21) 1 ; : : : ; (cid:21) n as the eigenvalues of A (cid:18);(cid:13);n L .
Then given the eigenvalues of (cid:22) A 0 , i.e. (cid:23) 1 ; : : : ; (cid:23) n and the eigenvalues of (cid:22) A L , i.e. (cid:22) 1 ; : : : ; (cid:22) n L (in descending order), when k (cid:20) n U , there holds
[Equation]
) (cid:23) k + } ; (15) when n U < k < n U + r , there holds (cid:21) k +1 (cid:21) max { max i = n L + k (cid:0) r
+1 ;:::;n L + k (cid:0) 1 f (cid:18)(cid:11)(cid:22) n + k +1 (cid:0) i + (1 (cid:0) (cid:18) ) (cid:23) i g ; (1 (cid:0) (cid:18) ) (cid:23) k + } ; (16) and when k (cid:21) n U
+ r , there holds (cid:21) k
+1 (cid:21) (1 (cid:0) (cid:18) ) (cid:23) k +1 : (17)
According to Proposition 2, the lower bound of Speciﬁcally, under the deterministic scenario, we have for k (cid:20) n U , (cid:21)
k +1 (cid:21) max { (cid:18) + (1 (cid:0) (cid:18) ) (cid:23) n L + k ; (cid:18)(cid:11) + (1 (cid:0) (cid:18) )
(cid:23) n L + k +1 (cid:0) r ; (1 (cid:0) (cid:18) )
(cid:23) k + } ; (18) for n U < k < n U + r , (cid:21)
k +1 (cid:21) max { (cid:18)(cid:11) + (1 (cid:0) (cid:18) ) (cid:23) n L + k +1 (cid:0) r ; (1 (cid:0) (cid:18) )
(cid:23) k + } ; (19) and for k (cid:21) n U + r , (cid:21) k
+1 (cid:21) (1 (cid:0) (cid:18)
[Equation]
We see that under the deterministic scenario, the lower bound of the k + 1 -th largest eigenvalue (cid:21) k +1 of A (cid:18);(cid:13);n L depends on the eigenvalues (cid:23) n L + k , (cid:23) n L + k +1 (cid:0) r , and (cid:23) k +1 of the unsupervised augmentation graph A 0 .
The value of (cid:21) k +1 is also affected by the weighting parameter (cid:18) and the noise rate (cid:13) .
A perhaps anti-intuitive conclusion is that when k is larger than n U + r , the lower bound of (cid:21) k +1 is unaffected by the noise rate.
That is, when k is large enough, the weak labels will not affect the k + 1 -largest eigenvalue of the mixed similarity graph.
5. W EAK S UPERVISION H ELPS R EDUCE E RROR B OUND
Recall that the goal of contrastive representation learning is to learn a embedding function f : X ! R k .
The quality of the learned embedding is often evaluated through linear evaluation.
To be speciﬁc, denote B 2 R k (cid:2) r as the weights of the downstream linear classiﬁer, and the linear predictor is denoted as (cid:22) g f;B ((cid:22) x ) = arg max i 2 [ r ] P x (cid:24)A ( (cid:1)j (cid:22) x ) ( g f;B ( x ) = i ) , where g f;B ( x ) = arg max i 2 [ r ] ( f ( x ) ⊤ B ) i .
In this paper, we focus on analyzing the error bound of the best possible downstream linear classiﬁer g f (cid:3) pop ;B (cid:3) , where f (cid:3) pop 2 arg min f : X! R k L ( f ) is the minimizer of the population spectral contrastive loss L ( f ) as deﬁned in equation 1, and B (cid:3) is the optimal weight for the downstream linear classiﬁer.
Following HaoChen et al.
(2021), we assume that the labels are recoverable from augmentations, i.e. we assume there exists a classiﬁer g that can predict label y ( x ) given input x with error at most (cid:14) 2 (0 ; 1) with function ^ y : X ! [ r ] .
Assumption 2.
Let P (cid:22)
X be the probability distribution of original input data (cid:22) x .
Denote x as an augmented sample and y is its label.
Assume that for some (cid:14) > 0 , there holds
[Equation]
[Equation]
and
[Equation]
Compared with Assumption 3.5 in HaoChen et al.
(2021), Assumption 2 additionally assume the recoverable of labels taking expectation under the uniform probability distribution.
We mention that
Assumption 2 is a minor revision of the original assumption.
The additional assumption equationdoes not change the nature of the original idea of label recovery, and will be used to bound the error term of learning from weakly supervised labels.
Then in the following theorem we can derive the error bound of downstream linear evaluation learned by weakly supervised contrastive learning.
Theorem 1.
For arbitrary Y , assume that the labeled data is class-balanced, i.e. ∑ i 2 [ n L ] (cid:17) j ( x i ) =
n L =r for j 2 [ r ] .
Denote (cid:23) 1 ; : : : ; (cid:23) n as the eigenvalues of (cid:22) A 0 (in descending order).
Denote E := P (cid:22) x
(cid:24)P (cid:22) X ;x (cid:24)A ( (cid:1)j (cid:22) x ) ( (cid:22) g f (cid:3) pop ;B (cid:3) ( x ) ̸ =
y ((cid:22) x ) ) as the linear evaluation error, where B (cid:3) 2 R r (cid:2) k with norm ∥ B (cid:3) ∥ F (cid:20) 1 =(cid:21) k .
Then under the deterministic scenario and Assumptions 1 and 2, for k (cid:20) n U , there holds E (cid:20) [Equation] 1 (cid:0) r
[Equation]
(cid:0) (cid:11)
[Equation]
(1 (cid:0) (cid:18) )(1 (cid:0) (cid:23) k +1 )
+ (cid:18) g + 8 (cid:14); (23) for n U + 1 (cid:20) k
(cid:20) n U + r {+(cid:0) 
+} , there holds E (cid:20)
[Equation]
(cid:18) (
[Equation]
(cid:0) (cid:11) [Equation] (1 (cid:0) (cid:18) )(1 (cid:0) (cid:23) k +1 ) + (cid:18) g + 8 (cid:14); (24) and for k (cid:21) n U + r , there holds
[Equation]
25) where (cid:11) : = ( 1 (cid:0) rr (cid:0) 1 (cid:13) ) 2 .
By Theorem 1, we show that the form of the linear evaluation error bound depends on the dimension of embedding k , whereas the error bound is larger when the noise rate (cid:13) and the label recovery error (cid:14) gets larger, regardless of the dimension k .
Recall that in HaoChen et al.
(2021), the error bound of purely unsupervised contrastive learning is
[Equation]
+1 + 8 (cid:14) .
under the setting of standard semi-supervised classiﬁcation, i.e. when (cid:13) = 0 , and usually k (cid:20) n U , we have
[Equation]
which improves the error bound of purely unsupervised contrastive learning since (cid:23) k +1 (cid:21) (cid:23) n L + k .
Next, we discuss the situation when noisy label exists, i.e. (cid:13) > 0 .
(cid:15) For k (cid:21) n U + [Equation] – if 1 (cid:0) (cid:11) > 2 r(cid:14)r (cid:0) 1 (cid:23)
[Equation]
+1 1 (cid:0) (cid:23) k +1 , then when (cid:18) = 0 , there holds
[Equation]
– if 1 (cid:0) (cid:11) (cid:20)
[Equation]
1 (cid:23) k +1 1 (cid:0) (cid:23) k +1 , then when (cid:18) = 1 , there holds
[Equation]
For n U + 1 (cid:20) k (cid:20) n
[Equation]
+ r (cid:0) 1 , or k (cid:20) n U and (cid:14) (cid:20) r (cid:0) 1 2 r (1 (cid:0) (cid:23) n L + k +1 (cid:0) r ) , there holds – if 1 (cid:0) [Equation] >
[Equation]
(cid:0) 1 (cid:23) k +1 1 (cid:0) (cid:23) k +1 , then when (cid:18) =
[-+
 −-][Equation]
– if 1 (cid:0) (cid:11) (cid:20) [Equation] (cid:0) 1 (cid:23) k +1 1 (cid:0) (cid:23) k +1 , then when (cid:18) = (cid:23) k +1 (cid:0)
[Equation] We show that when k < n U + r , when 1 (cid:0) (cid:11) (cid:20) 2 r(cid:14)r [Equation]
1 (cid:23) k +1 1 (cid:0) (cid:23) k +1 , which is equivalent to the noise rate (cid:13) smaller than a certain threshold, the weakly supervised information can improve the downstream error bound by leveraging both label and feature information and by selecting a proper weighting parameter (cid:18) .
However, when the noise rate (cid:13) is large enough, the introduction of noisy labels cannot directly improve the linear evaluation error, regardless of the dimension of the embedding k .
Fortunately, for contrastive learning under severe label noise, we can use multiple empirical techniques such as using spatial relationship to select conﬁdent samples and reduce noise rate, use the pre-ﬁltered weakly supervised data to help improve contrastive learning, and in turn use the improved feature embedding to further reduce label noise.
This philosophy has been empirically proved to be effective in many methodology studies (Yao et al., 2021; Ortego et al., 2021;
Li et al., 2022).
E XPERIMENTS
In this section, we aim to empirically verify the our theoretical results that mixing noisy labels and feature information can improve the performance of contrastive learning.
Loss function.
Recall that in the theoretical analysis, we investigate the mixed similarity graph
A (cid:18); [Equation] [Equation] L
[Equation]
=
[Equation]
+ [Equation] ~ A .
By triangle inequality, we have the matrix factorization loss
[Equation]
According to equation 2, the spectral contrastive loss is equivalent to the matrix factorization loss.
Therefore, in experiments, we use the convex combination of supervised and unsupervised contrastive losses to leverage the noisy label and feature information, i.e. for (cid:18) 2 (0 ; 1) , we use
[Equation]
Setup.
We conduct numerical comparisons on the CIFAR-10 and TinyImagenet-200 benchmark image dataset (the results on TinyImagenet-200 can be found in Appendix A.2) and follow the setting of SimCLR (Chen et al., 2020) and SupCon (Khosla et al., 2020).
We use the SGD optimizer and use ResNet-50 as the encoder and a 2-layer MLP as the projection head.
We run experiments on 4 NVIDIA Tesla v100 32GB GPUs.
The data augmentations we use are random crop and resize (with random ﬂip), color distortion and color dropping.
The models are trained with batch size and 1000 epochs for each model.
We evaluate the self-supervised learned representation by linear evaluation protocol, where a linear classiﬁer is trained on the top of the encoder, and regard its test accuracy as the performance of the encoder.
The symmetric noisy labels are generated by ﬂipping the labels of a given proportion of training samples uniformly to one of the other class labels.
In Table 1, we compare the performance of unsupervised contrastive learning (SimCLR), supervised contrastive learning (SupCon), and weakly supervised contrastive learning (Mix) under noise rate (cid:13) = 5% and (cid:13) =
In SimCLR, we neglect all labels in the training procedure, and in SupCon, we select positive samples as those with the same noisy annotations.
The parameter grid of (cid:18) for Mix is f 0 : 1 ; 0 : 2 ; 0 : 4 ; 0 : 6 ; 0 : 8 ; 0 : 9 ; 0 : 95 g .
The performance comparisons with more noise rates can be found in Appendix A.2.
The best results are marked in bold .
The standard deviation is also reported.
[Table]
We show in Table 1 that if the noise rate is small ( (cid:13) = 5% ), SupCon results in better performance than SimCLR, whereas when the noise rate raises to (cid:13) = 20% , the noisy labels actually harm the performance of contrastive learning.
Nonetheless, under (cid:13) = 5% and (cid:13) = 20% , the weakly supervised Mix outperforms both unsupervised SimCLR and supervised SupCon.
This veriﬁes the result in Theorem 1 that when the noise rate is smaller than a certain threshold, leveraging both weakly supervised and feature information helps improve the performance of contrastive learning.
T e s t
A cc u r a c y (a) Noise rate (cid:13) = 5% . T e s t A
[Figure]
u r a c y
[Figure]
In Figure 1 we conduct parameter analysis of (cid:18) for the weakly supervised contrastive learning (Mix).
We show that as (cid:18) increases from 0 to 1 , the performance of Mix ﬁrst increases and then decreases.
Moreover, larger noise rate requires smaller optimal (cid:18) .The
optimal value of (cid:18) for (cid:13) = 5% is larger than that for (cid:13) = 20% .
That is, under severer label noise, less supervised information should be considered in weakly supervised contrastive learning.
C ONCLUSION
In this paper, we establish a theoretical framework for weakly supervised contrastive learning, which is compatible with the settings of both noisy label learning and semi-supervised learning.
By formulating a mixed similarity graph describing both weakly supervised label information and unsupervised feature information, we analyze the weakly supervised spectral contrastive learning based on the framework of spectral clustering, and derive the downstream linear evaluation error bound.
Our theoretical results show that semi-supervised noisy labels improves the downstream error bound when the noise rate is smaller than a certain threshold.
Our theoretical framework reveals the effect of weak supervision to contrastive learning, and has the potential to explain the existing weakly supervised learning algorithms based on contrastive learning approaches and to inspire new algorithms.
For future works, we will investigate the effect of more complex weak supervision, such as active learning and label-dependent label noise, on contrastive learning.
A A PPENDIX A. P ROOFS
Proof of Lemma 1.
Under Assumption 1, we have ( T 2 ) i;j
{+= { (1 (cid:0) (cid:13) ) 
+}
+ (cid:13) 2 = ( r (cid:0) 1) ; i = j 2 (cid:13) (1 (cid:0) (cid:13) ) =
( r (cid:0) 1) + ( r {+(cid:0) 2) (cid:13) 
+}
{+= ( r (cid:0) 1) 2 ; i ̸ = j = 8< : (1 (cid:0) (cid:13) ) 2 + (cid:13) 
 =+}
( r (cid:0) 1) ; i = j (cid:13) r (cid:0)( 2 (cid:0) r r (cid:0) 1 (cid:13) ) ; i ̸ =
j: (33)
That is, we have
T {+
+} = {+[ (1 (cid:0) (cid:13) ) 
+}
[-γ ) 
-] + (cid:13) 2 =
( r (cid:0) 1) (cid:0) (cid:13) r (cid:0)( 2 (cid:0) r r (cid:0) 1 (cid:13) )] I r (cid:2) r + (cid:13) r (cid:0)( 2 (cid:0) r r (cid:0) 1 (cid:13) ) ⃗ 1 r ⃗ 1 ⊤ r[-r − 1 γ (cid:17) 
-]
=
( 1 (cid:0) r r (cid:0) 1 (cid:13) ) I r (cid:2) r + (cid:13) r (cid:0)( 2 (cid:0) r r (cid:0) 1 (cid:13) ) ⃗ 1 r ⃗ 1 ⊤ r := (cid:11) I r (cid:2) r + (cid:12)⃗ 1 r ⃗ 1 ⊤ r :
[Equation]
Given (cid:13) 2 [0 ; 1) , we have
[Equation]
) where the last equality holds because ∑ j (cid:17) j ( x i )
= 1 for i 2 [ n ] .
and the normalized augmentation graph is
[Equation]
36) where
[Equation]
38) and d i = ∑ [Equation]
∑
[Equation]
Speciﬁcally, when the labeled data is class-balanced, i.e. n 1 = : : : = n r = n L =r .
Then we have
[Equation]
and thus
[Equation]
Proof of Proposition 1.
We ﬁrst prove that v 1 = [Equation] 1 n L is an eigenvector of (cid:22)
A L :=
rn L A L with eigenvalue (cid:22) 1 = 1 .
To be speciﬁc,
[Equation]
[Equation]
where the second last equality is due to class balance, i.e. ∑ i 2 [ n L ] (cid:17) j ( x i )
=
n L =r for j 2 [ r ] , and the last equality holds because ∑ j 2 [ r ] (cid:17)
j ( x i ) = 1 for i 2 [ n L ] .
Therefore, we can rewrite (cid:22) A L as
[Equation]
Note that 1 n L ⃗ 1 n L ⃗ 1 ⊤ n L can be decomposed as
[Equation]
[Equation]
Then we have
[Equation]
[Equation] [Equation] [Equation] : : : (cid:11)(cid:22) n
[Equation]
[Equation] [Equation] [Equation] [Equation]
[Equation] [Equation] [Equation]
[Equation]
(cid:11)(cid:22)
[Equation] [Equation]
: : : (cid:11)(cid:22)
[Equation] [Equation]
v
[Equation]
v
[Equation]
Since (cid:11) + r(cid:12) = 1 , the eigenvalues of (cid:22)~ A L are 1 ; (cid:11)(cid:22) 2 ; : : : ; (cid:11)(cid:22) n L .
Thus the eigenvalues of
[Equation]
[Equation]
are
[Equation]
Proof of Proposition 2.
By equation 13 in Fulton (2000), for two real symmetric n by n matrix (1 (cid:0) (cid:18) ) (cid:22) A 0 and (cid:18) [Equation] ~ A , the k + 1 -th largest eigenvalue of A
[Equation] n L :
[Equation]
~ A can take any value in the interval
[Equation]
By Proposition 1, we have
[Equation]
Therefore, we have
[Equation]
i = max [Equation] = max [Equation]
[Equation]
k
[Equation] [Equation] [Equation] [Equation]
n
[Equation]
+ k (cid:0) [Equation] (1 (cid:0) (cid:18) ) (cid:23) k +1 ; (51) where the last equality holds because f (cid:23) i g i 2 [ n ] is ranked in descending order.
Then when k (cid:20) n U , (cid:21) k +1 (cid:21) max { [Equation] n [Equation]
; max
[Equation]
k
[Equation]
n
[Equation]
f
[Equation]
1 (cid:0)
[Equation]
[Equation]
(cid:0) (cid:18) )
(cid:23)
[Equation]
g [Equation] (1 (cid:0) (cid:18) ) (cid:23) k + } ; (52) when n U < k < n U + r ,
[Equation]
max [Equation] 53) and when k (cid:21) n U + r , (cid:21) k
[Equation]
(cid:21)
[Equation]
(cid:23)
[Equation]
Proof of Theorem 1.
By Lemma B.3 of HaoChen et al.
(2021), for any labeling function ⃗y : X ! [ r ] , there exists a linear probe B (cid:3) 2 R r (cid:2) k with norm ∥ B (cid:3) ∥ F (cid:20) 1 =(cid:21) k such that
[Equation]
[Equation]
where according to the deﬁnition of A (cid:18);(cid:21);n L , ϕ
[Equation]
We investigate the RHS of equation 56 respectively.
The ﬁrst term is ∑
[Equation]
[Equation]
The second term is
[Equation]
According to the deﬁnition of (cid:22)~ A [Equation] the last two terms are equal to 0 .
Then by Lemma
[Equation]
the second term on the RHS of equation 56 becomes
[Equation]
Under the deterministic scenario
[Equation]
we have
[Equation]
where the second last equation holds due to (cid:11) + r(cid:12) = 1 .
Combining equation [Equation] equation 57 and equation [Equation]
we have
[Equation]
Therefore
[Equation]
by equation
[Equation]
we have
[Equation]
Combined with Proposition 2, we have for k (cid:20) n U , there holds
[Equation]
for n U + 1 (cid:20) k (cid:20) n U + r (cid:0) 1 , there holds
[Equation] [Equation]
and for k (cid:21) n U + r , there holds
[Equation]
We run additional experiments on CIFAR-10 dataset with a noise rate (cid:13) varying from 0% to 60% in Table 2.
The parameter grid of (cid:18) for Mix is f 0 : 05 ; 0 : 1 ; 0 : 2 ; 0 : 4 ; 0 : 6 ; 0 : 8 ; 0 : 9 ; 0 : 95 g .
{+Table 
 that our Mix consistently outperforms SimCLR and SupCon. [Table]+}
We run additional experimental comparisons on the TinyImagenet-200 dataset with noise rate (cid:13) = 0 : 4 .
The parameter grid of (cid:18) is f 0 : 1 ; 0 : 2 ; 0 : 4 ; 0 : 6 g .
We additionally adopt Gaussian Blur for data augmentation and keep the other experimental setups the same as Table 1. The results are presented in Table 3. We show that Mix outperforms both SimCLR and SupCon on the TinyImagenetdataset. [Table]