SelecMix: Debiased Learning by Contradicting-pair Sampling
Abstract
Neural networks trained with ERM (empirical risk minimization) sometimes learn unintended decision rules, in particular when their training data is biased, i.e., when training labels are strongly correlated with undesirable features.
To prevent a network from learning such features, recent methods augment training data such that examples displaying spurious correlations (i.e., bias-aligned examples) become a minority, whereas the other, bias-conﬂicting examples become prevalent.
However, these approaches are sometimes difﬁcult to train and scale to real-world data because they rely on generative models or disentangled representations.
We propose an alternative based on mixup, a popular augmentation that creates convex combinations of training examples.
Our method, coined SelecMix, applies mixup to contradicting pairs of examples, deﬁned as showing either (i) the same label but dissimilar biased features, or (ii) different labels but similar biased features.
Identifying such pairs requires comparing examples with respect to unknown biased features.
For this, we utilize an auxiliary contrastive model with the popular heuristic that biased features are learned preferentially during training.
Experiments on standard benchmarks demonstrate the effectiveness of the method, in particular when label noise complicates the identiﬁcation of bias-conﬂicting examples.
Introduction
The inductive biases contributing to the success of deep neural networks (DNNs) can sometimes limit their capabilities for out-of-distribution (OOD) generalization.
DNNs are prone to learn simple, linear predictive patterns from their training data, sometimes ignoring more complex but important ones [30, 32].
It has been suggested that the simplest correlations in the data are often spurious [7].
A DNN relying on such simple, spurious patterns will therefore display poor OOD generalization.
Spurious correlations in a dataset are often the result of a selection bias, and such datasets are therefore said to be biased .
This paper is about debiased learning, also known as debiasing, i.e., methods that prevent a network from relying on spurious correlations when trained on a biased dataset.
Biased datasets typically contain a majority of so-called bias-aligned examples and a minority of bias-conﬂicting ones.
In bias-aligned examples, ground truth labels are correlated with both robust and biased features.
In bias-conﬂicting examples, labels are correlated only with robust features.
Clearly, the issues of models trained on biased datasets stem from the prevalence of bias-aligned samples.
Various approaches for debiased learning encourage models to ignore biased features.
Since the identiﬁcation of biased features from i.i.d.
data is ill-deﬁned, it requires additional assumptions, or supervision from heterogeneous (non-i.i.d.)
training samples [28].
In this work, we approach debiased learning with the assumption that biased features are “easier to learn” than robust ones, meaning that they are incorporated in the model earlier during training [29, 30].
Existing works based on this heuristic typically train two models: (i) an auxiliary model that purposefully relies on biased features, and (ii) the desired debiased model.
The auxiliary one guides the training of the debiased one [24, 27].
For example, Nam et al.
[24] trains the auxiliary model with a generalized cross-entropy (GCE) loss [40] that strengthens its reliance on biased, easy-to-learn features.
The training of the debiased model either augments the data with novel bias-conﬂicting examples [15, 20] or upweights existing ones [22, 24].
On the one hand, upweighting-based methods are simple but their debiasing capabilities are limited when bias-conﬂicting examples are scarce.
On the other hand, augmentation-based methods rely on carefully tuned generative models or disentangled representations that are difﬁcult to apply to real-world data.
We propose a simple and effective method based on mixup [37], a popular data augmentation method that creates convex combinations of randomly-chosen pairs of examples and their labels.
Our method, coined SelecMix, is an application of mixup to selected contradicting pairs of examples to generate new bias-conﬂicting examples.
We deﬁne contradicting pairs as having either (i) the same ground truth label but dissimilar biased features, or (ii) different labels but similar biased features.
To compare examples with respect to their biased features and thereby identify the contradicting pairs, we train an auxiliary contrastive model with a novel generalized supervised contrastive (GSC) loss that ampliﬁes the reliance on easy-to-learn features.
As a result, feature clustering in the embedding space serves as a good indicator of the similarity of the biased features.
We train the auxiliary model and the desired debiased model simultaneously.
The auxiliary model identiﬁes contradicting pairs, while the debiased model is trained on data augmented by SelecMix.
Compared to past approaches, our method generates bias-conﬂicting examples without generative models or disentanglement, while implicitly upweighting existing ones since they are frequently selected for the mixup.
We evaluate our method on standard benchmarks for debiasing.
Experimental results suggest that
SelecMix consistently outperforms prior methods, especially when bias-conﬂicting samples are scarce.
In addition, our method maintains its superior performance in the presence of label noise that complicates the identiﬁcation of bias-conﬂicting examples.
Ablation studies show advantages of both (i) the selective mixup strategy compared to other mixup variants, and (ii) the GSC loss, which strengthens the reliance on biased features and allows measuring the similarity of examples with respect to the biased features.
Related work
Debiasing with known forms of bias or bias labels.
Early works on debiasing assume some knowledge about the bias.
Some methods require that each training example is provided with a bias label , i.e., a precise value for its biased features [11, 14, 21, 26, 31].
Other methods use knowledge of the general form of the bias, such as color or texture in images.
This information is typically used to design custom architectures [1, 5, 34].
For example, ReBias [1] uses a BagNet [4] as an auxiliary model because it focuses on texture, which is assumed to be the biased feature.
The auxiliary model guides the training of a debiased model robust to unusual variations in texture.
Debiasing with the easy-to-learn heuristic.
A number of recent works assume that biased features are learned more quickly than robust ones [20, 24].
A popular approach is to train an auxiliary model that intentionally relies primarily on the easy-to-learn biased features, e.g., with the GCE loss [40].
The auxiliary model guides the training of a debiased model that focuses on other, presumably non-biased features.
For example, LfF [24] learns biased and debiased models simultaneously.
Bias-conﬂicting training examples are identiﬁed based on the relative losses from the biased and debiased models, then upweighted for the training the debiased model.
BiaSwap [15] trains an image translation model to generate new bias-conﬂicting training examples.
Building on LfF, DFA [20] disentangles robust and biased features and swaps them randomly for augmentation.
Disentanglement is however an ill-posed problem in itself [23] and a challenge with real-world data.
In contrast, our
[Figure]
method augments bias-conﬂicting data by mixing existing examples, without generative models nor disentangled representations.
Method
We ﬁrst describe the use of mixup as a debiasing strategy, while assuming that each training example is (unrealistically) provided with bias labels (Sec. 3.1).
Then, we move to a realistic scenario where bias labels are not available.
We introduce an auxiliary contrastive model that identiﬁes the biased features, which are assumed to be "easier to learn" than robust ones.
This allows comparing examples with respect to these biased features (Sec. 3.2).
Finally, we describe the complete SelecMix method that combines the selective mixup with our auxiliary biased model (Sec. 3.3).
3.1 Mixup for augmenting bias-conﬂicting samples
In a highly biased dataset, bias-conﬂicting samples constitute only a small fraction of the training data.
This is the root issue in the cases we consider.
The goal is thus to increase the fraction of bias-conﬂicting examples in the training data, which will then reduce the reliance of the learned model on biased features.
Our idea is to use mixup [37] to augment the existing pool of bias-conﬂicting examples.
Mixup is a popular augmentation method [2, 16, 36] known to improve various measures of robustness [25, 39].
It constructs convex combinations of pairs of examples and their labels:
[Equation]
where ( x i , y i ) and ( x j , y j ) are two original training examples (e.g., image and one-hot label vector) and  is a random mixing coefﬁcient,  ⇠ U [0 , 1] .
Assuming for now that bias labels are available, we could generate bias-conﬂicting examples by applying mixup on pairs having either (i) the same ground truth label but different bias labels or (ii) different labels but the same bias label.
Any such pair includes at least one bias-conﬂicting example, so that mixup generates additional ones as long as this original example is assigned a higher mixing weight in Eq.
An overview of this mixup strategy is shown in Fig.
Next, we describe how to identify such desired pairs when bias labels are not available.
[Figure]
[Figure]
Observations: As training proceeds with the SC loss, the similarity of contradicting positives increases while it decreases for the contradicting negatives.
In contrast, the proposed GSC loss ampliﬁes the reliance on the biased features, thus the clustering in embedding space remains a good indicator of the similarity of the biased features during the whole training process.
3.2 Replacing bias labels with an auxiliary model
We utilize an auxiliary model to compare training examples with respect to their biased features.
We assume that biased features are easier to learn than robust ones, because they are involved in simpler (e.g., linear) predictive patterns.
Our auxiliary model is trained to rely primarily on biased features.
We train the auxiliary model with a contrastive objective [6, 10, 13].
This is known to induce a clustering in embedding space (better than standard cross-entropy) that reﬂects the similarity of training examples in terms of the learned features.
These are biased features by our assumption, such that the clustering reﬂects the similarity of examples w.r.t.
their (unknown) bias labels.
We use the supervised contrastive (SC) loss of Khosla et al.
[Equation]
where z i is the normalized embedding of image x i , B = { 1 , 2 , ..., B } is the set of indices in the current mini-batch, P i = { k 2 B\{ i } | y i =
y k } is the set of positive examples relative to the example i (i.e., with the same label), and the scalar ⌧ is a temperature hyperparameter.
As an experiment to conﬁrm that the clustering of training examples in embedding space is indeed based on biased features, we train the auxiliary model on the Colored MNIST, the Corrupted CIFAR10, and the BFFHQ datasets (see Appendix A.1) with the SC loss and compute the cosine similarity z | i z j of the embeddings of all pairs of examples.
Fig.
2 shows that the examples are clustered according to the biased features early in the training.
In other words, predictive patterns involving biased features are learned faster than those involving robust features, as desired.
Since the higher cosine similarity z | i z j implies a high probability p
i,j , we interpret it as the likelihood of the pair ( i, j ) having similar biased features.
To further amplify the reliance of the auxiliary model on the biased features, we deﬁne the generalized
SC (GSC) loss as follows:
[Equation]
Output e e do 5:
6: if
7: else g e x e y i )
( x i 1   ) x y k ) 9: e B e e e 10: end where ˆ p qi,k is a scalar having the same value as p qi,k , meaning that the gradient is not back-propagated through it.
The term ˆ p qi,k assigns a higher weight to sample pairs with a high probability p
i,k and thus ampliﬁes the reliance on the biased features.
We discuss the relationship between the GCE and GSC losses in Appendix C.2.
3.3 Complete proposed method: selective mixup with biased embedding space
We now have an auxiliary model for quantifying the similarity of the training examples in terms of the biased features.
We use it to apply mixup on contradicting pairs , which have either (i) the same label but dissimilar biased features ( contradicting positives ) or (ii) different labels but similar biased features ( contradicting negatives ).
Contradicting positives.
For each instance ( x i , y i ) in the current mini-batch (i.e., the “query”), we pick another one ( x k , y k ) with the lowest similarity (measured in the space of their embeddings produced by the auxiliary model) among the set of positive examples (i.e., with the same label as x i ):
[Equation]
where B = { 1 , 2 , ..., B } is the set of the sample indices in the current mini-batch, and z i and z j are the normalized embeddings produced by our auxiliary model g  , i.e., z i =
g  ( x i ) .
Since we select the pair among the set of positives, the training CE loss of the mixed example is l ( e x i , e y i )
=
l (  x i + (1   ) x k ,  y i + (1   ) y k )
=
l (  x i + (1   ) x k , y k ) .
Considering that most examples are bias-aligned in the training set, the query ( x i , y i ) is also likely to be bias-aligned.
In addition, since the query x i and the selected example x k have the same label but dissimilar biased features, it is also likely that the biased features of x k are not correlated with the label, i.e., the selected example ( x i , y i ) is likely to be bias-conﬂicting.
Thus, to effectively generate an example that contradicts the prediction based on biased features, we sample  ⇠ U [0 , 1] and assign the smaller value among  and 1   to x i and the larger one to x k .
Contradicting negatives.
For each query ( x i , y i ) , we pick another one with the highest similarity among the set of negative examples:
[Equation]
where N [Equation] Similarly, we sample  ⇠ U [0 , 1] and let  min(  , 1   ) .
In standard mixup, the training loss of the mixed sample is: l ( e x i , e y i ) =
l (  x i + (1   ) x k ,  y i + (1   ) y k )
=
· l (  x i + (1   ) x k , y i )
+ (1   ) · l (  x i + (1   ) x k , y k ) .
However, considering that (i) the query ( x i , y i ) is likely to be biasaligned, and (ii) the pair ( x i , x k ) shares similar biased features, the ﬁrst term  · l (  x i +(1   ) x k , y i ) acts as bias-aligned example since the biased feature shared with x i and x k is predictive of the label
y i .
Thus, rather than interpolating the label, we simply assign e y i y k .
The pseudo-code of the proposed algorithm is presented in Alg.
1 and Alg. 2.
Intuitive interpretation.
Unlike standard mixup, we assign the label of the generated sample to the label of the selected sample, which is likely to be bias-conﬂicting.
Therefore, the proposed method can be viewed as generating new bias-conﬂicting samples by injecting bias-aligned samples as noise to existing bias-conﬂicting samples .
The method can also be interpreted as implicitly upweighting existing bias-conﬂicting samples, since they are frequently chosen for the mixup pair.
Experiments
We now validate the effectiveness of the proposed method on debiasing benchmarks.
We also evaluate it under the presence of label noise, which is a challenging but realistic scenario, yet less explored so far (Sec. 4.1).
We also provide a detailed analysis of each component of our method: (i) the auxiliary contrastive model (Sec. 4.2) and (ii) the selective mixup strategy (Sec. 4.3).
Datasets.
The Colored MNIST is a modiﬁed MNIST [19] that consists of colored images of ten digits where each digit is correlated with the color (e.g., most of the images of "0" are colored with red).
Here, the label is a digit (i.e., 0 ⇠ 9 ) and the biased feature is color.
The Corrupted CIFAR10 is constructed by applying different types of corruptions to the corresponding objects in the original
CIFAR-10 [18] dataset (e.g., most of the images of dogs are corrupted with G AUSSIAN BLUR noise).
The Biased FFHQ (BFFHQ) [20] is constructed based on the real-world dataset FFHQ [12], where the label is age and the biased feature is gender.
The ratio of bias-conﬂicting samples in the training set is ↵ 2 { 0 .
5% , 1% , 2% , 5% } for {Colored MNIST, Corrupted CIFAR10} and ↵ = 0 .
5% for BFFHQ.
All datasets are available in the ofﬁcial repository of DFA [20].
We defer the detailed description of the datasets in Appendix A.1.
Baselines.
To evaluate the effectiveness of our method in debiasing, we compare it with the prior methods LfF [24] and DFA [20] which also rely on the easy-to-learn property of the biased features.
LfF trains an auxiliary model with the GCE loss to amplify its reliance on the biased features, then reweights examples for training a debiased model.
DFA disentangles the biased and robust features with a similar principle as LfF, then augments the data for training a debiased model by swapping the biased features across examples.
We also include EnD [31], ReBias [1], and HEX [34].
EnD leverages explicit bias labels.
ReBias and Hex are designed for a speciﬁc, known form of biased features such as color and texture in images.
[Table]
4.1 Main results
We apply our method to a vanilla ResNet18 (V+Ours) and to LfF (L+Ours).
We use the Colored
MNIST, Corrupted CIFAR
[Table]
and BFFHQ datasets.
As shown in Table 1, our method consistently outperforms baselines, except ReBias [1] on the Colored MNIST.
Their bias-capturing model BagNet [4] is speciﬁcally tailored to color and texture as biased features by relying on local image patches as input.
Both DFA and our method augment the pool of bias-conﬂicting training examples
[Table]
but
DFA’s reliance on disentangled representations seems problematic on the more complex datasets.
In contrast, our method performs well on all datasets, owing to the simplicity of the mixup strategy.
In particular, our method outperforms DFA by a large margin on BFFHQ while the gap is smaller on
Colored MNIST where disentanglement is easier.
See Appendix A.2 for experimental details.
Debiasing under the presence of label noise.
Label noise can negatively affect debiasing methods that need to identify bias-conﬂicting examples.
This is because training examples with noisy (i.e., incorrect) labels are difﬁcult to distinguish from the bias-conﬂicting examples that we wish to identify.
Fig.
3 shows that our method maintains better performance under the presence of label noise than
[Figure]
[Table]
baselines.
We hypothesize that the robustness of our method comes from the nature of mixup [Table] which is known to improve robustness [39].
4.2 Detailed analysis of the biased contrastive model Comparison of the biased embedding spaces for measuring bias similarity.
Our auxiliary contrastive model trained with the GSC loss learns the embedding space which reﬂects the similarity of the examples w.r.t.
their biased features.
It is then used for SelecMix to identify the contradicting pairs by measuring the cosine similarity.
We replace our auxiliary model with the biased model of
LfF [24] which is trained with the GCE loss, and use it for SelecMix.
For the similarity measures, we used cosine distance and l 2 distance in the embedding space learned by their biased model, and the
KL-divergence of the softmax outputs of the classiﬁcation head.
As shown in Table 2, our auxiliary contrastive model achieves the best performance.
Especially, the performance gap is signiﬁcant for the contradicting negatives.
This supports our claim in Sec. 3.2 that the proposed GSC loss induces the feature clustering in the embedding space w.r.t.
the biased features.
In contrast, the
GCE loss learns the decision boundary and does not explicitly cluster the features, thus selecting the contradicting negatives, i.e., the pairs with different labels but similar biased features, seems to underperform ours.
[Table]
Bias label prediction of the biased model.
Table 3 shows the accuracy of the bias label prediction of the auxiliary biased model for each method.
Our biased contrastive model does not have a classiﬁcation head since it is trained with a contrastive loss.
Thus, we attach a linear classiﬁer on top of the model and ﬁne-tune it.
Note that the bias labels are used only for the evaluation.
As shown in
Table 3, the biased contrastive model shows the best performance.
As the ratio of the bias-conﬂicting samples increases, they degrade the performance.
Notice our biased contrastive model is robust to this effect compared with the prior methods relying on the GCE loss.
[Figure]
Visualization.
Fig.
4 illustrates t-SNE [33] plot of the features extracted from the corresponding models trained on the Corrupted CIFAR10.
As shown in Fig. 4(d), which corresponds to the proposed biased contrastive model, we observe that the samples are well clustered on the embedding space of the biased contrastive model.
Similar to the results in Table 3, the GCE-based biased models, i.e., LfF and DFA, suffer from the increasing number of bias-conﬂicting samples.
[Figure]
Pretraining vs. simultaneous training of the auxiliary model.
For our method in the main experiments, the auxiliary biased model is simultaneously trained with the debiased model.
To analyze the performance of the pretrained biased model, we equip SelecMix with the pretrained biased contrastive model and evaluate the performance of our method with the varying total number of epochs for pretraining.
The solid line represents the unbiased accuracy of our method with the pretrained biased model.
The dotted line represents the unbiased accuracy of our method, i.e., simultaneous training of the auxiliary biased model.
As shown in Fig.
5, vanilla SC loss exhibits the high variance of the performance with respect to the number of the epochs for pretraining, compared to the proposed GSC loss.
Detailed analysis of the selective mixup strategy of SelecMix
Ablation study.
As shown in Table 4, we obtain the best performance when utilizing both the contradicting positives (A) and the contradicting negatives (B) all together in most cases.
This is because it generates more diverse bias-conﬂicting examples compared to when using only one of them alone.
On the other hand, standard mixup degrades the generalization capability in many cases which implies that the selection of the pairs is crucial.
Comparison with a mixup variant when bias label is available.
We compare SelecMix with the recently proposed LISA [35], the mixup strategy for addressing domain generalization and subpopulation shift problems.
LISA similarly applies the vanilla mixup on the pair of (i) the samples with the same label but different domains, and (ii) the samples with different labels but the same domain.
Here, the domain label corresponds to the bias label in our experiment.
The key differences between SelecMix and LISA are (i) ours does not require the bias label, (ii) we do not interpolate the labels of the generated samples, and (iii) we sample  and let  min(  , 1   ) , i.e., we always assign the higher weight to the selected sample and the lower weight to the query sample (Sec. 3.3).
Table 5 empirically conﬁrms the better performance of SelecMix, using the explicit bias label for a fair comparison, over LISA, implying that augmenting the samples close to the bias-conﬂicting
[Table] [Table]
samples is crucial on the biased datasets.
More discussions on the comparison between the SelecMix (using the explicit bias label) and LISA is provided in Appendix C
[Table] [Table]
Conclusions
We presented SelecMix, a method for debiased learning that augments bias-conﬂicting examples using mixup on contradicting pairs of examples.
The selection of these pairs is the critical part of the method.
It relies on an auxiliary model trained with a contrastive loss designed to amplify reliance on the biased features.
The biased features are assumed to be “easy to learn” and incorporated earlier than others during training by SGD.
SelecMix outperforms baselines on debiasing benchmarks and remains effective under the presence of label noise.
Limitations.
The “easy-to-learn” assumption may not be correct, i.e., biased features are not always guaranteed to be learned faster than robust ones.
Our method should only be used when this assumption holds, but it is unclear how to determine such cases a priori, and how frequent they are in real-world data [38].
In the worst case, our method could increase reliance on biased features and worsen robustness.
Our experiments use semi-synthetic datasets where the assumption is made valid by construction.
Thus, our results are not a sign of the broad real-world applicability of the method.
Societal impact.
Our contributions should have a positive impact since our aim is to make machine learning systems more reliable.
However, our method is only one step in this direction and the problems addressed should not be considered as solved.
Acknowledgments and Disclosure of Funding
We would like to thank Sangdoo Yun for the useful discussions and Yeonji Song for the suggestions on the writing.
We also like to thank the anonymous reviewers for their constructive comments.
This work was supported by the SNU-NAVER Hyperscale AI Center and the Institute of Information & Communications Technology Planning & Evaluation (2015-0-00310-SW.StarLab/10%, 20190-01371-BabyMind/10%, 2021-0-02068-AIHub/10%, 2021-0-01343-GSAI/10%, 2022-0-00951LBA/10%, 2022-0-00953-PICA/50%) grant funded by the Korean government.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reﬂect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] (c) Did you discuss any potential negative societal impacts of your work?
[Yes] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[N/A] (b) Did you include complete proofs of all theoretical results?
[N/A] 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[No] (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Appendix A (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] See Appendix A 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[Yes] (c) Did you include any new assets either in the supplemental material or as a URL?
[No] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[No] (e) Did you discuss whether the data you are using/curating contains personally identiﬁable information or offensive content?
[No]
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]