Leveraging Gradients for Unsupervised Accuracy Estimation under Distribution Shift
Renchunzi Xie, Ambroise Odonnat, Vasilii Feofanov, Ievgen Redko, Jianfeng Zhang, Bo An
TL;DR
This work addresses unsupervised estimation of model accuracy under distribution shift by introducing GdScore, a lightweight proxy based on the L_p norm of the classification-layer gradient after a single gradient step on unlabeled test data. The method uses a simple pseudo-labeling strategy that combines high-confidence predictions with random labels for low-confidence samples, enabling backpropagation without access to true test labels. The authors provide theoretical connections between gradient norms and true risk under shift and demonstrate state-of-the-art empirical performance across 11 benchmarks and multiple architectures, while being significantly faster than existing self-training baselines. The approach is robust across synthetic, natural, and subpopulation shifts, making it practical for real-world deployment with large models and confidential data. Overall, the paper highlights the informative role of gradient magnitudes in generalization under distribution shift and offers a scalable tool for unsupervised accuracy estimation.
Abstract
Estimating the test performance of a model, possibly under distribution shift, without having access to the ground-truth labels is a challenging, yet very important problem for the safe deployment of machine learning algorithms in the wild. Existing works mostly rely on information from either the outputs or the extracted features of neural networks to estimate a score that correlates with the ground-truth test accuracy. In this paper, we investigate -- both empirically and theoretically -- how the information provided by the gradients can be predictive of the ground-truth test accuracy even under distribution shifts. More specifically, we use the norm of classification-layer gradients, backpropagated from the cross-entropy loss after only one gradient step over test data. Our intuition is that these gradients should be of higher magnitude when the model generalizes poorly. We provide the theoretical insights behind our approach and the key ingredients that ensure its empirical success. Extensive experiments conducted with various architectures on diverse distribution shifts demonstrate that our method significantly outperforms current state-of-the-art approaches. The code is available at https://github.com/Renchunzi-Xie/GdScore
