The Value of Out-of-Distribution Data

Ashwin De Silva, Rahul Ramesh, Carey E. Priebe, Pratik Chaudhari, Joshua T. Vogelstein

TL;DR

Conventional wisdom dictates that out-of-distribution (OOD) data harms model performance and should be discarded. This paper reveals a counter-intuitive phenomenon: target generalization error can be a non-monotonic function of the amount of OOD data. A small amount of OOD data can actually improve target performance by acting as a variance reducer, whereas larger amounts degrade it as distribution bias begins to dominate.

What Problem Does This Paper Address?

When training machine learning models, datasets are frequently curated incrementally, often leading to an undetected mix of target in-distribution data and out-of-distribution (OOD) data. Classical learning theory suggests a simple binary relationship: if OOD data is similar to the target, it helps; if it is dissimilar, it harms performance monotonically.

The authors challenge this foundational assumption. They investigate whether OOD data from a single distribution can simultaneously help and hurt target generalization error depending purely on the quantity of OOD samples introduced. Furthermore, they explore whether standard engineering safeguards—like data augmentation, pre-training, or hyperparameter optimization—are enough to protect models from performance degradation when OOD data goes unnoticed.

Methods

The authors approach the problem through both theoretical modeling and empirical deep learning experiments:

  1. Analytical Framework (Fisher’s Linear Discriminant): To make the problem mathematically tractable, they analyze a binary classification task using Fisher’s Linear Discriminant (FLD) on a one-dimensional Gaussian mixture model where the OOD distribution is a translated version of the target distribution.
  2. Empirical Deep Learning: They scale their findings to deep neural networks using three architectures: a small convolutional network (SmallConv), a wide residual network (WRN-10-2), and a larger wide residual network (WRN-16-4).
  3. $\alpha$-Weighted Objective: In an idealistic setting where OOD samples are known, they introduce a weighted empirical risk minimization (ERM) objective: $$\alpha \hat{e}_t(h) + (1 - \alpha)\hat{e}_o(h)$$ where $\alpha$ controls the loss contribution between target ($\hat{e}_t$) and OOD ($\hat{e}_o$) data to see if the non-monotonic trend can be exploited or corrected.

Datasets

The authors validate their findings across several widely used computer vision benchmarks, modifying them to create distinct target and OOD pairs:

  • MNIST / Rotated MNIST: 10-way digit classification where unrotated digits serve as the target and rotated digits serve as OOD data.
  • CIFAR-10: Divided into sub-tasks (Split-CIFAR10) to test category shifts, alongside geometric transformations like Rotated CIFAR-10 and Blurred CIFAR-10.
  • CINIC-10: A benchmark combining CIFAR-10 and ImageNet images to evaluate distribution shifts.
  • PACS: A domain generalization dataset containing four distinct environments: Photo (target), Art, Cartoon, and Sketch (OOD).
  • DomainNet: A large-scale domain generalization dataset using the "Real" photo domain as the target and domains like Quickdraw or Sketch as OOD.

Key Insights and Ideas

  • The Bias-Variance Tradeoff: The underlying mechanism behind the non-monotonic "dip" in error is a classic bias-variance tradeoff. When the amount of OOD data ($m$) is small relative to target data ($n$), the OOD samples provide a regularizing effect that reduces the variance of the learned decision boundary. However, as $m$ grows large, the structural difference between the two distributions introduces a severe bias, shifting the decision boundary away from the target optimal.
Figure 2. Mean squared error (MSE) (Y-axis) of the decision threshold ˆc of FLD (see Appendix A.3), for the same setup as that of Figure 1, plotted against the ratio of the OOD and target samples m/n (X-axis) for ∆= 1.8. Squared bias and variance of the MSE are in violet and blue, respectively. This illustration clearly demonstrates the intuition behind non-monotonic target error: the MSE drops initially because of the smaller variance due to the OOD samples. With more OOD samples, MSE increases due to the increasing bias. Non-monotonic trend in MSE of ˆc translates to a similar trend in the target generalization error (0-1 loss).
  • Existing Learning Theory Fails: Traditional generalization bounds (such as those by Ben-David et al., 2010) are too loose ("vacuous") to capture this non-monotonic behavior. They incorrectly predict a strictly monotonic degradation when the distribution shift ($\Delta$) is large.
  • Standard Engineering Fixes Fall Short: If OOD data is undetected, common strategies like data augmentation, pre-training followed by fine-tuning, and hyperparameter optimization fail to mitigate the eventual performance degradation caused by large volumes of OOD data.

Key Results

  • The Optimal OOD "Sweet Spot": In the analytical FLD setup with $n=100$ target samples and a distribution shift of $\Delta=1.6$, the target generalization error reaches a distinct minimum when exactly $m=28$ OOD samples are added, outperforming a model trained purely on target data.
Figure 1. Left: A schematic of the Gaussian mixture model corre- sponding to the target (top) and OOD samples (bottom). The OOD sample size (m = 28) at which the target generalization error is minimized at ∆= 1.6 is indicated at the top. Right: For n = 100, we plot the generalization error of FLD on the target distribution as a function of the ratio of OOD and target samples m/n, for dif- ferent types of OOD samples corresponding to different values of ∆. This plot uses the analytical expression for the generalization error in (2); see Appendix A.6 for a numerical simulation study. For small values of ∆, when the two distributions are similar to each other, the generalization error et(h) decreases monotonically. However, beyond a certain value of ∆, the generalization error is non-monotonic in the number of OOD samples. The optimal value of m/n which leads to the best generalization error is a function of the relatedness between the two distributions, as governed by ∆ in this example. This non-monotonic behavior can be explained in terms of a bias-variance tradeoff with respect to the target distri- bution: a large number of OOD samples reduces the variance but also results in a bias with respect to the optimal hypothesis of the target.
  • Deep Network Validation: This U-shaped generalization curve consistently appears in deep networks across DomainBed benchmarks. For example, when training on PACS or DomainNet, adding sketched or quickdraw images initially improves accuracy on real photos before severely degrading it at higher ratios.
Figure 5. Non-monotonic trends in target generalization error on three DomainBed benchmarks. Left: Rotated MNIST (10 classes, 10 target samples/class, SmallConv), Middle: PACS (3 classes {dog, elephant, horse}, 10 target samples/class, WRN-16-4), and Right: DomainNet (2 classes {bird, plane}, 25 target samples/class, WRN-16-4). Error bars indicate 95% confidence intervals (10 runs). Also see Figure A9 for results from a 40-way classification task from DomainNet.
  • Rectifying the Trend: If OOD data can be identified, optimizing the loss weight $\alpha^*$ via grid search completely eliminates the non-monotonic degradation, ensuring that adding OOD data consistently improves or maintains target performance.

Limitations and Future Work

  • Dependency on OOD Labels: The proposed solution ($\alpha$-weighted ERM) is a proof-of-concept that requires knowing exactly which samples are OOD in advance. In real-world applications, this metadata is rarely available.
  • Clean Validation Data Required: Finding the optimal weight $\alpha^*$ requires a clean, held-out validation set drawn purely from the target distribution, which can be difficult to acquire in data-scarce environments.
  • Future Directions: The authors highlight a critical need for new learning-theoretic tools capable of formally modeling non-monotonicity under finite sample sizes, alongside practical algorithms that can automatically detect OOD data and dynamically adjust loss weights during training.

Summary updated

BibTeX
@inproceedings{silva2023value,
  author = {Ashwin De Silva and Rahul Ramesh and Carey E. 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