# Training on Test Data with Bayesian Adaptation for Covariate Shift

**Authors:** Aurick Zhou, Sergey Levine  
**arXiv:** [2109.12746](https://arxiv.org/abs/2109.12746)  
**Date:** 2021-09-27  
**Summary page:** https://www.summarizepaper.com/en/paper/2109.12746v1/

## Key points

- Distribution shifts at test time are a common challenge in deep neural networks
- Dealing with distribution shifts leads to inaccurate predictions and unreliable uncertainty estimates
- Adapting neural networks to unlabeled inputs from specific distribution shifts is an alternative approach
- The relationship between unlabeled inputs and model parameters is unclear in the standard Bayesian model for supervised learning
- This paper introduces a Bayesian model that establishes a relationship between unlabeled inputs and model parameters under distributional shift
- An approximate inference method based on regularized entropy minimization is proposed to instantiate this model at test time
- The method is evaluated on various distribution shifts for image classification tasks, including image corruptions, natural distribution shifts, and domain adaptation settings
- Results show improved accuracy and enhanced uncertainty estimation compared to prior heuristic methods
- Reliable uncertainty estimates allow for quantifying risks when making predictions
- The research provides insights into how unlabeled test data can inform optimal classifiers under covariate shift
- The proposed method offers a principled framework for adapting models using unlabeled data during testing

## Summary

, , , , 

In the field of deep neural networks, one common challenge is dealing with distribution shifts at test time. This often leads to inaccurate predictions and unreliable uncertainty estimates. While improving the robustness of neural networks is a potential solution, an alternative approach is to directly adapt them to unlabeled inputs from the specific distribution shift encountered at test time. However, this raises a difficult question: in the standard Bayesian model for supervised learning, unlabeled inputs are conditionally independent of model parameters when labels are unobserved. Therefore, it is unclear what information unlabeled data can provide about the model parameters at test time. To address this question, this paper introduces a Bayesian model that establishes a well-defined relationship between unlabeled inputs under distributional shift and model parameters. The authors propose an approximate inference method based on regularized entropy minimization to instantiate this model at test time. They evaluate their method on various distribution shifts for image classification tasks, including image corruptions, natural distribution shifts, and domain adaptation settings. The results demonstrate that their approach not only improves accuracy but also enhances uncertainty estimation. This is crucial because reliable uncertainty estimates allow for quantifying risks when making predictions. Prior works have proposed heuristic methods for test-time adaptation but have not considered uncertainty estimation or risk quantification. By taking a Bayesian approach and explicitly formulating a Bayesian model, this paper provides valuable insights into how unlabeled test data under covariate shift can inform optimal classifiers. Overall, this research contributes to addressing the challenges posed by distribution shifts in deep neural networks by developing a principled framework for adapting models using unlabeled data during testing. The proposed method shows promising results in improving both predictive accuracy and uncertainty estimation under different types of distribution shifts in image classification tasks.
