Implicit Visual Bias Mitigation by Posterior Estimate Sharpening of a
  Bayesian Neural Network
The fairness of a deep neural network is strongly affected by dataset bias
and spurious correlations, both of which are usually present in modern
feature-rich and complex visual datasets. Due to the difficulty and variability
of the task, no single de-biasing method has been universally successful. In
particular, implicit methods not requiring explicit knowledge of bias variables
are especially relevant for real-world applications. We propose a novel
implicit mitigation method using a Bayesian neural network, allowing us to
leverage the relationship between epistemic uncertainties and the presence of
bias or spurious correlations in a sample. Our proposed posterior estimate
sharpening procedure encourages the network to focus on core features that do
not contribute to high uncertainties. Experimental results on three benchmark
datasets demonstrate that Bayesian networks with sharpened posterior estimates
perform comparably to prior existing methods and show potential worthy of
further exploration.
Rebecca S Stone, Nishant Ravikumar, Andrew J Bulpitt, David C Hogg
# Implicit Visual Bias Mitigation by Posterior Estimate Sharpening of a Bayesian Neural Network

###### Abstract

The fairness of a deep neural network is strongly affected by dataset bias and spurious correlations, both of which are usually present in modern feature-rich and complex visual datasets. Due to the difficulty and variability of the task, no single de-biasing method has been universally successful. In particular, implicit methods not requiring explicit knowledge of bias variables are especially relevant for real-world applications. We propose a novel implicit mitigation method using a Bayesian neural network, allowing us to leverage the relationship between epistemic uncertainties and the presence of bias or spurious correlations in a sample. Our proposed posterior estimate sharpening procedure encourages the network to focus on core features that do not contribute to high uncertainties. Experimental results on three benchmark datasets demonstrate that Bayesian networks with sharpened posterior estimates perform comparably to prior existing methods and show potential worthy of further exploration.

## 1 Introduction

In a perfectly unbiased world, every possible combination of features would be equally present in every sample set. Unfortunately, it has become increasingly apparent that societal and historical biases are prevalent in every domain. Furthermore, even if it were always feasible to obtain a balanced dataset, this in itself does not ensure a fair model, as relative quantities are not the sole contributor towards bias [41, 26]. Not only are biased datasets pervasive, but algorithms themselves can even amplify bias [50, 18].

Particularly in the visual domain, it is not realistic to assume a comprehensive knowledge of all bias variables in a dataset, let alone know where they occur across the training data. In high-impact domains highly susceptible to dataset bias, including medicine, finance, welfare, and crime, confidentiality and privacy requirements prohibit general use of metadata which might specify presence of bias variables in training sets. Furthermore, in most cases population bias makes balanced sampling impossible. The implications and consequences [11, 9, 28, 8]1 of unfair models built using such biased datasets are disheartening and intolerable.

Footnote 1: [https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing](https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing)

Recently, various studies propose implicit mitigation methods for neural networks [42, 27, 46, 4]. Yet many challenges still remain. Sample imbalances between minority and majority groups can be too steep to overcome without overfitting [43, 4, 36], learning spurious correlations is often much easier than learning the desired core features [18], and some bias-conflicting samples are simply more difficult to learn than others [41]. Additionally, studies comparing results for multiple methods on more than one visual bias benchmark dataset indicate that _no single mitigation method is universally effective_[34, 42, 18].

We contribute towards a better understanding and exploration of visual bias mitigation by proposing a novel implicit mitigation method which leverages the correlation between uncertainties and bias-conflicting samples. Episemic uncertainties in the Bayesian paradigm arise from lack of knowledge - missing information or data - and decrease given a more comprehensive distribution of data. This contrasts with aleatoric uncertainty, or data "noise" uncertainty which is irreducible since probabilistic variations are present irrespective of the dataset size. Thus, a more balanced distribution of data (in both quantity and ease of learning) will reduce epistemic uncertainties. We can directly leverage this for implicit bias mitigation.

A few recent works have also used this correlation. Branchaud-Charron et al. [7] show Bayesian Active Learning by Disagreement (BALD) [15] can help mitigate bias against relying on spurious correlations through rebalancing the dataset via an acquisition scheme which greedily reduces epistemic uncertainty. Khan et al. [22] use Bayesian uncertainty estimates to deal with class imbalance by weighting the loss function to move learned class boundaries away from more uncertain classes. This focuses primarily on class-level bias in the class imbalance score
nario, with some consideration for sample-level bias; our proposed method focuses solely on sample-level bias as we do not expect bias to be constrained to classes. Epistemic uncertainties are also used in a previous study [36] (EpiWt) to dynamically weight samples during training, but this approach suffers from the same overfitting problem as both explicit and implicit up-weighting methods.

Contributing to this body of literature, we propose a novel posterior estimate sharpening approach, which focuses on uncertainty-guided implicit feature re-weighting in the classification layers of a Bayesian neural network. In addition to showing potential compared against other methods, our sharpening approach also provides post-inference uncertainty estimates which can be useful for a variety of purposes.

## 2 Related Work

Prior mitigation methods can be categorized as _explicit_ or _implicit_. Explicit approaches require knowing the bias variables and which training samples are bias-aligned. Various works have experimented with re-weighting or re-sampling, the intuitive approach by which the minority samples are made to appear more often, thus encouraging the model not to leverage undesired correlations. This can be done via sampling probability [10, 21], loss weighting [12], or synthetically generating or augmenting data to balance out or encourage learning of certain features [19, 16].

Other methods focus on discouraging the representation portion of the network from encoding the biases. This can be accomplished through adversarial learning [48, 40], or by manipulating the feature representations in latent space to disentangle the spurious and core features [38, 37].

Another category of works explicitly learn the bias variable, in order to then unlearn it or adjust the model decisions based on this knowledge [14, 42]. Alvi et al. [3] propose a variant of this through "fairness through blindness", simultaneously learning the target task while learning to ignore the bias variables. However, these methods are vulnerable to redundant encoding [26], or learning combinations of other perhaps unlabeled bias variables as a proxy for the chosen bias variables.

The knowledge of bias variables can also be used to group the training data into subgroups for training fairer models. Group distributionally robust optimization (gDRO) suggests sub-grouping data according to their bias and class variables, and optimizes such that the model generalizes best over all groups [30]. Predictive group invariance (PGI) [1] also groups data according to bias variables and encourages matched predictive distributions across the groups, penalizing learning spurious features that do not appear across all groups. Both [30, 1] assume bias variables are specified in the training set, but also propose ways to infer groupings implicitly from the data. Similarly, but with a reinforcement learning setup, [41] propose an adaptive margin loss function which computes ideal margins between groups.

In contrast, implicit methods do not assume any prior knowledge of bias variables in the data. One such category of implicit methods leverages the observation that networks themselves can sometimes identify when they have learned spurious features as they are more easily learned, but, relying on them still results in misclassifications for a minority. Learning from Failure (LfF) [27], Learning with Biased Committee (LWBC) [23], and approaches by Bahng et al. [5] and Sanh et al. [31] exploit the failures of one or more normal or bias-amplifying networks to inform a de-biased network. These methods attempt to minimise the effect of bias-aligned training samples, some by actually removing samples from the training set shown to the target network.

Other methods explore implicit versions of up-weighting or re-sampling, by discovering sparse areas of the feature space [4] or dynamically identifying samples more likely to be bias-conflicting [36]. Du et al. [13] de-bias the classification head of the network by training on neutralized representations of training data. This requires knowing when bias variables appear in the training samples (or at least being able to predict using some other model) in order to adjust the representations.

Another category of implicit methods change the loss function to reward learning a fairer model; Xu et al. [46] implement this via a false positive rate penalty loss, and Pezeshki et al. [29] through Spectral Decoupling (SD), an adjusted L2 loss encouraging feature decoupling and discouraging learning features at the expense of learning another. SD allows the learning of simple correlations but not unilaterally, resulting in the preservation of minority core features.

Recently, Shrestha et al. [35] open a promising new direction of work, leveraging architectural inductive biases with an adaptable architecture (OccamNets) which allows the network to favor simpler solutions when needed. The resulting model prefers focusing on smaller visual regions for predictions yet does not constrain all samples to rely on the same complexity of hypotheses, as optimal "exit" locations in the architecture are learned per sample.

Our proposed implicit method shares intuition and motivation with many of these approaches, as we discuss further in Section 3.4.

## 3 Methodology

### Premise

For a Bayesian neural network with parameters \(\boldsymbol{\theta}\), posterior \(p(\boldsymbol{\theta}\ \mid D,\boldsymbol{x})\), class-labelled training data \(D=(X,Y)\), and test sample \(\boldsymbol{x}_{i}\), the predictive posterior distribution for a given target class \(\boldsymbol{y}_{i}\) is as follows:
\[p(\mathbf{y}_{i}\mid D,\mathbf{x}_{i})=\int p(\mathbf{y}_{i}\mid\mathbf{\theta},\mathbf{x}_{i})p(\mathbf{ \theta}\mid D)d\mathbf{\theta} \tag{1}\]

While this itself is intractable, stochastic gradient MCMC (SG-MCMC [44]) is a tractable variation of the gold standard Markov chain Monte Carlo (MCMC) algorithm, and uses the stochastic gradient over mini-batches with an additional Gaussian noise bound instead of the gradient over the whole training distribution. Furthermore, for faster convergence and a more thorough exploration of the multimodal distributions prevalent in deep neural networks, we adopt the cyclical learning rate schedule introduced in [49] known as cyclical SG-MCMC, or cSG-MCMC. Larger learning step phases provide a warm restart to the subsequent smaller steps constituting the sampling phase.

The final estimated posterior of the Bayesian network consists of \(\mathbf{\Theta}=\{\mathbf{\theta_{1}},...\mathbf{\theta_{M}}\}\), \(M\) moments sampled from the posterior over all trainable parameters, taken during the sampling phases of each learning cycle. With functional model \(\mathbf{\Phi}\) representing the neural network, the approximate predictive mean \(\mathbf{\mu}_{i}\) and output class prediction \(\mathbf{\hat{y}}_{i}\) for sample \(\mathbf{x}_{i}\) are:

\[\mathbf{\mu}_{i}\approx\frac{1}{M}\sum_{m=1}^{M}\mathbf{\Phi}_{\theta_{m}}(\mathbf{x}_{i}) \tag{2}\]

\[\mathbf{\hat{y}}_{i}=\text{argmax}\left(\mathbf{\mu}_{i}\right) \tag{3}\]

The epistemic uncertainty corresponding to this prediction is:

\[\mathbf{\sigma}_{i}\approx\frac{1}{M}\sqrt{\sum_{m=1}^{M}\left(\mathbf{\Phi}_{\mathbf{ \theta}_{m}}(\mathbf{x}_{i})-\mathbf{\mu}_{i}\right)^{2}} \tag{4}\]

which for any given sample is an indicator of model confidence in its prediction based on the information given. We refer readers to [20] for a more in-depth presentation of Bayesian neural networks and their implementation.

### Bias and Uncertainties

Bias-conflicting samples tend to have higher epistemic uncertainties than their bias-aligned counterparts [17, 2, 36]. These epistemic uncertainties arise from the classification, not representation, portions of the network despite the learned representations being arguably "biased representations" [13]. We can briefly explore these two claims on a toy synthetic dataset which we call Biased Synbols. We choose Synbols [25] as the tool to build Biased Synbols as we can easily control the resolution and features in each generated image. The foreground of each \(224\) x \(224\) image is a character displayed in a font chosen randomly from a large selection of fonts, and the texture of the character is a random natural scene, cropped to fit the character mask. The background behind the character is a 2-color gradient. We introduce four types of bias as shown in Figure 1.

We generate a two letter ("s" and "t") binary classification task with train/val/test splits of 20k/5k/5k and train Bayesian AlexNet on four versions of Biased Synbols, each with a different bias variable and \(p_{bias}=0.95\) for the "s" class and \(p_{bias}=0.05\) for the "t". In each case, the bias-conflicting samples have higher mean group uncertainties than the bias-aligned (a mean increase by 0.15, 0.16, 0.09, and 0.20 for the four variables shown in Figure 1 respectively, for normalized uncertainties between 0.0-1.0).

Next, we identify where the discrepancies in uncertainties arise from in the network. We find indiscernible difference in uncertainties by averaging the uncertainties across the features extracted directly after the final convolutional layer. To further confirm, we perform network dissection [6]. on Biased Synbols with the spurious square in a random corner. Network dissection measures the alignment between convolutional kernel activations and any concept, which can be defined by segmentation masks on the dataset. As the square bias variable is generally spatially distinct from the core feature, i.e. the character shape, we can dissect the network to locate which convolutional kernels are most strongly activated by the former (Figure 2). For every convolutional layer in AlexNet, we compute the intersection-over-union (IoU) of the square with the thresh

Figure 1: One sample from class “s” of our toy dataset Biased-Synbols with controllable bias variables _(left to right)_: texture of letter, spurious square placed in random corner, resolution of whole image, and gray-scale.

Figure 2: The six training images for which kernel 0, convolutional layer 4 _(top)_ and kernel 10, convolution layer 2 _(bottom)_ from AlexNet most strongly activate. The first kernel has identified a core feature for class “s”, whereas the second corresponds to the spurious or bias feature rather than the character.
olded kernel activation heatmaps, and measure correlation between these IoUs and the kernel uncertainties. The Pearson correlations per layer are -0.01, -0.03, 0.13, -0.07, and 0.17, strongly indicating no clear correlation; thus, simply learning features associated with bias variables _does not create discrepancies in uncertainties_.

These observations motivate our focus on the classification head and the uncertainties induced by learning a biased feature weighting in the classification layers of the network.

### Posterior Estimate Sharpening

We propose a _sharpening_ procedure (Algorithm 1) which further fine-tunes the classification layers of each Monte-Carlo sample from the Bayesian posterior using a multi-component loss function. We freeze the representation portion of the network during this procedure because (1) we aim to learn re-weighting of learned features in the classification head only, (2) updating the representation network can change the feature representations, thus complicating the re-weighting goal, and (3) experimental evidence backs these intuitions, showing a drastic drop in both performance and model fairness when the whole network is fine-tuned. Thus, when we refer to posterior estimates for sharpening, we are referring to \(\mathbf{\theta}_{c}\), where each posterior sample \(\mathbf{\theta}_{m}=\{\mathbf{\theta}_{r,m},\mathbf{\theta}_{c,m}\}\) includes the parameters from the representation and classification portions of the network respectively. The validity of operating on \(\mathbf{\theta}_{c}\) alone can be supported by literature on "Bayesian last layer" networks [24].

Our novel loss, a _sharpening loss_, penalizes the posterior of a Bayesian neural network for having a large variance. This can also be compared to artificially sharpening or tempering the posterior (see discussion in Section 3.4). Consider a regular negative log likelihood loss measuring, for a sample \(\mathbf{x}_{i}\), the divergence between the true class and the predicted likelihood of each class. For one-hot encoded true target \(\mathbf{y}_{i}\) and model prediction \(\mathbf{\Phi}(\mathbf{x}_{i})\), negative log likelihood loss computes the sum over all possible classes:

\[L_{nll}=L(\mathbf{y}_{i},\mathbf{\Phi}(\mathbf{x}_{i}))=-\sum\mathbf{y}_{i}\cdot\text{log}(\bm {\Phi}(\mathbf{x}_{i})) \tag{5}\]

With our Bayesian posterior estimate, our proposed loss \(L_{s}\) must be computed separately for each posterior sample \(\mathbf{\theta}_{m}\). We replace the true target \(\mathbf{y}_{i}\) with one-hot encoded \(\mathbf{\hat{y}}_{i}\) (Equation 3) derived from the predictive mean, capturing the divergence between the prediction of _a single posterior estimate_ and the mean prediction of the whole posterior:

\[L_{s}=L(\mathbf{\hat{y}}_{i},\mathbf{\Phi}_{\theta_{m}}(\mathbf{x}_{i}))=-\sum\mathbf{\hat{y}} _{i}\cdot\text{log}(\mathbf{\Phi}_{\theta_{m}}(\mathbf{x}_{i})) \tag{6}\]

This minimizes \(\mathbf{\sigma}\) in Equation 4. Equivalently, \(L_{s}\) encourages the classification layers of the network to learn a feature weighting which minimizes uncertainties for high uncertainty samples, by diminishing the importance of features contributing to high uncertainties. A bias-conflicting sample class pair \((\mathbf{x}_{i},\mathbf{y}_{i})\) may have high uncertainty because it does not contain bias feature \(b\) present in the majority of class \(\mathbf{y}_{i}\). One or more features \(F\) capture the relationship between \(b\) and \(\mathbf{y}_{i}\) and the variance of the distributions over the weights of \(F\) are responsible for the high class uncertainty for \(\mathbf{x}_{i}\). The sharpening loss rewards down-weighting \(F\), hence discouraging the \((b,\mathbf{y}_{i})\) correlation.

Not all samples are equally important. The bias-conflicting sample with high uncertainty, for example, should have larger gradients which shift the distribution. In contrast, there is no need to adjust the weights for a bias-aligned sample with low uncertainty; to do so would strengthen the existing undesired correlation. To reflect this, we weight each sample by \(\mathbf{w}_{i}\) as a function of its epistemic uncertainty as proposed in [36] and shown in Equation 7 for a batch of size \(N\). The distribution is shifted by 1.0 and scaling constant \(\kappa\) controls the steepness of the function such that low uncertainty samples are never completely discounted, but only minimally shift the distribution.

\[\mathbf{w}_{i}=(1.0+\mathbf{\sigma}_{i,y_{i}})^{\kappa} \tag{7}\]

Backpropagating with this loss sharpens the estimated posterior, and has the potential to also shift the predictive mean away from the true target. Thus, we find it is not beneficial to completely discard the original loss that directs the network towards true targets.

```
0: Training data \(X,Y\), neural network \(\mathbf{\Phi}\), update step size \(\epsilon\), posterior \(\mathbf{\Theta}\)
1:for each iteration of sharpening do
2: Given \(\mathbf{\Theta}\), compute \(\mathbf{\mu}\) and \(\mathbf{\sigma}\), for all \(X\)
3:for each \(\mathbf{\theta}_{m}=\{\mathbf{\theta}_{r,m},\mathbf{\theta}_{c,m}\}\in\mathbf{\Theta}\)do
4:for each batch \(\mathbf{x}_{b}\), \(\mathbf{y}_{b}\) of size \(\left|b\right|\)do
5:\(\mathbf{w}_{b}=(1.0+\mathbf{\sigma}_{b,y_{b}})^{\kappa}\)
6:\(\mathbf{\hat{y}}_{b}=\text{argmax}\left(\mathbf{u}_{b}\right)\)
7:\(L_{nll}=L(\mathbf{y}_{b},\mathbf{\Phi}_{\theta_{m}}(\mathbf{x}_{b}),\mathbf{w}_{b})/\left|b\right|\)
8:\(L_{s}=L(\mathbf{\hat{y}}_{b},\mathbf{\Phi}_{\theta_{m}}(\mathbf{x}_{b}),\mathbf{w}_{b})/\left|b\right|\)
9: Update \(\left[\mathbf{\theta}_{c,m}+\mathbf{\epsilon}\text{PCGrad}(L_{s},L_{nll})\right]\)
10:endfor
11:endfor
12:endfor
```

**Algorithm 1** Sharpening procedure on Monte-Carlo estimate of posterior \(\mathbf{\Theta}=\{\mathbf{\theta}_{m},...\mathbf{\theta}_{M}\}\)

As the two loss gradients may conflict, we use a form of gradient surgery used in multi-task learning called _projecting conflicting gradients_ (PCGrad) [47], whereby the gradient of one loss is projected onto the normal plane of the other when the gradients have negative cosine similarly. For each sample in each mini-batch, gradients for losses \((L_{s},L)\)
are computed. If there is destructive interference, one gradient is selected at random and projected onto the normal plane of the other. In the case of constructive interference, both gradients are combined as usual. The cumulative update to the weights is then averaged over the batch. An ablation study showing experimental support for the use of gradient surgery is shown in Table 5.

### Related Observations

Sharpening posterior estimates allows the network to first learn all features unhindered, then implicitly adjusts the weighting of those features with respect to the final task. The motivation for this novel approach stems from two main observations.

**Addressing simplicity bias.** Firstly, deep neural networks trained with empirical risk minimization (ERM) prefer simple solutions, tending to rely on spurious correlations especially when they are easier to learn than the core features. This has been referred to as _simplicity bias_[33]. Every bias mitigation method attempts to inform the model when it should rely on more complex predictive features versus when a simpler explanation is preferable. In literature, this has been addressed by either (1) selectively modifying the learned representations post-training [32, 13], or (2) guiding the network to selectively learn un-biased representations to begin with [27, 23, 29, 35, 36].

Posterior estimate sharpening falls in the first category, an implicitly-guided re-weighting of the classification head. It constrains the complexity of the model, not unlike OccamNets [35] which does so architecturally. Furthermore, sharpening is less prone to overfitting to minority samples as unlike [36, 10, 21, 12], it is not directly equivalent to up-weighting samples, focusing rather on feature weighting. The sharpening procedure addresses simplicity bias by relying on uncertainty estimates to inform when simpler solutions are not preferable, because they result in high uncertainties for bias-conflicting samples.

**Adjusting Bayesian posteriors.** Secondly, artificially tampering with posteriors of Bayesian deep neural networks is not a foreign concept. As presented by Wenzel et al. [45], the true Bayesian posteriors of deep neural networks are rarely used in practice. Rather, _tempered_ or _cold posteriors_ are widely found to perform better. Tempered posteriors are equivalent to over-counting the data by a factor of \(1/T\) for temperature scalar \(T\) and re-scaling the prior to \(p(\mathbf{\theta})^{1/T}\). In contrast, the true Bayes posterior corresponding to \(T=1\) usually gives sub-optimal performance.

We note, however, that our proposed sharpening procedure is applied only to the _estimated_ posterior derived from MC sampling, not to the true Bayes posterior. The MC samples provide a finite, numerical handle on model inference. Furthermore, running the sharpening procedure with a sampling size \(M\) of up to 20 indicates that increasing the MC sample size for a more accurate posterior estimate has negligible impact on the de-biasing.

## 4 Experiments

### Datasets

Following the benchmarks established by Shreshtha et al. in [35], we experiment on three datasets for visual bias mitigation shown in Figure 3. **Biased MNIST**[34] introduces color, texture, scale, and contextual biases into a 5 x 5 grid of cells, one or more of which contain one of the target MNIST 10 digits. With \(p_{bias}=0.95\), each digit co-occurs 95% with each bias source. The test set is unbiased with a 50K/10K/10K train/val/test split. **COCO-on-Places**[1] spuriously correlates Places backgrounds with COCO object foregrounds. Most zebras, for example, appear in front of a desert, and most horses in front of a snowy landscape. Three test sets are provided: 1) biased backgrounds, matching the correlations present in the training set, 2) unseen backgrounds, including seen objects placed on new backgrounds unseen during training, and 3) seen but unbiased backgrounds. COCO-on-Places has a 7200/900/900 train/val/test split and 9 classes. Finally, **Biased Action Recognition (BAR)**[27] includes manually selected real-world images of action-background pairs, where the backgrounds are correlated to the action; e.g., most characters in the "climbing" class are climbing snowy mountains, and more rarely climb other objects such as buildings, structures, etc. BAR is the smallest dataset with a 1641/300/654

Figure 3: Datasets used for evaluation: Biased MNIST _(left)_, COCO-on-Places _(center)_, Biased Action Recognition (BAR) _(right)_.
train/val/test split 2 and 6 target classes.

Footnote 2: We randomly split the published training set into training and validation sets as no split is consistently used in literature.

### Group Epistemic Uncertainties

Unlike Biased-Synbols where the bias variable and its effect on model uncertainty can be observed and controlled in isolation, our benchmark datasets are significantly more complex. Bias-inducing features co-occur, but not always on the same samples (Biased MNIST). Classes can be severely imbalanced (BAR contains only 163 fishing images compared to its largest class of 520 images). Furthermore, both COCO and BAR exhibit intra-class diversity; the "racing" category includes bikes, motorcycles, runners, and a wide variety of vehicles, and COCO objects occur with different angles and coloring. This diversity also introduces bias into the dataset, albeit unintentional and unaccounted for. The mean group sample uncertainties extracted from Bayesian ResNet18 models trained on each dataset reflect this as well, as shown in Figure 4.

While this entangled experimental setup makes evaluation of the impact of de-biasing methods more difficult, the scenario is certainly realistic given the state of real-world visual datasets. Instead of explicitly disentangling the bias sources, sharpening trusts that the posterior adequately expresses its own shortages in information. Thus, sharpening considers class imbalance, intra-class diversity, unintentional biases, and known biases simultaneously.

### Training and Inference

Optimal parameters for cSG-MCMC are determined via grid search for initial step sizes {0.01 0.05, 0.1, 0.5}, cycle lengths {150, 200, 300, 400, 500, 600, 700}, and Gaussian noise control parameter \(\alpha\in\{\)0.1, 0.3, 0.5, 0.7}. We fixed each schedule to 2 cycles and 3 moments sampled per sampling phase. Batch sizes for the baseline Bayesian models were fixed at 128 for training, and 64 for the sharpening procedure due to memory constraints (32 for BAR due to larger image size). Validation accuracy was used to determine stopping points and optimal hyper-parameters for both baseline Bayesian models and the sharpening procedure. Training took place on several IBM Power 9 dual-CPU nodes with 4 NVIDIA V100 GPUs. We refer readers to the Appendix for the optimal parameters for all experiments.

Following methodology reported in [35], we reduce the kernel size of the first convolutional layer of ResNet18 from 7 to 3 for COCO due to the small image size (64 x 64). We also initialize the priors for the BAR Bayesian ResNet18 models using the weights from a deterministic ResNet18 trained on an ImageNet subset of 100 classes.

The sharpening procedure requires keeping a handle on each Monte Carlo sample from \(p(\mathbf{\theta}\mid D,\mathbf{x})\), and back-propagating on each of these samples for every iteration. Thus, the procedure has time complexity of \(O(M\cdot N\cdot K)\) for \(M\) posterior samples, \(K\) multiplication operations as required for the network architecture, and \(N\) iterations, versus \(O(N\cdot K)\) for a deterministic network.

## 5 Results and Discussion

For a fair comparison against prior reported results on these datasets, we use a ResNet18 throughout the experiments. We compare against several explicit and implicit mitigation methods, separated in each table: UpWt, gDRO, and PGI for explicit approaches, and the baseline ERM, SD and OccamNet for implicits. We also include EpiWt, another implicit method, due to its similarity to our approach in leveraging the epistemic uncertainties of a Bayesian neu

\begin{table}
\begin{tabular}{l c c c} \hline \hline Architecture+Method & Biased MNIST & COCO & BAR \\ \hline \multicolumn{4}{c}{_Explicit method_} \\ ResNet+UpWt & \(37.7\pm 1.6\) & \(35.2\pm 0.4\) & \(51.1\pm 1.9\) \\ ResNet+gDRO [30] & \(19.2\pm 0.9\) & \(35.3\pm 0.1\) & \(38.7\pm 2.2\) \\ ResNet+PGI [1] & \(\mathbf{48.6\pm 0.7}\) & \(\mathbf{42.7\pm 0.6}\) & \(\mathbf{53.6\pm 0.9}\) \\ \hline \multicolumn{4}{c}{_Implicit method results_} \\ ResNet+ERM & \(36.8\pm 0.7\) & \(35.6\pm 1.0\) & \(51.3\pm 1.9\) \\ ResNet+SD [29] & \(37.1\pm 1.0\) & \(35.4\pm 0.5\) & \(51.3\pm 2.3\) \\ OccamResNet [35] & \(\mathbf{65.0\pm 1.0}\) & \(\mathbf{43.4\pm 1.0}\) & \(52.6\pm 1.9\) \\ \multicolumn{4}{c}{BayResNet+EpiWt [36]} & \(34.4\pm 1.1\) & \(34.4\pm 0.8\) & \(52.1\pm 1.5\) \\ \multicolumn{4}{c}{- BayResNet+Sharpen} & \(38.6\pm 0.6\) & \(34.9\pm 0.6\) & \(\mathbf{53.9\pm 0.7}\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Unbiased test set accuracies comparing Bay-ResNet against current debiasing methods. **First, second** and third best results are formatted.

Figure 4: Mean uncertainties for subgroups of each test dataset, showing bias-induced discrepancies, but also increased uncertainties arising from a variety of other sources, some of which may be unintentional bias present in the data.
ral network. We consider two baselines: (1) empirical risk minimization (ERM) of a deterministic ResNet18, and (2) a Bayesian ResNet18, both trained with normal cross entropy loss and no bias mitigation. The sharpening procedure gives competitive results on BAR, and comparable performance on Biased MNIST (Table 1).

We observe poorer performance on the COCO dataset. Posterior estimate sharpening always increases model fairness when compared to its baseline Bayesian starting point. As demonstrated in Table 3, the Bayesian ResNet struggles with both the out-of-distribution and unbiased background test sets, with differences of -3.5% and -2.6% respectively compared to the deterministic ERM baseline. Building on the BayResNet, the sharpening thus starts with a _more unfair model_ than methods based on a deterministic ERM model, giving it a distinct disadvantage. Assuming the discrepancy in performance is somewhat due to the stochastic nature of the network, BayResNet+EpiWt would also have a disadvantage but does better on the biased test set than BayResNet+Sharpen; nonetheless, as is consistent across datasets, BayResNet+Sharpen still does better than BayResNet+EpiWt on the two unbiased test sets.

Regardless, this highlights a weakness of the sharpening approach. We consider the vast topic of comparing the predictive performances of deterministic and Bayesian neural networks out of the scope of this paper, but acknowledge that Bayesian neural networks can struggle to match deterministic benchmarks, which directly affects the sharpening method. We weigh these sacrifices in performance against the added benefit of quantified prediction uncertainty estimates, which deterministic models fail to communicate altogether.

BAR is a counterexample, where the Bayesian baseline outperforms or does at least as well as the deterministic one across class groups. The most realistic and complex dataset of the three, BAR is neither texturally simple like Biased MNIST nor synthetically created and low-resolution like COCO-on-Places. The posterior estimate sharpening method performs well on BAR (Table 2), especially considering the large discrepancy in performances across classes and methods. Notably, while various methods do well in two or three classes, BayResNet+Sharpen has good performance across the majority of classes (5/7 classes). For this dataset, perhaps because of its ability to regularize despite the small dataset size and substantial intra-class diversity, the baseline BayResNet provides a strong starting point for the sharpening method.

Table 4 shows the majority/minority group accuracies and bias-induced accuracy gap for the six bias variables in Biased MNIST. Compared to the baseline ERM, the sharpened model decreases the accuracy gaps between majority and minority groups across the dataset for 4 out of 6 of the biases (texture, texture color, letter, and letter color). While BayResNet+Sharpen results on Biased MNIST are not as competitive, results demonstrate that the sharpening objective aims at increasing model fairness rather than simply

\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline Methods & Overall & Climbing & Diving & Fishing & Pole & \multirow{2}{*}{Racing} & \multirow{2}{*}{Throwing} \\  & \multicolumn{6}{c}{_Explicit method results_} \\ ResNet+UpWt & 51.1 \(\pm\)1.9 & 61.7 \(\pm\)13.2 & **43.9**\(\pm\)5.8 & 42.3 \(\pm\)8.3 & 52.3 \(\pm\)7.4 & 67.9 \(\pm\)6.7 & 28.2 \(\pm\)12.8 \\ ResNet+gDRO [30] & 38.7 \(\pm\)2.2 & 49.5 \(\pm\)8.5 & 40.3 \(\pm\)8.4 & 44.0 \(\pm\)10.4 & 39.9 \(\pm\)7.1 & 41.7 \(\pm\)4.0 & 13.5 \(\pm\)5.9 \\ ResNet+PGI [1] & 53.6 \(\pm\)0.9 & 61.2 \(\pm\)10.4 & 38.4 \(\pm\)4.1 & 42.9 \(\pm\)8.4 & **73.3**\(\pm\)3.7 & 68.9 \(\pm\)5.9 & 23.5 \(\pm\)1.9 \\ OccamResNet+UpWt & 52.2 \(\pm\)1.4 & 57.9 \(\pm\)1.8 & 35.7 \(\pm\)7.5 & 51.8 \(\pm\)11.2 & 64.3 \(\pm\)8.8 & 71.8 \(\pm\)3.8 & 27.4 \(\pm\)3.5 \\ OccamResNet+gDRO [30] & 52.9 \(\pm\)0.8 & 51.2 \(\pm\)9.6 & 42.8 \(\pm\)8.2 & 52.3 \(\pm\)5.1 & 63.5 \(\pm\)7.3 & 74.2 \(\pm\)5.2 & 25.3 \(\pm\)4.5 \\ OccamResNet+PGI [1] & **55.9**\(\pm\)0.7 & 64.2 \(\pm\)5.1 & **52.3**\(\pm\)6.4 & 51.4 \(\pm\)8.3 & 64.4 \(\pm\)4.1 & 70.9 \(\pm\)8.1 & 18.6 \(\pm\)6.8 \\ \hline \multicolumn{8}{c}{_Implicit method results_} \\ ResNet+ERM & 51.3 \(\pm\)1.9 & 69.5 \(\pm\)7.5 & 29.2 \(\pm\)1.8 & 39.9 \(\pm\)16.2 & 55.5 \(\pm\)6.4 & 75.6 \(\pm\)5.6 & **31.8**\(\pm\)4.3 \\ ResNet+SD [29] & 51.3 \(\pm\)2.3 & 62.1 \(\pm\)7.5 & 35.8 \(\pm\)2.0 & 51.2 \(\pm\)6.4 & 62.4 \(\pm\)9.2 & 71.6 \(\pm\)10.0 & 18.5 \(\pm\)6.7 \\ OccamResNet [30] & 52.6 \(\pm\)1.9 & 59.3 \(\pm\)3.8 & 42.3 \(\pm\)7.5 & 44.6 \(\pm\)14.9 & 60.5 \(\pm\)8.6 & 74.1 \(\pm\)7.2 & 22.1 \(\pm\)3.9 \\ OccamResNet+SD [29] & 52.3 \(\pm\)2.4 & 56.4 \(\pm\)6.8 & 34.3 \(\pm\)5.8 & **55.4**\(\pm\)7.4 & **69.1**\(\pm\)4.9 & 72.9 \(\pm\)4.2 & 21.8 \(\pm\)2.1 \\ BayResNet & 52.7 \(\pm\)2.6 & **71.1**\(\pm\)2.7 & 28.3 \(\pm\)10.3 & 54.8 \(\pm\)8.2 & 54.2 \(\pm\)3.3 & **78.0**\(\pm\)3.9 & **31.8**\(\pm\)2.6 \\ BayResNet+EpiWt [36] & 52.1 \(\pm\)1.6 & 67.9 \(\pm\)2.2 & 27.9 \(\pm\)5.1 & 51.6 \(\pm\)5.4 & 59.8 \(\pm\)3.5 & 76.2 \(\pm\)0.4 & 30.0 \(\pm\)2.9 \\ BayResNet+Sharpen & **53.9**\(\pm\)0.7 & **72.1**\(\pm\)2.0 & 32.1 \(\pm\)3.2 & **59.5**\(\pm\)2.3 & 52.7 \(\pm\)2.7 & **79.6**\(\pm\)0.7 & **32.6**\(\pm\)2.9 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Overall and per-class accuracies on BAR, showing large discrepancies in performance across methods and classes.

\begin{table}
\begin{tabular}{l c c c} \hline \hline Architecture+Method & Biased & Unseen & Seen, but \\  & Bgs & Bgs & Unbiased \\ \hline \multicolumn{4}{c}{_Explicit method results_} \\ ResNet+PGI [1] & 77.5 \(\pm\)0.6 & 52.8 \(\pm\)0.7 & 42.7 \(\pm\)0.6 \\ OccamResNet+PGI [1] & 82.8 \(\pm\)0.6 & **55.3**\(\pm\)1.3 & **43.6**\(\pm\)0.6 \\ \hline \multicolumn{4}{c}{_Implicit method results_} \\ ResNet+ERM & 84.9 \(\pm\) 0.5 & 53.2 \(\pm\)0.7 & 35.6 \(\pm\)1.0 \\ OccamResNet [35] & 84.0 \(\pm\)1.0 & **55.8**\(\pm\)1.2 & **43.4**\(\pm\)1.0 \\ \multicolumn{4}{c}{BayResNet} \\ BayResNet+EpiWt [36] & **85.8**\(\pm\)0.1 & 50.3 \(\pm\)1.1 & 34.4 \(\pm\)0.8 \\ \hline BayResNet+Sharpen & **85.6**\(\pm\)0.6 & 51.2 \(\pm\)0.2 & 34.9 \(\pm\)0.6 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Accuracies on all three test splits of COCO-on-Places: biased backgrounds (Bgs), unseen backgrounds, and seen but unbiased backgrounds.
rewarding accuracy gains on the majority groups.

We consider the impact of PCGrad on the multi-task loss in the ablation study shown in Table 5. For weighted loss \(L+k\cdot L_{s}\), scalar weight \(k\) is chosen using a grid search in range \(k=2\) to \(k=10\) with optimal \(k\) being in range 3 to 5 for all datasets with negligible impact for \(k<3\) and declining accuracy (biased and unbiased sets) for values \(k>5\); this loss simply adds the two losses together regardless of conflict, with a fixed weighting term across all samples.

Finally, uncertainty distributions across training sets do not collapse under PCGrad sharpening, so sample uncertainty estimates extracted at inference time may still be useful for triage or other purposes in high-risk scenarios.

## 6 Conclusion

The visual datasets heavily relied on by today's deep neural networks are complex, feature-dense, and full of unidentified biases and spurious correlations. While no single bias mitigation method has thus far been unilaterally successful, a wide variety of ideas in recent literature make promising advances in both explicit and implicit mitigation.

Our posterior estimate sharpening method adds to this body of work by implicitly exploiting the relationship between minority samples and epistemic uncertainties. We have demonstrated competitive performance on one benchmark, and comparable results on another. Further exploration is required to better understand when and why Bayesian neural networks struggle with respect to deterministic networks within the context of bias mitigation, and why the performances of mitigation methods vary across datasets. This perhaps calls for a better disentangling of features and correlations within training and test datasets used for evaluation, which we leave for future consideration.

## 7 Acknowledgements

The first author is a recipient of an Ezra Rabin Scholarship. Training was carried out on Bede, a facility of the N8 Centre of Excellence in Computationally Intensive Research (N8 CIR) 3. We would like to acknowledge the respective authors for their publicly available code for cSG-MCMC 4, network dissection 5, PCGrad [39], and OccamNets 6 from which we have modified code for our work. We thank Robik Shrestha for kindly providing the checkpoint for the ResNet18 trained on the ImageNet-100 subset, which was used as the prior for the BAR models. Finally, special thanks to Jose Sosa and Mohammed Alghamdi from the School of Computing's Computer Vision Group for critical feedback and many great discussions.

Footnote 3: [https://n8cir.org.uk/bede/](https://n8cir.org.uk/bede/)

Footnote 4: [https://github.com/ruqizhang/csgmcmc](https://github.com/ruqizhang/csgmcmc)

Footnote 5: [https://github.com/davidbau/dissect](https://github.com/davidbau/dissect)

Footnote 6: [https://github.com/erobic/occam-nets-v1](https://github.com/erobic/occam-nets-v1)
