Chroma-VAE: Mitigating Shortcut Learning with Generative Classifiers
Abstract
Deep neural networks are susceptible to shortcut learning, using simple features to achieve low training loss without discovering essential semantic structure.
Contrary to prior belief, we show that generative models alone are not sufficient to prevent shortcut learning, despite an incentive to recover a more comprehensive representation of the data than discriminative approaches.
However, we observe that shortcuts are preferentially encoded with minimal information, a fact that generative models can exploit to mitigate shortcut learning.
In particular, we propose Chroma-VAE, a two-pronged approach where a VAE classifier is initially trained to isolate the shortcut in a small latent subspace, allowing a secondary classifier to be trained on the complementary, shortcut-free latent subspace.
In addition to demonstrating the efficacy of Chroma-VAE on benchmark and real-world shortcut learning tasks, our work highlights the potential for manipulating the latent space of generative classifiers to isolate or interpret specific correlations.
Introduction
As science fiction writer Robert Heinlein quipped in his 1973 novel Time Enough for Love , progress is made not by “early risers”, but instead by “lazy men trying to find easier ways to do something”.
Indeed we can accuse modern machine learning models of emulating the same behaviour.
There are notable examples of models that wind up learning the wrong things.
For example, images of cows standing on anything other than grass fields are commonly misclassified, because the combination of cows and grass fields is so prevalent in training data that the model simply learns to rely on the background as a predictive signal [4].
A more concerning example involves predicting pneumonia from chest X-ray scans.
Hospitals in the training data have differing rates of diagnosis, a fact that the model easily exploits by learning to detect hospital-specific metal tokens in the scans rather than signals relevant to pneumonia itself [50].
Deep neural networks can learn brittle, unintended signals under empirical risk minimization (ERM) [11, 16, 13], a well-known phenomenon observed and studied by various communities.
These signals often possess two key attributes: (i) they are spuriously correlated to the label and are therefore strongly predictive [6, 48, 29], despite having no meaningful semantic relationship with the label, and (ii) they are learnt by the neural network as a result of its inductive biases [41, 10].
A recent unifying effort by Geirhos et al.
[10] coins the term shortcut to describe such a signal.
Networks that learn shortcuts will fail to generalize to relevant or challenging distribution shifts.
Prior work has sought to alleviate this problem under various formalizations, most commonly in the settings of group robustness [e.g. 37, 26, 7] or adversarial robustness [e.g. 5, 43].
In this paper, we motivate a different approach to mitigate undesirable shortcuts, where we seek instead to learn a shortcut-invariant representation of the data — that is, “everything but the shortcut”.
To this end, we first observe empirically that deep neural networks preferentially encode shortcuts as they are the most efficient compression of the data that is strongly predictive of training labels.
This helps to explain why shortcut learning is so prevalent amongst discriminative classifiers.
However, this same preference can be exploited in a generative classifier to learn a shortcut-invariant compression.
Specifically, we consider the Variational Auto-Encoder (VAE)
[22], capable of learning latent representations of the data.
Our key insight is to back-propagate the classifier’s loss through a latent subspace , while reconstructing with the entire latent space .
The model minimizes classification error by encoding the shortcut in this subspace.
Since the shortcut representation is isolated, the complementary subspace is free to learn a shortcut-invariant representation through reconstruction.
The final classifier is then trained on this invariant representation.
We dub our approach ChromaVAE , inspired by the technique of chromatography, which separates the components of a chemical mixture travelling through the mobile phase.
Figure 1 summarizes our approach.
Our contributions are as follows:
• We show empirically that: (i) deep neural networks preferentially encode shortcuts as the most efficient compression (Section 3.1), and (ii) the shortcut representation can be sequestered in a latent subspace of the VAE classifier (Section 3.2).
• These observations allow us to propose Chroma-VAE (Section 3.3), an approach designed to learn a classifier on a shortcut-invariant representation of the data.
We demonstrate the effectiveness of Chroma-VAE on several benchmark datasets (Section 5)
Background and Notation
Even though shortcuts are present in many domains within deep learning [4, 48, 2, 32, 28, 12], we restrict our discussion to image classification tasks, as (i) VAEs are widely applied to modeling image distributions, and (ii) shortcut learning is ubiquitous in the vision domain.
Let D tr = { x i , y i } Ni =1 denote i.i.d.
training data.
A variational auto-encoder (VAE) [22] ( E ϕ , D θ ) models x with a latent variable: p ( x , z )
= p ( z ) p ( x | z ) .
The prior p ( z ) is typically N ( 0 , I ) and the likelihood p ( x | z ) is implicitly modeled by the decoder network D
θ ( z ) =
(cid:0) µ θ ( z ) , diag (cid:0) σ 2 θ ( z ) (cid:1) (cid:1) as N (cid:0) x | µ θ ( z ) , diag (cid:0) σ 2 θ ( z ) (cid:1) (cid:1) .
Maximizing p ( x ) directly is intractable due to the integral over z .
Instead, we use an encoder network E ϕ ( x ) = (cid:16) µ ϕ ( x ) , diag (cid:16) σ 2 ϕ ( x ) (cid:17)(cid:17) as an (amortized) variational approximation q ϕ (cid:0) z | µ ϕ ( x ) , diag ( σ 2 ϕ ( x )) (cid:1) and maximize the Evidence Lower BOund (ELBO):
[Equation]
by computing unbiased estimates of its gradients.
[Figure]
The smaller the bottleneck, the more likely it is that the model only focuses on the shortcut patch.
With more capacity, the model focuses on other regions of the image.
In a hybrid VAE classifier ( E ϕ , D θ , C φ ) , we model D tr as p ( z , x , y )
= p ( z ) p ( x | z ) p ( y | x ) .
p ( y | x ) is modeled by a classifier network C φ that takes the latent mean µ ϕ ( x ) as input and outputs class probabilities, i.e. p φ,ϕ ( y | x ) = CE (cid:16) y, C φ (cid:0) µ ϕ ( x ) (cid:1) (cid:17) , where CE is the cross-entropy loss.
Again, maximizing p ( x , y ) directly is intractable and the training objective becomes:
[Equation]
where λ is a scalar multiplier widely used in practice to account for the fact that p ( x ) is typically magnitudes smaller than p ( y | x ) on high-dimensional image datasets.
Group Terminology Let s ∈ S denote the shortcut (spurious) label.
The group of an input x is g =
( s, y ) , the combination of its shortcut and true labels.
Majority groups refer to examples with the dominant correlation between s and y on the training data, while minority groups refer to the small number of examples with the opposite correlation that ERM models typically misclassify.
Group robustness refers to the ability of models to generalize to distribution shifts where shortcuts are no longer predictive.
Methods to improve group robustness can make use of group annotations, however, our method does not assume access to group labels at train or test time.
Chroma-VAE: Separating Shortcuts Generatively
The key intuition behind our approach is to exploit shortcut learning for representation learning, by using a VAE to learn a shortcut-invariant representation of the data.
Two central ideas, supported by empirical observations, motivate our method: (i) deep neural networks preferentially encode shortcuts under finite and limited representation capacity, and (ii) the shortcut representation can be sequestered in a latent subspace of the VAE when jointly trained with a classifier.
3.1 Shortcuts are preferentially encoded under limited representation capacity
Why do shortcuts exist?
As Geirhos et al.
[10] note, shortcuts arise because the model’s inductive biases (the sum total of interactions between training objective, optimization algorithm, architecture, and dataset) favour learning certain patterns over others, e.g. convolutional neural networks (CNNs) prefer texture over global shape [3, 9].
We approach this from an information-theoretic lens.
Deep neural networks are commonly thought of as representation learners that optimize the information bottleneck (IB) trade-off, i.e. they aim to learn a maximally compressed representation (minimally sufficient statistic) that fits the labels well [45, 40].
Our key empirical observation is that in datasets where shortcuts exist, they are often efficiently compressed, and the compressed information is predictive of labels .
As such, deep models preferentially encode shortcuts, especially under limited representation capacity.
We consider an experiment on the CelebA dataset [27], where the task is predicting hair color (“blond” or not).
We inject a synthetic shortcut in the form of a 10 × 10 blue “patch”, superimposed onto [Figure] the image with 0.9 probability for the positive class (see Figure 2b).
We first train a discriminative classifier on the labels, and then independently learn a decoder on the (fixed) hidden layer of the trained discriminative model.
Figure 2a shows the reconstructions of the decoder.
The shortcut is accurately replicated in sharp detail where it exists, but other regions of the reconstructions are not as faithful to the originals.
In particular, note that reconstructions are even less accurate for examples of the positive class (with the shortcut), where mode collapse has happened.
Since the decoder was learned separately, this implies that the classifier’s latent compression primarily encoded for the shortcut’s presence.
This result is further supported by visualizing the activated regions of the input images during training.
We implement Grad-CAM [39], which computes a linear combination of activation maps weighted by the gradients of output logits (or any upstream parameters).
This can be visualized as a heatmap superimposed on the original image, showing regions of the image with the greatest positive contributions to the network’s prediction.
In Figures 2b-e, we visualized these heatmaps on models with a bottleneck hidden layer of different sizes.
As we can see, the smaller the bottleneck size, the stronger the activations on the shortcut patch.
With additional model capacity, the model is more likely to encode other relevant (or spurious) features in addition to the shortcut itself.
From these experiments, we see that deep neural networks tend to compress input data in a shortcutpreserving manner when such shortcuts are both (i) compressible with little information and (ii) predictive of training labels.
This tendency is exacerbated under limited latent capacity and is the reason why discriminative classifiers are susceptible to shortcut learning under ERM.
3.2 VAE classifiers can sequester shortcuts into specific latent dimensions
What presents a problem for discriminative modeling can be exploited into an advantage using a generative model.
The key insight here is that we can train a VAE classifier where the latent space is partitioned into two disjoint subspaces — however, only one subspace feeds into a classifier and is backpropagated through using labels.
This subspace encodes the shortcut precisely because this information maximizes the classifier’s performance (i.e. simultaneously exhibits high mutual information with the labels and small mutual information with the data).
The remaining subspace therefore encodes a partial representation of the image without the shortcut.
Formally, we modify the standard VAE classifier described in Section 2 as follow: we partition the latent space as z =
( z 1 , z 2 ) .
The classifier C φ uses only z 1 as input, i.e. for a given data point x , the predicted output is C φ (cid:0) µ ϕ ( x ) 1 (cid:1) .
As such, z 1 is used for both reconstruction and classification, whereas z 2 is used for reconstruction only.
We visualize the results of this experiment in two ways: (i) Grad-CAM, where we use gradient weights both of µ ϕ ( x ) 1 and of µ ϕ ( x ) 2 , and (ii) sampling partial reconstructions ˜ x from the VAE: given an encoding µ ϕ ( x ) , we replace each half µ ϕ ( x ) i with standard Gaussian noise and sample Algorithm Input: data D tr , VAE classifier ( E [Equation]
, D
[Equation]
, C φ ) , z 2 -classifier C (2) φ ′ , optimization hyperparameters //
Training initial VAE classifier initialize ( θ, ϕ, φ ) using Adam, minimize Equation (2), noting that C φ only takes µ ϕ ( x ) 1 as input //
Training z 2 -classifier initialize φ ′ compute the (fixed) input µ ϕ ( x ) 2 using E ϕ using Adam, minimize L ( φ ′ )
= CE (cid:16) y, C (2) φ ′ (cid:0) µ ϕ ( x ) 2 (cid:1)(cid:17) return C (2) φ ′ from the decoder: [Equation] We use the same predictive task and synthetic shortcut as described in Section 3.1.
The visualizations are displayed in Figure 3.
As can be seen from Figures 3b-c, Grad-CAM shows that µ ϕ ( x ) 1 is most sensitive to pixels around the blue patch, whereas µ ϕ ( x ) 2 is sensitive to pixels spread out in other regions of the image (including certain regions of the celebrity’s blonde hair).
This highlights that the representation of the patch is largely isolated in z 1 .
Partial reconstructions in Figures 3d-e support this observation.
In Figure 3d, where µ ϕ ( x ) 1 is fixed and we sample only z 2 ∼ N ( 0 , I ) , the decoded samples ˜ x 1 represent a variety of faces that do not resemble the original image.
However, all samples contain the shortcut patch in the bottom-right corner.
Conversely, in Figure 3e where µ ϕ ( x ) 2 is fixed, the reconstructed samples ˜ x 2 greatly resemble the original image, but may or may not contain the shortcut.
In other words, µ ϕ ( x ) 1 is strongly correlated with the shortcut’s presence, whereas µ ϕ ( x ) 2 is uncorrelated with the shortcut.
Together, Grad-CAM and the partial reconstructions suggest that the latent representation of the shortcut patch has largely been sequestered into z 1 .
Intuitively, this is believable — as the classification loss on C φ only back-propagates through z 1 , it will learn representations that are most useful for prediction.
This representation is dominated by the shortcut patch, as we showed in Section 3.1.
Since the model is also simultaneously learning to reconstruct the image, most other information describing the image is partitioned into z 2 , resulting in ˜ x 2 samples being very similar to the original.
3.3 Chroma-VAE
These results suggest a simple approach: we only need to train a separate, secondary classifier C (2) φ ′ on z 2 after the initial VAE classifier ( E ϕ , D θ , C φ ) has been trained, i.e. z 2 is a fixed input into C (2) φ
′ that is not back-propagated through to x .
Section 3.2 shows that the initial VAE classifier learns zin a way that minimizes shortcut representation but contains other salient features (by virtue of zlearning to reconstruct).
As such, C (2) φ ′ will be shortcut-invariant while remaining predictive.
We name this approach Chroma-VAE .
A full description is provided in Algorithm 1 and a diagram of the training procedure can be found in Appendix A. From here on, we will refer to C φ as the z 1 -classifier ( z 1 - clf ; not used for prediction) and C (2) φ ′ as the z 2 -classifier ( z 2 - clf ; shortcut-invariant classifier used for prediction). Chroma-VAE allows high flexibility with respect to the z 2 -classifier.
Since z 2 is a latent vector, the z 2 -classifier need not be a deep neural net.
Indeed, we noticed in our experiments that simpler models like k -nearest neighbors can perform better on smaller datasets.
Furthermore, instead of training C (2) φ ′ on z 2 , we can generate partial reconstructions ˜ x 2 and train a classifier directly in X -space.
This allows us to exploit deep models since the inputs are now images.
We term this latter approach the ˜ x 2 -classifier ( ˜ x 2 - clf ).
Hyperparameters and Group Labels Our method has two hyperparameters: the dimensionality of z , dim( z ) , and the partition fraction, z p = dim( z 1 ) dim( z 1 )+dim( z 2 ) ∈ (0 , 1) , which controls the relative sizes of z 1 and z 2 .
Compared to existing work, Chroma-VAE does not require training group labels. While validation group labels are technically necessary for hyperparameter tuning, we empirically found that it is possible to tune Chroma-VAE without needing them. There are two reasons for this: (a) In most domains, where the shortcut is known a priori (e.g. image background), we can generate and visually inspect partial reconstructions for hyperparameter tuning, by selecting dim( z ) to ensure good reconstruction, and z p to confirm that the shortcut has been isolated in z 1 . (b) Even where the shortcut is unknown, worst-group accuracy is far less sensitive to Chroma-VAE hyperparameters than for existing methods such as [26].
This is likely because most small values of z p typically suffice to isolate the shortcut in z 1 .
Table 1 summarize the group label requirements.
[Table]  Related Work Generative Classifiers Depending on how we decompose p θ ( x , y ) , generative classifiers can be divided into two categories: (i) class-conditional models p θ ( y ) p θ ( x | y ) or (ii) hybrid models p θ ( x ) p θ ( y | x ) .
The majority of previous work on deep generative classifiers [e.g. 38, 52] focus on the former category, e.g. for semi-supervised learning [23, 19] or adversarial robustness [38].
The most notable work in the latter category is Nalisnick et al.
[30], which applies hybrid models to OOD detection and semi-supervised learning.
Our work uses VAEs as the deep generative component, since we require explicit latent representation.
We only focus on hybrid models as we desire a single model that learns the shortcut representation across all classes.
Group Robustness Out-of-distribution (OOD) generalization is a broad area of study [e.g. 8, 14, 35], depending on what assumptions are made on the relationship between train and test distributions as well as the information known at train time.
In this work, we primarily consider distribution shifts arising from the presence of shortcuts or spurious correlations, where signals predictive in the train distribution are no longer correlated to the label in the test distribution.
Prior work has generally approached this from the group robustness perspective, where the objective is to maximize worst-group accuracy (typically the minority groups) while retaining strong average accuracy.
To the best of our knowledge, Chroma-VAE is the first method to tackle shortcut learning from a supervised representation learning approach using generative classifiers.
Methods in this space can be distinguished by the assumptions they make.
Some work rely on having group labels for training data [1, 36, 51, 37], for example, Sagawa et al.
[36] optimize worst-group accuracy directly.
However, as group annotations can be expensive to acquire, other approaches relax this requirement [26, 7, 42, 49, 31].
For example, Liu et al.
[26], which we compare to, treat misclassified examples by an initial model as a proxy for minority groups; these samples are upweighted when training the final model.
However, their approach is brittle to hyperparameter choices, requiring group labels on validation data (from the test distribution) for hyperparameter tuning.
Experiments
In Section 5.1, we present results on the ColoredMNIST benchmark, a proof-of-concept which we use to highlight some key observations and comparisons.
In Section 5.2, we apply Chroma-VAE to two large-scale benchmark datasets ( CelebA and MNIST - FashionMNIST Dominoes ), as well as a real-world problem involving pneumonia prediction using chest X-ray scans.
Appendix C.1 contains further results on the CelebA synthetic patch proof-of-concept that was presented earlier in Section 3.
Method
D in D
[Table]
Note that the best that a classifier relying only on digit can do is 75% since p d = 0 .
75 by construction.
[Figure]
Detailed experimental setups can be found in Appendix B.
In considering baselines, we avoid comparing to methods that rely on group labels [36, 34], multiple training environments [1], or counterfactual examples [44].
We select the following baselines:
Naive discriminative classifier (Naive-Class): standard ERM classifier 2.
Naive VAE classifier (Naive-VAE-Class): standard VAE classifier 3.
Naive VAE + classifier (Naive-Independent): standard VAE is first trained on unlabelled data { x i } Ni =1 , the classifier is then separately trained on the latent projection { µ ϕ ( x ) , y } Ni = 4.
Just Train Twice (JTT
) [26]: classifier is trained with a limited number of epochs, misclassified training points are upweighted and a second classifier is trained again
5.1 ColoredMNIST
Setup Following Arjovsky et al.
[1], (i) first we binarize MNIST [24] labels as ˆ y (with digits 0and 5-9 as the two classes), (ii) we then obtain actual labels y
(used to train and evaluate) by flipping ˆ y with probability p d = 0 .
25 , and finally (iii) we obtain color labels c by flipping y with variable probability p c . c is used to color each image green or red.
In the training distribution D in , p c = 0 . 1 , hence c is more strongly correlated to y than ˆ y is and color becomes the shortcut.
In the adversarial OOD test distribution D out , p c = 0 . 9 , i.e. every digit is more likely to be shaded the other color.
Table 2 shows that the “invariant” classifier (trained on black-and-white images) performs similarly on both D in and D out , hence degraded performance on D out is solely due to shortcut learning.
The main takeaway from our results in Table 2 is that Chroma-VAE vastly outperforms all other methods under the adversarial distribution D out . We want to demonstrate that the z 2 -classifier is learning from a largely shortcut-invariant representation of the data in attaining this performance.
First, we observe that the shortcut is heavily present in z 1 , as the z 1 -classifier performs just as poorly as the naive ERM approaches.
Furthermore, to show that the shortcut representation is isolated in z 1 , we can sample and inspect partial reconstructions. We plot one input example in Figure 4b; further examples can be found in Appendix C.2.
As we can observe, samples of ˜ x 1 are color-invariant whereas samples of ˜ x 2 are digit-invariant, suggesting that the bulk of color representation has been isolated in z 1 .
As yet further evidence
, we create D ′ tr , a dataset that is identical to the training set D tr except that every image has its color flipped.
We then measure | µ ( x ) ( i ) − µ ( x ) ′ ( i ) | for every z p [Table]
z p =z p = [Table] [Table] dimension i of the latent mean, averaged across all inputs x in the dataset.
In Figure 4c, observe that the dimensions corresponding to z 2 have smaller differences than dimensions of z 1 , suggesting color (shortcut) is minimally represented in z 2 .
Next, the poor performance of the naive baselines highlight our finding that generative models alone are insufficient for avoiding shortcuts.
Neither the VAE classifier (Naive-VAE-Class) nor the independent VAE + classifier
(Naive-Independent) improved on the ERM model (Naive-Class).
While our work motivated VAEs specifically from observations about the information bottleneck [Table] we note that the community at-large has hoped [10] that simply having a generative component might incentivize the model to learn a comprehensive representation of the data-generating factors [Table]
and not just the minimum compression necessary for small training loss.
Our results show that this is not true.
This failure is not limited to hybrid models — further results in Section C.1 show that class-conditional generative classifiers fare just as poorly.
Ablations for hyperparameters dim( z ) and z p
Table 3 shows partial reconstructions as a function of varying dim( z ) and z p .
As we expect, reconstructions are poor when dim( z ) is small but improve as latent capacity increases.
For sufficiently large dim( z ) , smaller values of z p are successful at isolating the shortcut color representation in z 1 , ensuring that samples of ˜ x 2 are color-invariant but retain the digit shape.
As z p increases, z 1 learns both color and digit, resulting in samples of ˜ x 1 that closely resemble the original image.
As such, we will expect the z 2 -classifier to perform poorly since z 2 no longer contains meaningful representations for prediction. These results suggest that hyperparameters should be tuned by first tuning dim( z ) to ensure sufficient capacity for reconstruction, before tuning z p to ensure that the shortcut is learnt by z 1 , but not the true feature. As we observe in our experiments, small values of z typically work well. [Table]
[Figure] Ablations for β Our method relates to learning disentangled latent representations. β -VAE, proposed by Higgins et al.
[15], introduces the hyperparameter β (the coefficient on the KullbackLiebler (KL) divergence term in (1)) to encourage a VAE to learn disentangled representations. Table 4 shows the ablation where we train Chroma-VAE with different values of β . Counterintuitively, increasing β > 1 result in degraded performance on D anti . This could be because unlike β -VAE, the generative model here is trained jointly with a supervised task.
As such, the latent factors in the data (color and digit) are correlated by the label and cannot be recovered via disentanglement.
5.2 Large-Scale Benchmarks
Setup We consider two benchmark CelebA tasks: (1) predicting Blond where Gender is the spurious feature [36, 26] and (ii) predicting Attractive where Smiling is the spurious feature [25].
We also consider the MF-Dominoes dataset [33], where input images consist of MNIST digits (0 or 1) concatenated with FashionMNIST objects (coat or dress), with the FashionMNIST object being the true label.
For both of these datasets, we use the harder setting from Lee et al.
[25], where the spurious feature is completely correlated with the label at train time (by filtering out the two minority groups).
Chroma-VAE is naturally suited for this regime, as complete correlation allows the spurious feature to be simultaneously compressible and highly discriminative.
In addition, as an example of a real-life domain where shortcut learning happens, we consider the prediction of pneumonia from frontal chest X-ray scans [50, 34, 20]. The shortcut is the background of the image, which contains artifacts specific to the machine that took the X-ray.
As different hospitals use different machines and have differing rates of diagnosis, the background becomes spuriously correlated with the label. There is no benchmark dataset for this problem and different authors have created their own datasets from existing public or private X-ray repositories. Likewise, we make a training set ( N = 20 K) with roughly equal numbers of X-rays from the National Institutes of Health Clinical Center (NIH) dataset [46] and the Chexpert dataset [18], such that 90% of NIH images are from the negative class and 90% of Chexpert images are from the positive class. Table 5 summarizes the results.
On CelebA and MF-Dominoes , Chroma-VAE has the highest average and worst-group accuracies.
Figure 5 shows the corresponding partial reconstructions, which visually confirm that the desired invariances have been learnt and the shortcuts correctly isolated.
JTT underperforms in this complete correlation setting (no minority groups) as it is unable to leverage on misclassification of minority examples to train the final model.
This experiment highlights a significant difference between group robustness methods and Chroma-VAE.
Methods like JTT will perform more poorly when there are fewer minority examples, as they rely on these examples to approximate the test distribution and implicitly teach the model what features are most useful.
In contrast, Chroma-VAE tries to learn explicit representations of the shortcut and true features.
Chroma-VAE will do better when the correlation between the shortcut and label is stronger, as the shortcut is then more likely to be the minimal encoding that is predictive of the label.
On the Chest X-ray dataset, Chroma-VAE has the highest worst-group accuracy , however, we note that it suffers from lower average accuracy.
The fact that Chroma-VAE improves on worst-group accuracy shows that the model works correctly to avoid shortcut learning by isolating the shortcut in z 1 . However, the trade-off against average accuracy also highlights one limitation of our approach, which is the reliance on VAE architecture to model the data distribution well.
To the best of our knowledge, we are the first to attempt to model Chest X-ray data with a deep generative model, as existing work for Chest X-ray shortcut learning rely on discriminative models — specifically, pre-trained ResNets [e.g. 34].
As the VAE is unlikely to model the X-ray dataset perfectly, some meaningful predictive features will not be well-captured, resulting in poorer performance of the z 2 -classifier despite being shortcut-free. Reconstruction examples for the Chest X-ray dataset can be found in Appendix C.3.
Discussion and Conclusion
We empirically observe that shortcuts — being the most efficient and predictive compression of the data — are often preferentially encoded by deep neural networks. Inspired by this result, we propose
Chroma-VAE, which exploits a VAE classifier to learn a latent representation of the image where the shortcut is abstracted away. This representation can be used to train a classifier that generalizes well to shortcut-free distributions.
We demonstrate the efficacy of Chroma-VAE on several benchmark shortcut learning tasks.
Finally, we conclude with promising avenues for future work.
First, a limitation of our work is the reliance on VAEs to model the underlying data distribution well, which can be challenging for many natural image datasets. Extending Chroma-VAE to incorporate stronger deep generative models, such as diffusion-based models, can lead to stronger performance on many real-life datasets.
Next, we can impose priors on z that explicitly encourage z 1 and z 2 to learn separate predictive factors. While we noted that simply changing β does not help due to label correlation, quantities like conditional independence or orthogonality might prove to be fruitful.
Acknowledgments and Disclosure of Funding
We would like to thank Marc Finzi, Pavel Izmailov and Wesley Maddox for helpful comments.
This research is supported by NSF CAREER IIS-2145492, NSF I-DISRE 193471, NIH R01DA04876401A1, NSF IIS-1910266, NSF 1922658 NRT-HDR: FUTURE Foundations, Translation, and Responsibility for Data Science, Meta Core Data Science, Google AI Research, BigHat Biosciences, Capital
One, and an Amazon Research Award.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] The experiments in Sections 3 and 5 support the claims we made.
(b) Did you describe the limitations of your work?
[Yes] Limitations are addressed in Section 5 and 6.
(c) Did you discuss any potential negative societal impacts of your work?
[Yes] Potential societal impact of our work is discussed in Appendix D. (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)?
[Yes] Section 5 and Appendix B describe the experimental details necessary to reproduce our results.
We will release our code accompanying the public release of our paper.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Appendix B. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[No] We have generally found our results to be robust to repeated random runs.
(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)?
[No] We note that the computational resources we used are typical of most research using the same models and datasets.
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] All datasets and models used were cited in Section 5 or Appendix B. (b) Did you mention the license of the assets?
[No] All these datasets and models are well-known and broadly used.
We refer readers to the original papers for licenses.
(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?
[N/A]
This only applies to CelebA , discussed in the original paper.
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A]
This only applies to CelebA , discussed in the original paper.
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]
A Chroma-VAE: Model Implementation
Figure 6 depicts Chroma-VAE and its training procedure. In the diagrams below, the forwardfacing solid arrows represent the forward pass and the backwards-facing dotted arrows represent the backpropagation of gradients. (a) In the first stage of the training procedure, the encoder, decoder, and classifier are all trained.
The loss function consists of two terms: the cross-entropy loss and the reconstruction loss.
(b) The classifier head is attached to z 1 only ( not the entire latent embedding z ).
As such, the cross-entropy loss term is only backpropagated through z 1 .
(c) The decoder is attached to the entire latent embedding z .
As such, the reconstruction loss term is backpropagated through both z 1 and z 2 .
Consequently, putting both terms of the loss function together, z 1 learns to encode shortcut features whereas z 2 encodes salient non-shortcut features of the input image.
B Experimental Details
Section 3: CelebA (Synthetic Patch)
We use standard CNN architecture.
The encoder contains 4 convolutional layers, followed by fully-connected layers to µ ϕ and σ 2 ϕ .
The decoder contains a fully-connected layer, followed by 4 deconvolutional layers.
The Adam optimizer [21] is used with a learning rate of 0.0005.
The hyperparameters are dim( z )
= 128 and z p = 0 .
Section 5: ColouredMNIST We use standard CNN architecture.
The encoder contains 2 convolutional layers, followed by fully-connected layers to µ ϕ and σ 2 ϕ .
The decoder contains a fully-connected layer, followed by 2 deconvolutional layers.
The Adam optimizer is used with a learning rate of 0.001.
The hyperparameters are dim( z ) =
32 and z p = 0 .
We performed a hyperparameter sweep for
JTT with T ∈ { 1 , 3 , 5 , 10 } and α ∈ { 2 , 5 , 50 , 100 } .
Section 5: CelebA and MF-Dominoes We use standard CNN architecture.
The encoder contains 4 convolutional layers, followed by fully-connected layers to µ ϕ and σ 2 ϕ .
The decoder contains a fully-connected layer, followed by 4 deconvolutional layers.
The Adam optimizer is used with a learning rate of 0.0005.
For CelebA , the hyperparameters are dim( z )
= 128 and z p = 0 .
For
MF-Dominoes , the hyperparameters are dim( z ) = 8 and z p = 0 .
We performed a hyperparameter sweep for JTT with T ∈ { 1 , 3 , 5 , 10 } and α ∈ { 2 , 5 , 50 , 100 } .
Section 5: Chest X-rays
Following prior work [50], we use a Densenet (pretrained on ImageNet)
[17] for the encoder, along with a standard CNN decoder (containing a fully-connected layer, followed by 4 deconvolutional layers).
The Adam optimizer is used with a learning rate of 0.0001.
The hyperparameters are dim( z )
= 128 and z p = 0 .
C Additional Results
[Table]
C.1 Synthetic Patch on CelebA
We consider the same task as in Section 3.1, where we predict blond hair, with a synthetic shortcut (blue patch superimposed onto the positive class with probability 0.9).
We evaluate performance on three test environments:
• Training Distribution ( D tr ): the patch is added to all members of the positive class
• Neutral Distribution
( D neut ): no patches are added • Adversarial Distribution ( D anti ): the patch is added to all members of the negative class
Table 6 summarizes the results.
Chroma-VAE vastly outperforms all other methods under the adversarial distribution .
The z 2 -classifier has the same performance as the invariant classifier on the in-distribution D tr , implying that it did not benefit (unfairly) from shortcut representations, unlike the naive baselines.
However, the fact that the z 2 -classifier is still outperformed by the invariant classifier on D anti and D neut suggests that not all desired features were captured by z 2 .
This implies that the maximally-useful compression of the data in z 1 primarily encodes the shortcut, but also other useful correlations.
Partial reconstructions in Figure 7 support the quantitative results.
The first image represents an example of the negative class (non-blonde hair), the second image is an example of the positive class with the shortcut, and the third image is an example of the positive class without the shortcut (which happens with probability 0.1 in the training set).
Similar to Figure 3, samples of ˜ x 1 do not resemble the original image, but always encode the shortcut patch if it exists in the original image.
Conversely, samples of ˜ x 2 bear great resemblance to the original image but may or may contain the shortcut — confirming that they are shortcut-invariant.
C.2 ColoredMNIST: Partial Reconstructions
Figure 8 shows partial reconstruction samples on three additional images.
We observe the same patterns as in Figure 4, where samples of ˜ x 1 preserve the colour of the original image but not the digit, whereas samples of ˜ x 2 preserve the digit of the original shape but is colour-invariant.
C.3 Chest X-Ray: Partial Reconstructions
Figure 9 shows the reconstruction as well as partial reconstruction samples on a test example.
Similar to partial reconstructions on the CelebA dataset, samples of ˜ x 1 are more diverse and less likely to resemble the original image, whereas samples of ˜ x 2 bear greater resemblance to the original image, especially around the center region of the image (where true predictive signals for pneumonia are located).
D Broader Societal Impact
Positive Sources of Impact By learning shortcut-invariant predictive signals, Chroma-VAE is robust to distribution shifts and performs well when deployed on OOD test cases. This is promising for applications in high-stakes domains where errors are costly, such as the pneumonia prediction example in Section 5.2.
Furthermore, the partial reconstructions produced by Chroma-VAE can be useful for identifying if shortcut learning is occurring in the first place, as they can be examined to identify traits that are invariant in each latent subspace.
Potential for Abuse Deep generative models can be used to produce deepfakes [47], which are samples generated by the model that are realistic enough to resemble real-life examples, e.g. fake faces produced by a generative model trained on CelebA .
Chroma-VAE can be abused in a similar (and potentially more dangerous) way, as partial reconstructions can be generated to keep certain traits while changing others, by concatenating z 1 and z 2 from different samples.
For example, partial reconstructions produced by Chroma-VAE trained on gender labels might be used to generate “counterfactual deepfakes”, e.g. a person with the opposite gender.
Combating deepfakes is an active area of research, and such techniques can be used to detect Chroma-VAE deepfakes as well.