Beyond Discrepancy: A Closer Look at the Theory of Distribution Shift

Robi Bhattacharjee, Nick Rittler, Kamalika Chaudhuri

TL;DR

Traditional learning theory for distribution shift relies on pessimistic, worst-case "discrepancy" bounds that fail to explain why modern machine learning models generalize so well in practice. This paper introduces a novel theoretical framework based on a "Statistical Invariant Risk Minimization (IRM)" assumption, mapping out exactly when source data alone, unlabeled target data, or a minimal amount of labeled target data are sufficient for successful generalization using nearest-neighbor classifiers in a learned feature space.

What Problem Does This Paper Address?

In classical machine learning, we assume our training (source) and testing (target) data come from the same underlying distribution. In the real world, this assumption frequently breaks down—a phenomenon known as distribution shift.

To date, theoretical guarantees for distribution shift have taken a worst-case approach, bounding a model's target error based on the geometric "discrepancy" between the source and target distributions. If the source and target data cover completely different regions of the input space, these classical bounds declare generalization impossible. Yet, large modern models routinely succeed under these exact conditions because they map disparate inputs into a shared, meaningful latent feature space. This paper addresses this massive gap between pessimistic theory and optimistic practice.

Methods

The authors shift the focus away from raw distribution discrepancy and instead introduce the Statistical IRM Assumption. They assume that there exists an ideal feature map ($\phi^*$) within a hypothesis class ($\Phi$) that transforms the data into a space where the source and target tasks are cleanly unified. Specifically, this ideal feature map must satisfy three properties:

  1. Source-Preservation: It retains all information necessary for optimal classification on the source distribution.
  2. Contraction: It maps target data points close to source data points in the feature space.
  3. Bayes-Unification: It ensures that points mapped close together share the same optimal label, regardless of whether they originated from the source or target.

To make predictions, the learner projects data into this feature space and applies a standard $k_n$-Nearest Neighbors ($k_n$-NN) classifier.

To quantify the complexity of the feature map class $\Phi$, the authors introduce a new capacity measure called the Distance Dimension ($\partial(\Phi)$), defined as the VC-dimension of the binary relations determining whether one pair of points is closer together than another pair in the embedded space.

Datasets

Not discussed in the paper. As a purely theoretical work, the authors do not evaluate their methods on empirical deep learning benchmarks, relying instead on rigorous mathematical proofs and synthetic geometric examples to illustrate their concepts.

Key Insights and Ideas

The core "aha moment" of the paper is that generalization under distribution shift is fundamentally an identifiability problem. The challenge isn't just whether a good feature space exists, but whether a learner can successfully identify it given their available data. The authors break this down into three distinct scenarios:

  • Pure Source Data Sufficiency: If every feature map that perfectly solves the source task also happens to correctly unify the source and target, then training purely on source data is sufficient for target generalization. Pure source data is sufficient
Pure source data is sufficient
  • Unlabeled Target Data Sufficiency: Sometimes, multiple feature maps look great on the source data, but some fail to map the target data near the source data. Unlabeled target data provides the geometric clues needed to eliminate these bad maps by checking which ones satisfy the contraction property. Unlabeled target data is sufficient
Unlabeled target data is sufficient
  • Labeled Target Data Necessity: In the trickiest cases, multiple feature maps look identical on both source data and unlabeled target data, yet imply completely contradictory labeling rules for the target task. Here, labeled target data is fundamentally required to break the symmetry. Labeled target data is needed
Labeled target data is needed

Key Results

  • The Statistical IRM Theorem (Theorem 1): The authors prove that if the ideal, unifying feature map $\phi^*$ is known, a $k_n$-NN classifier trained on source data will achieve optimal target accuracy in the large-sample limit.
  • Bounded Distance Dimension (Theorem 2): They prove that the Distance Dimension is finite and manageable for common feature map families, scaling as $\le K \log D$ for coordinate projections and $\le D^2$ for linear transformations from $\mathbb{R}^D$ to $\mathbb{R}^K$.
  • Target Sample Complexity Speedups (Theorem 7): When labeled target data is required to identify the correct map, the authors show that the number of target samples ($m$) needed scales logarithmically with the number of source samples ($n$). This yields a massive convergence speedup compared to naively training a non-parametric classifier on the target data from scratch.

Limitations and Future Work

While providing a refreshing alternative to worst-case discrepancy bounds, this framework has a few notable limitations:

  1. Asymptotic Regime: The guarantees are primarily proven for the large-sample regime ($n \to \infty$), leaving finite-sample rates for the source distribution as an open problem.
  2. Nearest-Neighbor Focus: The proofs rely heavily on the local properties of $k_n$-NN classifiers. Extending this theory to parametric models like deep neural networks remains a major hurdle.
  3. Strict Regularity Conditions: The proofs assume well-behaved data distributions that satisfy specific margin conditions ($\rho, \Delta$-separation) and measure-theoretic openness, which might not perfectly mirror noisy, real-world data.

Summary updated

BibTeX
@misc{bhattacharjee2024beyond,
  author = {Robi Bhattacharjee and Nick Rittler and Kamalika Chaudhuri},
  title = {{Beyond Discrepancy: A Closer Look at the Theory of Distribution Shift}},
  year = {2024},
  eprint = {2405.19156},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.19156},
}
Figure