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

Out of the Ordinary: Spectrally Adapting Regression for Covariate Shift

Benjamin Eyre, Elliot Creager, David Madras, Vardan Papyan, Richard S. Zemel

Abstract

Designing deep neural network classifiers that perform robustly on distributions differing from the available training data is an active area of machine learning research. However, out-of-distribution generalization for regression—the analogous problem for modeling continuous targets—remains relatively unexplored. To tackle this problem, we return to first principles and analyze how the closed-form solution for Ordinary Least Squares (OLS) regression is sensitive to covariate shift. We characterize the out-of-distribution risk of the OLS model in terms of the eigenspectrum decomposition of the source and target data. We then use this insight to propose a method for adapting the weights of the last layer of a pre-trained neural regression model to perform better on input data originating from a different distribution. We demonstrate how this lightweight spectral adaptation procedure can improve out-of-distribution performance for synthetic and real-world datasets.

Introduction

Robustness to distribution shift is a critical requirement for deploying machine learning models in the real world. While significant progress has been made in robust classification, regression tasks—such as predicting poverty levels from satellite imagery or estimating physical properties—have received less attention. This work focuses on covariate shift, where the marginal distribution of inputs changes between training (source) and testing (target), while the underlying relationship between inputs and targets remains stable. Standard models like Ordinary Least Squares (OLS) are notoriously sensitive to these changes, often producing massive errors when faced with unfamiliar input variance.

The Problem: Spectral Inflation

The authors identify a phenomenon termed Spectral Inflation as a key driver of out-of-distribution (OOD) failure in regression. In many real-world scenarios, the target distribution may have significant variance in directions (subspaces) that were poorly represented in the training data. Standard regression models often fit these "flat" directions to training noise. When the test data "inflates" along these directions, the model's weights—which were essentially fit to noise—cause prediction errors to explode.

Overview of the Spectral Inflation phenomenon and the SpAR adaptation method. (a) illustrates the difference in input distributions and their eigenvectors. (c) shows how OLS predictions are skewed by inflated directions, while (d) and (e) demonstrate how SpAR recovers the ground truth by projecting out unreliable subspaces.

Methodology: Spectrally Adapted Regression (SpAR)

To mitigate the impact of spectral inflation, the researchers propose SpAR (Spectral Adapted Regressor). SpAR is a lightweight, post-hoc adaptation technique designed for the final linear layer of a pre-trained neural network. Unlike many robust learning methods that require training from scratch, SpAR adapts the model using a set of unlabeled test data.

The procedure involves:

  1. Spectral Analysis: Performing Singular Value Decomposition (SVD) on both source training data and a batch of unlabeled target data.
  2. Inflation Identification: Comparing the eigenspectra to find directions where target variance significantly exceeds source variance.
  3. Bias-Variance Tradeoff: Using a statistical test (based on the Marcum Q-function) to determine if the variance introduced by an inflated direction outweighs the useful information (bias) the model would lose by ignoring it.
  4. Subspace Projection: Projecting the model's weight vector onto the reliable subspace, effectively telling the model to ignore the inflated, noisy directions.

Experimental Evaluation

SpAR was evaluated across synthetic data, tabular benchmarks (CommunitiesAndCrime, SkillCraft), and complex image-based regression tasks (RCF-MNIST, ChairAngles, PovertyMap-WILDS).

  • Performance: On the PovertyMap-WILDS benchmark, SpAR achieved state-of-the-art "worst-group" performance when combined with existing robust training methods like C-Mixup.
  • Efficiency: SpAR is highly efficient. For the PovertyMap dataset, it required only 40 minutes of post-processing compared to 6 hours for training a robust model from scratch (e.g., DARE-GRAM).
  • Versatility: The method consistently improved OOD performance across various base models (ERM, Deep CORAL, DANN), highlighting its utility as a general-purpose add-on for any regression pipeline.

Discussion and Limitations

SpAR provides a principled approach to OOD regression by focusing on the spectral properties of data. However, it requires a batch of unlabeled target data for adaptation and cannot adapt to a single, isolated test point without prior context. Additionally, it assumes covariate shift; if the underlying relationship between inputs and targets changes ("concept shift"), spectral adaptation alone may be insufficient.

Conclusion

By identifying and addressing spectral inflation, SpAR offers a robust and efficient solution for regression under covariate shift. Its post-hoc nature makes it an attractive tool for practitioners looking to enhance the reliability of existing regression models in changing environments without the need for expensive retraining.

Summary updated

BibTeX
@inproceedings{eyre2024out,
  author = {Benjamin Eyre and Elliot Creager and David Madras and Vardan Papyan and Richard S. Zemel},
  title = {{Out of the Ordinary: Spectrally Adapting Regression for Covariate Shift}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=H3bATm4mKn},
}
Figure