Leveraging Gradients for Unsupervised Accuracy Estimation under Distribution Shift

Renchunzi Xie, Ambroise Odonnat, Vasilii Feofanov, Ievgen Redko, Jianfeng Zhang, Bo An

Introduction

Machine learning models often experience significant performance degradation when deployed in environments that differ from their training data, a phenomenon known as distribution shift. In real-world applications, such as autonomous driving or medical diagnostics, it is crucial to estimate a model's reliability without access to ground-truth labels. This paper introduces GdScore, a novel, unsupervised method that leverages gradient information to predict test accuracy under various distribution shifts.

Problem Statement

Traditional unsupervised accuracy estimation methods typically rely on model confidence (softmax outputs) or internal feature representations. However, these methods often falter when models are poorly calibrated or when shifts are severe. The core research question is whether the signals used to train a model—its gradients—can serve as a robust proxy for its generalization performance on unseen domains.

Methodology: The GdScore Approach

GdScore is a lightweight, gradient-based statistic designed for rapid estimation. The method follows a four-step process:

  1. Hybrid Pseudo-Labeling: To avoid bias from "confident but incorrect" predictions, the method uses a confidence threshold $\tau$. Samples with confidence above $\tau$ receive the model's predicted label, while those below receive a random label.
  2. Single-Step Backpropagation: The cross-entropy loss is calculated using these pseudo-labels, followed by exactly one step of backpropagation.
  3. Layer-Specific Extraction: Gradients are extracted specifically from the final classification layer, which has been found to be more sensitive to domain shifts than lower layers.
  4. $L_p$-Norm Calculation: The GdScore is defined as the $L_p$-norm of these gradients, with $p=0.3$ empirically found to be optimal for high-dimensional gradient spaces.

The intuition is that a model "struggles" more with out-of-distribution data, resulting in higher gradient magnitudes compared to data it generalizes well to.

Experimental Results

The authors evaluated GdScore across 11 benchmark datasets encompassing synthetic, natural, and subpopulation shifts.

Performance and Correlation

GdScore demonstrates a remarkably strong linear correlation with true test accuracy. As shown in the comparison below, GdScore maintains a tighter linear relationship compared to existing methods like Dispersion Score or ProjNorm, especially as accuracy fluctuates across different corruption types and severities.

Comparison of accuracy estimation methods: GdScore shows a more consistent linear correlation with true test accuracy compared to Dispersion Score and ProjNorm.

Quantitatively, GdScore consistently achieves higher $R^2$ and Spearman correlation ($\rho$) values across nearly all tested datasets and architectures (ResNet18, ResNet50, WRN-50-2), as detailed in the comprehensive results table.

Comprehensive performance comparison of accuracy estimation methods across 11 datasets. GdScore (Ours) consistently outperforms baselines in R-squared and Spearman correlation.

Efficiency

Beyond accuracy, GdScore is significantly more efficient than iterative self-training methods. By requiring only a single pass over the last layer's gradients, it achieves up to an 80% reduction in computation time compared to ProjNorm, making it suitable for real-time monitoring.

Discussion and Conclusion

The success of GdScore highlights the value of gradient information as a proxy for model-data dissimilarity. Key findings include the effectiveness of random labeling for low-confidence samples and the superiority of the $L_{0.3}$ norm. While the method's performance is tied to model calibration, its robustness across diverse shifts makes it a powerful tool for reliable AI deployment. Future work will explore extending this gradient-based framework to non-classification tasks and a wider array of neural architectures.

Summary updated

BibTeX
@article{xie2025leveraging,
  author = {Renchunzi Xie and Ambroise Odonnat and Vasilii Feofanov and Ievgen Redko and Jianfeng Zhang and Bo An},
  title = {{Leveraging Gradients for Unsupervised Accuracy Estimation under Distribution Shift}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure