Convergence of End-to-End Training in Deep Unsupervised Contrasitive Learning

Zixin WenarXiv 2020

Abstract

While unsupervised contrastive learning has achieved significant empirical success in both computer vision and natural language processing, its theoretical optimization dynamics have remained poorly understood. This paper provides the first theoretical proof that end-to-end training of deep, over-parameterized neural networks using unsupervised contrastive learning converges to an approximate stationary solution. By analyzing the simultaneous updates of query and key encoders, this work bridges the gap between the practical efficacy of frameworks like SimCLR and MoCo and our mathematical understanding of their convergence.

Introduction

Unsupervised contrastive learning has emerged as a dominant paradigm for representation learning. By training networks to align a "query" representation with a positive "key" while distancing it from negative samples, models can learn rich features without human-annotated labels. Despite the success of algorithms such as SimCLR, MoCo, and BERT-based contrastive approaches, a rigorous theoretical foundation for their optimization has been lacking.

In supervised learning, the convergence of deep networks is often explained through the lens of over-parameterization, where massive network width allows gradient descent to find global minima. However, unsupervised contrastive learning presents unique challenges: there is no fixed target function, and the loss involves the interaction of two simultaneously updating encoders. This paper addresses these challenges by establishing convergence guarantees for the joint optimization of query and key encoders in the over-parameterized regime.

Problem Formulation

The study focuses on the instance-level discrimination contrastive loss, often referred to as InfoNCE. In this setting, a query encoder and a key encoder—both deep neural networks with ReLU activations—are trained via gradient descent. The objective is to minimize a loss function that is jointly non-convex and highly interactive due to the simultaneous updates of both networks.

The theoretical analysis assumes a training set of $n$ data points that are normalized on a 1-sphere and satisfy a non-degeneracy condition (separated by a minimum distance $\delta$). The goal is to prove that standard gradient descent can navigate this complex landscape to reach a stationary point.

Methodology

To analyze the optimization landscape, the author adapts techniques from Neural Tangent Kernel (NTK) literature, which are traditionally applied to supervised learning. The proof relies on two primary technical developments:

  1. Gradient Bounds: The author proves that the gradients for both the query and key networks remain well-behaved throughout the training process. Specifically, they are bounded away from zero and do not explode near the random initialization.
  2. Semi-smoothness Properties: Because ReLU activations are non-smooth, the author establishes second-order bounds to manage the interactions between the two networks. This allows for a controlled analysis of how perturbations in network weights affect the overall loss.

By bounding the movement of network outputs during training, the author demonstrates that the loss function decreases reliably, even as both encoders evolve.

Key Insights

Provable Simultaneous Convergence

The research demonstrates that massive over-parameterization ensures gradient descent does not become trapped in suboptimal local minima. Because the networks remain relatively close to their initial states, the optimization landscape remains navigable despite its inherent non-convexity.

The Necessity of High-Dimensional Projections

A significant finding of this work is the relationship between network width and output dimensionality. Unlike supervised learning, where the output dimension is often fixed by the number of classes, contrastive learning requires the output dimension $d$ to be sufficiently large—specifically $\Theta(\log^2 m)$, where $m$ is the network width. This ensures the encoders can project enough information to distinguish between queries and keys effectively.

Extending NTK to Unsupervised Learning

The paper successfully shows that the "lazy training" regime described by NTK theory is applicable to unsupervised objectives. This suggests that the principles of over-parameterization are fundamental to deep learning optimization, regardless of whether the objective is label-fitting or distribution encoding.

Main Results

The central contribution is Theorem 4.2, which proves that gradient descent finds an $\epsilon$-approximate stationary solution for the contrastive loss in polynomial time.

For a network with $L$ layers and $n$ data points, convergence is guaranteed if the network width $m$ satisfies: $$m \ge \Omega(n^{15}L^{12}(\log m)^5 \delta^{-5} \epsilon^{-2})$$ Under these conditions, the training converges in $T = \Theta(n^{10}L^2k / (\delta^3 \epsilon^4))$ iterations, where $k$ represents the number of negative samples.

Discussion and Limitations

While this work provides a landmark theoretical result, several gaps between theory and practice remain:

  • Gradient Descent vs. SGD: The proof assumes full Gradient Descent using all negative examples. In practice, contrastive learning utilizes Stochastic Gradient Descent (SGD) with mini-batches and random negative sampling. The "doubly stochastic" nature of these practical implementations remains to be analyzed.
  • Width Requirements: The required width $m$ for the proof to hold is extremely large (scaling with $n^{15}$), far exceeding the width of neural networks used in practical applications.
  • Generalization: The current analysis focuses on optimization (convergence to a stationary point) rather than generalization. Future work is needed to explain why the resulting representations perform so well on downstream tasks and to provide bounds for the fine-tuning stage.

Conclusion

This paper provides a rigorous mathematical foundation for the convergence of end-to-end unsupervised contrastive learning. By proving that over-parameterized networks can successfully optimize interactive, non-convex contrastive losses, it moves the field closer to a complete theoretical understanding of self-supervised representation learning.

Summary updated

BibTeX
@misc{wen2020convergence,
  author = {Zixin Wen},
  title = {{Convergence of End-to-End Training in Deep Unsupervised Contrasitive Learning}},
  year = {2020},
  eprint = {2002.06979},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.06979},
}
Figure