Shortcut Learning · Waterbirds
Method

Dataset bias, training, and the saliency experiments

Waterbirds pairs a bird type with a background that is correlated during training and decorrelated at test time. That design lets us measure whether a CNN learns the bird or the background.

The engineered shortcut

In the training split, background predicts bird type roughly 95% of the time: waterbirds mostly appear on water, landbirds mostly on land. The test split breaks that correlation, so a model that has learned the background as a proxy for the bird will fail on the two conflict groups.

Waterbird on water
Majority
waterbird-water
642 test images
Waterbird on land
Conflict
waterbird-land
642 test images
Landbird on water
Conflict
landbird-water
2255 test images
Landbird on land
Majority
landbird-land
2255 test images

Training setup

  • ImageNet-pretrained ResNet18 with the final layer replaced by two logits.
  • Adam optimiser, learning rate 1e-4, weight decay 1e-4, batch size 32.
  • 15 epochs at 224×224, standard ImageNet normalisation.
  • The checkpoint is selected by validation worst-group accuracy, not overall accuracy, so the model is judged on the subgroup it handles least well.
Training history
Validation accuracy by subgroup, per epoch
Notice how overall validation accuracy stays high (~83%) while worst-group accuracy oscillates between 16% and 56% — this gap is the shortcut signal the project investigates.

Measuring where the model looks

Grad-CAM and the bias score

Grad-CAM produces a class-conditional saliency map from the last convolutional block (layer4[-1]). We take a 60% centre crop as a foreground proxy and define the attention-bias score as the fraction of saliency that falls outside it — i.e. on the background.

Inference-time interventions

We edit each test image and re-run the model to test the background's causal role: background blur, background mask (grey), background patch shuffle, and foreground mask. If accuracy holds when the background changes but collapses when the bird is hidden, the model is reading the bird; the opposite pattern indicates a shortcut.