Towards a Rigorous Analysis Of Mutual Information in Contrastive Learning

Kyung‐Eun Lee, Jaeill Kim, Suhyun Kang, Wonjong Rhee

TL;DR

This paper tackles the challenge of rigorously analyzing mutual information (MI) in contrastive learning, a key but often difficult metric. They introduce novel methods for MI estimation and analysis, demonstrating how to overcome common pitfalls and gain deeper insights into representation learning.

What Problem Does This Paper Address?

Contrastive learning has revolutionized unsupervised representation learning, with its success often linked to maximizing mutual information (MI) between augmented views of data. However, accurately estimating and interpreting MI in deep learning is fraught with challenges: the true joint distribution is unknown, high dimensionality makes traditional methods ineffective, neural estimators have accuracy limitations, interpreting bounds is tricky, and pinpointing the source of shared information is difficult. These issues can lead to flawed conclusions and misconceptions about contrastive learning.

Methods

The authors propose three key methods to enhance MI analysis rigor:

  • Same-class sampling: A novel positive pairing strategy that leverages only class labels, allowing for theoretical analysis where true MI can be precisely determined (equal to class entropy under certain conditions). This is crucial for establishing ground truth.
  • CDP dataset: A synthetic dataset designed for easy manipulation of class entropy (H(C)), enabling concrete interpretations of MI analysis results and providing a controlled environment for experiments.
  • Post-training MI estimation: Decoupling MI estimation from the training phase. This allows for using a frozen encoder and training a separate critic network with flexible batch sizes and positive pairing strategies, leading to more accurate and reliable MI estimates.

Datasets

  • CDP dataset: A synthetic dataset introduced by the authors, constructed by uniformly choosing color, digit, and position attributes. This allows for controlled manipulation of class entropy.
  • ImageNet-100, ImageNet-1k, CIFAR-10, CIFAR-100: Standard benchmark datasets used for evaluating downstream task performance and MI metrics.
  • CIFAR-5A, CIFAR-5B, CIFAR-50A, CIFAR-50B: Disjoint subsets of CIFAR-10 and CIFAR-100, used to investigate the effect of negative sampling strategies.

Key Insights and Ideas

  • Small batch sizes don't necessarily limit true MI: The common belief that small training batch sizes (KTr) limit MI due to the log(2KTr-1) bound is a misunderstanding. While in-training MI estimation is bounded, the encoder's inherent capability and downstream performance are not.
  • MI can be a superior representation quality measure (with caveats): When using the proposed post-training MI estimation with a carefully chosen positive pairing (like same-class sampling), MI (specifically Îclass(hx; hy)) shows a strong correlation with downstream performance, outperforming other metrics like alignment and uniformity.
  • Task-irrelevant information isn't always harmful: The InfoMin principle suggests discarding task-irrelevant information for better generalization. However, experiments show that performance can remain high even with seemingly irrelevant information, suggesting a more complex interplay.
  • Negative sampling matters: The choice of negative samples significantly impacts contrastive learning performance. Using related but not identical datasets for negative sampling can improve performance over using random noise or samples from the same distribution.

Key Results

  • Experiments on CDP dataset demonstrate that post-training MI estimation with same-class sampling (Îclass(hx; hy)) correlates highly with downstream task accuracy (Pearson's $\rho$ up to 0.967, Kendall's $\tau$ up to 0.883).
  • Analysis of 16 pre-trained networks shows that Îclass(hx; hy) is a more reliable indicator of downstream performance than ÎsimCLR(hx; hy).
  • On CIFAR-5A and CIFAR-50A, using CIFAR-5B and CIFAR-50B respectively as negative sampling datasets improved accuracy by up to 1.92% compared to using uniform random noise.

Limitations and Future Work

  • Practicality of same-class sampling: While theoretically powerful, same-class sampling requires labels, making it a supervised method. Its primary utility is in theoretical analysis and establishing ground truth.
  • MI as a learning objective: The paper questions whether MI maximization is always the best learning objective, suggesting that deviations from pure MI optimization (e.g., using surrogate losses) can be beneficial.
  • Future work: The authors suggest further exploring MI as a learning objective and investigating advancements in unsupervised representation learning beyond contrastive learning. They also highlight the need to understand the complex interplay between different information sources and their impact on generalization.

Summary updated

BibTeX
@article{lee2024towards,
  author = {Kyung‐Eun Lee and Jaeill Kim and Suhyun Kang and Wonjong Rhee},
  title = {{Towards a Rigorous Analysis Of Mutual Information in Contrastive Learning}},
  journal = {Neural Networks},
  year = {2024},
  doi = {10.1016/j.neunet.2024.106584},
}
Figure