NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Model Agnostic Sample Reweighting for Out-of-Distribution Learning

Xiao Zhou, Yong Lin, Renjie Pi, Weizhong Zhang, Renzhe Xu, Peng Cui, Tong Zhang · DOI

Abstract

Out-of-distribution (OOD) generalization remains a significant challenge for deep learning models, which often rely on spurious correlations present in training data. While existing methods like Invariant Risk Minimization (IRM) attempt to address this through model regularization, they frequently fail as models become overparameterized. We present MAPLE (Model Agnostic samPLe rEweighting), a framework that shifts the focus from parameter regularization to automated sample reweighting via bilevel optimization. By optimizing in the lower-dimensional sample weight space, MAPLE achieves state-of-the-art OOD performance that is remarkably robust to increases in model capacity.

Introduction

Standard Empirical Risk Minimization (ERM) often leads models to latch onto "spurious correlations"—features that correlate with labels in the training set but do not hold in real-world, out-of-distribution scenarios. A classic failure mode is a model identifying a "cow" primarily by its "green grass" background. When the background changes to a beach, the model's accuracy collapses.

Existing solutions, such as IRM and Distributionally Robust Optimization (DRO), introduce regularization terms to penalize reliance on these unstable features. However, these methods face a "pathology" in overparameterized regimes: large neural networks are flexible enough to minimize the regularization penalty to zero while still exploiting spurious cues. Furthermore, many reweighting techniques require explicit "group labels" (e.g., knowing which images contain specific backgrounds), which are rarely available in practice.

Methodology: Bilevel Sample Reweighting

MAPLE addresses these issues by treating OOD generalization as a bilevel optimization problem. Instead of modifying the loss function directly, it learns a set of weights for the training samples that force the model to ignore spurious correlations.

Illustration of sample reweighting in MAPLE. (a) Standard unweighted training. (b) Weighted training identifies influential samples. (c) Weighted+sparse training prunes noisy samples to focus on invariant features.

The Optimization Framework

The process consists of two nested loops:

  1. Inner Loop: The model parameters ($\theta$) are updated using standard ERM on a weighted version of the training data.
  2. Outer Loop: The sample weights ($w$) are optimized to minimize an OOD criterion (such as the IRM or DRO loss) evaluated on a held-out validation set.

This approach offers several advantages. First, by optimizing in the "sample weight space" rather than the "parameter space," MAPLE significantly reduces the search dimensionality, preventing the model from overfitting to spurious noise. Second, the framework is model agnostic; weights learned on a smaller architecture (e.g., ResNet-18) can be effectively transferred to larger models (e.g., ResNet-50). Finally, the authors incorporate an $L_0$ relaxation using Gumbel-softmax to encourage weight sparsity, effectively pruning noisy or misleading samples from the training process.

Experimental Results

MAPLE was evaluated across a variety of synthetic and real-world OOD benchmarks, including ColoredMNIST, CIFARMNIST, Waterbirds, and CelebA.

Performance and Scalability

A key finding is MAPLE's stability across different model sizes. In experiments on ColoredMNIST, standard methods like IRM and ERM showed significant performance degradation as the number of hidden dimensions increased. In contrast, MAPLE maintained high accuracy, closely tracking the performance of the "Oracle" (a theoretical upper bound).

Top-1 Test Accuracy across varying hidden dimensions for ColoredMNIST datasets. MAPLE maintains high performance comparable to the Oracle, while standard methods like IRM and ERM degrade or remain low as model complexity increases.

Key Benchmarks

  • CIFARMNIST: MAPLE achieved 82.9% accuracy, significantly outperforming IRMv1 (51.3%) and SparseIRM (63.9%).
  • Waterbirds: MAPLE reached a worst-group accuracy of 91.7%. Notably, this exceeded the 91.4% achieved by GroupDRO, even though GroupDRO requires manual group labels that MAPLE does not use.
  • Automatic Group Discovery: Without any group annotations, MAPLE successfully identified and upweighted rare or difficult groups, effectively "discovering" the underlying distribution shifts.

Discussion and Conclusion

MAPLE demonstrates that sample reweighting is a powerful alternative to model-based regularization for OOD learning. By leveraging a small validation set to guide the weight search, it avoids the memorization pitfalls common in overparameterized models.

While highly effective in vision tasks, future research is needed to evaluate MAPLE's performance in Natural Language Processing and other domains. Additionally, while the authors utilized 1-step truncated backpropagation to mitigate the computational cost of bilevel optimization, the overhead remains a factor for extremely large-scale deployments. Nonetheless, MAPLE provides a robust, model-agnostic path toward building neural networks that generalize more reliably to the real world.

Summary updated

BibTeX
@inproceedings{zhou2022model,
  author = {Xiao Zhou and Yong Lin and Renjie Pi and Weizhong Zhang and Renzhe Xu and Peng Cui and Tong Zhang},
  title = {{Model Agnostic Sample Reweighting for Out-of-Distribution Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=cNt4OI012BC},
}
Figure