cs.DSSep 30, 2026

Optimal VC Dimension of Contrastive Learning with Margin

Authors: Dionysis Arvanitakis, Vaggos Chatziafratis, Yiyuan Luo, Konstantin Makarychev

Organizations: Northwestern University · UC Santa Cruz

Abstract

Contrastive learning is a successful paradigm for learning dd-dimensional geometric representations from a collection of anchor--positive--negative'' triplets $(i,j^{+},k^{-})$, indicating that item ii is closer to jj than to kk.'' Despite its success, understanding why contrastive learning leads to representations of high \textit{generalization} quality---beyond the often pessimistic predictions from PAC-learning---remains a central question. Recently, \citet*{alon2024optimal} proved that, for PAC-learning dd-dimensional Euclidean representations of nn-point datasets, Θ(min⁡(nd,n2))Θ(\min(nd, n^2)) triplets are necessary and sufficient, while they posed as an open question whether their VC dimension bounds for the more realistic setting of \textit{contrastive learning with a margin} can be improved. For a margin parameter α>0α>0, a triplet (i,j+,k−)α(i,j^{+},k^{-})_α is satisfied by the embedding φ:[n]→Rdφ:[n]\rightarrow \mathbb{R}^{d}, if ∥φ(i)−φ(k)∥2>(1+α)⋅∥φ(i)−φ(j)∥2\|φ(i)-φ(k)\|_2>(1+α)\cdot\|φ(i)-φ(j)\|_2. In this work, we resolve their question by proving that the VC dimension of contrastive learning under any margin α∈(0,1)α\in(0,1) is in fact O(n/α2)O(n/α^2), improving on the previous bound of O(nlog⁡(n)/α2)O(n\log(n)/α^2). We also establish that the bounds are optimal up to constant factors, by providing a matching lower bound of Ω(nα2)Ω(\frac{n}{α^2}) (the previously known lower bound was Ω(nα)Ω(\frac{n}α)), for α≥max⁡(n−1/2,d−1/2)α\geq \max(n^{-1/2},d^{-1/2}).

Figures & tables

Appendix figures & tables5 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

May 5, 2026cs.DS

Provable Accuracy Collapse in Embedding-Based Representations under Dimensionality Mismatch

Embedding-based representations in Euclidean space Rd\mathbb{R}^d are a cornerstone of modern machine learning, where a major goal is to use the \emph{smallest dimension} that faithfully captures data relations. In this work, we prove sharp dimension--accuracy tradeoffs and identify a fundamental information-theoretic limitation: unless the embedding dimension dd is chosen close to the ground-truth dimension DD, accuracy undergoes a sudden collapse. Our main result shows that this phenomenon arises even in standard contrastive learning settings, where supervision is limited to a set of mm anchor--positive--negative triplets (i,j,k)(i,j,k) encoding distance comparisons dist(i,j)<dist(i,k)\mathrm{dist}(i,j) < \mathrm{dist}(i,k). Specifically, given triplets realizable by an unknown ground-truth embedding in DD dimensions, we prove that there exists constant c<1c < 1, such that \emph{every embedding of dimension at most cDcD violates half of the triplets}, yielding accuracy as low as a trivial one-dimensional solution that ignores the input. We complement our information-theoretic bounds with strong computational hardness results: under the Unique Games Conjecture, even if the given triplets are nearly realizable in D=1D=1 dimension, no polynomial-time algorithm -- \textit{regardless of its dimension} -- can achieve accuracy above the trivial 50%50\% baseline.
May 11, 2026cs.LG

Optimal Representations for Generalized Contrastive Learning with Imbalanced Datasets

In this paper, we provide a computable characterization of the geometry of optimal representations in Contrastive Learning (CL) when the classes are imbalanced. When classes are balanced and the representation dimension is greater than the number of classes, it is well-known that the optimal representations exhibit Neural Collapse (NC), i.e., representations from the same class collapse to their class means and the class means form an Equiangular Tight Frame (ETF). For imbalanced classes and a large, generalized family of CL losses, we prove that the optimal representations of all samples from the same class collapse to their class means and their geometry exhibits an angular symmetry structure that is determined by the relative class proportions. In general, we show that the geometry can be determined by solving a convex optimization problem. Exploiting this symmetry structure, we analytically investigate a special case where class imbalance is extreme and prove that CL exhibits a phenomenon called Minority Collapse (MC) where all samples from the minority classes (classes with small probabilities) collapse into a single vector, whenever the class imbalance exceeds a threshold, which in turn depends on the regularity properties of the CL loss used and on the number of negative samples. Numerical results are provided to illustrate these phenomena and corroborate the theoretical results. We conclude by identifying a number of open problems.
May 4, 2026cs.LG

Statistical Consistency and Generalization of Contrastive Representation Learning

Contrastive representation learning (CRL) underpins many modern foundation models. Despite recent theoretical progress, existing analyses suffer from several key limitations: (i) the statistical consistency of CRL remains poorly understood; (ii) available generalization bounds deteriorate as the number of negative samples increases, contradicting the empirical benefits of large negative sets; and (iii) the retrieval performance of CRL has received limited theoretical attention. In this paper, we develop a unified statistical learning theory for CRL. For downstream tasks, we evaluate retrieval quality using an AUC-type population criterion and show that the contrastive loss is \emph{statistically consistent} with optimal ranking. We further establish a \emph{calibration-style inequality} that quantitatively relates excess contrastive risk to excess retrieval suboptimality. For upstream training, we study both supervised and self-supervised contrastive objectives and derive generalization bounds of order O(1/m+1/n)O(1/m + 1/\sqrt{n}) and O(1/m+1/n)O(1/\sqrt{m} + 1/\sqrt{n}), respectively, where mm denotes the number of negative samples and nn the number of anchor points. These bounds not only explain the empirical advantages of large negative sets but also reveal an explicit trade-off between mm and nn. Extensive experiments on large-scale vision--language models corroborate our theoretical predictions.