Counterfactual Maximum Likelihood Estimation for Training Deep Networks

Abstract:
Although deep learning models have driven state-of-the-art performance on a wide array of tasks, they are prone to spurious correlations that should not be learned as predictive clues. To mitigate this problem, we propose a causality-based training framework to reduce the spurious correlations caused by observed confounders. We give theoretical analysis on the underlying general Structural Causal Model (SCM) and propose to perform Maximum Likelihood Estimation (MLE) on the interventional distribution instead of the observational distribution, namely Counterfactual Maximum Likelihood Estimation (CMLE). As the interventional distribution, in general, is hidden from the observational data, we then derive two different upper bounds of the expected negative log-likelihood and propose two general algorithms, Implicit CMLE and Explicit CMLE, for causal predictions of deep learning models using observational data. We conduct experiments on both simulated data and two real-world tasks: Natural Language Inference (NLI) and Image Captioning. The results show that CMLE methods outperform the regular MLE method in terms of out-of-domain generalization performance and reducing spurious correlations, while maintaining comparable performance on the regular evaluations.1

heading: 1 Introduction
text: Deep neural networks have been tremendously successful across a variety of tasks and domains in recent years. However, studies have shown that deep learning models trained with traditional supervised learning framework tend to learn spurious correlations as predictive clues [1–4]. For example, in computer vision, deep learning models can rely on surface-level textures [1, 5] or background environment [2, 6] instead of the object of interest in images. In natural language processing (NLP), question-answering models are insensitive to the choice of question [7] and natural language inference models are surprisingly accurate at predicting the logical relationship between a pair of sentences from just one of them [3]. In image captioning, a phenomenon called object hallucination is observed where models tend to include nonexistent objects in a caption based on their common association with other objects that are actually present in the image [4].
Another related problem in the current associative learning framework, like maximum likelihood estimation (MLE), is that neural networks can achieve almost perfect performance on one dataset but dramatically fail to generalize on another because of a naturally occurring or adversarially enforced distribution shift [8–11]. One explanation is that the model learns ‘fake’ features induced by spurious correlations instead of invariant features that would hold in different domains for the same task [12]; this kind of invariance can be explained by the underlying causal mechanism of the task [13].
1Our code is released at https://github.com/WANGXinyiLinda/CMLE.
35th Conference on Neural Information Processing Systems (NeurIPS 2021).
It is usually impractical to identify and disentangle all of the potential sources of spurious correlations. Various training algorithms have been proposed to reduce the influence of spurious correlations by learning the underlying causal mechanism. One approach for discovering the underlying causal mechanism is by invariant prediction based on the invariance of causal mechanisms across different environments [13, 12, 14]. However, constructing such diverse environments is usually unrealistic. Another approach is counterfactual data augmentation [15–19], which directly modifies the part of the input that causes the target variable, but usually involves expensive human efforts in generating the counterfactual examples. We propose Counterfactual Maximum Likelihood Estimation (CMLE), which tries to perform MLE on an interventional distribution instead of the observational distribution. Here, obervational distribution means the distribution that the train data is sampled from. Interventional distribution means the distribution with one or some of the variables intentionally intervened (set to some fixed value). More specifically, we aim to remove observable confounders and reduce spurious correlations by directly intervening on the label variable, without requiring human annotators or the curation of diverse environments.
In this paper, we focus on the setting of predicting the outcome Y of a certain action T on X , with the underlying causal model as X → Y ← T and an observed train dataset in the form of (X,Y, T ). Such a setting enables us to assume that there exist some observed confounders in X that influence both Y and T . This means there is potentially a false causal relation from X to T , indicated by a red arrow in Figure 1a. In our framework, instead of trying to identify all the confounders, we try to rule out the effect of the confounders by considering the interventional distribution that directly deleting the false causal edge from X to T with a resulting causal graph as shown in Figure 1d. This causal graph can be viewed as a Randomized Controlled Trial (RCT), which is the gold standard approach for estimating the treatment effect [20].
Our method is inspired by individual treatment effect (ITE) prediction [21, 22], which tries to predict the expected effect E[Y1 − Y0|X = x] (e.g. differnce in blood pressure) of a treatment T ∈ {0, 1} (e.g. drug/surgery) on a individual unit X = x (e.g. a patient). In this case, the observed confounder in X can be explained by selection bias [22], which means the treatment T applied to an individual X is dependent on X . For example, young patients are more likely to be treated by surgery, while elder patients are more likely to be treated by drugs.
There are two broad kinds of tasks to which our proposed CMLE framework can apply: relationship prediction tasks that predicts the relation T given two inputsX and Y (e.g. natural language inference [23, 24], paraphrase identification [25, 26], natural language for visual reasoning [27], etc.), and conditional generation tasks that generate Y given preconditionX and constraint T (e.g. style transfer [28, 29], controllable image/text generation [30–32], controllable image captioning [33, 34] etc.). For conditional generation tasks, the causal relation of X,Y, T fits in our setting. For relation prediction tasks, we first assume there is an underlying conditional generation process of Y for a given pair of X and T . This is a natural assumption as this is usually how the datasets for this type of task is generated. Then we augment the original dataset using the counterfactual examples generated by our method. In this paper, we try to reduce the spurious correlations contained in both kinds of tasks.
Since we generally cannot observe the interventional distribution, we derive two different upper bounds of the expected interventional negative log-likelihood using only the observational distribution: one is Implicit CMLE, as it does not involve any explicit generation of counterfactual examples; while the other is Explicit CMLE, as it explicitly generates counterfactual examples during the training process. We test our framework with deep neural networks on a simulated dataset and two real-world tasks with well-known spurious correlations: natural language inference [23] and image captioning [35]. Compared to regular MLE, we improve the out-of-domain accuracy of NLI on a hard adversarial dataset by 2.9% relatively and beat baselines on human preference evaluations by more than 10%, while maintaining comparable performance on automated evaluations. Our results show that our learning framework can better capture the underlying causal mechanism and reduce spurious correlations without degrading performance.

heading: 2 Related Work
text: A growing body of work has investigated algorithmic improvements for machine learning model training by leveraging underlying causal mechanisms. One line of work tries to utilize the invariance of causal mechanisms across different environments. Invariant Causal Prediction (ICP) [36] aims to
X Y T
(a) Observed pO(X,Y, T )
X
Y1 Y2 Ym
T=1 T=2
T=m
T
… YT …
(b) Expand all possible outcomes
X
Y1 Y2 Ym
T=1 T=2 T=m
… ...
(c) Intervene on T
X
Y T
(d) Intervened pI(X,Y, T )
Figure 1: The Structural Causal Model (SCM) assumed by Counterfactual MLE, where (a) and (b) have the same distribution, (c) is the resulting causal graph of intervening on T . (d) is the intervened distribution by only removing the X → T edge from (a). Shaded nodes means being observed and red arrows denote the causal relation causing the spurious correlation.
learn a linear invariant causal predictor to identify the causal parents of given target variables with data obtained from different environments. Further refinements on this line of work include nonlinear and nonparametric ICP assessment methods [37] and Invariant Risk Minimization (IRM) where out-of-distribution generalization is enabled by learning a nonlinear invariant causal predictor shared across different environments [12]. However, these methods generally require a set of environments that are both sufficiently diverse to eliminate confounders while maintaining the underlying causal structure. Though this can be achieved by intervening in the non-causal variables in a synthetic or interactive setting, it is very difficult to obtain or even define such environments with complex high-dimensional observational data like text or images. Our proposed CMLE framework only requires a single observational dataset, making it much more practical.
Another line of work approaches this problem with data augmentation. Methods including programmatically editing text to address gender bias [16–18], employing crowd workers to augment training data to capture potential unmeasured variables [38], and manually editing minimal text spans to flip the predicted label [15] have all been proposed to produce counterfactually augmented data (CAD) for improving out-of-domain generalization. Conceptually, in contrast to the first approach that involves interventions on a potentially large number of non-causal variables, CAD directly intervenes on a target variable [39], which is more practical for a specific task. Refinements on this work attempt to better utilize the manually edited or synthetically generated counterfactual data by pairing the factual and counterfactual examples together [40, 41], and leverage local causal structures to generate counterfactual experience in training reinforcement learning algorithms [19]. While human annotators can generate high-quality counterfactual examples that are effective in reducing spurious correlations, they are expensive to obtain and do not easily scale. Meanwhile, our proposed CMLE framework is fully automated, requiring no human annotations.
Our CMLE framework is inspired by a technique for predicting the Individual Treatment Effect (ITE) from observational data [22]. This method only observes one possible outcome of an individual X = x with one binary treatment T = 0 or T = 1, and it assumes there are no hidden confounders but potentially observed ones. Assuming a similar underlying causal model as ours (m = 2) gives an error bound as the sum of the standard generalization error and the distance between the control and treated distributions in a representation space. Improvements on this work include disentangling the observable confounders in ITE using representation learning [42], and estimating the causal effects of linguistic properties [43]. While in this work we do not aim to separate the confounders from the causal factors in X , we try to reduce the spurious correlations caused by the possible confounders contained in X using our proposed CMLE training framework.

heading: 3 Method
text: In this section, we first introduce our problem setting and the goal of Counterfactual Maximum Likelihood Estimation (CMLE). As we cannot observe the counterfactual outcomes in observational data, we propose two different ways of estimating the counterfactual likelihood by deriving two different upper bounds: Implicit CMLE, which is faster in training, and Explicit CMLE, which is more flexible. We also briefly introduce the deep learning architecture we use in our experiments.

heading: 3.1 Problem Setting
text: We consider the scenario with one input variable X ∈ X that contain all the confounders, one discrete treatment variable T ∈ {1, 2, ...,m} where m ≥ 2, and one outcome variable Y ∈ Y ,
as shown in Figure 1a. Note that X and Y can be very complicated high dimensional space like text or image and all three variables are observed in the dataset. Suppose the data we observed is D = {(x1, t1, y1), (x2, t2, y2), ..., (xn, tn, yn)} and only xi’s are sampled i.i.d. In this paper, we adopt the causal notations from [44]. Below we give a formal definition of Structural Causal Model (SCM) [44] that we use to model our framework: Definition 1. A Structural Causal Model (SCM) is a pair 〈M,p(u)〉, where M is a triple 〈U, V, F 〉 and p(u) is a probability function defined over the domain of U . U = {U1, U2, ..., Un} is a set of background variables (exogenous) that are determined by factors outside the model. V = {V1, V2, ..., Vn} is a set of variables (endogenous) and F = {f1, f2, ..., fn} is a set of functions s.t. Vi = fi(Pa(Vi), Ui), i = 1, 2, ..., n, where Pa(Vi) ∈ V \Vi are the parents of Vi. We say that “Vj is a direct cause of Vi" if Vj ∈ Pa(Vi) and illustrate this relation as Vj → Vi in a causal graph.
In Figure 1, we omit the exogenous and only show the causal relations between endogenous variables. The shaded nodes indicate that the corresponding variables are observed. Intervention on a specific variable is formalized as fixing the value of this variable to a specific value. This is known as the do-operation, changing the causal graph by removing all edges incident to the intervened variable. We denote the outcome of Y corresponding to do(T = t) as Yt. We expand all the possible outcomes of Y in Figure 1b while we actually can only observe one outcome for each data point in the observational dataset. We also make the following standard assumption [22, 45–49]: Assumption 1. (Strong Ignorability Condition) (Y1, Y2, ..., Ym) ⊥ T |X and 0 < p(T |X) < 1.
Under this condition, the counterfactual outcomes are identifiable since p(Yt = y|X = x) = p(Y = y|X = x, T = t). i.e. The counterfactual likelihood can be written as observable conditional probabilities estimated from data.
Our goal is to eliminate the false causal relation from X to T represented by the red arrow in Figure 1a. To achieve this goal, we define our objective over the interventional distribution pI(X,Y, T ) as shown in Figure 1d, instead of over the observed data distribution pO(X,Y, T ) as shown in Figure 1a. To construct the interventional distribution, we only delete the causal edge between X and T and keep all the other causal relationships unchanged. In this distribution, T is uniformly sampled from {1, 2, ...,m}. Note that pI(Y |X,T ) = pI(YT |X) = pO(YT |X) = pO(Y |X,T ). As p(YT |X) is the same for both observational distribution and interventional distribution, we omit the superscript for simplicity. Then for predicting Y , the objective of counterfactual maximum likelihood estimation (CMLE) would be:
EpI(X,Y,T ) [ − log pIθ(Y |X,T ) ] = EX [ 1 m m∑ i=1 EYi|X [− log pθ(Yi|X)] ]
(1)
Similarly, for predicting T , we have:
EpI(X,Y,T ) [ − log pIθ(T |X,Y ) ] = EX [ 1 m m∑ i=1 EYi|X [− log p I θ(T = i|X,YT )] ] (2)
Here θ is the learnable parameters. In the remaining part of paper, the probabilities without superscripts are default to be observational probabilities. In the following sections, we first focus on deriving two different upper bounds of the CMLE objective for predicting Y : Implicit CMLE and Explicit CMLE. In Implicit CMLE, we add a regularizer to balance the distribution of X given T in the representation space. For Explicit CMLE, we directly generate counterfactual examples during training. To predict T , we train a classifier using normal MLE on a augmented dataset with the generated counterfactual examples to estimate the interventional distribution pI(X,Y, T ). We define a counterfactual example as follows: Definition 2. A counterfactual example is an example (x, t, y) with y sampled from p(Yt|X = x) s.t. (x, t, y) /∈ D and there is an example (x, t′, y′) ∈ D where t′ 6= t.
We can rewrite our objective function in Equation 1 as Ex [∑m t=1 Lθ(x, t) ] , by defining the expected loss function of a specific input and treatment as: Definition 3. We denote the loss function for predicting Y as Lθ(x, t, y) = − log pθ(Yt = y|X = x). Then the expected loss function given X = x and T = t is Lθ(x, t) = EYt|X=x[Lθ(x, t, Yt)].
Because of the Strong Ignorability Assumption, we have Lθ(x, t) > 0. Then we define an expected factual loss T=tF and expected counterfactual loss T=t CF when observing a specific treatment T = t:
Definition 4. The expected factual loss and expected counterfactual loss given T = t are T=tF = EX|T=t[Lθ(X, t)] and T=tCF = EX|T 6=t[Lθ(X, t)], respectively.
Here T=tF measures how well the model performs on the observational distribution while T=t CF measures how well the model would perform on an alternative world where a different treatment is chosen. Then we can rewrite our CMLE objective as:
Ex [ m∑ t=1 Lθ(x, t) ] = m∑ t=1 [p(T = t) T=tF + p(T 6= t) T=tCF ] (3)

heading: 3.2 Implicit CMLE
text: We consider learning a representation function of X , Φ : X → Rd, where Rd is the representation space. Here we make the following assumption about Φ: Assumption 2. Φ : X → Rd is a invertible function. We denote Ψ : Rd → X as the inverse of Φ. For continuous X , Ψ also needs to be differentiable to calculate the Jacobian matrix.
Note that this assumption can be fulfilled for neural networks as long as all the activation functions are invertible. We denote the distribution induced by Φ by pΦ. We can easily transform p(X|T ) to pΦ(Φ(X)|T ) by a standard change of variable [50, 51]: Definition 5. For i ∈ {1, 2, ...,m} and r ∈ Rd, we denote pT=iΦ (r) := pΦ(r|T = i). For discrete X , we simply have pT=iΦ (r) = p(X = Ψ(r)|T = i), while for continuous X , we have pT=iΦ (r) = p(X = Ψ(r)|T = i) det ∣∣∂Ψ ∂r
∣∣. We adopt a similar idea as [22] and use the Integral Probability Metric (IPM) to derive an upper bound of the CMLE objective. IPM is a class of metrics between probability distributions with the following definition [52]: Definition 6. For two probability density functions p and q defined over S, we have
IPMG(p, q) := sup g∈G ∣∣∣∣∫ S g(s)(p(s)− q(s))ds ∣∣∣∣ Where G is a family of functions g : S → R.
Note that here (and in the rest of our paper) we abuse the notation of integration. If X is discrete, the integration would become a sum over it. Then we can derive an upper bound for our CMLE objective by Assumption 2, Definition 5 and Equation 3: (See Appendix A.1 for full proof.) Theorem 1. For a function familyG and a constantBΦ > 0 s.t. 1BΦLθ(Ψ(r), t) ∈ G for any r ∈ R d and t ∈ {1, 2, ...,m}, the CMLE objective is bounded by:
Ex [ m∑ t=1 Lθ(x, t) ] ≤ m∑ t=1 [ T=tF + p(T 6= t)BΦIPMG(pT=tΦ , p T 6=t Φ )]
In this upper bound, we are only left with observational/factual quantities that can be estimated from the observational data. We choose G to be 1-Lipschitz functions, which implies IPMG to be the Wasserstein distance [53, 54], denoted by WASS(·, ·). Then the empirical CMLE objective using an unbiased estimator of this upper bound can be written as:
arg min θ
1
n n∑ i=1 n uti Lθ(xi, ti, yi) + α m∑ j=1 (1− uj n )WASS({Φ(xi)}i:ti=j , {Φ(xi)}i:ti 6=j) (4)
Where ui = ∑n j=1 1tj=i and 1 is the indicator function. α is a hyperparameter accounting for BΦ and we abuse the notation of WASS(·, ·) to denote an empirical version of Wasserstein distance. The resulting empirical training objective consists of a weighted version of the normal factual loss for empirical risk minimization and a regularization term to draw pT=iΦ and p T 6=i Φ closer.
n uti accounts
for different number of examples with each label and 1 − ujn account for p(T 6= j) (see Theorem 1). The empirical Wasserstein distance is calculated among examples with different labels in the representation space. In practice, to perform back propagation, we directly compute the gradient of WASS(pT=iΦ , p T 6=i Φ ) over a single mini-batch, using the algorithm proposed by [55]. (See Appendix B.1 for details.)

heading: 3.3 Explicit CMLE
text: While Implicit CMLE tries to reduce the spurious correlation by learning a better representation of X , we consider directly learning a better approximation of the log likelihood log pθ(Yt|X) by explicitly generating counterfactual examples at training. Here we assume that there is a neural network with parameter φ that approximates the interventional distribution pIθ(T |Y,X) defined as follow: Definition 7. pφ(T |Y,X) is an approximate of pIθ(T |Y,X) parameterized by φ s.t. KL(pIθ(T |X,Y )||pφ(T |X,Y )) < B, where B > 0 is a real constant. We also define an associated loss function Jφ(t, x, y) = − log pφ(T = t|Y = y,X = x).
Here KL(p||q) denotes the KL divergence between two distributions p and q. Our intuition is that it is directly feasible to learn the normal MLE objective EX,Y,T [log pφ(T |Y,X)] from the observation data, while is infeasible to directly learn the CMLE objective Ex [∑m t=1 Lθ(x, t) ] . Also, as T is a categorical variable, its distribution can be simplified as a Multinomial distribution. We then derive an upper bound of the CMLE objective using Bayes’ rule and Jensen’s Inequality: (See Appendix A.2 for full proof.) Theorem 2. By Assumption 1, there exist 0 < δ1 < δ2 < 1 s.t. δ1 < p(T |X) < δ2, then we have
Ex [ m∑ t=1 Lθ(x, t) ] ≤ Ex,t [ ηEpθ(Yt|X=x)[Lθ(x, t, y)] + m∑ i6=t Epθ(Yi|X=x)[Jφ(i, x, y)] ] + µ
Where η = (1 + 1p(t) (1− 1 m )), µ = (mδ2 −mδ1 −m+ 1) logm.
This theorem indicates that we can transfer the counterfactual likelihood of predicting Y into the counterfactual likelihood of T predicted by another model. Note that the resulting bound would be tighter when pφ(T |Y,X) is a better approximate of pIθ(T |Y,X) as we use the fact KL(pIθ(T |Y,X)||pφ(T |Y,X)) > 0 in the proof (see Appendix A.2). In practice, we can either pretrain a pφ(T |Y,X) on the observational data when pOθ (T |Y,X) and pIθ(T |Y,X) are not too far away, or we can simultaneously train a pφ(T |Y,X) with pθ(Yi|X) to take advantages of the generated counterfactual examples.
Since it is expensive to take m− 1 samples of yi from pθ(Yi|X) for each training example at train time, we introduce another random variable Kt for each t ∈ {1, 2, ...,m}, such that is Kt uniformly distributed on {1, 2, ...,m}\{t}. Then the Explicit CMLE objective can be rewritten as:
arg min θ
Ex,t [ Epθ(Yt|X=x) [ Lθ(x, t, Yt)] + m− 1 η EKt [Epθ(YKt |X=x)[Jφ(Kt, x, YKt)] ]]
Here we ignore the constant term µ in the upper bound and multiply the remaining terms by 1η . We can then write the Explicit CMLE objective empirically as:
arg min θ
1
n n∑ i=1 [Lθ(xi, ti, yi) + α(ti)Jφ(kti , xi, yθ(xi, kti))] (5)
Where α(ti) is a hyperparameter corresponding to m−1η , kti is randomly sampled from p(Kti) and yθ(xi, kti) is sampled from pθ(Ykti |X = x). We only sample Kt once and sample the corresponding YKt once for computational efficiency. In our implementation, to backpropagate through pθ(Ykti |X = x), we adopt the Gumbel-Softmax approach [56] to deal with the discrete text data, which creates a differentiable sample to replace the non-differentiable discrete variable. For alternative approaches for discrete and continuous Y , see Appendix B.2.

heading: 3.4 CMLE Implementation
text: While CMLE is a general causal training framework that can be applied to almost any deep learning architecture, in this paper, we primarily consider the Transformer [57] architecture, which excels at modeling sequential data and has been successfully applied to various domains, especially with pretraining on a large amount of data [58, 59]. Here we assume for any x ∈ X , we can write x as x = {x(0), x(1), ..., x(w)} and for any y ∈ Y , we have y = {y(0), y(1), ..., y(k)}. We input T = t by prepend a special token/vector corresponding to t as a prefix to the decoder input y. The model architectures of Implicit CMLE and Explicit CMLE are shown in Figure 2.

heading: 4 Experiments
text: We consider one synthetic dataset and two real-world tasks, Natural Language Inference and Image Captioning, to evaluate the effectiveness of our proposed CMLE causal training framework. Both real-world tasks have prominent datasets containing well-known spurious correlations; we aim to reduce these correlations’ influence on each target task. In the following sections, we will introduce our experiments in details and compare the performance of our proposed CMLE against vanilla MLE.

heading: 4.1 Simulated Experiments
text: We consider a synthetic dataset generated by the following procedure inspired by [45]:
Given the followigng functions g1(x) = x−0.5, g2(x) = (x−0.5)2 +2, g3(x) = x2−1/3, g4(x) = −2 sin(2x), g5(x) = e−x−e−1−1, g6(x) = e−x, g7(x) = x2, g8(x) = x, g9(x) = 1x>0, g10(x) = cos(x), g11(x, t) = log(t+ x 2), g12(x, t) = e t+x, and g13(x, t) = sin(t+ x):
1. Sample xi from N (0, 1), i ∈ {1, 2, ..., 100}. 2. Let s = g1(x1) + g2(x2) + g3(x3) + g4(x4) + g5(x5). Let t = 1 if s ≤ 4; t = 2 if
4 < s ≤ 5; t = 3 if s > 5. 3. Let µ1 = g6(x1) + g7(x2) + g8(x3) + g11(x6, t) + g12(x7, t), µ2 = g9(x4) + g10(x5) + g11(x8) + g13(x9, t). Then sample y from N ((µ1, µ2), 1).
4. Repeat steps 1-3 for N times.
Here X is a real vector of length 100, T takes value in {1, 2, 3} and Y is a real vector of length 2. The task is to predict Y given X and T . Then we generate 10000 train data, and 5000 validation data and 5000 in distribution (observational) test data by setting N=10000 and 5000 respectively. We also generate corresponding ground truth counterfactual test data for testing how well our models can estimate the counterfactuals. OOD1, OOD2, OOD3 are three out-of-distribution test sets that generates T using different mechanisms as follows:
• OOD1: t is uniformly sampled from {1, 2, 3}. • OOD2: Let s = g1(x6) + g2(x7) + g3(x8) + g4(x9) + g5(x10). Let t = 1 if s ≤ 4; t = 2
if 4 < s ≤ 5; t = 3 if s > 5. • OOD3: Let s = g6(x1) + g7(x2) + g8(x3) + g9(x4) + g10(x5). Let t = 1 if s ≤ 4; t = 2
if 4 < s ≤ 5; t = 3 if s > 5. We use multi-layer perceptrons for all of our models and use the mean-squared-error (MSE) loss at training. This means we assume Y to follow a Gaussian distribution given X and T . In Table 1, we report MSE of predicting Y on different test sets.
Here Explicit CMLE* means using a pφ(T |X,Y ) that is trained on the interventional distribution instead of the observational distribution. The numbers are averaged over ten runs and the standard deviation is also reported. We take α = 0.01 for Implicit CMLE and α = 0.1 for Explicit CMLE.
We can see that all CMLE methods perform better than MLE on the counterfactual test set and the out-of-distribution test sets, while Explicit CMLE performs better than Implicit CMLE. And the performance of Explicit CMLE would be better when pφ(T |X,Y ) is closer to the ground truth interventional distribution.

heading: 4.2 Natural Language Inference (NLI)
text: Natural language inference (NLI) [23] is a fundamental task in natural language understanding, which aims to infer the logical relation between a pair of sentences, premise and hypothesis. Unfortunately, NLI datasets are known to present significant spurious correlations. For example, [3] demonstrated that a machine learning model can non-trivially outperform the majority baseline using only the hypothesis without the premise. One known spurious correlation comes from the background knowledge contained in the premises. i.e. The prediction is based on the background knowledge instead of the logical relation between the premise and the hypothesis. For example, the hypothesis “TV viewing and consumption both begin at about the same time.” would usually be considered to be true from common knowledge. While a fine-tuned RoBERTa [60] also predict this example as entailment, it contradicts its premise “Regular TV viewing typically begins between 2 and 3 years of age, consuming about 10.”. We view the premise sentence as X , the hypothesis sentence as Y , and the label (entailment, neutral, or contradiction) as T . The NLI annotation procedure [23, 61] naturally fits in our causal framework in Figure 1, as the crowd workers are instructed to write a hypothesis that is entailed/neutral/contradicted to a given premise.
We consider three large-scale NLI datasets: SNLI [23], MNLI [24] and ANLI [62]. SNLI and MNLI are considered standard benchmarks, with each containing 550,152/10,000/10,000 examples and 392,702/20,000/20,000 examples for train/dev/test split respectively. ANLI was constructed as a hard adversarial dataset to eliminate spurious correlations and balance the data distribution, thus it serves as a great benchmark to evaluate a model’s generalizability. ANLI contains three subsets of increasing difficulty—A1, A2, and A3—with about about 392,702/20,000/20,000 examples, 45,460/1,000/1,000 examples and 100,459/1,200/1,200 examples each for train/dev/test split respectively.
For generating counterfactual hypotheses we fine-tune the pre-trained BART large model [63] provided by HuggingFace [64] with 12 encoder and decoder layers. We fine-tune BART on the combined dataset of SNLI and MNLI using both Implicit and Explicit CMLE. We choose α = 0.003 for Implicit CMLE and α = 0.1 for Explicit CMLE. We predict pφ(T |X,Y ) for Explicit CMLE with a conventionally fine-tuned RoBERTa large model with 24 layers. We call this model NLI-RoBERTa.
We evaluate how consistent our generated hypotheses Y are to their corresponding labels T using both NLI-RoBERTa and human evaluation2 in Table 2 (right). In both cases, we perform this assessment by comparing the model- or human-predicted t′ against the ground truth t. The accuracy of the NLIRoBERTa is shown in the first row of Table 2. Both of our CMLE methods significantly outperform the MLE baseline by a large margin on the labeling consistency of the generated hypothesis, which indicates that our CMLE framework can generate Yt that is truly influenced by T = t.
To construct a dataset that mimics sampling from the interventional distribution, we generate two counterfactual examples for each example in the original train dataset of SNLI and MNLI. We filter out the inconsistent examples using NLI-RoBERTa. We generate three augmented datasets using standard MLE, Implicit CMLE, and Explicit CMLE and fine-tune a copy of RoBERTa on each one. The results for these models are presented in rows MLE (w/ Aug), Implicit CMLE and Explicit CMLE of Table 2 respectively. The baseline MLE is NLI-RoBERTa itself. We test the accuracy of all the fine-tuned RoBERTas simultaneously on the regular test sets (MNLI, SNLI) and the out-of-domain adversarial test sets (ANLI). The results in Table 2 show that, while maintaining performance on
2All of our human evaluations are conducted via Amazon Mechanical Turk. See Appendix C.3 for details.
regular test sets, our proposed CMLE methods significantly outperform both MLE baselines on the adversarial test set. This indicates that CMLE can improve the out-of-domain generalization performance of large deep learning models without hurting the in-domain performance.

heading: 4.3 Image Captioning
text: Image captioning is a fundamental task in studying multimodal interaction. However, image captioning models also suffer severely from spurious correlations [65] that lead to hallucinations. This type of spurious correlation is mainly caused by the typical co-occurrences of objects in images. For example, as toilets are frequently present in bathroom pictures, a captioning model trained by MLE is very likely to hallucinate a ‘toilet’ whenever it sees a ‘bathroom’, even if no toilet is present.
To reduce these hallucination artifacts, we apply our CMLE framework by regarding the image as X , the caption as Y , and whether the caption is hallucinated as T . In our setting, the nonhallucinated captions are ground truth captions written by a human, and the hallucinated captions are generated by image captioning models. The dataset we use is the MSCOCO 2014 dataset [66] which contains 123,287 images of common objects with 5 human-annotated captions per image. We use the Karpathy [67] split with 113,287/5,000/5,000 images in the train/validation/test set respectively. Our implementation is based on [68].
The Transformer architecture we use directly follows [57], with 6 layers in each of the encoder and decoder layers. To construct a dataset with both hallucinated and non-hallucinated captions, we synthetically generate captions by masking out one object word for each caption and use BERT (large) [58] to fill in an alternative word that aligns with the language model. We estimate the caption hallucination by the CHAIR score [65], which parses the object words in a caption and compares them to the ground truth objects annotated in MSCOCO images and captions. In total, we synthesize 648,550 hallucinated captions for 93,004 images in the training set.
Then we train the transformer model on this augmented dataset of MSCOCO captions with synthetic hallucinated captions using regular MLE and our proposed CMLE methods. We choose α = 0.0002 for Implicit CMLE and α = 0.0001 for Explicit CMLE. For Explicit CMLE, we fine-tune a pretrained LXMERT [59] on this augmented dataset as pφ(T |X,Y ). Here we consider two MLE baselines: The MLE baseline is the Transformer model regularly trained on the original MSCOCO dataset, while the MLE (w/ Aug) baseline is trained on the augmented dataset.
We conduct user studies on the generated captions as shown in Table 3. In the user study, we let the user choose the best caption among our two baselines and two proposed CMLE methods from the following aspects: Faithfulness, Expressiveness and Informativeness. Faithfulness means how faithful is the generated caption to the corresponding image, which partially measures the extend of hallucinations. Expressiveness means if the generated caption is coherent, grammatically, and semantically correct. Informativeness means if the caption includes most of the information in the image instead of giving a general description. We also let the user choose the caption that best describes the image in their opinion, which is referred to as Preference in Table 3. We can see that our proposed CMLE methods outperform the two MLE baselines with a large margin on all the evaluation dimensions which indicates that our methods can not only reduce the hallucination contents in the generated captions but also increase the quality of generated captions in general.
The automatic evaluation results are shown in Table 4, where CHAIRs is the percentage of hallucinated sentences and CHAIRi is the percentage of hallucinated instances (objects). We can see that our CMLE methods outperform both MLE baselines on CHAIR scores, which indicates that our methods
can effectively reduce hallucination in image captions. At the same time, the regular scores (BLEU@4, METEOR, CIDEr, SPICE) that measure the similarities between the generated captions and ground truth captions, are comparable between CMLE and the MLE baseline. We note that the MLE (w/ Aug) baseline on augmented data is significantly worse than the MLE baseline on both the automatic scores and human evaluations. We conjecture that this is because the model trained by vanilla MLE is not good at finding the causal relation between the hallucination label T and the caption Y and thus would be confused by the mixture of hallucinated captions and non-hallucinated captions.

heading: 4.4 Discussions and Limitations
text: From both NLI and image captioning experiments, we observe that Explicit MLE is significantly better than Implicit MLE in terms of human evaluations of the generated text, and comparable on other automatic evaluations. We conjecture that this is because that Implicit CMLE only incorporates counterfactual constraints into the representation of X while Explicit CMLE directly optimizes pθ(Yt|X) when generating the counterfactual examples. We also note that the improvement on automatic metrics is not that large for both real-world tasks. For NLI, our data augmentation cannot perfectly simulate sampling from the interventional distribution as we only augment two counterfactual examples for each factual example. For Image captioning, as it is difficult to simulate the true distribution of hallucinated captions, the models we trained on the augmented data can be affected by these newly introduced artifacts. On the other hand, the automatic metrics like BLEU only measure the similarity of generated sentences with the observed ground truth which cannot demonstrate the full strength of our methods.

heading: 5 Conclusion
text: Our proposed CMLE framework can be applied to a wide range of learning scenarios with paired inputs and corresponding labels or involving conditional generation. While currently we only consider the spurious correlations caused by the observable confounders under the Strong Ignorability assumption, it is often the case that the confounders are not observed. For example, annotators may have a biased pattern of annotation. As we do not record the information of the annotators, this confounder is considered unobserved. Expanding the current CMLE framework by including the unobserved confounders into the causal model would be an interesting and important future direction.

heading: Acknowledgments
text: This work was supported in part by the National Science Foundation Graduate Research Fellowship under Grant No. 1650114. This material is based on work that is partially funded by an unrestricted gift from Google.

Review summaries:
The paper tackles the problem of spurious correlations caused by observed confounders and offers two potential solutions: implicit and explicit counterfactual maximum likelihood estimation. Specifically the paper deals with the setup of predicting the outcome Y of some action T on X and considers X to potentially be a confounder. The paper compares the performance of the proposed methods to on a natural language inference and an image captioning task and shows improvements in terms of human evaluation but little difference in terms of automatic evaluation.

This work proposes counterfactual maximum likelihood estimation (CMLE), a new training objective for suppressing the spurious effect of confounding variables. The authors derive two types of upperbound formulation for interventional log-likelihood (i.e. implicit CMLE and explicit CMLE). Using natural language inference (NLI) and image captioning as the intervention modeling tasks, the proposed method demonstrated superior performance in terms of human-perceived performance.

This paper applies methodology from CATE estimation to do maximum likelihood with respect to samples from the interventional distributions Y|do(T),X, which they call Counterfactual MLE (CMLE). They provide two algorithms, Implicit CMLE and Explicit CMLE. The implicit variant uses the CATE generalization bounds from Shalit's CATE generalization bounds paper to get bounds on the likelihood from the desired counterfactual sampling distribution. The Explicit variant writes bounds in terms of the distribution T|Y,X. The two methods are applied to natural language inference and image captioning tasks. The authors suggest that this methodology and the surrounding literature on causally-inspired prediction should play a large role in the standard approach of deep learning in order to avoid shortcut learning / relying on spurious correlations.

In this work, authors propose the Counterfactual Maximum Likelihood Objective CMLE, where the parameters of the statistical model are inferred by maximizing the likelihood of the data under the interventional distribution, as opposed to the observational data. For the assumed model X -> Y <- T and X -> T, where X is the covariate, T is the treatment and Y is the outcome, the objective is to learn the parameters \theta that predict Y|X=x,T=t using just the causal link T->Y and not the spurious features in X=x. Ideally, if one could intervene on T and set do(T=t), it is possible to collect data where the outcome is observed upon the intervention done on T. Then maximizing the following likelihood: (CMLE objective) \argmax_\theta \sum_t E_{X|t}  E_{Y|x,t} p_\theta(Y|X=x,do(T=t)) would give us the MLE estimate of the parameter \theta under the set of interventional distributions do(T=t), thereby eliminating any effect of the spurious features in X on the prediction of the outcome label Y. The paper proposes two upper bounds for the above CMLE objective: i) Implicit MLE: focuses on obtaining better representations of the covariates X, such that the distribution of these representations is similar (by Wasserstein distance) for every value of T; and ii) Explicit MLE: where counterfactual examples are generated during training. Expectations in the theoretical derivations of the above upper bounds, can be estimated by Monte Carlo evaluations using only the observational data. Results are provided on two downstream tasks where models often rely upon spurious correlations: i) Natural Language Inference (NLI); and ii) Image Captioning (IC).

This paper proposed to use counterfactual maximum likelihood estimation to learn deep learning models that are less susceptible to spurious correlation relationships. In particular, it proposes two general algorithms, Implicit CMLE and Explicit CMLE, for learning causal predictions of DL models under observational data. The proposed method shows improvement over the regular MLE method in two real data sets.