If your data distribution shifts, use self-learning

Evgenia Rusak, Steffen Schneider, George Pachitariu, Luisa Eck, Peter Gehler, Oliver Bringmann, Wieland Brendel, Matthias Bethge

TL;DR

Simple self-learning techniques like entropy minimization and pseudo-labeling are highly effective, "source-free" tools for adapting computer vision models to test-time distribution shifts. By updating only a fraction of model parameters (such as BatchNorm layers) on unlabeled target data, these methods consistently boost robustness across various architectures and pre-training strategies, achieving state-of-the-art results.

What Problem Does This Paper Address?

Deep learning models are notoriously fragile when encountering data that differs from their training distribution—whether due to image corruptions, weather changes, or artistic variations.

To combat this, two distinct research tracks have emerged: the robustness community, which focuses on heavy data augmentation during pre-training, and the unsupervised domain adaptation (UDA) community, which retrains models using both source and target data. However, UDA is computationally expensive and requires access to the original training data, which is often impossible in production environments due to privacy laws or proprietary constraints.

This paper focuses on the practical middle ground: source-free test-time domain adaptation. How can a deployed model adapt to an unseen, systematic distribution shift on the fly, using only unlabeled target data and without touching its original training set?

Methods

The authors evaluate and unify classical self-learning approaches and propose a novel robust variant:

  1. Entropy Minimization (ENT): Sharpening the model's output distribution to make its predictions more confident.
  2. Hard/Soft Pseudo-Labeling (PL): Using a teacher network's predictions as targets to fine-tune a student network.
  3. Robust Pseudo-Labeling (RPL) [Novel]: Standard pseudo-labeling suffers when the teacher network provides incorrect labels (label noise). The authors replace standard cross-entropy with a noise-tolerant Generalized Cross Entropy (GCE) loss to withstand these errors.

Crucially, when adapting Convolutional Neural Networks (CNNs), they only optimize the affine scale ($\gamma$) and shift ($\beta$) parameters of the Batch Normalization layers. This design choice drastically reduces compute requirements and prevents the model from collapsing into trivial solutions. For Vision Transformers (ViTs), however, they find that full-model adaptation yields the best results.

Figure 1: Robustness and adaptation to new datasets has traditionally been achieved by robust pre-training (with hand-selected/data-driven augmentation strategies, or additional data), unsupervised domain adaptation (with access to unlabeled samples from the test set), or, more recently, self-supervised learning methods. We show that on top of these different pre-training tasks, it is always possible (irrespective of architecture, model size or pre-training algorithm) to further adapt models to the target domain with simple self-learning techniques.

Datasets

The methods were rigorously tested across a wide array of benchmarks:

  • Large-scale: ImageNet-C (common corruptions), ImageNet-R (artistic renditions), and ImageNet-A (natural adversarial examples).
  • Small-scale: CIFAR10-C, STL10, MNIST, and MNIST-M.
  • Real-world shifts (WILDS): Camelyon17 (histopathology images across different hospitals), RxRx1, and FMoW (satellite imagery).
  • ImageNet-D [New]: The authors introduce a new benchmark by mapping 164 overlapping classes from the DomainNet dataset to ImageNet. This creates a systematic domain shift benchmark (covering styles like Clipart, Infograph, Painting, Quickdraw, and Sketch) that remains exceptionally difficult even after adaptation.

Key Insights and Ideas

  • Universality: Self-learning is entirely agnostic to the model's history. Whether a model was trained via standard supervision, heavy data augmentation, self-supervision (like DINO), or UDA, adding a test-time self-learning step always improves performance.
  • Dataset Scale Flips the Winner: The optimal algorithm changes with scale. Robust Pseudo-Labeling (RPL) consistently outperforms Entropy Minimization on large-scale datasets (ImageNet), whereas Entropy Minimization wins on smaller datasets (CIFAR).
  • The Temperature Rule: Through a simplified theoretical "two-point model," the authors prove that to avoid representation collapse during pseudo-labeling, the student network's temperature must exceed the teacher network's temperature ($\tau_s > \tau_t$).
  • Systematic vs. Shuffled Shifts: Test-time adaptation works brilliantly on systematic shifts (like a specific hospital's scanner or a specific type of image corruption) but fails on datasets where domains are mixed or shuffled sample-by-sample at test time (such as RxRx1).

Key Results

The simple addition of self-learning yielded state-of-the-art results across major robustness benchmarks:

  • ImageNet-C: Reduced the mean Corruption Error (mCE) of an EfficientNet-L2 Noisy Student model to a record 22.0% mCE (down from 28.3%).
  • ImageNet-R: Lowered top-1 error from 23.5% to 17.4%.
  • ImageNet-A: Lowered top-1 error from 16.5% to 14.8%.
  • CIFAR10-C: Achieved a new state-of-the-art 8.5% top-1 error when combined with an AugMix-trained WideResNet.

The quantitative breakdown on ImageNet-scale datasets highlights the consistent edge that RPL holds over ENT on large benchmarks:

Table 1: Self-learning decreases the error on ImageNet-scale robustness datasets. Robust pseudo-labeling generally outperforms entropy minimization.

Limitations and Future Work

  • Calibration Penalty: Because self-learning forces the model to maximize its confidence, it severely degrades calibration, leading to a substantial increase in Expected Calibration Error (ECE).
  • Forgetting: Fine-tuning the model parameters to the target domain causes a slight drop in accuracy on the original clean source dataset.
  • Long-term Instability: If run for too many epochs without early stopping, self-learning loops can eventually diverge or collapse. Future work is needed to make these methods stable indefinitely without relying on a validation set to know when to stop training.

Summary updated

BibTeX
@inproceedings{rusak2022if,
  author = {Evgenia Rusak and Steffen Schneider and George Pachitariu and Luisa Eck and Peter Gehler and Oliver Bringmann and Wieland Brendel and Matthias Bethge},
  title = {{If your data distribution shifts, use self-learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=1oEvY1a67c1},
}
Figure