Generalization Bounds for Adversarial Contrastive Learning

Xin Zou, Weiwei Liu

Introduction

Deep Neural Networks (DNNs) have achieved remarkable success across various domains, yet they remain notoriously vulnerable to adversarial perturbations. Small, imperceptible changes to input data can lead to catastrophic classification errors. While Adversarial Training (AT) is a common defense, it is significantly more data-intensive than standard training, often creating a bottleneck in supervised settings.

To mitigate this, researchers have turned to Adversarial Contrastive Learning (ACL). ACL leverages the power of self-supervised learning—specifically contrastive learning, which learns representations by comparing similar and dissimilar pairs of unlabeled data—and incorporates adversarial perturbations during the pre-training phase. While empirical evidence suggested that ACL produces robust models for downstream tasks, the theoretical justification for this phenomenon remained elusive. This paper provides the first rigorous theoretical foundation for ACL, establishing a mathematical link between unsupervised robustness and supervised performance.

The Theoretical Bridge: Upstream to Downstream

The core contribution of this research is the formalization of the relationship between "upstream" (unsupervised) adversarial risk and "downstream" (supervised) adversarial risk. The authors address a fundamental question: Why does robustness in a pairwise, label-free task translate to robustness in a multi-class supervised task?

Using Rademacher complexity—a metric that measures a model's ability to fit random noise—the authors prove that the downstream supervised risk is upper-bounded by the upstream unsupervised risk plus a complexity term. This "Robustness Transfer Guarantee" mathematically justifies the practice of self-supervised robust pre-training, showing that minimizing the surrogate adversarial loss on unlabeled data effectively minimizes the average adversarial risk on subsequent supervised tasks.

Complexity Analysis in Deep Networks

Moving beyond simple linear models, the paper derives generalization bounds for multi-layer neural networks under $\ell_p$ norm-bounded attacks. This analysis utilizes "covering numbers" to estimate the number of representative functions required to approximate the behavior of the entire network.

Key findings from this analysis include:

  • Weight Regularization: The generalization bounds for deep networks are heavily influenced by the norms of the weight matrices. Specifically, the authors demonstrate that constraining the Frobenius norm or the $\ell_{1,\infty}$-norm of the layers acts as a direct regularizer for adversarial supervised risk.
  • Network Depth and Width: The complexity term scales with the product of the layers' weight norms and the square root of the number of parameters, providing a roadmap for designing architectures that generalize better under attack.

Block-based Contrastive Learning

The research also introduces and analyzes a refined version of contrastive learning that utilizes "blocks" of data. Rather than comparing simple pairs (one positive, one negative), this approach uses multiple positive and negative samples simultaneously. The theoretical analysis suggests that using larger blocks yields a tighter generalization bound. By observing more examples of a "latent class" at once, the model develops a more resilient representation that is less susceptible to adversarial noise.

Empirical Validation

The authors validated their theoretical insights using the CIFAR-10 and CIFAR-100 benchmarks, focusing on how hyperparameters influence "Clean" accuracy and "Adversarial" accuracy (tested against PGD and FGSM attacks).

  • The Impact of Regularization: On CIFAR-10, the addition of a Frobenius norm regularizer ($\lambda$) directly improved robustness. Adversarial accuracy under PGD attacks rose from 46.71% (without regularization) to 48.17% with the regularizer applied.
  • The Benefit of Block Size: Experimental results confirmed the "block" theory. Increasing the block size from 1 to 10 showed a clear upward trend in performance. For instance, clean accuracy on CIFAR-10 improved from approximately 72% to 82% as the model was exposed to more negative samples per batch during pre-training.

Conclusion and Future Directions

This paper bridges the gap between the empirical success of Adversarial Contrastive Learning and its theoretical underpinnings. By proving that unsupervised robust pre-training provides a guaranteed bound on supervised performance, the authors provide a principled framework for developing more robust AI systems with less labeled data.

However, several avenues for future work remain. The current analysis focuses on fully connected multi-layer networks; extending these bounds to Transformers or Residual Networks (ResNets) is a necessary next step. Additionally, the theory relies on the network being Lipschitz continuous, and the bounds can become "vacuous" if weights are entirely unconstrained. Finally, while $\ell_p$ attacks are the standard benchmark, exploring generalization bounds for non-norm-based adversarial perturbations will be critical for real-world deployment.

Summary updated

BibTeX
@article{zou2023generalization,
  author = {Xin Zou and Weiwei Liu},
  title = {{Generalization Bounds for Adversarial Contrastive Learning}},
  journal = {J. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=K7GTvBaJOd},
}
Figure