Abstract
Contrary to the classical machine learning mantra that "more data is always better," adding out-of-distribution (OOD) data can cause generalization error to behave non-monotonically. Performance initially improves as OOD data is introduced, but severely degrades as the volume of OOD data increases. This paper investigates the dynamics of this "U-shaped" error curve and demonstrates that by using a weighted training objective to balance target and OOD samples, researchers can mitigate this degradation and turn OOD data into a consistent asset for model generalization.
Introduction: The Problem with "Impure" Data
In classical learning theory, it is generally assumed that increasing the size of a training dataset leads to better generalization. However, real-world datasets are rarely pure. They are frequently contaminated with out-of-distribution (OOD) samples—data that deviates from the target task due to sensor noise, geometric nuisances (like viewpoint changes), semantic differences, or temporal shifts.
While it is well understood that OOD data can be detrimental to model performance, the specific dynamics of how it affects learning have remained poorly characterized. Specifically, a counter-intuitive phenomenon often emerges: a small amount of OOD data can help a model generalize, while a large amount of the exact same data degrades performance. This paper aims to characterize this non-monotonic behavior and provide actionable strategies to exploit OOD data safely.
The Bias-Variance Trade-off of OOD Data
The non-monotonic trend observed when adding OOD data is driven by a fundamental bias-variance trade-off. Initially, introducing OOD data helps by providing more overall samples, which reduces the variance of the learned hypothesis. However, as the proportion of OOD data grows, the distributional difference between the OOD and target data becomes the dominant factor. This introduces a bias that pulls the model away from the optimal solution for the target task.
The point at which OOD data begins to harm performance depends heavily on a "similarity threshold." If the OOD data is highly similar to the target task, the generalization error might decrease monotonically. Conversely, if the OOD data is vastly different, the initial reduction in error is shallow, followed by a steep increase. Interestingly, standard mitigation strategies like heavy data augmentation or pre-training fail to correct this non-monotonic trend if the learner remains "agnostic" (i.e., unaware of which samples are OOD).
Methodology
To understand and correct this behavior, the authors employ both theoretical modeling and empirical experimentation across a wide range of complexities, from synthetic 1D Gaussian mixtures to vision benchmarks like MNIST, CIFAR-10, CINIC-10, PACS, and DomainNet.
- Theoretical Modeling via FLD: Using Fisher’s Linear Discriminant (FLD) on a 1D synthetic Gaussian mixture model, the authors analytically derive the generalization error. This proves that the error is a direct function of the ratio between target and OOD samples.
-
$\alpha$-Weighted Empirical Risk: To correct the non-monotonicity, they propose a weighted objective: $$\hat{e}_\alpha(h) = \alpha \hat{e}_t(h) + (1 - \alpha)\hat{e}_o(h)$$ where $\hat{e}_t$ is the loss on target data and $\hat{e}_o$ is the loss on OOD data. By tuning the parameter $\alpha$, the influence of the OOD samples can be explicitly controlled.
-
Biased Mini-batch Sampling: When OOD data vastly outnumbers target data, standard uniform sampling leads to "target-starved" gradients. To stabilize training, the authors implement a sampling procedure where each mini-batch contains a fixed fraction ($\beta$) of target samples.
Key Findings
The empirical results on neural networks closely match the analytical predictions made using the simpler FLD model, suggesting this U-shaped error curve is a general property of empirical risk minimization. Non-monotonic curves were observed across all tested architectures (SmallConv, WRN-10-2, WRN-16-4) and datasets. For instance, in the PACS benchmark, adding "Sketch" data to a "Photo" target task initially lowered the error but subsequently caused it to spike by several percentage points.
Crucially, the authors found that OOD data is almost always useful. The optimal weight $\alpha$ is rarely exactly 1.0, meaning that even highly "messy" OOD data contains some structural information that benefits the target task when weighted correctly. By using the $\alpha$-weighted objective with an optimal $\alpha$ (discovered via grid search), the researchers successfully converted the U-shaped error curves into monotonically decreasing ones. Furthermore, for deep networks, biased mini-batch sampling (e.g., $\beta = 0.5$ or $0.75$) proved essential for achieving optimal test error when OOD data was abundant.
Limitations and Future Directions
While the $\alpha$-weighted objective effectively mitigates the negative impacts of OOD data, it relies on a significant assumption: the ability to identify which samples in the training set are OOD. In many real-world scenarios, datasets are black boxes where target and OOD samples are inextricably mixed.
Additionally, because current learning theory tools are primarily designed for infinite data, there is a pressing need for new theoretical frameworks to better characterize these trends in the finite-sample regime. Future work must focus on developing methods to automatically estimate the optimal $\alpha$ or identify OOD samples without manual labeling, potentially leveraging two-sample tests or influence functions to make these insights applicable to uncurated, real-world datasets.
Summary updated