Measuring Generalization with Optimal Transport

Ching-Yao Chuang, Youssef Mroueh, Kristjan H. Greenewald, Antonio Torralba, Stefanie Jegelka

Deep neural networks often possess millions of parameters, yet they generalize remarkably well to unseen data. Traditional statistical learning theory, which relies on measures like VC-dimension or Rademacher complexity, often fails to explain this phenomenon in practice, frequently producing "vacuous" bounds that do not correlate with actual performance. This paper introduces a novel framework for measuring generalization by analyzing the geometric properties of internal representations using Optimal Transport (OT).

The Challenge of Generalization Bounds

A central mystery in deep learning is why overparameterized models do not simply memorize training data. While generalization bounds aim to predict the gap between training and test error, many existing measures correlate poorly with real-world results. To bridge this gap, the authors propose a complexity measure that is both theoretically rigorous and empirically predictive across diverse architectures and datasets.

Methodology: $k$-variance and Normalized Margins

The core of the proposed approach is the concept of $k$-variance, a data-dependent complexity measure rooted in Optimal Transport.

  1. $k$-variance ($kV$): Unlike standard variance, $k$-variance captures the structural properties of a distribution. It is defined as the expected Wasserstein-1 distance between two independent random subsets of the data. This metric serves as a proxy for the "clusterability" and intrinsic dimensionality of learned features.
  2. Normalized Margins: The authors argue that a large margin (the distance to a decision boundary) is only a reliable indicator of generalization if the features are well-behaved. They introduce:
  3. $kV$-Margin: The standard margin normalized by the $k$-variance of the features.
  4. $kV$-GN-Margin: A version incorporating gradient normalization to better approximate the distance to the decision boundary in the input space.

The theoretical framework proves that generalization is favored when features within a class are tightly clustered (low $k$-variance) and features of different classes are well-separated (high Wasserstein distance).

Empirical Evaluation

The methods were rigorously tested using the Predicting Generalization in Deep Learning (PGDL) benchmark, covering eight tasks with datasets such as CIFAR-10, SVHN, CINIC-10, Oxford Pets, and Fashion MNIST.

Key Results and Insights

The proposed $kV$-normalized margins demonstrated superior predictive power compared to traditional baselines.

The $kV$-GN-Margin (bottom right) is the only measure that consistently ranks the four models in the correct order of their generalization error.

As shown in the figure above, the $kV$-GN-Margin effectively ranks models by their generalization error, a feat that standard margins and other baselines fail to achieve consistently. Furthermore, the quantitative results across the PGDL benchmark highlight the robustness of this approach.

Quantitative comparison of margin-based measures across various datasets and architectures. Bold values indicate the best performance in each category.

Key findings include:

  • Superior Correlation: $kV$-normalized margins outperformed standard baselines like Spectral Margins in 6 out of 8 PGDL tasks.
  • Robustness to Noise: In "sanity check" experiments with random labels, the measure correctly identified poor generalization despite 100% training accuracy, recognizing that the resulting features were unconcentrated.
  • Geometry over Norms: The results suggest that generalization is driven by how a network organizes data in latent space—specifically, "squeezing" classes into tight, distant clusters.

Limitations and Future Directions

While promising, the approach relies on empirical approximations of the network's Lipschitz constant, as exact computation is NP-hard. Additionally, calculating Optimal Transport costs can be computationally intensive, though the use of random subsets provides a practical mitigation. Future work may explore the relationship between OT-based bounds and contrastive learning or adversarial robustness.

Summary updated

BibTeX
@inproceedings{chuang2021measuring,
  author = {Ching-Yao Chuang and Youssef Mroueh and Kristjan H. Greenewald and Antonio Torralba and Stefanie Jegelka},
  title = {{Measuring Generalization with Optimal Transport}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=Yt89iqqswiM},
}
Figure