UnLearning from Experience to Avoid Spurious Correlations
Jeff Mitchell Jesús Martínez del Rincón Niall McLaughlin



 


UnLearning from Experience to Avoid Spurious Correlations
    Jeff Mitchell

Queen's University Belfast

School of EEECS

United Kingdom 

jmitchell25@qub.ac.uk





Jesús Martínez del Rincón

Queen's University Belfast

School of EEECS

United Kingdom 

j.martinez-del-rincon@qub.ac.uk
Niall McLaughlin

Queen's University Belfast

School of EEECS

United Kingdom 

n.mclaughlin@qub.ac.uk

    September 9, 2024
============================================================================================================================================================================================================================================================================================================================================




§ ABSTRACT 
    While deep neural networks can achieve state-of-the-art performance in many tasks, these models are more fragile than they appear. They are prone to learning spurious correlations in their training data, leading to surprising failure cases. In this paper, we propose a new approach that addresses the issue of spurious correlations: UnLearning from Experience (ULE). Our method is based on using two classification models trained in parallel: student and teacher models. Both models receive the same batches of training data. The student model is trained with no constraints and pursues the spurious correlations in the data. The teacher model is trained to solve the same classification problem while avoiding the mistakes of the student model. As training is done in parallel, the better the student model learns the spurious correlations, the more robust the teacher model becomes. The teacher model uses the gradient of the student's output with respect to its input to unlearn mistakes made by the student. We show that our method is effective on the Waterbirds, CelebA, Spawrious and UrbanCars datasets.





§ INTRODUCTION






Training Deep Learning (DL) models is a well-studied problem that usually involves minimizing the average loss on the training set. The underlying assumption is that the data in the training and testing sets are drawn from identical distributions. However, in many realistic situations, the training set does not reflect the full diversity of realistic test data. Therefore, the trained system does not generalise well to Out-Of-Distribution (OOD) or group-shifted data. This can happen because the trained system relies on various spurious correlations present in the training set but not present in the testing data, leading to performance drops in realistic settings.



Spurious correlations happen when, for a given dataset, there is a coincidental correlation between a non-predictive feature of the input and the label. If those spurious correlations are present during training, machine learning models may learn to use the non-predictive feature to solve the task. Then, when tested on the same task but without the spurious feature present, the system's performance will drop. For example, in the Waterbirds dataset <cit.>, an image's background is correlated with the label. A model could learn to associate the presence of water backgrounds with the label water-bird and land backgrounds with the label land-bird rather than looking at the bird to solve the task. In the simplest case, a dataset may have one spurious correlation. In more complex scenarios, the term group shift is used to describe cases with multiple sub-groups within the dataset, each of which may be subject to multiple different spurious correlations.



Many existing methods for spurious correlation robustness explicitly use group labels during training <cit.>.
In practice, full details of the number and kinds of spurious correlations and/or explicit group label information may not be available.
We propose, UnLearning from Experience (ULE), which allows the creation of a model robust to spurious correlations and does not require any group label information at either training or testing time. In our approach, two models are trained in parallel. A student model s(x) is directly trained on the dataset. A teacher model t(x) then unlearns spurious correlations by observing the gradient of the student's output ∂ s(x) / ∂ x with respect to its input x. Thus, the teacher model learns to avoid the mistakes made by the student, while also solving the task of interest. <Ref> shows an overview of our proposed method. We demonstrate the validity of this approach for classification tasks.

The main contributions of this paper are:

    
  * We propose a new twist on student-teacher methods by reversing the traditional student and teacher roles to improve spurious correlation robustness.
    
  * We train the two models in parallel, optimising a loss where the teacher looks at the student's gradient to avoid repeating the student's mistakes.
    
  * We do not require knowledge of the presence of spurious correlation or group-shifts. Group labels are not required at training or testing time.
    
    
  * We use XAI to show how our model avoids learning spurious correlations.
    
    
  * Our method achieves SOTA results on Waterbirds and CelebA. And comparable results on Spawrious. 
    
    
    
    




§ RELATED WORK









The standard neural network training approach is Empirical Risk Minimization (ERM) <cit.>, which minimizes the average loss on the training data. 
ERM does not confer robustness to spurious correlations or group shifts. Recently, various approaches have been proposed to increase robustness to these effects <cit.>.











Group Labels used in Training Common approaches to improving group-shift robustness use group labels during training and validation.

Sagawa et al. <cit.> have shown that using Distributionally Robust Optimization (Group-DRO) to minimize the worst-group loss, coupled with strong L_2 regularization, results in models with high average test accuracy and high Worst-Group Accuracy (WGA). WGA has become established as the reference for validating spurious correlation robustness. However, DRO requires full supervision with explicit group labels, which is undesirable. Izmailov et al. <cit.> studies the quality of features learned by ERM. They find that many robustness methods work by learning a better final layer. A similar approach is taken by Kirichenko et al. <cit.> where the last layer features are reweighted using a small dataset without the spurious correlation present. Qiu et al. <cit.> again re-trained the final layer using a weighted loss that emphasizes samples where ERM predicts poorly.



Explicit Group Labels in Validation 
More flexible approaches to improving group robustness do not require group labels during training. Instead, a small sample of group labels, usually explicitly provided, are present in the validation set. Nam et al. <cit.> train debiased models from biased models via their Learning from Failure (LfF) framework. They intentionally train a biased model and amplify its prejudice. They then train a debiased model that learns from the mistakes of the biased model by optimizing a generalized cross-entropy loss to amplify the bias. Similarly, Zhang et al. <cit.> improve robustness to OOD and noisy datasets using a noise-robust generalized cross-entropy loss.

Group labels and pseudo-labels can be inferred from the data as demonstrated by Environment Inference for Invariant Learning (EIIL) <cit.>, a general framework for domain-invariant learning that directly discovers partitions from the training data that are maximally informative for downstream invariant learning. Spread Spurious Attribute (SSA) <cit.> is a semi-supervised method that leverages samples with/without spurious attribute annotations to train a model that predicts the spurious attribute. It then uses pseudo-labelled examples to train a new robust model.




Xie et al. <cit.> propose NoisyStudent (NS), a semi-supervised self-learning method which first trains a supervised teacher model to generate pseudo-labels for an equal or larger student model trained on the data with noise injected. It makes use of data augmentation, dropout and stochastic depth. This method is iterated multiple times by making the student model the new teacher and repeating. In Just Train Twice (JTT) <cit.>, a model is trained for a small number of epochs; then a second model is trained by up-weighting samples where the first model has made a mistake.

Lee et al. <cit.> train an ensemble of models with a shared backbone. The models are forced to be diverse during training, and a final robust model is selected by observing a small number of new samples. Pagliardini et al. <cit.> take a similar approach of training an ensemble of models to agree on the training data but give different predictions on OOD data.

Finally, we note that related student-teacher approaches have been proposed for machine-unlearning in a more general context <cit.>.



No Explicit Group Labels Group labels may be scarce in real-world settings. 
Invariant Risk Minimization (IRM) <cit.> assumes that training data is collected from separate distinct environments. IRM promotes learning a representation with correlations that are stable across these environments. CORrelation ALignment (CORAL) <cit.> for unsupervised domain adaptation aims to minimize the domain shift by aligning the second-order statistics of the source and target distributions without requiring any target labels. Deep-CORAL <cit.> extends this technique to deep neural networks. CausIRL <cit.> takes a causal perspective on invariant representation learning by deriving a regularizer to enforce invariance through distribution matching. Adversarial feature learning can also help with tackling the problem of domain generalization <cit.>, by using Adversarial Autoencoders (MMD-AAE)  trained with a Maximum Mean Discrepancy (MMD) regularizer to align the distributions across different domains.

Finally, approaches have been proposed for producing robust models without group labels or the need for explicit domain generalization. Mehta et al. <cit.> extract embeddings from a large pre-trained Vision Transformer, then train a linear classification layer using these embeddings. This approach does not require group labels, although it primarily relies on the pre-existing robustness of the embeddings from the pre-trained model <cit.>. Tiwari et al. <cit.> use an auxiliary network to identify and erase predictive features from lower network layers. Zhao et al. <cit.> suppress shortcuts during training using an autoencoder, thus improving generalization. Zhang et al. <cit.> trains an ERM model to identify samples of the same class but with different spurious features, then uses contrastive learning to improve representation alignment. Recently Yang et al. <cit.> proposed SePArate early and REsample (SPARE), which identifies spuriously correlated samples early in training and uses importance sampling to minimize their effect. It does not require a group-labelled validation set. 

In common with many of the above approaches, ULE only uses group labels in the validation set to select network hyperparameters, which is also done by all rival methods (JTT, SSA, LfF, EIIL, Group DRO). Additionally, SSA, JTT and Groups DRO require group labels during training, for their methods to work. ULE and other methods (EIIL, LfF) only need group labels in validation for tuning hyperparameters. The methods JTT <cit.>, LfF <cit.> and NS <cit.> are the most similar to our proposed method as they use a second model to gain further insight into the dataset. However, these methods rely on generating pseudo-labels during validation. In contrast, our method does not use explicit group labels. In our method, one model observes the gradients of the other model to counteract spurious correlations. The key advantage of ULE over our closest performing rivals, SSA and JTT, is that once the hyperparameters of ULE are set, ULE does not require explicit group labels to compensate for spurious correlations. This makes ULE more general and elegant than SSA and JTT, which require more domain knowledge, i.e., labelled examples, to work.


































§ UNLEARNING FROM EXPERIENCE



In this section, we introduce our proposed approach, UnLearning from Experience (ULE). As illustrated in <Ref>, we train two models in parallel: a student model and a teacher model. The student model is trained to solve a classification task as normal, while the teacher model is trained in parallel, using a custom loss function, to solve the same classification task while avoiding spurious correlations learned by the student model. Both models are trained simultaneously, with identical batches, and their parameters are updated in parallel.

The core idea is that the student model will be prone to use shortcuts or spurious correlations in the dataset to solve the classification task. The teacher model is then trained to solve the same classification task with an additional term in its loss function to encourage it to avoid learning the same behaviour as the student model, hence avoiding the shortcuts or spurious correlations learned by the student model.

We purposefully reverse the names in our student-teacher paradigm. We want to emphasise the fact that the teacher is learning not to copy the student, i.e., it is unlearning from the experience of the student.

It has been shown to be theoretically impossible to mitigate shortcuts without prior assumptions about the data <cit.>. In practice, such mitigation is only possible when an assumption, such as simplicity bias, is imposed <cit.>. Thus, our underlying assumption is that learning short-cuts or spurious correlations is easier than learning the primary task. Therefore, it is more difficult to unlearn the correct semantic features.



Assume a classification function s(x) that maps from an input image x to the  class, c, of a normalised probability distribution, ŷ_s, over the classes. We will refer to s(x) as the student network, trained using a conventional classification loss, such a cross-entropy ℒ_CE(ŷ_s,y), where y is the target probability distribution over the classes. We can define, g_s, a saliency map for s(x) as:


    g_s = ∂ s(x)/∂ x


In other words, the saliency map is defined as the gradient of s(x) with respect to the input x. It indicates parts of the input that, if changed, would affect the classification decision. 

We expect that any spurious correlations present will play an important part in the network's decision-making process. Hence, they will be highlighted in g_s. 

During training, averaged over all batch updates, the saliency map is expected to be dominated by meaningful features. Noise and features with very small magnitudes, which do not strongly influence the classification decision, will average out.

Therefore, g_s can guide the training of another network to avoid following the same spurious correlations. 

In parallel with the student classification network, we train a teacher classification network, t(x), using a loss function that includes both a standard classification loss and an additional term that causes it to avoid the spurious correlations highlighted in g_s. 















To encourage the teacher network to avoid spurious correlations, we use the loss term ℒ_MSE to encourage the saliency map of the teacher network to be the opposite of the saliency map from the student network. ℒ_MSE is defined as:







    ℒ_MSE(-g_s,g_t) = ‖𝒩(-g_s) - 𝒩(g_t) ‖_2^2


where 

g_t = ∂ t(x) / ∂ x is the saliency map of the teacher network. The function 𝒩(z) normalises the saliency maps to have a maximum value of 1 by dividing the input by its maximum absolute value i.e.,



𝒩(z) = z / max(| z |). 

Note the term -g_s in <Ref>. By multiplying g_s by -1, the saliency map from the student network is inverted. Recall that our overall goal is to use g_s to guide the training of the teacher network to avoid spurious correlations. In other words, features assigned high importance by the student network may coincide with spurious correlations; hence, the teacher network should try to assign low importance to these areas and vice versa. Thus, the ℒ_MSE term encourages the saliency maps of both networks to be opposites. The final loss value is calculated via the mean squared difference between the two vectors. Pseudocode for UnLearning from Experience (ULE) is included in the supplementary material. 

The overall loss function for the teacher network is defined as follows:










    ℒ_total = λℒ_CE(ŷ_t,y) + (1-λ) ℒ_MSE(-g_s,g_t)


where ℒ_CE is a classification loss, such a cross-entropy. The loss terms, ℒ_CE and ℒ_MSE, are normalised to the same order of magnitude, then the hyperparameter λ∈ [0,1] balances the two loss terms. 

























 §.§ Practical Implementation



In the section above, we assume that saliency is based on ∂ t(x) / ∂ x, which is taken with respect to the input. Instead, we can freeze early layers of the network, treating them as a feature extractor, and compute ∂ t(x) / ∂ A_j, where A_j is the matrix of activations at an intermediate layer j. 



It has been shown that modifying only the final layer of a pre-trained network can increase robustness to spurious correlations <cit.>. Moreover, we argue that features originally intertwined at the input may be separable at the final layer(s) of a pre-trained network, helping our approach to cope with more complex spurious correlations <cit.>.

If the student and teacher networks have different architectures, there may be no layers with equal dimensionality. Therefore, a different way to perform supervision is needed. 

Let A_j ∈ℝ^b× d_j be the activation matrix for a given hidden layer of the teacher network, where b is the batch dimension, and d_j is the flattened layer dimension. We can form the matrix E_t=A_jA_j^𝖳, where  E_t ∈ℝ^b× b, i.e., the size of E_t is independent of the hidden layer dimensionality. The same process can be applied to any hidden layer, A_k of the student network, to form matrix E_s ∈ℝ^b× b. In our training scheme, both networks are always trained in parallel with the same batch, so matrices E_t and E_s will always have the same size. The matrices E_t and E_s can be flattened and compared using ℒ_MSE(-ℱ(E_s),ℱ(E_t)) (see <Ref>), where ℱ is the flattening operation, thus encouraging the student and teacher hidden layers to diverge. 

In practice (See Section <ref>), we select A_j and A_k as the final fully connected layers of the teacher and student networks. Earlier layers are frozen. We note that last layer re-training is common in the spurious correlation literature <cit.>. Our method then simplifies to training the final linear layer using ℒ_total (see <Ref>).






























§ EXPERIMENTS



In this section, we experimentally evaluate our proposed method qualitatively and quantitatively. We test our approach using several pre-trained models, including ResNet-18 <cit.> pre-trained on the ImageNet1K_V1, ResNet-50 <cit.> pre-trained on ImageNet1K_V2, and ViT-H-14 <cit.> comprising the original frozen SWAG <cit.> trunk weights with a final linear classifier trained on  ImageNet1K.

As mentioned in <Ref>, we only fine-tune the final linear layer of each model. Unless otherwise noted, we use the same model for the student and teacher in all experiments. In all experiments, we train the models for 300 epochs.




We tune our hyperparameters separately for each dataset and model by grid search. We vary the value of λ in steps of 0.1 over the range [0, 1], the learning rate in the range [1e-1, 1e-5] in powers of 10, and select between standard and strong L_2 regularization. We select the values of λ, learning rate, and regularization that achieve the highest worst-group accuracy (WGA) on the validation set. We evaluate the model on the validation set every 10 epochs to monitor the model. We investigate the effect of strong L_2 regularization, which can be used to reduce the effects of spurious correlations by preventing the model from overfitting <cit.>. 














 §.§ Datasets

The following datasets, containing group-shifted and OOD data, were used to evaluate our proposed method: Waterbirds <cit.>, CelebA <cit.> and Spawrious <cit.>. 





Waterbirds Dataset <cit.>
 Consists of images of birds (land and water) cropped from the Caltech-UCSD Birds-200-2011 (CUB-200-2011) dataset <cit.> imposed onto backgrounds from the Places dataset <cit.>. The resulting dataset contains ≈ 11,800 custom images. The objective is to classify the images into two classes: y={Waterbirds, Landbirds} given spurious correlation, a={Water, Land}, between the background and the bird class.


The test set consists of images from all four combinations of labels y and spurious correlations a. To prevent bias in evaluating the model, we ensure that the number of test images in each group is balanced.

We calculate two main metrics to evaluate the robustness of models on the group-shifted data. The first metric is the average test accuracy, which is the average accuracy over all groups.








    Acc = 1/N_g∑_i=1^N_gAcc_i


where N_g=|y|*|a| is the number of groups and Acc_i  

is the model's accuracy on group i, calculated as the number of correct predictions divided by the total number of predictions for that group. However, the average test accuracy does not consider the distribution of the groups. For example, suppose the model performs well on the majority groups but poorly on the minority groups. In that case, the average test accuracy may be high, but the model will not be robust to group-shifted data. To measure robustness against spurious correlation, we look at WGA, defined as the model's accuracy on the worst-performing group.


 
    
  


    WGA = min{Acc_1, Acc_2, …, Acc_N_g}


WGA is the main metric in the literature <cit.> rather than Acc, as it specifically demonstrates robustness to spurious correlations.




CelebA Dataset




Following <cit.>, we train models to classify images into two classes: y={Blond hair, Non-blond hair} with a spurious correlation a={Female, Male} between gender presentation and hair colour. We evaluate using WGA. The dataset has ≈ 202,600 images and balanced testing groups.

UrbanCars Dataset


UrbanCars <cit.> include multiple types of spurious correlations. The task is to classify images into two classes: y={urban, country}, given two types of spurious correlations, the background and a co-occurring object, which are correlated with the true class, and which both also take the classes a={urban, country}.









Spawrious Dataset <cit.> contains six datasets with easy, medium and hard variants of one-to-one and many-to-many spurious correlations. Many-to-many spurious correlations are more complex than the one-to-one spurious correlations in Waterbirds or CelebA.

Each dataset shows various dog breeds on different backgrounds. 
We classify images into four classes: y={Bulldog, Corgi, Dachshund, Labrador} with a spurious correlation a={Desert, Jungle, Dirt, Mountain, Snow, Beach} between the background and dog breed. Testing sets are balanced. Following the procedure in <cit.>, we evaluate using average accuracy and additionally with WGA for consistency with Waterbirds and CelebA.



 §.§ Proof of Concept


We first demonstrate the effectiveness of our proposed ULE method using two modified versions of the MNIST dataset with artificial spurious correlations <cit.>. 

MNIST-SC - MNIST modified by one-hot encoding the class label into the upper left corner of every image. 

Coloured-MNIST (ten-class) - MNIST modified so that the digit colour is correlated with the class label. Hence, the input feature and spurious correlation are intertwined. We use all ten MNIST classes with ten unique colours, and the digit colour is perfectly correlated with the correct class label.



This experiment uses a convolutional neural network (CNN) comprised of two convolutional layers, with 32 and 64 filters, each followed by ReLUs, then 2× 2 max-pooling, a flattening layer, dropout layer, followed by two linear layers with 9216 and 128 neurons with dropout and ReLUs. The output is always a length-10 vector encoding the class label. 

We train from scratch our CNN on MNIST-SC, Coloured-MNIST, and standard MNIST, with and without our proposed ULE method. Then test on MNIST, which does not contain the spurious correlation. Our results are shown in <Ref>.

When we train a neural network on MNIST-SC in the standard way, i.e., using ERM, we observe that the model focuses on the spurious correlation. It achieves perfect accuracy on both the training set and MNIST-SC testing set images with the spurious correlations present. However, the model's performance drops to 85% when evaluated on MNIST testing set images, which do not contain spurious correlations. 

In contrast, when we train the same network using our proposed ULE method, it achieves an accuracy of 95% whether or not the spurious correlation is present. This demonstrates that ULE has helped increase model robustness to spurious correlations.


When we train on ten-class Coloured-MNIST and test on ten-class MNIST, the performance of ULE is significantly better than ERM. This suggests that when the features are intertwined at the input, ULE can, to an extent, guide the teacher in ignoring spurious correlations.

Finally, we train and test on the standard MNIST dataset using ULE. In this case, no spurious correlations were present during training or testing. ULE's testing-set performance is only marginally below ERM, suggesting that ULE doesn't significantly harm performance, even in cases where the student has learned the correct features. 





























To investigate further, we visualise g_t(x), the gradient of the trained teacher network's output with respect to its input, for a random sample of images from the MNIST-SC testing set. <Ref> shows that the ERM-trained model places significant attention on the upper left corner of the image, where the spurious correlation class labels were embedded. This shows the model learns to use the spurious correlation rather than focusing on the digits. In contrast, <Ref>, shows our ULE model does not place emphasis on the top left corner but focuses on the digits instead. 
The results from <Ref> and <Ref> show that our proposed ULE method can help train models that are robust to spurious correlations. With ULE the model does not rely on spurious correlations to achieve high accuracy even if they are clearly present in the data.


















 §.§ Evaluating Spurious Correlation Robustness





In this section, we evaluate our ULE approach on several datasets with realistic spurious correlations and perform a comparison with state-of-the-art approaches. 

For each experiment, we tune the hyperparameters of our models as discussed above in <Ref>. The learning rate, L_2 regularization and λ hyperparameters were tuned independently for all datasets. 
The overall best-performing model on the validation set is saved and evaluated on the test set using Acc and WGA 
(See <Ref>). Training and evaluation of the models are repeated five times to compute the mean and standard deviation of the results. This ensures results are not affected by random initialization data shuffling. In this set of experiments, we use the same architecture for the student and teacher models. 

As discussed in <Ref>, we only fine-tune the final fully connected layer of the models. 
The gradients of the student model, g_s, 

are extracted from the output of the final block of convolutional layers for the ResNet and the output of the MLP Head for the ViT.



For all like-for-like comparison tables, we colour the 1st, 2nd and 3rd best results, and highlight results from other model architectures, which may not be direct comparable, ViT-H-14 in Gray.




  §.§.§ Waterbirds


<Ref> shows the results of our ULE method applied to three network architectures: ResNet-18, ResNet-50 and ViT-H-14. We compare our approach with state-of-art robustness methods on the Waterbirds dataset.  In a direct comparison, ULE-trained ResNet-50 equals the best result from the literature. Although not directly comparable, using the ViT-H-14 model, our method achieves a higher worst-group accuracy than all other current approaches, almost 2% higher than the next best approach, even when compared against models that use group labels.










  §.§.§ XAI Analysis of Network trained on Waterbirds
 



To compare the different behaviours of models trained with our proposed ULE vs an ERM baseline, we use the GradCAM <cit.> eXplainable AI method. We visualize the saliency maps of ULE and ERM, ResNet-50 models on a random selection of images from the Waterbirds test set. The results in <Ref> show the ERM-trained model focuses on the background, i.e., the spurious correlations. In contrast, the ULE-trained model focuses on the subject, thus avoiding spurious correlations in the background. This is true across various images in <Ref>, demonstrating that our ULE method increases model robustness to spurious correlations, even in challenging realistic conditions. We also show some failure cases where the ERM model makes the wrong prediction. In these cases, it focuses on the background.






























  §.§.§ Hyperparameter Sensitivity


The loss function, Eq. <ref>, is critical to functionality ULE. Therefore, we measure the sensitivity of ULE to changes in the value of the λ hyperparameter, which controls the balance between the classification and gradient loss terms of the teacher network. For each value of λ, we trained a ResNet-50 model with ULE on Waterbirds 3 times and averaged the WGA. The results in Fig. <ref> indicate that ULE performs well over a wide range of λ values.

Using the same procedure, we also varied the second component of the loss function in Eq. <ref> to use L1 loss rather than MSE loss. This resulted in a WGA of 87.3 and an average accuracy of 89.0. These values are marginally below those in Table <ref>, indicating that the choice of MSE or L1 loss is not critical to the functionality of ULE.





  §.§.§ Waterbirds – Trained from Scratch


In common with the majority of other spurious correlation robustness methods <cit.>, ULE typically acts on the final layer representations from a pre-trained model. However, ULE can also be used when training a model from scratch (Also see Section <ref>). We train a ResNet-50 model from scratch on Waterbirds using ULE, where the saliency, ∂ t(x) / ∂ x, is taken with respect to the input image, and all network layers are allowed to train. 

In Table <ref>, we contrast ULE with the comparable from-scratch results reported in <cit.>. In common with other methods, ULE's from-scratch performance is worse than when using a pre-trained model (See Section <ref>). However, ULE outperforms ERM, and is comparable with the best other methods in terms of average accuracy and WGA. 






  §.§.§ CelebA

<Ref> compares ULE with state-of-art approaches to spurious correlation robustness on the CelebA dataset. Our ULE method is in the top-3 best methods in terms of worst-group accuracy. Only SSA <cit.> and GroupDRO <cit.> achieve higher worst-group accuracy. It is important to note that our method does not use group labels in training or validation, while those other techniques do, meaning it is easier to apply our approach in new situations.








  §.§.§ Spawrious
 Spawrious is more complex than Waterbirds or CelebA. It includes one-to-one and many-to-many spurious correlations. Following the procedure in Lynch et al. <cit.>, 
in <Ref> we evaluate using average accuracy to allow for direct comparison against the results reported in <cit.>. Additionally, in Table <ref>, we report WGA for consistency and to allow future comparison with our method. We are unaware of any WGA results in the literature for this dataset, so we make no claims about ULE's performance compared to other methods. 

Spawrious: One-to-One 
In <Ref>, we compare ULE against the literature on Spawrious: One-to-One. 
ULE with the ResNet-50 model achieves the highest average accuracy on the easy setting and is competitive on other difficulties. 



























































































Spawrious: Many-to-Many
Many-to-many spurious correlations happen when the spurious correlations hold over disjoint groups of spurious attributes and classes. For instance, each class from the group {Bulldog, Dachshund} is observed with each background from the group {Desert, Jungle} in equal proportion in the training set <cit.>. These more complex scenarios require the model to learn to ignore spurious correlations for more than one class and group combination. Robustness to many-to-many spurious correlations is important because they can occur in real settings.









































































































































































































































































































<Ref> shows a comparison between ULE and state-of-the-art methods on the Spawrious: Many-to-Many benchmark. 

ULE with ResNet-50 achieves the highest average accuracy across all difficulty settings.






  §.§.§ UrbanCars


UrbanCars <cit.> is a challenging dataset that includes multiple types of spurious correlations. Both the image background and a co-occurring object are correlated with the true class. We follow the protocol of Li et al. <cit.>, which allows for direct comparison with results from the literature. 

In <Ref>, we see that ULE performs in the top three of recently published methods in terms of WGA. We also see that ULE has the highest average accuracy of all methods.






 §.§ Mixed Models






We now investigate ULE's performance when different model architectures are used for teacher and student. We compare performance when models are paired with themselves versus paired with other models.



In common with <Ref>, we perform hyperparameter tuning to select the best hyperparameters for each model combination. All experiments were performed on the Waterbirds dataset.























<Ref> shows worst-group test accuracies for different teacher and student model architecture combinations. The results show a correlation between the total complexity of the teacher and student models and worst-group accuracy. As the total complexity increases, the worst-group accuracy increases consistently, with the most complex combination, ViT-H-14 paired with itself, achieving the highest worst-group accuracy. When using mixed models, we also see that having a simpler student model and a more complex teacher model leads to better performance. Indeed, since the student aims to highlight mistakes to the teacher, its complexity or architecture seems to be of little importance. Our intuition is that the teacher model requires more capacity to be capable of solving the task in a different way than the student model, thus learning to ignore the spurious correlations. The complexity of the teacher seems to be the main factor in determining performance, with the ViT-H-14 teacher clearly outperforming any other choice.










§ CONCLUSION














We propose UnLearning from Experience (ULE), a new twist on student-teacher approaches that reverses the usual roles of student and teacher. The teacher observes the gradients of the student model, and ensures its gradients are the opposite, hence “unlearning” the student's mistakes to increase its robustness to spurious correlations.  

We demonstrate the effectiveness of ULE on the, Waterbirds, CelebA, and Spawrious datasets. ULE achieves state-of-the-art results on Waterbirds and CelebA, and is competitive on Spawrious. 

ULE does not require prior knowledge of the spurious correlations and is not affected when spurious correlations are not present. It does not require group labels, unlike some other approaches (<Ref>). ULE is simple to implement and can be applied to many model architectures. These factors enhance its real-world applicability.



ieee_fullname



