Learning Stable Classifiers by Transferring Unstable Features

Yujia Bao, Shiyu Chang, Regina Barzilay

TL;DR

Machine learning models often fail when they rely on "spurious correlations"—unstable features like backgrounds that happen to correlate with labels during training but disappear in the real world. This paper introduces TOFU (Transfer OF Unstable features), a method that identifies these biases in a source task and transfers that knowledge to a target task, allowing the model to explicitly ignore those same biases and achieve significantly higher robustness.

What Problem Does This Paper Address?

Standard machine learning assumes that the correlations found in training data will hold during testing. However, models frequently latch onto spurious correlations (e.g., a cow is usually on grass, so the model learns "grass = cow"). These are unstable features: they work in one environment but fail in another.

The challenge is that "bias" is often a human-defined concept. Without explicit labels for what constitutes a bias (like "background color" or "gender"), a model has no way to distinguish a stable, causal feature from an unstable, spurious one. While some methods try to automatically de-bias, they often fail because they lack the context of which features to ignore for a specific task. The authors argue that related tasks often share the same biases, and we can use a "source" task to learn what those biases look like.

The TOFU Method

The authors propose a two-step algorithm called TOFU:

  1. Inferring Unstable Features (Source Task): In the source task, data is available from multiple environments where the spurious correlations differ. TOFU trains environment-specific classifiers. By analyzing where a classifier trained on Environment A makes mistakes on Environment B, the algorithm identifies features that are unstable. It then learns a representation that specifically encodes these unstable features using a triplet loss.

  2. Learning Stable Correlations (Target Task): In the target task (where there might only be one environment available), the learned representation is used to cluster the data. These clusters act as proxies for the "bias groups" (e.g., one cluster for "cows on grass," another for "cows on sand"). Finally, the model uses Group Distributionally Robust Optimization (Group DRO) to minimize the worst-case risk across these clusters. This forces the model to perform well regardless of the unstable feature's value.

Key Insights and Ideas

  • Mistakes are a Signal: A key insight is that a model's errors when moving between environments are not random; they are often driven by the model's reliance on features that changed. These mistakes serve as a powerful, unsupervised signal for identifying bias.
  • Bias is Transferable: Even if the labels change (e.g., from "camel vs. cow" to "sheep vs. antelope"), the underlying spurious correlations (like the backgrounds) often remain the same.
  • Direct Transfer Fails: Simply fine-tuning a "robust" source model on a target task doesn't work. The internal representation of the source model still contains the bias, which the target model quickly exploits. TOFU succeeds because it uses the source task to define what to avoid, rather than just providing a starting point.
Comparison of methods on Colored MNIST. Standard transfer fails when spurious correlations flip, while TOFU matches the performance of an Oracle with perfect knowledge of the bias.

Experimental Results

The researchers evaluated TOFU across five diverse datasets, including Colored MNIST, text classification (BeerReview, ASK2ME), and image classification (Waterbird, CelebA).

  • Synthetic Robustness: On Colored MNIST and BeerReview, TOFU improved accuracy by an average of 22.9% over the best baseline, nearly matching the "Oracle" performance (the theoretical upper bound where bias is perfectly known).
  • Real-World Performance: On the CelebA dataset, TOFU achieved the best "worst-group accuracy" across 38 different latent attributes, outperforming the best baseline by 18.06%.
  • Visualizing Bias: PCA visualizations confirm that TOFU's learned representation successfully separates data based on hidden spurious features (like color), even when those features were never explicitly labeled.

Limitations and Future Work

  • Shared Bias Assumption: TOFU relies on the source and target tasks sharing the same set of unstable features. If the target task has a completely new, unique bias, TOFU cannot "see" it.
  • Domain Shift: The current work assumes the source and target tasks are from the same domain (e.g., both are images or both are text). The authors suggest that using domain-adversarial training could extend TOFU to cross-domain scenarios.
  • Computational Cost: Training multiple environment-specific classifiers in the source phase adds computational overhead, though this can be mitigated through multi-task learning.

Summary updated

BibTeX
@inproceedings{bao2022learning,
  author = {Yujia Bao and Shiyu Chang and Regina Barzilay},
  title = {{Learning Stable Classifiers by Transferring Unstable Features}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=xs-tJn58XKv},
}
Figure