Simple and Fast Group Robustness by Automatic Feature Reweighting

Shikai Qiu, Andres Potapczynski, Pavel Izmailov, Andrew Gordon Wilson

Abstract

Machine learning models often achieve high accuracy by exploiting spurious correlations—patterns that are predictive in the majority of training data but fail in minority groups. While existing group robustness methods often require expensive group annotations or complex, multi-stage training procedures, we present Automatic Feature Reweighting (AFR). AFR is a simple, two-stage method that retrains only the last layer of a pre-trained model using a weighted loss based on the model's own prediction confidence. AFR achieves state-of-the-art worst-group accuracy with minimal computational overhead and without requiring group labels during training.

1. Introduction

A persistent challenge in machine learning is the tendency of models to prioritize "spurious features" over "core features." For instance, in the Waterbirds dataset, models often learn to associate water backgrounds with waterbirds rather than identifying the bird's physical characteristics. When presented with a waterbird on land (a minority group), these models fail. This phenomenon, known as group robustness failure, occurs because the model finds the spurious correlation easier to learn than the causal feature.

Current solutions generally fall into two categories: oracle-based methods that require explicit group labels for every training sample, and annotation-free methods that attempt to infer groups. The former is often impractical due to labeling costs, while the latter typically involves significant computational complexity, often increasing training time by 5x to 10x compared to standard training.

2. Methods

AFR addresses these limitations through a remarkably efficient two-stage process designed to re-orient the model toward core features without the need for group labels during training.

2.1 Stage 1: Standard Empirical Risk Minimization

The first stage involves training a standard model using Empirical Risk Minimization (ERM) on a subset of the training data (typically 80%). Unlike other methods that require early stopping or specific regularization to prevent the model from over-memorizing spurious features, AFR utilizes a fully trained ERM model. The core insight is that a fully trained model's errors serve as a roadmap to where spurious correlations fail.

2.2 Stage 2: Last-Layer Retraining

In the second stage, the feature extractor (all layers except the final classification head) is frozen. The last layer is then retrained on the remaining 20% of the data using a specialized weighting function. The weight $\mu_i$ for a sample $i$ is calculated as:

$$\mu_i \propto \exp(-\gamma \hat{p}_i)$$

where $\hat{p}_i$ is the probability the Stage 1 model assigned to the correct class, and $\gamma$ is a tunable intensity parameter. This function prioritizes samples where the initial model was most "incorrect." Because the model naturally performs poorly on minority groups where spurious correlations are absent, this weighting automatically forces the classification head to focus on core features to resolve these difficult cases.

3. Experimental Evaluation

The researchers evaluated AFR across a diverse set of benchmarks covering vision (Waterbirds, CelebA), natural language processing (MultiNLI, CivilComments), and medical imaging (Chest X-Ray).

3.1 Performance and Efficiency

AFR demonstrated superior performance in Worst-Group Accuracy (WGA), reaching 90.4% on Waterbirds and 73.4% on MultiNLI. These results represent the state-of-the-art for methods that do not utilize group labels during the training phase.

Beyond accuracy, AFR's primary advantage is its efficiency. By caching features and only updating the final linear layer, Stage 2 training often completes in under a minute. The total computational overhead of AFR is approximately 6% over standard ERM, a stark contrast to competing methods like Just Train Twice (JTT) or Correct-n-Contrast (CNC), which can impose overheads of 200% to 550%.

3.2 Robustness to Hyperparameters

A common pitfall of robustness methods is extreme sensitivity to hyperparameter tuning. AFR proves resilient in this regard; the authors found that significant gains in WGA were maintained across a broad range of $\gamma$ values, making it easier to deploy in practical settings where tuning resources are limited.

4. Discussion and Limitations

While AFR provides a powerful baseline for group robustness, it is not without limitations. On the CelebA dataset, AFR was outperformed by CNC. Analysis suggests that on certain datasets, the model's output probabilities and class labels alone may be insufficient to perfectly distinguish between groups, creating a mathematical ceiling for reweighting-only approaches. Furthermore, like most current research in this area, AFR still requires group labels on a validation set to select the optimal hyperparameters—a dependency that remains a "holy grail" for future research to eliminate.

5. Conclusion

Automatic Feature Reweighting (AFR) demonstrates that complex interventions are not always necessary to achieve group robustness. By leveraging the errors of a standard ERM model as a signal for reweighting, AFR provides a fast, simple, and effective way to mitigate the impact of spurious correlations. Its minimal computational footprint and state-of-the-art performance make it an ideal candidate for large-scale applications where group labels are unavailable.

Summary updated

BibTeX
@inproceedings{qiu2023simple,
  author = {Shikai Qiu and Andres Potapczynski and Pavel Izmailov and Andrew Gordon Wilson},
  title = {{Simple and Fast Group Robustness by Automatic Feature Reweighting}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=s5F1a6s1HS},
}
Figure