ELSA: Efficient Label Shift Adaptation through the Lens of Semiparametric Models

Qinglong Tian, Xin Zhang, Jiwei Zhao

TL;DR

ELSA (Efficient Label Shift Adaptation) is a novel framework that tackles the problem of label shift in domain adaptation using the geometry of influence functions from semiparametric statistics. By framing the problem as a moment-matching task, ELSA achieves state-of-the-art accuracy without the need for computationally expensive post-prediction calibration, making it significantly faster and more robust than traditional maximum likelihood approaches.

What Problem Does This Paper Address?

In machine learning, we often assume that our training (source) and testing (target) data come from the same distribution. However, in the real world, distributions often shift. This paper focuses on label shift (or prior probability shift), where the marginal distribution of labels $p(y)$ changes between domains, but the conditional distribution of features given the label $p(x|y)$ remains identical.

Imagine a medical diagnostic tool trained in a region with low disease prevalence (source) but deployed in a region during an outbreak (target). While the symptoms ($x$) given a specific infection ($y$) are the same, the probability of any patient having the infection is much higher in the target domain.

Existing solutions generally fall into two camps:

  1. Confusion Matrix Methods (e.g., BBSE, RLLS): These are simple and fast but often suffer from high estimation errors.
  2. Maximum Likelihood Label Shift (MLLS): This is more accurate but has a "calibration trap." It only works well if the underlying predictive model is perfectly calibrated (i.e., its predicted probabilities match true frequencies). Achieving this requires "post-prediction calibration" (like Temperature Scaling), which adds computational overhead and sensitivity to the choice of calibration method.

ELSA aims to bridge this gap: providing the high accuracy of MLLS with the simplicity and speed of confusion matrix methods, all while ditching the requirement for calibration.

Methods

The authors leverage semiparametric theory to derive a new estimator. Instead of assuming a specific parametric form for the feature distribution $p(x|y)$, they treat it as a "nuisance parameter"—something necessary for the model but not the primary object of interest.

Key technical steps include:

  • Influence Functions: The authors use the geometry of influence functions to find a function space perpendicular to the nuisance parameters. This ensures the estimator is robust even if the nuisance models are misspecified.
  • Moment-Matching Framework: They show that estimating importance weights $\omega$ (the ratio of target to source label probabilities) can be reduced to matching the moments of a specific mapping $h(x)$ across the two domains.
  • The ELSA Estimator: By choosing a specific form for $h(x)$ based on the projection of the score function, they arrive at a system of linear equations. This allows the importance weights to be calculated efficiently via linear algebra or a simple fixed-point iteration.

Theoretically, the authors prove that ELSA is $\sqrt{n}$-consistent and asymptotically normal, providing strong statistical guarantees for its performance.

Datasets

The researchers evaluated ELSA against standard benchmarks:

  • MNIST: The classic handwritten digit dataset.
  • CIFAR-10 & CIFAR-100: Popular image classification datasets with 10 and 100 classes, respectively.

To simulate label shift, they used a Dirichlet distribution to generate synthetic target label distributions, controlled by a parameter $\alpha$ (where smaller $\alpha$ indicates a more severe shift). They also tested a "tweak-one" shift mechanism.

Key Insights and Ideas

  • Calibration is a Robustness Issue: The paper argues that the need for calibration in previous methods was essentially a workaround for model misspecification. By using a semiparametric approach, ELSA builds robustness directly into the estimator's geometry.
  • Geometry over Iteration: While MLLS often relies on the Expectation-Maximization (EM) algorithm, ELSA’s foundation in influence functions leads to a solution that can be found by solving linear systems, which is inherently more stable and faster.
  • Independence from Calibration: Perhaps the most striking insight is that ELSA performs optimally even with "vanilla" uncalibrated neural networks. As shown in the experiments, adding calibration doesn't significantly change ELSA's performance, whereas it is mandatory for MLLS.

Key Results

  • Superior Accuracy: ELSA consistently achieved lower Mean Squared Error (MSE) in estimating importance weights compared to BBSE, RLLS, and uncalibrated MLLS. In some MNIST scenarios, it reduced MSE by nearly 50% compared to RLLS.
MSE vs. Alpha (Shift Severity)
As seen in Figure 1, ELSA (solid blue line) maintains a low, stable MSE across different degrees of shift ($\alpha$), while other methods degrade significantly as the shift becomes more severe (smaller $\alpha$).
  • Massive Speedup: Because it avoids the calibration phase and converges in just 1-2 iterations, ELSA is much faster.
Computation Time Comparison
Figure 4 highlights the trade-off: ELSA achieves the lowest MSE in less than 2.5 seconds, while the best-performing calibrated MLLS methods take between 10 and 20+ seconds.
  • Sample Efficiency: ELSA performs better than competitors even with smaller sample sizes, as shown in Figure 2.

Limitations and Future Work

  • Optimal Mapping: While the authors propose a specific mapping $h_{ELSA}(x)$, they acknowledge that finding the theoretically optimal mapping function for $x$ remains an open research question.
  • Complex Shifts: The current work focuses on pure label shift. Future research could extend this semiparametric framework to more complex scenarios, such as open-set label shift, where the target domain contains entirely new classes not seen during training.

Summary updated

BibTeX
@inproceedings{tian2023elsa,
  author = {Qinglong Tian and Xin Zhang and Jiwei Zhao},
  title = {{ELSA: Efficient Label Shift Adaptation through the Lens of Semiparametric Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=Nf2JpOSDsb},
}
Figure