The Value of Out-of-distribution Data

Ashwin De Silva, Rahul Ramesh, Carey Priebe, Pratik Chaudhari, Joshua T Vogelstein · DOI

Abstract

While conventional machine learning wisdom suggests that more data leads to better performance, the inclusion of out-of-distribution (OOD) data presents a complex challenge. This paper investigates the impact of incrementally adding OOD data to a training set, revealing a non-monotonic "U-shaped" generalization error curve. We demonstrate that while limited OOD data can act as a beneficial regularizer by reducing variance, excessive amounts introduce significant bias, ultimately degrading performance on the target task. This finding highlights a critical "sweet spot" for OOD data utilization that current theoretical frameworks often fail to predict.

Introduction

In the classical view of machine learning, data is a blessing—provided it comes from the same distribution as the test set. OOD data, which is shifted or different from the target task, is typically treated as a nuisance to be ignored. However, the success of large-scale pre-training and heavy data augmentation suggests that OOD data can be beneficial. This study reconciles these views by asking a fundamental question: how does generalization error on a target task change as we incrementally add more OOD data to the training set?

Theoretical Framework: The U-Shaped Error Curve

To understand the fundamental mechanics of this phenomenon, we first analyze Fisher’s Linear Discriminant (FLD) on synthetic 1D Gaussian mixture datasets. By varying the translation ($\Delta$) between target and OOD distributions, we can mathematically derive the exact expected generalization error.

Analytical generalization error curves showing the non-monotonic 'U-shaped' trend as OOD data is added.

As illustrated in the figure above, when the distribution shift is sufficiently large, the error does not decrease monotonically. Instead, it initially "dips," reaching a minimum before rising sharply. This initial improvement suggests that OOD data provides a regularization effect that outweighs the introduced bias at low volumes. Existing generalization bounds are often too loose to capture this initial dip, indicating a gap in current learning theory.

Empirical Validation in Deep Learning

We validated these theoretical findings using deep learning architectures, including Small Convolutional networks and Wide Residual Networks (WRN), across several computer vision benchmarks. These included MNIST and CIFAR-10 modified with geometric nuisances (rotations) and semantic nuisances (blurring), as well as domain generalization benchmarks like PACS and DomainNet.

Empirical validation of the U-shaped error curve across Rotated CIFAR-10, Blurred CIFAR-10, and SplitCIFAR-10.

The empirical results mirror the analytical model. In tasks involving rotations or blurring, we consistently observe the non-monotonic trend. For instance, in Rotated CIFAR-10, specific ratios of OOD to target data yield lower error than training on target data alone. However, as the OOD data volume increases, the error eventually becomes significantly worse, confirming that the "U-shape" is a widespread phenomenon in practical deep learning settings.

The Bias-Variance Tradeoff

The non-monotonic behavior can be explained through the lens of the bias-variance tradeoff. Initially, adding OOD samples increases the total sample size, which reduces the variance of the learned model. However, because these samples are drawn from a different distribution, they pull the decision boundary away from the target optimum, introducing bias. The "sweet spot" occurs where the reduction in variance is most effectively balanced against the increase in bias. Standard strategies like data augmentation or pre-training do not naturally eliminate this behavior if the model cannot distinguish between target and OOD samples.

Mitigation and Future Directions

We explored an $\alpha$-weighted objective to "rectify" the error curve. By weighting the loss function between target and OOD data, the U-shaped curve can be transformed into a monotonic decrease, ensuring OOD data always provides a benefit. However, this approach requires knowing the identity of OOD samples, which is rarely possible in "in-the-wild" datasets.

Future research should focus on automated OOD detection to identify samples for weighting and the development of tighter theoretical bounds that can account for the beneficial regularization effect of OOD data without requiring explicit labels.

Summary updated

BibTeX
@inproceedings{silva2023value,
  author = {Ashwin De Silva and Rahul Ramesh and Carey Priebe and Pratik Chaudhari and Joshua T Vogelstein},
  title = {{The Value of Out-of-distribution Data}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=RqNaJx9R-6},
}
Figure