1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:38,850 [Hal Turing] Today we're covering "A Theoretical Analysis of Contrastive Unsupervised Representation Learning," a 2019 ICML paper led by Sanjeev Arora at Princeton and the Institute for Advanced Study, with Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis and Nikunj Saunshi, who were at Princeton, IAS and Carnegie Mellon. The claim is that you can prove why training on similar pairs and random negatives, with no labels, produces features a linear classifier can use. 3 00:00:38,850 --> 00:00:55,549 [Dr. Ada Shannon] The stakes: contrastive methods already worked well in practice, but the success was treated as obvious. This paper asks why it should work at all, and what can actually be proven. It gets a real guarantee, and it pays for it with a strong modeling assumption. We'll get to that. 4 00:00:55,549 --> 00:01:03,349 [Hal Turing] Start with the setup. What's unsupervised representation learning, and how does it differ from semi-supervised? 5 00:01:03,349 --> 00:01:24,424 [Dr. Ada Shannon] You use unlabeled data to learn a function f that maps an input x to a vector f(x). Later, a classifier trained on f(x) should need fewer labels than one trained on raw x. Pretraining and the labeled task are separate phases. Semi-supervised learning mixes labeled and unlabeled data in a single learning step. Word2vec is the example this paper leans on. 6 00:01:24,424 --> 00:01:28,950 [Hal Turing] And contrastive learning is a particular way of doing that. 7 00:01:28,950 --> 00:01:49,550 [Dr. Ada Shannon] Right. The paper uses the term for a family of methods. You learn f so that the inner product of f(x) with f(x+), a similar point, beats the inner product of f(x) with f(x-), a negative. Word2vec does this with a word and its context against random words. Quick Thoughts does it with a sentence and its neighboring sentence. Video methods do it with nearby frames. 8 00:01:49,550 --> 00:01:53,400 [Hal Turing] Concrete case. Take a sentence from a movie review. 9 00:01:53,400 --> 00:02:09,599 [Dr. Ada Shannon] The next sentence in that review is x+. A sentence from some unrelated review is x-. The loss rewards the encoder when the first pair scores higher than the second. No labels are involved, only a notion of what counts as a similar pair. 10 00:02:09,599 --> 00:02:16,924 [Hal Turing] But x- is just random. What if the random sentence is also a movie review, with the same sentiment? 11 00:02:16,924 --> 00:02:35,524 [Dr. Ada Shannon] Then the loss is pushing apart two things that belong together. That's the central problem. The negative is drawn from the whole data distribution, so it can land in the same class as the anchor. The paper calls this a class collision, and the whole analysis has to account for it. Part of the theory is about what that costs. 12 00:02:35,524 --> 00:02:38,974 [Hal Turing] Wait, what class? Nobody gave us labels. 13 00:02:38,974 --> 00:03:01,949 [Dr. Ada Shannon] That's exactly the modeling move. The paper posits a latent class framework. There's a set of hidden classes, and a distribution rho over them. Each class c has its own data distribution D_c. To make a similar pair, you draw a class from rho, then draw x and x+ independently from D_c. A negative is drawn from the marginal, meaning you pick a class from rho and a point from it, ignoring the anchor. The classes are never revealed in the unlabeled data. They exist only in the theory. 14 00:03:01,949 --> 00:03:05,424 [Hal Turing] So what's a downstream task in this picture? 15 00:03:05,424 --> 00:03:26,599 [Dr. Ada Shannon] A classification task over a subset of those same latent classes, with labeled samples from each D_c. The paper measures quality by the average linear classifier loss over such tasks, with classes drawn from rho. The identical classes appear in pretraining and in the downstream task. That's a deliberate and strong choice. I'll flag it now and we'll examine it later. 16 00:03:26,599 --> 00:03:32,549 [Hal Turing] Why not just use a generative model, like a topic model or a mixture of Gaussians? 17 00:03:32,549 --> 00:03:54,049 [Dr. Ada Shannon] Because those need a parametric form for p(x given c), and for images or text that's hard to write down. Here D_c is arbitrary, and classes can overlap. All the framework needs is that you can sample similar pairs. That keeps it independent of architecture. The analysis covers any function class F, a deep net included, by measuring its capacity with Rademacher complexity. We'll define that when we need it. 18 00:03:54,049 --> 00:03:58,174 [Hal Turing] Does the framework actually promise anything concrete? 19 00:03:58,174 --> 00:04:20,174 [Dr. Ada Shannon] Two things. First, a guarantee: if a representation achieves low unsupervised loss, it will do well on average linear classification over these tasks. Second, a sample-complexity statement: pretraining on unlabeled data pays the capacity cost once, and then a linear head needs relatively few labels. Though it's a bound for a generic function class. It doesn't exploit anything specific about deep nets. 20 00:04:20,174 --> 00:04:22,824 [Hal Turing] What's in the rest of the paper? 21 00:04:22,824 --> 00:04:42,724 [Dr. Ada Shannon] Roughly, a bound linking unsupervised loss to supervised loss, then the price of negative sampling from class collisions, then a competitive bound against the best supervised features under extra conditions. After that, what happens with many negatives, and finally a block version of the loss that averages several similar points. 22 00:04:42,724 --> 00:04:54,150 [Hal Turing] Let's take the pieces in order. The first one links the unsupervised loss to the supervised loss. How does that work, given the classifier is something we never train? 23 00:04:54,150 --> 00:05:13,175 [Dr. Ada Shannon] The paper bounds the loss of a specific classifier, the mean classifier. Each class gets a row equal to the average representation of that class. Then it shows the contrastive loss upper-bounds that classifier's loss, up to a correction. The step is Jensen's inequality, in Lemma 4.3. 24 00:05:13,175 --> 00:05:15,550 [Hal Turing] Walk me through the chain. 25 00:05:15,550 --> 00:05:47,300 [Dr. Ada Shannon] The contrastive loss uses one random positive point and one random negative point as stand-ins for the classes. That's a noisy classifier. Swap in the class means instead. The loss is convex, so the loss of an average is at most the average of the losses. Moving the expectation inside the loss can only lower it. So the mean classifier does no worse than the random-point version. After accounting for same-class draws, you get the mean classifier's loss bounded by the unsupervised loss minus tau, divided by one minus tau. 26 00:05:47,300 --> 00:05:50,575 [Hal Turing] Tau being the collision probability. 27 00:05:50,575 --> 00:05:58,300 [Dr. Ada Shannon] Right, the chance two sampled classes match. For uniform class probabilities, that's one over the number of classes. 28 00:05:58,300 --> 00:06:03,450 [Hal Turing] So Theorem 4.1 is that plus a generalization term. 29 00:06:03,450 --> 00:06:34,850 [Dr. Ada Shannon] Yes. The learner minimizes the empirical loss on M samples, and the generalization term says how far that can sit from the population loss. It has two parts: a Rademacher term, scaling like the norm bound R times the complexity, over M, and a confidence term that shrinks like one over root M. Rademacher complexity measures how well the function class can fit random sign noise. A richer class fits noise better, so the bound loosens. The paper relates it to the usual labeled complexity, up to a factor of d, which is where the labeled sample complexity story comes from. 30 00:06:34,850 --> 00:06:40,975 [Hal Turing] Now the price of negative sampling. If tau is small, why does the correction matter? 31 00:06:40,975 --> 00:07:02,100 [Dr. Ada Shannon] The bound only helps if the unsupervised loss can get near tau. Split that loss into same-class draws and different-class draws. For a same-class draw, the positive and negative come from one distribution. By Jensen again, the best case is a loss of one, as if the two means were identical. So the loss can't drop below tau no matter what, and it can sit far above it. 32 00:07:02,100 --> 00:07:04,225 [Hal Turing] What pushes it above? 33 00:07:04,225 --> 00:07:27,175 [Dr. Ada Shannon] Spread within a class. The paper defines intraclass deviation, s of f, from the covariance spectral norm times the representation norm. Lemma 4.4 says the same-class loss is at least one minus a constant times s. Theorem 4.5 then bounds supervised loss by the different-class loss, plus lambda times s, plus the generalization term. Lambda is a constant times tau over one minus tau, and eta is one over one minus tau. 34 00:07:27,175 --> 00:07:36,775 [Hal Turing] So the guarantee is stated for the best function in the class. Does contrastive learning at least match the best supervised representation? 35 00:07:36,775 --> 00:08:00,850 [Dr. Ada Shannon] No, and Figure 1 gives two small counterexamples. In the first, one direction separates the classes perfectly, but it's buried among spurious directions. Inner products pick up all of them, so the contrastive loss prefers a useless constant function. In the second, the classes are separable by the mean classifier but spread widely within each class, so same-class loss is high. In both, the unsupervised objective picks the wrong function. The ideal bounds are false without extra assumptions. 36 00:08:00,850 --> 00:08:03,425 [Hal Turing] And what assumptions rescue it? 37 00:08:03,425 --> 00:08:23,100 [Dr. Ada Shannon] Lemma 5.1 and Corollary 5.1.1. If representations are sub-Gaussian in every direction within each class, and the mean classifier separates classes with a high margin, you get a weaker competitive bound against that mean classifier. It's a guarantee for a specific classifier under specific conditions. 38 00:08:23,100 --> 00:08:27,725 [Hal Turing] Section 6 adds more negatives. More should be better, no? 39 00:08:27,725 --> 00:08:51,100 [Dr. Ada Shannon] The paper says the standard belief is yes, and noise contrastive estimation theory supports it. But in Theorem 6.1 the coefficient on s of f grows with k, roughly k over the number of classes for uniform probabilities and small k. The paper argues that k on the order of the class count, or of the number of clusters the representation can't distinguish, can hurt. The support is Figures D.1a and D.1b in the appendix, and the paper only says they suggest this. 40 00:08:51,100 --> 00:08:53,950 [Hal Turing] Then the block algorithm, CURL. 41 00:08:53,950 --> 00:09:16,350 [Dr. Ada Shannon] Instead of one positive point and one negative point, average the embeddings of a block of b similar points and a block of b negatives. Equation 12 uses those averages. An average sits closer to the class mean than a single point does, so the Jensen step gets tighter. Proposition 6.2 says this surrogate is at least as good as the pairwise one. That compares surrogates. The paper leaves a rigorous generalization comparison for future work. 42 00:09:16,350 --> 00:09:18,500 [Hal Turing] What did they test it on? 43 00:09:18,500 --> 00:09:40,325 [Dr. Ada Shannon] CIFAR-100 with 100 classes, and Wiki-3029, built from 3029 Wikipedia articles as classes with 200 sentences each. For both, they simulate the framework's data generation process. The third is IMDb, with 560K unlabeled sentences, evaluated on sentiment classification. A GRU encoder serves both CURL and Quick Thoughts. 44 00:09:40,325 --> 00:09:43,175 [Hal Turing] The block-size result first. 45 00:09:43,175 --> 00:10:14,401 [Dr. Ada Shannon] Accuracy, higher is better, on average binary tasks. On CIFAR-100, moving from pairs to blocks of ten lifts accuracy from 88.1 to 89.7. That's 1.6 more correct answers per hundred. Most of it arrives by block size five. On Wiki-3029 it's 96.6 to 97.7. The direction matches the theory. But it's small, the paper reports no seeds or variance, and the data was generated to fit the framework, so it checks direction, not a bound. 46 00:10:14,401 --> 00:10:17,501 [Hal Turing] And IMDb against Quick Thoughts? 47 00:10:17,501 --> 00:10:39,201 [Dr. Ada Shannon] Here the data wasn't built to fit the framework. At block size ten, CURL gets about 90 reviews in a hundred right and Quick Thoughts about 87. Quick Thoughts rises, then falls as blocks grow, while CURL keeps creeping up. It's one dataset, one architecture, one baseline, and no seeds reported. It doesn't tell us whether averaging in the loss is what helps, or some other difference between the objectives. I'd call it suggestive, not established. 48 00:10:39,201 --> 00:10:55,151 [Hal Turing] Before we get to what the paper builds, I want to check the foundation. The whole framework rests on positives being two independent draws from one hidden class. Real positives are adjacent sentences or two crops of one image. Do those fit? 49 00:10:55,151 --> 00:11:14,651 [Dr. Ada Shannon] Not obviously. Adjacent sentences share local context, and two crops share pixels. Given the class, they are not independent. The paper never tests how the bounds degrade when that fails. It does relate its model to co-training, which also assumes conditionally independent views, so the authors know the assumption is strong. 50 00:11:14,651 --> 00:11:23,401 [Hal Turing] And the experiments can't test it, because CIFAR-100 and Wiki-3029 were generated from the framework. 51 00:11:23,401 --> 00:11:39,951 [Dr. Ada Shannon] Right. Positives there are drawn directly from class labels, so the data satisfies the assumption by construction. My verdict: the theory's structure is consistent with practice. The paper does not show that the assumption holds for naturally occurring positives. 52 00:11:39,951 --> 00:11:52,901 [Hal Turing] What about the bounds as numbers? Collisions first. With uniform classes, tau is one in a hundred for CIFAR-100, and about one in three thousand for Wiki-3029. 53 00:11:52,901 --> 00:12:12,727 [Dr. Ada Shannon] So the collision correction, one over one minus tau, is about 1.01. The collision terms are not what would make these bounds weak. The unknowns are the constant c0, the representation norm bound R, the Rademacher complexity of a deep GRU, and the intraclass deviation. The paper estimates none of them. 54 00:12:12,727 --> 00:12:15,602 [Hal Turing] So is the bound vacuous? 55 00:12:15,602 --> 00:12:27,752 [Dr. Ada Shannon] Plausibly, but the paper gives no value, so the honest word is unevaluated. What it checks is direction: bigger blocks help, and more negatives can hurt. It doesn't check a bound's value. 56 00:12:27,752 --> 00:12:35,077 [Hal Turing] There's also the mean classifier. The guarantee covers that classifier, not the best linear one. 57 00:12:35,077 --> 00:12:56,202 [Dr. Ada Shannon] Yes. The competitive bound needs sub-Gaussian concentration and a high-margin mean classifier, and the paper says contrastive learning isn't generally competitive with the best supervised representation. The mean classifier's accuracy is reported in the appendix, which wasn't in the text I have, so I can't tell you the gap. Whether those conditions hold for any trained network is also untested. 58 00:12:56,202 --> 00:13:04,677 [Hal Turing] Let's go to the claim I found strangest. More negatives can hurt past some point. Later work seems to say the opposite. 59 00:13:04,677 --> 00:13:46,027 [Dr. Ada Shannon] SimCLR, from Chen, Kornblith, Norouzi and Hinton at Google in 2020, uses large batches as negatives, with augmentations as positives and a temperature. MoCo, by He, Fan, Wu, Xie and Girshick at Facebook in 2020, keeps a queue so negatives don't depend on batch size. Both found that more negatives generally helped. That doesn't directly refute this paper. Here's my reading, not the paper's claim. In the paper's example, harm appears when k is around the number of classes and collisions are frequent. With augmentation positives, each image is close to its own class, so collisions are rarer and a threshold may never show up. Also, the paper's evidence is its own controlled experiments, not a SimCLR-scale test. 60 00:13:46,027 --> 00:13:51,377 [Hal Turing] And the mutual-information story? Van den Oord's InfoNCE paper. 61 00:13:51,377 --> 00:14:08,477 [Dr. Ada Shannon] Representation Learning with Contrastive Predictive Coding, van den Oord, Li and Vinyals at DeepMind, 2018. It introduced InfoNCE and gives a mutual-information reading of the loss. That's an alternative lens to latent classes, not a refuted one. 62 00:14:08,477 --> 00:14:11,602 [Hal Turing] So what does a practitioner take from this? 63 00:14:11,602 --> 00:14:43,327 [Dr. Ada Shannon] A vocabulary: class collision and intraclass deviation. A reason to care about the negative sampling distribution. The block idea. And a sample-complexity story for why unlabeled pretraining reduces labeled data. What it doesn't give you is a recipe for choosing k or a way to certify a model. It also treats the construction of positives as given, and the deployed objectives add details the analysis doesn't cover. Also, a tighter surrogate loss from blocks doesn't by itself guarantee a tighter generalization bound, which is exactly what the paper defers. 64 00:14:43,327 --> 00:14:46,227 [Hal Turing] What would settle the open questions? 65 00:14:46,227 --> 00:15:18,927 [Dr. Ada Shannon] Two experiments. First, measure the bound's components for a trained model: tau, the intraclass deviation, a complexity estimate. Second, degrade the assumption on purpose, for example by taking positives from adjacent windows with controlled overlap, and watch how performance falls. The paper's own list points elsewhere: tree or metric structure among classes, links to meta-learning and transfer, better heuristics for finding similar and dissimilar pairs, and a rigorous generalization comparison of blocks against pairs. 66 00:15:18,927 --> 00:15:44,827 [Hal Turing] So where does that leave us? Under the latent-class assumption, low unsupervised loss with controlled intraclass deviation provably gives good average linear classification, and the framework explains why random negatives carry a price. The boundary is that the assumption is untested for real positives, the bound's constants are never evaluated, and the empirical support is directional and mostly simulated. 67 00:15:44,827 --> 00:15:52,002 [Dr. Ada Shannon] That's the right summary. A useful theory of why the method can work, but not yet an explanation of practice. 68 00:15:52,002 --> 00:15:55,852 [Hal Turing] Thanks for listening, everyone. See you next time.