Learning Not to Learn: Training Deep Neural Networks with Biased Data

Byungju Kim, Hyunwoo Kim, Kyungsu Kim, Sungjin Kim, Junmo Kim

Introduction

Machine learning algorithms and artificial intelligence have been used in wide ranging fields. The growing variety of applications has resulted in great demand for robust algorithms. The most ideal way to robustly train a neural network is to use suitable data free of bias. However great effort is often required to collect well-distributed data. Moreover, there is a lack of consensus as to what constitutes well-distributed data.

Apart from the philosophical problem, the data distribution significantly affects the characteristics of networks, as current deep learning-based algorithms learn directly from the input data. If biased data is provided during training, the machine perceives the biased distribution as meaningful information. This perception is crucial because it weakens the robustness of the algorithm and unjust discrimination can be introduced.

A similar concept has been explored in the literature and is referred to as unknowns . The authors categorized unknowns as follows: known unknowns and unknown unknowns. The key criterion differentiating these categories is the confidence of the predictions made by the trained models. The unknown unknowns correspond to data points that the model’s predictions are wrong with high confidence, e.g. high softmax score, whereas the known unknowns represent mispredicted data points with low confidence. Known unknowns have better chance to be detected as the classifier’s confidence is low, whereas unknown unknowns are much difficult to detect as the classifier generates high confidence score.

In this study, the data bias we consider has a similar flavor to the unknown unknowns in . However, unlike the unknown unknowns in , the bias does not represent data points themselves. Instead, bias represents some attributes of data points, such as color, race, or gender.

Figure 1 conceptually shows how biased data can affect an algorithm. The horizontal axis represents shape space of the digits, while the vertical axis represents color space, which is biased information for digit categorization. In practice, shape and color are independent features, so a data point can appear anywhere in Figure 1. However, let us assume that only the data points with high saturation are provided during training, but the points with low saturation are present in the test scenario (yet are not accessible during the training). If a machine learns to categorize the digits, each solid line is a proper choice for the decision boundary. Every decision boundary categorizes the training data perfectly, but it performs poorly on the points with low saturation. Without additional information, learning of the decision boundary is an ill-posed problem, multiple decision boundaries can be determined that perfectly categorize the training data. Moreover, it is likely that a machine would utilize the color feature because it is a simple feature to extract.

To fit the decision boundary to the optimal classifier in Figure 1, we require simple prior information: Do not learn from color distribution. To this end, we propose a novel regularization loss, based on mutual information, to train deep neural networks, which prevents learning of a given bias. In other words, we regulate a network to minimize the mutual information shared between the extracted feature and the bias we want to unlearn. Hereafter, the bias that we intend to unlearn is referred to the target bias. For example, the target bias is the color in Figure 1. Prior to the unlearning of target bias, we assume that the existence of data bias is known and that the relevant meta-data, such as statistics or additional labels corresponding to the semantics of the biases are accessible. Then, the problem can be formulated in terms of an adversarial problem. In this scenario, one network has been trained to predict the target bias. The other network has been trained to predict the label, which is the main objective of the network, while minimizing the mutual information between the embedded feature and the target bias. Through this adversarial training process, the network can learn how to predict labels independent of the target bias.

Our main contributions can be summarized as follows: Firstly, we propose a novel regularization term, based on mutual information, to unlearn target bias from the given data. Secondly, we experimentally show that the proposed regularization term minimizes the detrimental effects of bias in the data. By removing information relating to the target bias from feature embedding, the network was able to learn more informative features for classification. In all experiments, networks trained with the proposed regularization loss showed performance improvements. Moreover, they achieved the best performance in the most experiments. Lastly, we propose bias planting protocols for public datasets. To evaluate bias removal problem, we intentionally planted bias to training set while maintaining test set unbiased.

Related Works

The existence of unknown unknowns was experimentally demonstrated by Attenberg et al. in . The authors separated the decisions rendered by predictive models into four conceptual categories: known knowns, known unknowns, unknown knowns, and unknown unknowns. Subsequently, the authors developed and participated in a “beat the machine challenge”, which challenged the participants to manually find the unknown unknowns to fool the machine.

Several approaches for identifying unknown unknowns have been also proposed . Lakkaraju et al. proposed an automatic algorithm using the explore-exploit strategy. Bansal and Weld proposed a coverage-based utility model that evaluates the coverage of discovered unknown unknowns . These approaches rely on an oracle for a subset of test queries. Rather than relying on an oracle, Alvi et al. proposed joint learning and unlearning method to remove bias from neural network embedding. To unlearn the bias, the authors applied confusion loss, which is computed by calculating the cross-entropy between classifier output and a uniform distribution. Similar approaches, making networks to be confused, have been applied on various applications .

As mentioned by Alvi et al. in the paper , the unsupervised domain adaptation (UDA) problem is closely related to the biased data problem. The UDA problem involves generalizing the network embedding over different domains . The main difference between our problem and the UDA problem is that our problem does not assume the access to the target images and instead, we are aware of the description of the target bias.

Embracing the UDA problem, disentangling feature representation has been widely researched in the literature. The application of disentangled features has been explored in detail . Using generative adversarial network , more methods to learn disentangled representation have been proposed. In particular, Chen et al. proposed the InfoGAN method, which learns and preserves semantic context without supervision.

These studies highlighted the importance of feature disentanglement, which is the first step in understanding the information contained within the feature. Inspired by various applications, we have attempted to remove certain information from the feature. In contrast to the InfoGan , we minimize the mutual information in order not to learn. However, removal of information is an antithetical concept to learning and is also referred to as unlearning. Although the concept itself is the complete opposite of learning, it can help learning algorithms. Herein, we describe an algorithm for removing target information and present experimental results and analysis to support the proposed algorithm.

Problem Statement

In this section, we formulate a novel regularization loss, which minimizes the undesirable effects of biased data, and describe the training procedure. The notations should be defined prior to introduction of the formulation. Unless specifically mentioned, all notation refers to the following terms hereafter. Assume we have an image x∈Xx\in\mathcal{X} and corresponding label yx∈Yy_{x}\in\mathcal{Y}. We define a set of bias, B\mathcal{B}, which contains every possible target bias that X\mathcal{X} can possess. In Figure 1, B\mathcal{B} is a set of possible colors, while Y\mathcal{Y} represents a set of digit classes. We also define a latent function b:X→Bb:\mathcal{X}\rightarrow\mathcal{B}, where b(x)b(x) denotes the target bias of xx. We define random variables XX and YY that have the value of xx and yxy_{x} respectively.

The objective of our work is to train a network that performs robustly with unbiased data during test time, even though the network is trained with biased data. The data bias has following characteristic:

where XtrainX^{train} and XtestX^{test} denote the random variable sampled during the training and test procedure, respectively, and I(⋅;⋅)\mathcal{I}(\cdot;\cdot) denotes the mutual information. Biased training data results in the biased networks, so that the network relies heavily on the bias of the data:

To this end, we add the mutual information to the objective function for training networks. We minimize the mutual information over f(X)f(X), instead of g(f(X))g(f(X)). It is adequate because the label prediction network, gg, takes f(X)f(X) as its input. From a standpoint of gg, the training data is not biased if the network ff extracts no information of the target bias. In other words, extracted feature f(x)f(x) should contain no information of the target bias, b(x)b(x). Therefore, the training procedure is to optimize the following problem:

where Lc(⋅,⋅)\mathcal{L}_{c}(\cdot,\cdot) represents the cross-entropy loss, and λ\lambda is a hyper-parameter to balance the terms.

The mutual information in Eq. (3) can be equivalently expressed as follows:

where H(⋅)H(\cdot) and H(⋅∣⋅)H(\cdot|\cdot) denote the marginal and conditional entropy, respectively. Since the marginal entropy of bias is constant that does not depend on θf\theta_{f} and θg\theta_{g}, H(b(X))H(b(X)) can be omitted from the optimization problem, and we try to minimize the negative entropy, −H(b(X)∣f(X))-H(b(X)|f(X)). Eq. (4) is difficult to directly minimize as it requires the posterior distribution, P(b(X)∣f(X))P(b(X)|f(X)). Since it is not tractable in practice, minimizing the Eq. (4) is reformulated using an auxiliary distribution, QQ, with an additional equality constraint:

The benefit of using the distribution QQ is that we can directly calculate the objective function. Therefore, we can train the feature extraction network, ff, under the equality constraint.

2 Training Procedure

As the equality constraint in Eq. (5) is difficult to meet (especially in the beginning of the training process), we modify the equality constraint into minimizing KL divergence between PP and QQ, so that QQ gets closer to PP as learning progresses. We relax the Eq. (5), so that the auxiliary distribution, QQ, could be used to approximate the posterior distribution. The relaxed regularization loss, LMI\mathcal{L}_{MI}, is as follows:

where DKLD_{KL} denotes the KL-divergence and μ\mu is hyper-parameter which balances the two terms. Similar to the method proposed by Chen et al. , we parametrize the auxiliary distribution, QQ, as the bias prediction network, hh. Note that we will train network hh, so that the KL-divergence is minimized. Provided that the distribution QQ implemented by network hh converges to P(b(X)∣f(X))P(b(X)|f(X)), we only need to train network ff so that the first term in Eq. (6) is minimized.

Although the posterior distribution, P(b(X)∣f(X))P(b(X)|f(X)), is not tractable, the bias prediction network, hh, is expected to be trained to stochastically approximate P(b(X)∣f(X))P(b(X)|f(X)), if we train the network with b(X)b(X) as the label with SGD optimizer. Therefore, we relax the KL-divergence of Eq. (6) with expectation of the cross-entropy loss between b(X)b(X) and h(f(X))h(f(X)), and we train network hh so that bias prediction loss, LB\mathcal{L}_{\mathcal{B}}, is minimized.

Although training network hh alone to minimize Eq. (7) is enough to make QQ closer to PP, it will be additionally beneficial to train ff to maximize Eq. (7) in an adversarial way, i.e. to let the networks ff and hh play the minimax game. The intuition is that the feature extracted by network ff is making the bias prediction difficult. As ff is trained to minimize the first term in Eq. (6), we can reformulate Eq. (6) using LB\mathcal{L}_{\mathcal{B}} instead of KL-divergence as follows:

We train hh to correctly predict the bias, b(X)b(X), from its feature embedding, f(X)f(X). We train ff to minimize the negative conditional entropy. The network hh is fixed while minimizing the negative conditional entropy. The network ff is also trained to maximize the cross-entropy to restrain hh from predicting b(X)b(X). Together with the primal classification problem, the minimax game is formulated as follows:

In practice, the deep neural networks, ff, gg and hh, are trained with both adversarial strategy and gradient reversal technique . Early in learning, g∘fg\circ f are rapidly trained to classify the label using the bias information. Then hh learns to predict the bias, and ff begins to learn how to extract feature embedding independent of the bias. At the end of the training, hh regresses to the poor performing network not because the bias prediction network, hh, diverges, but because ff unlearns the bias, so the feature embedding, f(X)f(X), does not have enough information to predict the target bias.

Dataset

Most existing benchmarks are designed to evaluate a specific problem. The collectors often split the dataset into train/test sets exquisitely. However, their efforts to maintain the train/test split to obtain an identical distribution obscures our experiment. Thus, we intentionally planted bias to well-balanced public benchmarks to determine whether our algorithm could unlearn the bias.

We planted a color bias into the MNIST dataset . To synthesize the color bias, we selected ten distinct colors and assigned them to each digit category as their mean color. Then, for each training image, we randomly sampled a color from the normal distribution of the corresponding mean color and provided variance, and colorized the digit. Since the variance of the normal distribution is a parameter that can be controlled, the amount of the color bias in the data can be adjusted. For each test image, we randomly choose a mean color among the ten pre-defined colors and followed the same colorization protocol as for the training images. Each sub-datasets are denoted as follows:

Train-σ2\sigma^{2}: Train images with colors sampled with σ2\sigma^{2}

Test-σ2\sigma^{2}: Test images with colors sampled with σ2\sigma^{2}

Since the digits in the test sets are colored with random mean colors, the Test-σ2\sigma^{2} sets are unbiased. We varied σ2\sigma^{2} from 0.02 to 0.05 with a 0.005 interval. Smaller values of σ2\sigma^{2} indicate more bias in the set. Thus, Train-0.02 is the most biased set, whereas Train-0.05 is the least biased.

Figure 3 (a) shows samples from the colored MNIST, where the images in the training set show that the color and digit class are highly correlated. The color of the digit contains sufficient information to categorize the digits in the training set, but it is insufficient for the images in the test set. Recognizing the color would rather disrupt the digit categorization. Therefore, the color information must be removed from the feature embedding.

2 Dogs and Cats

We evaluated our algorithm with the dogs and cats database, developed by kaggle . The original database is a set of 25K images of dogs and cats for training and 12,500 images for testing. Similar to , we manually categorized the data according to the color of the animal: bright, dark, and other. Subsequently, we split the images into three subsets.

Train-biased 1 (TB1) : bright dogs and dark cats.

Train-biased 2 (TB2) : dark dogs and bright cats.

Test set: All 12,500 images from the original test set.

The images categorized as other are images featuring white cats with dark brown stripes or dalmatians. They were not used in our training sets due to their ambiguity. In turn, TB1 and TB2 contain 10,047 and 6,738 images respectively. The constructed dogs and cats dataset is shown in Figure 3 (b), with each set containing a color bias. For this dataset, the bias set B={\mboxdark,bright}\mathcal{B}=\{\mbox{dark, bright}\}. Unlike TB1 and TB2, the test set does not contain color bias.

On the other hand, the ground truth labels for test images are not accessible, as the data is originally for competition . Therefore, we trained an oracle network (ResNet-18 ) with all 25K training images. For the test set, we measured the performance based on the result from the oracle network. We presumed that the oracle network could accurately predict the label.

3 IMDB Face

The IMDB face dataset is a publicly available face image dataset. It contains 460,723 face images from 20,284 celebrities along with information regarding their age and gender. Each image in the IMDB face dataset is a cropped facial image. As mentioned in , the provided label contains significant noise. To filter out misannotated images, we used pretrained networks on Adience benchmark designed for age and gender classification. Using the pretrained networks, we estimated the age and gender for all the individuals shown in the images in the IMDB face dataset. We then collected images where the both age and gender labels match with the estimation. From this, we obtained a cleaned dataset with 112,340 face images, and the detailed cleaning procedure is described in the supplementary material.

Similar to the protocol from , we classified the cleaned IMDB images into three biased subsets. We first withheld 20% of the cleaned IMDB images as the test set, then split the rest of the images as follows:

Extreme bias 1 (EB1): women aged 0-29, men aged 40+

Extreme bias 2 (EB2): women aged 40+, men aged 0-29

Test set: 20% of the cleaned images aged 0-29 or 40+

As a result, EB1 and EB2 contain 36,004 and 16,800 facial images respectively, and the test set contains 13129 images. Figure 3 (c) shows that both EB1 and EB2 are biased with respect to the age. Although it is not as clear as the color bias in Figure 3 (a) and (b), EB1 consists of younger female and older male celebrities, whereas EB2 consists of younger male and older female celebrities. When gender is target bias, B={\mboxmale,female}\mathcal{B}=\{\mbox{male, female}\}, and when age is target bias, B\mathcal{B} is their age.

Experiments

In the following experiments, we removed three types of target bias: color, age, and gender. The age and gender labels were provided in IMDB face dataset, therefore LB(θf,θh)\mathcal{L}_{\mathcal{B}}(\theta_{f},\theta_{h}) was optimized with supervision. On the other hand, the color bias was removed via self-supervision. To construct color labels, we first sub-sampled the images by factor of 4. In addition, the dynamic range of color, 0-255, was quantized into eight even levels.

For the network architecture, we used ResNet-18 for real images and plain network with four convolution layers for the colored MNIST experiments. The network architectures correspond to the parametrization of g∘fg\circ f. In the case we used ResNet-18, gg was implemented as two residual blocks on the top, while ff represents the rest. For plain network for colored MNIST, both gg and ff consist of two convolution layers. ResNet-18 was pretrained with Imagenet data except for the last fully connected layer. We implemented hh with two convolution layers for color bias and single fully connected layer for gender and age bias. Every convolution layer is followed by batch normalization and ReLU activation layers. All the evaluation results were averaged to be presented in this paper.

2 Results

We compare our training algorithm with other methods that can be used for this task. The performance of the algorithms mentioned in this section were re-implemented based on the literature.

Colored MNIST. The amount of bias in the data was controlled by adjusting the value of σ2\sigma^{2}. A network was trained for each σ2\sigma^{2} value from 0.02 to 0.05 and was evaluated with the corresponding test set with the same σ2\sigma^{2}. Since a color for each image was sampled with a given σ2\sigma^{2}, smaller σ2\sigma^{2} implies severer color bias. Figure 4 shows the evaluation results of the colored MNIST. The baseline model represents a network trained without additional regularization and the baseline performance can roughly be used as an indication of training data bias. The algorithm denoted as “BlindEye” represents a network trained with confusion loss instead of our regularization. The other algorithm, denoted as “Gray”, represents a network trained with grayscale images and it was also tested with grayscale images. For the given color biased data, we converted the color digits into grayscale. Conversion into grayscale is a trivial approach that can be used to mitigate the color bias. We presume that the conversion into grayscale does not reduce the information significantly since the MNIST dataset was originally provided in grayscale.

The results of our proposed algorithm outperformed the BlindEye and baseline model with all values of σ2\sigma^{2}. Notably, we achieved similar performance as the model trained and tested with grayscale images. Since we converted images in both training and test time, the network is much less biased. In most experiments, our model performed slightly better than the gray algorithm, suggesting that our regulation algorithm can effectively remove the target bias and encourage a network to extract more informative features.

To analyze the effect of the bias and proposed algorithm, we re-colored the test images. We sampled with the same protocol, but with fixed mean color, which was assigned to one of the ten digit classes of the biased training data. Figure 5 shows the confusion matrices drawn by the baseline and our models with the re-colored test images. The digits illustrated in the top row denotes the mean colors and their corresponding digit class in training set. For example, the first digit, red zero, signifies the confusion matrices below are drawn by test images colored reddish regardless of their true label. It also stands for a fact that every digit of category zero in training data is colored reddish.

In Figure 5, the matrices of the baseline show vertical patterns, some of which are shared, such as digits 1 and 3. The mean color for class 1 is teal; in RGB space it is (0, 128, 128). The mean color for class 3 is similar to that of class 1. In RGB space, it is (0, 149, 182) and is called bondi blue. This indicates that the baseline network is biased to the color of digit. As observed from the figure, the confusion matrices drawn by our algorithm (bottom row) show that the color bias was removed.

Dogs and Cats. Table 1 presents the evaluation results, where the baseline networks perform admirably, considering the complexity of the task due to the pretrained parameters. As mentioned in , neural networks prefer to categorize images based on shape rather than color. This encourages the baseline network to learn shapes, but the evaluation results presented in Table 1 imply that the networks remain biased without regularization.

Similar to the experiment on the colored MNIST, simplest approach for reducing the color bias is to convert the images into grayscale. Unlike the MNIST dataset, conversion would remove a significant amount of information. Although the networks for grayscale images performed better than the baseline, Table 1 shows that the networks remain biased to color. This is likely because of the criterion that was used to implant the color bias. Since the original dataset is categorized into bright and dark, the converted images contain a bias in terms of brightness.

We used gradient reversal layer (GRL) and adversarial training strategy as components of our optimization process. To analyze the effect of each component, we ablated the GRL from our algorithm. We also trained networks with both confusion loss and GRL, since they can be used in conjunction with each other. Although the GRL was originally proposed to solve unsupervised domain adaptation problem , Table 1 shows that it is beneficial for bias removal. Together with either confusion loss or our regularization, we obtained the performance improvements. Furthermore, GRL alone notably improved the performance suggesting that GRL itself is able to remove bias.

Figure 6 shows the qualitative effect of our proposed regularization. The prediction results of the baseline networks do not change significantly regardless of whether the query image is cat or dog if the colors are similar. If a network is trained with TB1, the network predicts a dark image to be a cat and a bright image to be a dog. If another network is trained with TB2, the network predicts a bright image to be a cat and a dark image to be a dog. This implies that the baseline networks are biased to color. On the other hand, networks trained with our proposed algorithm successfully classified the query images independent of their colors. In particular, Figure 6 (c) and (f) were identically predicted by the baseline networks depending on their color. After removing the color information from the feature embedding, the images were correctly categorized according to their appearance.

IMDB face. For the IMDB face dataset, we conducted two experiments; one to train the networks to classify age independent of gender, and one to train the networks to classify gender independent of age. Table 2 shows the evaluation results from both experiments. The networks were trained with either EB1 or EB2 and since they are extremely biased, the baseline networks are also biased. By removing the target bias information from the feature embedding, overall performances are improved. On the other hand, considering that gender classification is a two class problem, where random guessing achieves 50% accuracy, the networks perform poorly on gender classification. Although Table 2 shows that the performance improves after removing the target bias from the feature embedding, the performance improvement achieved using our algorithm is marginal compared to previous experiments with other datasets. We presume that this is because of the correlation between age and gender. In the case of color bias, the bias itself is completely independent of the categories. In other words, an effort to unlearn the bias is purely beneficial for digit categorization. Thus, removing color bias from feature embedding improved the performance significantly because the network is able to focus on learning shape features. Unlike the color bias, age and gender are not completely independent features. Therefore, removing bias information from feature embedding would not be completely beneficial. This suggests that a deep understanding of the specific data bias must precede the removal of bias.

Figure 7 shows the qualitative effect of regularization on the gender classification task. Young, mid-age, and old individuals with both male and female are presented. Similar to Figure 6, it implies that the baseline networks are biased toward age. The baseline network trained with EB1 predicted both young male and young female images (Figure 7 (a) and (d)) as female with high confidence. Meanwhile, the network trained with EB2 predicted the same images as the exact opposite gender with high confidence. Upon removal of age bias, the networks were trained to correctly predict the gender.

Conclusion

In this paper, we propose a novel regularization term to train deep neural networks when using biased data. The core idea of using mutual information is inspired by InfoGan . In constrast to the inspiring approach, we rather minimize the mutual information in order not to learn. By letting networks play minimax game, networks learn to categorize, while unlearning the bias. The experimental results showed that the networks trained with the proposed regularization can extract bias-independent feature embedding, achieving the best performance in the most of the experiments. Furthermore, our model performed better than “Gray” model which was trained with almost unbiased data, indicating the feature embedding becomes even more informative. To conclude, we have demonstrated in this paper that the proposed regularization improves the performance of neural networks trained with biased data. We expect this study to expand the usage of various data and to contribute to the field of feature disentanglement.

Acknowledgement

This research was supported by Samsung Research.

References