Are All Unseen Data Out-of-Distribution?

Songming Zhang, Yuxiao Luo, Qizhou Wang, Haoang Chi, Weikai Li, Bo Han, Jinyan Li

Abstract

Deep neural networks often face generalization problems to handle out-of-distribution (OOD) data, and there remains a notable theoretical gap between the contributing factors and their respective impacts. Literature evidence from in-distribution data has suggested that generalization error can shrink if the size of mixture data for training increases. However, when it comes to OOD samples, this conventional understanding does not hold anymore -- Increasing the size of training data does not always lead to a reduction in the test generalization error. In fact, diverse trends of the errors have been found across various shifting scenarios including those decreasing trends under a power-law pattern, initial declines followed by increases, or continuous stable patterns. Previous work has approached OOD data qualitatively, treating them merely as samples unseen during training, which are hard to explain the complicated non-monotonic trends. In this work, we quantitatively redefine OOD data as those situated outside the convex hull of mixed training data and establish novel generalization error bounds to comprehend the counterintuitive observations better. Our proof of the new risk bound agrees that the efficacy of well-trained models can be guaranteed for unseen data within the convex hull; More interestingly, but for OOD data beyond this coverage, the generalization cannot be ensured, which aligns with our observations. Furthermore, we attempted various OOD techniques to underscore that our results not only explain insightful observations in recent OOD generalization work, such as the significance of diverse data and the sensitivity to unseen shifts of existing algorithms, but it also inspires a novel and effective data selection strategy.

Introduction: The Generalization Gap

In-distribution (ID) generalization is a cornerstone of deep learning: as training datasets grow, model error typically follows a predictable power-law decline. However, real-world applications frequently encounter "distribution shifts"—scenarios where a model trained on photos must recognize sketches or handle varying levels of image blur. In these Out-of-Distribution (OOD) settings, the "more is better" mantra often fails.

Researchers have observed "counterintuitive" trends where increasing training data causes OOD error to stagnate or even increase. This paper addresses the lack of a quantitative distinction between "unseen data similar to training" and "true OOD data," which has historically left theoretical bounds loose and unhelpful for practical engineering.

Redefining OOD: The Convex Hull Framework

The authors propose a quantitative shift from qualitative definitions of OOD. They define the "mixture of training data" as a convex hull—the multi-dimensional space spanned by the various source domains used during training.

  • Interpolated Unseen Data: Samples falling inside this hull are treated as ID-like. Even if unseen, their performance is theoretically guaranteed to improve with more data.
  • Extrapolated OOD Data: Samples falling outside this hull are "true" OOD. For these, generalization is hindered by the distance from the training hull.
Visualizing the convex hull of source domains (Art, Photo, Cartoon) and the OOD Sketch domain.

By establishing new generalization error bounds based on this geometry, the authors show that while error shrinks for data inside the hull as training size ($N$) increases, error for data outside the hull is constrained by a "distance" factor ($\delta$), explaining why simple scaling fails.

Empirical Observations: When More Data Fails

The study validates these theoretical bounds across diverse benchmarks, including Rotated MNIST, Blurred CIFAR-10, and DomainNet. The results reveal that for significant shifts (e.g., large rotation angles or high blur levels), the OOD generalization error does not follow a simple power law.

OOD generalization error trends across different datasets and shifts, showing non-monotonic behavior as training size increases.

As shown in the figures, for large shifts, the error often plateaus or even increases after an initial decline. This "non-monotonic" behavior suggests that models may overfit to the specific noise or patterns of the training shifts, losing the ability to generalize to different degrees of those same shifts.

Beyond Volume: Diversity and RL-Guided Selection

A key insight is that Diversity > Volume. Simply increasing sample counts from existing distributions yields diminishing returns for OOD generalization. Expanding the coverage—the diversity of source domains—is the only reliable way to lower the OOD error bound.

To operationalize this, the authors propose an RL-Guided Data Selection strategy. Using the REINFORCE algorithm, they select training samples that maximize diversity, effectively "stretching" the convex hull to cover more potential test scenarios. On the PACS dataset, this method achieved a significantly steeper reduction in error compared to random sampling by prioritizing representational reach.

Conclusion

This work provides a rigorous framework for understanding OOD generalization by distinguishing between interpolation and extrapolation. While pre-training on massive, diverse datasets like ImageNet remains a powerful tool for broadening the initial convex hull, the findings underscore that for specific OOD challenges, strategic data selection and domain diversity are more critical than sheer data volume. Future work will explore integrating this theory with domain generalization algorithms like IRM and applying it to the massive training mixtures of Large Language Models.

Summary updated

BibTeX
@misc{zhang2023are,
  author = {Songming Zhang and Yuxiao Luo and Qizhou Wang and Haoang Chi and Weikai Li and Bo Han and Jinyan Li},
  title = {{Are All Unseen Data Out-of-Distribution?}},
  year = {2023},
  eprint = {2312.16243},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.16243},
}
Figure