Self-training Avoids Using Spurious Features Under Domain Shift

Yining Chen, Colin Wei, Ananya Kumar, Tengyu Ma

Introduction

Machine learning models often "cheat" by learning spurious correlations—features that happen to predict the label in the training data (the source domain) but have no real causal relationship with the label in the real world (the target domain). For example, a model might learn to associate a specific demographic with an outcome due to biased sampling in the training data, a correlation that fails to generalize to the broader population.

When deploying models to a new target domain, we often only have unlabeled data. Unsupervised domain adaptation attempts to fix domain shift using this unlabeled data, but existing theoretical guarantees mostly assume the source and target domains are already very similar. This paper tackles a much larger, structured domain shift: what happens when a feature is highly predictive in the source domain, but completely independent of the label in the target domain? It demonstrates that self-training on unlabeled target data can help models unlearn these "spurious features."

Theoretical Framework

The authors provide a theoretical analysis of self-training—specifically entropy minimization and pseudo-labeling—under this structured domain shift. To make the math tractable, they analyze linear classification models where the input features are split into two groups:

  1. Signal features ($x_1$): The true features that determine the label. These are modeled as a mixture of log-concave and log-smooth distributions.
  2. Spurious features ($x_2$): Features that correlate with the label in the source data but are independent in the target data. These are modeled as multivariate Gaussians.
Theoretical distributions of features

The algorithm initializes a model trained on the source data, and then runs projected gradient descent on the unlabeled target data to minimize the entropy of its predictions. This essentially forces the model to make confident predictions. The authors theoretically prove that these gradient updates naturally shrink the weights associated with the spurious features down to zero, effectively converging to the Bayes optimal classifier in the Gaussian setting within $O(\log(1/\epsilon))$ iterations.

Key Insights

Self-training is not a silver bullet; the authors identify specific failure cases where it can actually increase reliance on spurious features.

Illustration of the loss landscape and local minima
  • The "Decent Initialization" Requirement: For self-training to successfully discard spurious features, the source classifier must already have a baseline level of accuracy on the target domain. It must rely at least somewhat on the true signal features so that the gradient updates point in the right direction. If the initial model relies almost entirely on the spurious feature, entropy minimization will just push the model to be even more confident about its wrong, biased predictions, trapping it in a bad local minimum.
  • Data Distribution Matters: The theory relies on the signal features having a continuum of confident and unconfident examples. If data is too clustered or isolated, the loss gradient drops to zero before the spurious weights can be eliminated.
  • Algorithmic Equivalence: The authors show that a specific variant of pseudo-labeling (where the model re-labels the target data after every single gradient step) is mathematically equivalent to entropy minimization in this context.

Empirical Validation

To validate that their linear theory holds up in non-linear, deep learning scenarios, the authors use semi-synthetic image datasets:

  • CelebA: A facial attributes dataset partitioned so that gender (the target label) correlates perfectly with hair color (the spurious feature) in the training set, but not in the test set. Self-training a neural network on the unlabeled target data boosted target accuracy from 81% (source-trained model) to 88%, successfully ignoring the hair-color bias.
  • Colored MNIST: The shape of the digit is the true "signal," while the color is the "spurious feature." When color correlated with the label 95% of the time in the source, self-training improved target accuracy from 82% to 91%.
  • Validating the Failure Case: When the spurious correlation in CMNIST was pushed to 97%, the initial model's target accuracy dropped to a poor 72%. As predicted by their theory, self-training on this poorly initialized model degraded performance further to 67%.

Limitations and Future Work

The mathematical proofs are restricted to linear models and specific data distributions. While the experiments show the intuition holds for neural networks, the formal proof does not cover deep non-linear models. Furthermore, the strict requirement that the initial model must be "decently accurate" on the target domain might not always be achievable in practice, especially if the spurious correlation in the source data is overwhelmingly strong and washes out the true signal during initial training. Future work will explore other types of structured domain shifts that can be analyzed with this theoretical framework.

Summary updated

Abstract

In unsupervised domain adaptation, existing theory focuses on situations where the source and target domains are close. In practice, conditional entropy minimization and pseudo-labeling work even when the domain shifts are much larger than those analyzed by existing theory. We identify and analyze one particular setting where the domain shift can be large, but these algorithms provably work: certain spurious features correlate with the label in the source domain but are independent of the label in the target. Our analysis considers linear classification where the spurious features are Gaussian and the non-spurious features are a mixture of log-concave distributions. For this setting, we prove that entropy minimization on unlabeled target data will avoid using the spurious feature if initialized with a decently accurate source classifier, even though the objective is non-convex and contains multiple bad local minima using the spurious features. We verify our theory for spurious domain shift tasks on semi-synthetic Celeb-A and MNIST datasets. Our results suggest that practitioners collect and self-train on large, diverse datasets to reduce biases in classifiers even if labeling is impractical.
BibTeX
@inproceedings{chen2020self,
  author = {Yining Chen and Colin Wei and Ananya Kumar and Tengyu Ma},
  title = {{Self-training Avoids Using Spurious Features Under Domain Shift}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=bzJBHu_n4pl},
}
Figure