Title: Exogenous Matching: Learning Good Proposals for Tractable Counterfactual Estimation
Venue: NeurIPS 2024
Accepted: yes
Keywords: causality

causal inference

counterfactual estimation

importance sampling

normalizing flows
Abstract: We propose an importance sampling method for tractable and efficient estimation of counterfactual expressions in general settings, named Exogenous Matching. By minimizing a common upper bound of counterfactual estimators, we transform the variance minimization problem into a conditional distribution learning problem, enabling its integration with existing conditional distribution modeling approaches. We validate the theoretical results through experiments under various types and settings of Structural Causal Models (SCMs) and demonstrate the outperformance on counterfactual estimation tasks compared to other existing importance sampling methods. We also explore the impact of injecting structural prior knowledge (counterfactual Markov boundaries) on the results. Finally, we apply this method to identifiable proxy SCMs and demonstrate the unbiasedness of the estimates, empirically illustrating the applicability of the method to practical scenarios.

Exogenous Matching: Learning Good Proposals for Tractable Counterfactual Estimation

Abstract

We propose an importance sampling method for tractable and efficient estimation of counterfactual expressions in general settings, named Exogenous Matching. By minimizing a common upper bound of counterfactual estimators, we transform the variance minimization problem into a conditional distribution learning problem, enabling its integration with existing conditional distribution modeling approaches. We validate the theoretical results through experiments under various types and settings of Structural Causal Models (SCMs) and demonstrate the outperformance on counterfactual estimation tasks compared to other existing importance sampling methods. We also explore the impact of injecting structural prior knowledge (counterfactual Markov boundaries) on the results. Finally, we apply this method to identifiable proxy SCMs and demonstrate the unbiasedness of the estimates, empirically illustrating the applicability of the method to practical scenarios. 1

1 Introduction

Counterfactual reasoning, considered one of the advanced cognitive abilities of humans, aims to address questions about hypothetical worlds that have not been observed. Answering these questions, typically in the form of "what-if" or "why," is crucial for attribution and explanation, thus counterfactual reasoning is widely applied in generating explanations [48, 47, 94, 63], making decisions [71, 37, 95, 58], and evaluating fairness [56, 113, 105, 78, 117]. A class of generative models called Structural Causal Models (SCMs) provides a semantic characterization of counterfactuals, consisting of a set of endogenous mechanisms and an exogenous distribution, from which a collection of distributions described by specific formal languages is in-

M

Human

Behavior

Natural

Language

Formal

Language

PCH

Observational

Interventinal

Counterfactual

Variables:

,

,

Observations:

,

,

Interventions:

,

,

The submodel of SCM

M

under intervention

:

M

is

?

would be

under

?

if

were

under

,

would be

under

?

P

(

=

)

P

(

=

)

P

(

=

|

=

)

L

1

L

2

L

3

M

M

M

,

M

duced. These languages are organized into a progressively refined hierarchical structure, and each is associated with human activities: language L 1 is about seeing (observational), L 2 is about doing (interventional), and L 3 is about imagining (counterfactual). This hierarchy is referred to as the causal ladder [77] or the Pearl Causal Hierarchy (PCH) [5]. Fig. 1 provides a brief illustration of the relevant concepts. As the highest level of the PCH, counterfactuals entail the most subtle information

in the hierarchy, making the evaluation of counterfactual languages an appealing objective that has received widespread attention in recent years.

Counterfactual reasoning consists of two subtasks: counterfactual identification and counterfactual estimation. For an expression Q in L 3 , identification is to determine the uniqueness of the answer to Q [86, 17] or its bounds [114, 25, 66] under some assumptions, while estimation is to compute the specific value of Q . A series of literature [86, 17] transforms Q into a combination of expressions in L 1 and L 2 through identification. However, estimating the transformed expression may be intractable. Another series of literature focuses on identifying and estimating Q in specific settings, such as back door [82, 38, 115, 102], front door [43, 109, 98], instrumental variables [14, 100, 35], representation decoupling [15, 97, 61], categorical exogenous [22], exponential family [85], domain counterfactuals [116]. There are also some literature applicable to relaxed cases, such as [28, 44, 45, 46, 57], but still less developed.

In recent years, a class of methods has emerged that simulate the structure of the original SCM using neural network architectures and learn causal mechanisms based on observed or intervened distributions, which we refer to as neural proxy SCMs. These methods include the use of VAEs [110, 55, 54, 92, 23], GANs [52, 108], normalizing flows [74, 50, 4, 69, 42], DDPMs [84, 12]. Here, we focus only on models that provide identifiability results. Using bijections, [69, 42] demonstrates the identifiability of learned causal mechanisms. However, constrained by bijections, they only provide tractable counterfactual estimation methods for fully observed endogenous variables. The closest method to performing tractable counterfactual estimation in general cases is NCM [107, 108], which employs an optimization algorithm to concurrently achieve tractable counterfactual estimation and identification (or partial identifiability [93]). However, the counterfactual estimation depends on rejection sampling, thereby lacking scalability.

It is commonly recognized that performing tractable counterfactual estimation in general cases is challenging, even when the SCM is fully specified. From the perspective of definition [5], one needs to integrate over the entire exogenous space, which involves determining whether the constraints of different hypothetical worlds are simultaneously satisfied. From the perspective of complexity, although [34] has demonstrated that counterfactual reasoning is tractable if observational and interventional reasoning are tractable, it relies on algorithms with exponential complexity. Furthermore, according to [112], performing marginal inference on SCMs, including parameterized SCMs such as NCM, has been shown to be NP-hard.

This paper presents a tractable and efficient counterfactual estimation method in general settings based on importance sampling. Here, by "general settings", we mean that the exogenous variables of the SCM can be discrete or continuous, the expressions to be estimated can involve an arbitrary finite number of hypothetical worlds, and the observations and interventions can also be arbitrary.

Specifically, the contributions of this paper are as follows:

We propose a tractable and efficient importance sampling method for counterfactual estimation in general settings, which is based on optimizing an upper bound on the variance of the estimators, and is formulated as a conditional distribution learning problem.

The experiments conducted on different SCM settings demonstrate that the proposed method outperforms existing importance sampling methods. Ablation studies empirically highlight the effectiveness of injecting structural prior knowledge. The experiments on counterfactual estimation tasks conducted on two identifiable proxy SCMs illustrate the feasibility of applying the method in conjunction with proxy SCMs to real-world problems.

We explore the injection of structural prior knowledge (counterfactual Markov boundaries) into neural networks used for parameter optimization.

2 Preliminaries

In this section, we provide the necessary background and definitions for our work, which are consistent with [5, 8, 114]. To maintain consistency in notation, we use the uppercase letter X to denote random variables and the lowercase letter x to denote their values. Bold uppercase letter X represents a set of variables and x the corresponding set of values. The domain of the variable X is denoted as Ω X , and Ω X for X = { X 1 , . . . , X n } represents the product of domains × n i =1 Ω X i . We use P X to denote a distribution over a set of random variables X , and P ( X ∈ X ) (abbreviated as P ( X ) ) to denote

probability when X take values X ⊆ Ω X . The lowercase p ( x ) represents the probability density function of P X if Ω X is continuous.

Structural causal models An SCM is a 4-tuple M = ⟨ U , V , F , P U ⟩ , where U is a set of exogenous variables; V is a set of endogenous variables; F , which describes the causal mechanisms of M , is a collection of functions { f V 1 , f V 2 , . . . , f V n } such that each endogenous variable V i is determined by a function f V i . Each f V i ∈ F is a mapping from (the domains of) U V i ∪ Pa V i to V i , where U V i ⊆ U and Pa V i ⊆ V \ V i . The entire set F forms a mapping from U to V , while the uncertainty comes from a probability distribution P U over exogenous variables U .

̸

In the paradigm of SCM, an (perfect) intervention is described as replacing the mechanisms of some variables X with constants x . The model after this intervention is termed a submodel, defined as

An SCM yields a causal graph G , where each V i ∈ V is a vertex, and the edges come in two types: there is a directed edge ( V i → V j ) between each pair V i and V j ∈ Pa V i ; and there is a bidirected edge ( V i ↔ V j ) between each pair V i and V j if U V i ∪ U V j = ∅ . This resulting graph is also known as a directed mixed graph (DMG). Here, we assume that the SCM is recursive, which means that there exists an order in F such that for any pair f i , f j ∈ F , if f i < f j , then V j / ∈ Pa V i . In particular, this implies that given values for exogenous variables (also known as a unit or an individual) u ∈ Ω U , all values of endogenous variables in V are also fixed (i.e., there exists a unique solution for endogenous variables w.r.t. u ), and the resulting causal graph G is an acyclic directed mixed graph (ADMG). We denote Y ( u ) as the solution for Y ⊆ V given u .

In submodel M x , the solution of Y ⊆ U given u , denoted as Y M x ( u ) , is termed as the potential response, and is typically abbreviated as Y x ( u ) .

Counterfactual events and probabilities The random variable Y ∈ V corresponding to the submodel M x is denoted as Y x , termed a counterfactual variable, with its domain denoted as Ω Y x . A set of counterfactual variables from the same submodel M x is denoted as Y x , and the set of counterfactual variables from k different submodels M x 1 , . . . , M x k is denoted as Y ∗ = ⋃ k i =1 Y i [ x i ] , with the corresponding domain Ω Y ∗ = × k i =1 Ω Y i [ x ] . Let σ -algebra Σ Y ∗ ⊆ 2 Ω Y ∗ , where 2 Ω Y ∗ is the power set of Ω Y ∗ . The counterfactual probability space is then a triplet ⟨ Ω Y ∗ , Σ Y ∗ , P Y ∗ ⟩ , where P Y ∗ is a probability measure P Y ∗ : Σ Y ∗ → [0 , 1] , and for any measurable set Y ∗ ∈ Σ Y ∗ , its value equals the Lebesgue integral,

Counterfactual probability is the cornerstone of the language L 3 in PCH. Specifically, all expressions in L 3 consist of inequalities between polynomials (and their Boolean combinations) over terms of the form P ( Y ∗ ) . Here, we assume that the L 3 expressions to be estimated can be represented by a finite number of P ( Y ∗ ) terms (including those approximated by Monte Carlo methods). Therefore, the estimation of P ( Y ∗ ) will become a focal point of the subsequent discussion.

where ✶ Ω ( u ) is an indicator function, equal to 1 if u ∈ Ω and 0 otherwise. The set Ω U ( Y ∗ ) = { u | Y ∗ ( u ) ∈ Y ∗ } , where Y ∗ ( u ) denotes the potential responses ⋃ k i =1 Y i [ x i ] ( u ) of counterfactual variables in Y ∗ w.r.t. u . We refer to the random event Y ∗ ∈ Y ∗ as a counterfactual event, and its probability P ( Y ∗ ) = P Y ∗ ( Y ∗ ) is termed the counterfactual probability.

Normalizing flows The normalizing flow T θ : R d → R d is a transformation parameterized by θ that maps observable samples x with d features to latent samples z distributed according to a simple distribution P Z with probability density function p ( z ) . The mapping T θ is a diffeomorphism, which allows us to compute the density p ( x ) through the change-of-variables formula:

When the Jacobian determinant of T θ ( x ) is tractable to compute, we can use samples from the observable distribution and maximum likelihood estimation to train the flow T θ . Additionally, we can easily generate i.i.d. samples conforming to the learned observable distribution by first sampling z ( i ) from the base distribution P Z , and then evaluating the inverse transformation T -1 θ ( z ( i ) ) .

3 Exogenous Matching

In this section, we present only the final theoretical conclusions. Detailed derivations of all theories and equations can be found in App. A.

Assumptions In addition to assuming that the SCM M = ⟨ U , V , F , P U ⟩ is recursive, the proposed method also assumes: i) for any X ⊆ V , x ∈ Ω X , u ∈ Ω U , F x ( u ) is computable; ii) P U is sampleable and computable. These assumptions imply the feasibility of counterfactual generation, meaning we can draw arbitrary counterfactual samples, with F x and P U both treated as black boxes. For example, in the context of neural proxy SCMs, P U , as the latent distribution of the generative model, is typically modeled as a simple distribution, while F x is a neural network.

Importance sampling for Monte Carlo integration A widely used method for estimating the Lebesgue integral is Monte Carlo integration. However, the indicator function ✶ Ω U ( Y ∗ ) ( u ) in Eq. 2 limits the efficiency. We consider ✶ Ω U ( Y ∗ ) ( u ) = 1 as a rare event. Since importance sampling is commonly used to handle Monte Carlo estimations involving rare events, we adopt the method of importance sampling on a parameterized proposal distribution Q U for tractable Monte Carlo integration, and the estimator can be derived as:

where for each sample u ( i ) ∼ Q U , it is required that if p ( u ( i ) ) > 0 , then q ( u ( i ) ) > 0 . The density ratio p ( u ) /q ( u ) is also termed as the importance weight and is usually assumed to be bounded. In this section, we assume that our derivations are based on an exogenous distribution defined over a continuous space. Naturally, similar conclusions hold for discrete exogenous distributions.

3.1 An Optimizable Variance Upper Bound

In importance sampling, a proposal distribution with low variance regarding σ Y ∗ is crucial, as it implies that fewer samples are required to achieve the same effect, leading to higher sampling efficiency. Previous works have attempted to constrain variance, such as providing upper bounds [18, 49], introducing multiple proposals [16, 27], and learning from sampled data [72, 83, 11, 65]. Given that the samples are i.i.d., with the same sample size n , a lower variance of σ Y ∗ implies a lower estimator variance:

It is evident that this formulation can be directly optimized, and there are several methods employing similar approaches (e.g., transforming it into cross-entropy or χ 2 divergence), as shown in [32, 68]. This process is called proposal learning, which ultimately yields a proposal distribution Q u that is suitable for the estimator.

The learned Q U is typically "one-off", rendering it unsuitable for other estimators. This necessitates multiple rounds of proposal learning to estimate an L 3 expression that involves various counterfactual events, which remains inefficient. To address this issue, we propose replacing the proposal distribution Q U with a conditional proposal distribution Q U | Y ∗ . Intuitively, the proposal distribution Q U | y ∗ corresponding to y ∗ ∈ Ω Y ∗ should be concentrated on the support Ω U ( δ ( y ∗ )) , thus allowing for reuse across different estimators.

Building on this idea, we extend the methods from [32, 68], as illustrated in App. B.1. Additionally, we find that when certain conditions are met in Y ∗ , for any y ∗ ∈ Y ∗ , the proposal distribution Q U | y ∗ shares a common variance upper bound:

Theorem 1 (Variance Upper Bound) . Let σ Y ∗ ( u ) = ( p ( u ) /q ( u | y ∗ )) ✶ Ω U ( Y ∗ ) ( u ) , where q ( u | y ∗ ) denote the density of the proposal distribution Q U | y ∗ , and let Y ∗ ( u ) be the potential response w.r.t. u . If for any y ∗ ∈ Y ∗ , there exists κ ≥ 1 such that 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ holds almost surely on the support Ω U ( Y ∗ ) , then for any Q U | y ∗ where y ∗ ∈ Y ∗ :

where the constant c is solely dependent on κ and P U .

It is noted that the expected term in Eq. 6 bears resemblance to cross-entropy, albeit not strictly. Intuitively, the original indicator function is now implied as potential responses within the condition, and optimizing this expected term can encourage the density of each proposal distribution at specific locations to match that of the exogenous distribution as closely as possible. Therefore, this approach is named Exogenous Matching (EXOM) .

The boundedness condition on the importance weights in Thm. 1 is likely to be violated for Y ∗ with an infinite support set. We further discuss this issue in App. A.2, where we: i) provide two relaxed versions of Thm. 1 based on concentration inequalities; ii) demonstrate how to construct a guard proposal distribution that necessarily satisfies the boundedness condition.

3.2 Learning and Inference

Generalize Thm. 1 Since any L 3 expression Q is composed of terms P ( Y ∗ ) , and assuming that it is expressible by a finite set of P ( Y ∗ ) , we can consider all Y ∗ involved in Q as outcomes of a stochastic process. To allow different forms of Y ∗ , we extend Thm. 1 to general cases, making it potentially applicable to the estimation of any counterfactual probability term P ( Y ∗ ) in an L 3 expression Q , with only one proposal learning process is required.

Definition 1 (Stochastic Counterfactual Process) . The collection of counterfactual variable sets Y ∗ = { Y ( s ) ∗ | s ∈ S} is referred to as a stochastic counterfactual process w.r.t. the state space S . A state s ∈ S is a set composed of triplets ⟨ Y , X , x ⟩ , where X , Y ⊆ V represent the intervened and observed variables, respectively, and x denotes the intervened values. Each state s corresponds to a set of counterfactual variables Y ( s ) ∗ = ⋃ ⟨ Y , X , x ⟩∈ s Y x .

Corollary 1 (Expected Variance Upper Bound) . Let Q S denote an arbitrary distribution defined over the state space S of a stochastic counterfactual process, and let P ( s ) Y ∗ denote an arbitrary distribution defined over the σ -algebra Σ ( s ) Y ∗ corresponding to a set of counterfactual variables Y ( s ) ∗ given a state s ∈ S . P Y ∗ is the joint distribution induced by P ( s ) Y ∗ and Q S . If the conditions in Thm. 1 are met for any Y ( s ) ∗ and any s ∈ S , then for any Q U | y ∗ where y ∗ ∈ Y ( s ) ∗ and any s ∈ S :

where the constant c is the same as in Thm. 1.

Sampling and optimization Disregarding the constant terms of the expected variance upper bound (Eq. 7) in Cor. 1, we obtain the optimization objective as follows:

Based on our assumptions, P U and Y ( s ) ∗ ( u ) are known, while the prior distribution of states Q S needs to be specifically designed for the particular expression in L 3 . The problem is now reformulated as a conditional distribution learning problem, and we can model this conditional distribution using neural networks. The complete learning algorithm is presented in Fig. 5 in App. A.3.

Inference Given the conditional proposal Q U | Y ∗ , we can take the expectation of the importance sampling results over Y ∗ to intuitively further enhance robustness. This leads to another unbiased estimator in the form of multiple importance sampling [16, 27]:

where σ Y ∗ [ y ∗ ] ( u ) = ( p ( u ) /q ( u | y ∗ )) ✶ Ω U ( Y ∗ ) ( u ) , and y ( i ) ∗ ∼ Q Y ∗ , u ( i ) ∼ Q U | y ( i ) ∗ . The distribution Q Y ∗ could be any distribution with support covering Y ∗ .

Conditioning We attempt to find a function that maps y ∗ to the vectorized parameters θ y ∗ required for the proposal distribution Q U | y ∗ . The information provided by y ∗ (i.e., the counterfactual event Y ∗ ∈ { y ∗ } ) can be interpreted as a set of 4-tuples, where each 4-tuple ⟨ Y , y , X , x ⟩ expresses

y

∗

Eq. 10

= = =













c

⟨

Y

1

,

y

1

,

X

1

,

x

1

⟩

c

⟨

Y

2

,

y

2

,

X

2

,

x

2

⟩

.

.

.

c

⟨

Y

k

,

y

k

,

X

k

,

x

k

⟩















m

=

{

m

1

m

2

· · ·

m

k

}

Thm. 3

h

g

θ

y

∗

=

Q

U

|

y

∗

Forward

Mask

Compute

Encoding

counterfactual information within the same submodel M x , including the observed variables Y and their values y , and the intervened variables X and their values x . We represent it as a vector:

where ⊕ denotes vector concatenation. The functions π and ω map inputs to vectors, with each component of the vector corresponding to an exogenous variable X i ∈ V , defined as follows:

To encode the entire set {⟨ Y 1 , y 1 , X 1 , x 1 ⟩ , ⟨ Y 2 , y 2 , X 2 , x 2 ⟩ , . . . } , we introduce two functions, h and g . Here, h serves as an encoder, mapping the vector of a single 4-tuple c ⟨ Y , y , X , x ⟩ to a latent encoding, while g acts as an aggregator, capturing the permutation invariance of the set. The vectorized parameters θ y ∗ are inferred through the interplay of these two functions:

We choose to model h using a multilayer perceptron (MLP), and model g as a function that ensures permutation invariance for encoding aggregation, such as summation or weighted summation, where we opt for attention [96] to enhance expressiveness.

3.3 Injecting Markov Boundaries

This section will explore how to inject available structural prior knowledge (specifically, counterfactual Markov boundaries) into neural networks used for conditional encoding, intuitively improving the quality and efficiency of learning.

Counterfactual Markov boundary Markov boundaries [75] have been used in feature selection [111, 64, 104] and causal discovery [3, 87, 103], since they reveal the local causal structure of variables, where all elements are strongly correlated with the variable [2]. Just as in feature selection, intuitively we can enhance the performance of distribution learning by masking redundant information. For modeling distributions defined over exogenous variables and conditioned on counterfactual variables, the structural prior information used here is named counterfactual Markov boundaries:

Definition 2 (Counterfactual Markov Boundary) . For an exogenous variable U j ∈ U and a set of counterfactual variables Y , along with their joint distribution P . If U j is independent of Y \ X given X under P , i.e. U j ⊥ ⊥ P ( Y \ X ) | X , then X is termed a Markov blanket of U j on Y . The collection of all Markov blankets of U j on Y is denoted as B j ( Y ) . If X ∈ B j ( Y ) is a Markov blanket of U j on Y , and there exists no X ′ ⊊ X such that X ′ ∈ B j ( Y ) , then X is termed a (counterfactual) Markov boundary of U j on Y , denoted as B j ( Y ) .

Methods for learning Markov boundaries based on independence in data distribution (e.g. [3, 87, 103]) cannot be directly applied to learn counterfactual Markov boundaries unless exogenous variables are observable. Moreover, these methods may have low efficiency due to their reliance on independence tests. To obtain the counterfactual Markov boundary, in this work, we assume that

another representation of SCM graphs called augmented graphs is known. Compared to causal graphs, augmented graphs incorporate exogenous variables U into the nodes, then remove bidirectional edges and add unidirectional edges ( U j → V i ) for all V i ∈ U and U j ∈ U V i .

When the SCM is recursive, the augmented graph of any submodel is necessarily acyclic due to the closure of recursiveness under (perfect) intervention [8], which implies that d-separation [75] always holds. We additionally assume faithfulness [2], which means that only the variables that are d-separated in the graph are independent in the distribution, allowing us to directly compute counterfactual Markov boundary for any exogenous variable by graph algorithm.

Under the above assumptions, the following theorem indicates that the counterfactual Markov boundary of U j is independent across different submodels. This not only reduces the search space of the Markov boundary, but also aligns with Eq. 12, where we encode counterfactual information according to each submodel.

Theorem 2 (Counterfactual Markov Boundary Independence) . If Y ∗ = ⋃ k i =1 Y i [ x i ] and each Y i [ x i ] corresponds to a different submodel M x i , then for each U j ∈ U , there exists a Markov boundary B j ( Y ∗ ) = ⋃ k i =1 B j ( Y i [ x i ] ) on Y ∗ , where B j ( Y i [ x i ] ) is a Markov boundary on M x i .

Another theorem demonstrates how to obtain counterfactual Markov boundaries via d-separation, and indirectly proves their uniqueness:

Theorem 3 (Counterfactual Markov Boundary on Graph) . For an exogenous variable U j ∈ U and a counterfactual variable set Y x from the submodel M x , the counterfactual variable Y x ∈ B j ( Y x ) if and only if Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } , i.e., when given Y x \ { Y x } , Y x and U j are not d-separated on G a x , where G a x is the augmented graph induced from the submodel M x .

The graph algorithm to determine counterfactual Markov boundaries B j ( Y ∗ ) for U j ∈ U is derived simply by combining Thms. 2 and 3 with the d-separation criterion as a subroutine, which can be found in Fig. 7 in App. A.4.

Masking We then inject the counterfactual Markov boundary into the neural network used for conditioning by vectorizing it as a weight mask, as briefly illustrated in Fig. 2 depicting the entire conditioning and masking process. Specifically, let θ y ∗ ,j be any parameter corresponding to exogenous variable U j ∈ U in Q U | y ∗ . According to the description in Thm. 2, the Markov boundary on Y ∗ = ⋃ k i =1 Y i [ x i ] can be precisely decomposed into the union of the Markov boundaries on each Y i [ x i ] . This corresponds exactly to encoding the information for counterfactual events on each

submodel M x i as depicted in Eq. 10. Therefore, we can modify Eq. 12 as follows:

̸

In particular, m ij = ω ( B i ( Y j )) , and B i ( Y j ) are obtained through algorithm derived by Thm. 3. The correspondence between the parameters θ y ∗ ,j and U j exists in the specific design of the model, such as the mean and covariance of each component in GMMs or the element-wise transformations in normalizing flows. As used in [31, 81, 13], h is an MLP that allows weight masking, such that for all j , the i -th component of ∇ x h j ( x , m ij ) = 0 if and only if m ij = 1 . This ensures that θ y ∗ ,j is only related to the Markov boundary of U j on y ∗ .

4 Related Works

Importance sampling with normalizing flows In recent years, the combination of normalizing flows and importance sampling has been widely employed in tasks related to Monte Carlo integration. For instance, a plethora of literature [70, 99, 101, 53, 60, 10, 51, 67] utilizes this combination to efficiently compute the partition function of energy. Some studies [68, 30, 36] also employ this method to solve integration problems of complex functions in high-dimensional spaces. When the integrand involves rejection sampling [6, 89], particle events [29, 9, 88], or failure events [33, 20], this method can improve the efficiency of sampling rare events. This combination is also applied for posterior inference [19, 1, 79, 21] as an alternative to integrating over the intractable distribution.

Identifiable neural proxy SCMs Our approach is applicable to pre-trained neural proxy SCMs, where causal mechanisms are modeled as neural networks. Increasing attention has been paid to the

identifiability of these models. BGM [69] combines bijections to demonstrate the identifiability of causal mechanisms in several special cases. CausalNF [42] builds upon the conclusions of [106] to prove the identifiability of its causal mechanisms up to invertible functions. NCM [108] extends the findings of their previous work [107] and proposes a sound and complete algorithm to identify counterfactual queries.

Arbitrary conditioning In dealing with exponentially many conditional distributions, our work establishes a connection with another unsupervised learning task, known as arbitrary conditioning. The task of this paper can be viewed as extending arbitrary conditioning from a single observational distribution to multiple counterfactual distributions. Relevant works include VAE-AC [40] based on VAE, NC [7] based on GAN, ACE [90] based on energy models, and ACFlow [59] based on normalizing flows. The most similar to our work is [91], which matches on the posterior distribution of VAE, akin to our matching on the exogenous distribution.

5 Experiments

Experiment settings and metrics We first define the prior distribution Q S over the state space of a stochastic counterfactual process Y ∗ and train according to Eq. 8. Subsequently, based on Q S , we construct a distribution P Y ∗ concerning counterfactual events for the evaluation of the estimator (Eq. 4). Inspired by the metrics for rare event sampling effectiveness, we utilize Effective Sample Proportion (ESP) and Failure Rate (FR) with threshold m to measure the performance of the importance sampling, defined as:

where η ( Y ∗ ) = (∑ n i =1 ✶ Ω U ( Y ∗ ) ( u ( i ) ) ) /n is the proportion of effective samples (nonzero indicator) to estimate the probability P ( Y ∗ ) , which indirectly reflects the sampling efficiency of a single estimate; this is equivalent to the success rate in rare event sampling. Therefore, ESP reflects the overall efficiency of the sampling method in supporting Thm. 1, while FR reflects its overall effectiveness in the state space to support Cor. 1 and Eq. 8. For further discussion on metrics, see App. C.1.

Specifically, the following two types of stochastic counterfactual processes are involved in subsequent experiments: i) Y B ∗ with state space S B = { s | | s | = k } (that is, with k submodels) and prior distribution Q B S , where the indicators for intervention and observation follow Bernoulli distributions, and their values follow endogenous distributions; ii) Y Q ∗ , where Q ∈ { ATE , ETT , NDE , CtfDE } , the design of state space S Q and prior distribution Q Q are detailed in App. C.2.

During evaluation, the distribution of counterfactual events P Y ∗ is contingent upon the type of counterfactual variables: for discrete, we focus on counterfactual event Y ∗ ∈ { y ∗ } ; for continuous, we focus on counterfactual event Y ∗ ∈ δ l ( y ∗ ) , where δ l ( y ∗ ) is a cube with side length l = 0 . 02 centered at y ∗ . The latter can be further used to estimate the counterfactual density in continuous space, as discussed in App. D.2.

One Run Initial State Final State 0 10 20 LL 0 . 0 0 . 2 0 . 4 0 . 6 ESP 0 10 20 LL 0 . 2 0 . 4 0 . 6 0 . 8 1 . 0 FR Figure 3: LL (negative Eq. 8) and ESP, FR on SIMPSON-NLIN. As LL increases, ESP increases while FR decreases, until convergence. Our experiments involve the following fully specified SCMs, which fall into three categories: i) Markovian diffeomorphic [42], where there is no hidden confounder and causal mechanisms are diffeomorphic, including SIMPSON-NLIN, TRIANGLE-NLIN and LARGEBD-NLIN; ii) Semi-Markovian continuous [107], where hidden confounders may exist and endogenous variables are continuous, including M and NAPKIN; iii) Regional canonical [108], where hidden confounders may exist and endogenous variables are discrete and finite, including FAIRNESS and FAIRNESSXW. The consistent performance observed in experiments across these different types of SCMs will serve as a reference for evaluating the robustness of the proposed method.

0

.

000

0

.

025

0

.

050

0

.

075

0

.

100

0

.

125

0

.

150

0

.

3

0

.

4

0

.

5

0

.

6

0

.

7

0

.

5

0

.

6

0

.

7

0

.

8

0

.

9

0

.

75

0

.

80

0

.

85

0

.

90

0

.

00

0

.

05

0

.

10

0

.

15

0

.

20

0

.

25

0

.

30

0

.

2

0

.

3

0

.

4

0

.

5

0

.

6

0

.

7

0

.

8

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

0

.

5

0

.

6

0

.

7

0

.

8

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

02

0

.

04

0

.

06

0

.

08

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

40

0

.

45

0

.

50

0

.

55

0

.

60

0

.

65

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

40

0

.

45

0

.

50

0

.

55

0

.

60

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

5

0

.

6

0

.

7

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

02

0

.

04

0

.

06

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

35

0

.

40

0

.

45

0

.

50

0

.

55

0

.

60

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

ESP

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. M

d. NAPKIN

Convergence We integrated Exogenous Matching with various density estimation models (GMM, MAF [73], NICE [24], SOSPF [41]) to conduct experiments on the stochastic counterfactual process Y B ∗ (with | s | = 3 ) over different SCM settings. We present the results of ESP and FR during the training process. As shown in Fig. 3 (with all results detailed in App. C.5), both the ESP and FR metrics change as expected until convergence, along with the decrease in training loss Eq. 8 (equivalent to the increase in LL in Fig. 3). This validates the effectiveness of Thm. 1 and Cor. 1, and empirically suggests that the conditions we assumed are generally not violated under our settings.

Comparison We compare our proposed method with three different but related sampling methods: i) Rejection Sampling (RS); ii) Cross-Entropy based Importance Sampling (CEIS, [32]); iii) Neural Importance Sampling (NIS, [68]). To apply the latter two methods under the same experimental setup, we extended them as detailed in App. B.1. As shown in Tab. 1, our method outperforms other approaches in both continuous and discrete cases. Specifically, since MAF exhibits stronger representational capabilities than GMM, it is expected that EXOM using MAF as the conditional distribution model generally outperforms EXOM using GMM.

Ablation To investigate the impact of injecting Markov boundaries, we present the improvement of ESP after injecting Markov boundaries during the training process compared to the default scenario. We conducted ablation experiments on 4 continuous SCMs and various density estimators. As shown in Fig. 4, the use of Markov boundaries as masks significantly improves the performance of EXOM under various settings. We also observed that when masks are used, the width of the hidden layers of neural networks in conditioning affects practical performance, which will be discussed in App. C.8.

Counterfactual Estimation on Proxy SCMs We combine identifiable proxy SCMs with EXOM for counterfactual estimation. We employ CausalNF [42] for SIMPSON-NLIN (based on the stochastic process Y B ∗ ) and NCM [108] for FAIRNESS (based on the stochastic process Y Q ∗ ). For the combination of CausalNF and SIMPSON-NLIN, we estimate the counterfactual probability on cubes δ l ( y ∗ ) with side length l = 0 . 02 centered around 1024 randomly sampled y ∗ from P Y ∗ (this can be used further to estimate counterfactual density), measure the sampling FR, and employ a dimensionregularized 95% CI error bound. For the combination of NCM and FAIRNESS, we estimate 4 different counterfactual queries, measure the average bias of the query results relative to the ground truth, and use a 95% CI error bound to demonstrate the unbiasedness of the estimates.

The results in Tab. 2 empirically demonstrate the effectiveness of EXOM in counterfactual density and effect estimation tasks compared to RS. Specifically, when estimating the cube δ l ( y ∗ ) (equivalent to counterfactual density), RS almost fails in high-dimensional settings, while EXOM exhibits good sampling efficiency and lower error compared to RS. When estimating counterfactual queries, the bias and error of EXOM are similar to those of RS (partly due to the lower sampling difficulty in discrete cases). Further experimental details and analysis of the conclusions can be found in App. C.9.

6 Conclusion

We propose Exogenous Matching for tractable estimation of expressions in L 3 in general settings. Specifically, leveraging importance sampling, we find a variance upper bound for estimators potentially applicable to any relevant counterfactual probability (Cor. 1), and then introduce an optimization objective (Eq. 8) amenable to sampling, transforming the problem into a conditional distribution learning problem. Theoretical and empirical results demonstrate that this approach can be combined with identifiable proxy SCMs to address practical problems. We also explore injecting Markov boundaries as prior knowledge and empirically validate effectiveness in several scenarios.

Limitations i) The proposed method does not directly estimate counterfactuals through the available distribution but requires a partially specified SCM. This work explores its effectiveness in combination with identifiable proxy SCMs, which are still an active area of research; ii) It is important to emphasize that the "general case" mentioned in this paper does not cover all scenarios. For instance, our estimand, an L 3 expression Q , requires the assumptions of finite submodels and approximability by a finite number of counterfactual probabilities; iii) Furthermore, the specific structures and tricks demonstrated in this paper (such as the injection of Markov boundaries) may not be applicable to SCMs with general parameter settings, which warrants further investigation.

Acknowledgments and Disclosure of Funding

This work was supported in part by National Key R&D Program of China (No. 2022ZD0120302).

References

A. Agrawal, D. R. Sheldon, and J. Domke. Advances in black-box vi: Normalizing flows, importance weighting, and optimization. Advances in Neural Information Processing Systems , 33:17358-17369, 2020.

C. F. Aliferis, A. Statnikov, I. Tsamardinos, S. Mani, and X. D. Koutsoukos. Local causal and markov blanket induction for causal discovery and feature selection for classification part i: Algorithms and empirical evaluation. Journal of Machine Learning Research , 11(7):171-234, 2010.

C. F. Aliferis, A. Statnikov, I. Tsamardinos, S. Mani, and X. D. Koutsoukos. Local causal and markov blanket induction for causal discovery and feature selection for classification part ii: Analysis and extensions. Journal of Machine Learning Research , 11(8):235-284, 2010.

S. Balgi, J. M. Peña, and A. Daoud. Personalized public policy analysis in social sciences using causal-graphical normalizing flows. Proceedings of the AAAI Conference on Artificial Intelligence , 36(11):11810-11818, Jun. 2022.

E. Bareinboim, J. D. Correa, D. Ibeling, and T. Icard. On Pearl's Hierarchy and the Foundations of Causal Inference , page 507-556. Association for Computing Machinery, New York, NY, USA, 1 edition, 2022.

M. Bauer and A. Mnih. Resampled priors for variational autoencoders. In K. Chaudhuri and M. Sugiyama, editors, Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics , volume 89 of Proceedings of Machine Learning Research , pages 66-75. PMLR, 16-18 Apr 2019.

M. Belghazi, M. Oquab, and D. Lopez-Paz. Learning about an exponential amount of conditional distributions. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems , volume 32. Curran Associates, Inc., 2019.

S. Bongers, P. Forr'e, J. Peters, and J. M. Mooij. Foundations of structural causal models with cycles and latent variables. The Annals of Statistics , 2016.

E. Bothmann, T. Janßen, M. Knobbe, T. Schmale, and S. Schumann. Exploring phase space with Neural Importance Sampling. SciPost Phys. , 8:069, 2020.

Y. Cao and E. Vanden-Eijnden. Learning optimal flows for non-equilibrium importance sampling. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 12352-12364. Curran Associates, Inc., 2022.

O. Cappé, R. Douc, A. Guillin, J.-M. Marin, and C. P. Robert. Adaptive importance sampling in general mixture classes. Statistics and Computing , 18(4):447-459, Dec 2008.

P. Chao, P. Blöbaum, and S. P. Kasiviswanathan. Interventional and counterfactual inference with diffusion models. CoRR , abs/2302.00860, 2023.

A. Chen, R. I. Shi, X. Gao, R. Baptista, and R. G. Krishnan. Structured neural networks for density estimation and causal inference. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems , volume 36, pages 66438-66450. Curran Associates, Inc., 2023.

D. Cheng, Z. Xu, J. Li, L. Liu, J. Liu, and T. D. Le. Conditional instrumental variable regression with representation learning for causal inference. CoRR , abs/2310.01865, 2023.

M. Cheng, X. Liao, Q. Liu, B. Ma, J. Xu, and B. Zheng. Learning disentangled representations for counterfactual regression via mutual information minimization. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval , SIGIR '22, page 1802-1806, New York, NY, USA, 2022. Association for Computing Machinery.

J.-M. CORNUET, J.-M. MARIN, A. MIRA, and C. P. ROBERT. Adaptive multiple importance sampling. Scandinavian Journal of Statistics , 39(4):798-812, 2012.

J. Correa, S. Lee, and E. Bareinboim. Nested counterfactual identification from arbitrary surrogate experiments. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information Processing Systems , volume 34, pages 6856-6867. Curran Associates, Inc., 2021.

C. Cortes, Y. Mansour, and M. Mohri. Learning bounds for importance weighting. In J. Lafferty, C. Williams, J. Shawe-Taylor, R. Zemel, and A. Culotta, editors, Advances in Neural Information Processing Systems , volume 23. Curran Associates, Inc., 2010.

C. Cundy and S. Ermon. Flexible approximate inference via stratified normalizing flows. In J. Peters and D. Sontag, editors, Proceedings of the 36th Conference on Uncertainty in Artificial Intelligence (UAI) , volume 124 of Proceedings of Machine Learning Research , pages 1288-1297. PMLR, 03-06 Aug 2020.

A. Dasgupta and E. A. Johnson. Rein: Reliability estimation via importance sampling with normalizing flows. Reliability Engineering & System Safety , 242:109729, 2024.

M. Dax, S. R. Green, J. Gair, M. Pürrer, J. Wildberger, J. H. Macke, A. Buonanno, and B. Schölkopf. Neural importance sampling for rapid and reliable gravitational-wave inference. Physical Review Letters , 130(17):171403, 2023.

E. De Brouwer. Deep counterfactual estimation with categorical background variables. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 35213-35225. Curran Associates, Inc., 2022.

F. De Sousa Ribeiro, T. Xia, M. Monteiro, N. Pawlowski, and B. Glocker. High fidelity image counterfactuals with probabilistic causal models. In Proceedings of the 40th International Conference on Machine Learning , volume 202 of Proceedings of Machine Learning Research , pages 7390-7425, 23-29 Jul 2023.

L. Dinh, D. Krueger, and Y. Bengio. NICE: non-linear independent components estimation. In Y. Bengio and Y. LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Workshop Track Proceedings , 2015.

G. Duarte, N. Finkelstein, D. Knox, J. Mummolo, and I. Shpitser. An automated approach to causal inference in discrete settings. Journal of the American Statistical Association , 0(0):1-16, 2023.

C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios. Neural spline flows. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems , volume 32. Curran Associates, Inc., 2019.

V. Elvira, L. Martino, D. Luengo, and M. F. Bugallo. Generalized Multiple Importance Sampling. Statistical Science , 34(1):129 - 155, 2019.

I. R. Fulcher, I. Shpitser, S. Marealle, and E. J. Tchetgen Tchetgen. Robust Inference on Population Indirect Causal Effects: The Generalized Front Door Criterion. Journal of the Royal Statistical Society Series B: Statistical Methodology , 82(1):199-214, 11 2019.

C. Gao, S. Höche, J. Isaacson, C. Krause, and H. Schulz. Event generation with normalizing flows. Phys. Rev. D , 101:076002, Apr 2020.

C. Gao, J. Isaacson, and C. Krause. i- flow: High-dimensional integration and sampling with normalizing flows. Machine Learning: Science and Technology , 1(4):045023, oct 2020.

M. Germain, K. Gregor, I. Murray, and H. Larochelle. Made: Masked autoencoder for distribution estimation. In F. Bach and D. Blei, editors, Proceedings of the 32nd International Conference on Machine Learning , volume 37 of Proceedings of Machine Learning Research , pages 881-889, Lille, France, 07-09 Jul 2015. PMLR.

S. Geyer, I. Papaioannou, and D. Straub. Cross entropy-based importance sampling using gaussian densities revisited. Structural Safety , 76:15-27, 2019.

T. Guo, H. Wang, J. Li, and H. Wang. Sampling-based adaptive design strategy for failure probability estimation. Reliability Engineering & System Safety , 241:109664, 2024.

Y. Han, Y. Chen, and A. Darwiche. On the complexity of counterfactual reasoning. In E. Elkind, editor, Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, IJCAI-23 , pages 5676-5684. International Joint Conferences on Artificial Intelligence Organization, 8 2023. Main Track.

J. Hartford, G. Lewis, K. Leyton-Brown, and M. Taddy. Deep IV: A flexible approach for counterfactual prediction. In D. Precup and Y. W. Teh, editors, Proceedings of the 34th International Conference on Machine Learning , volume 70 of Proceedings of Machine Learning Research , pages 1414-1423. PMLR, 06-11 Aug 2017.

T. Heimel, R. Winterhalder, A. Butter, J. Isaacson, C. Krause, F. Maltoni, O. Mattelaer, and T. Plehn. Madnis-neural multi-channel importance sampling. SciPost Physics , 15(4):141, 2023.

c. Hızlı, S. T. John, A. T. Juuti, T. T. Saarinen, K. H. Pietiläinen, and P. Marttinen. Causal modeling of policy interventions from treatment-outcome sequences. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning , volume 202 of Proceedings of Machine Learning Research , pages 13050-13084. PMLR, 23-29 Jul 2023.

D. G. Horvitz and D. J. Thompson. A generalization of sampling without replacement from a finite universe. Journal of the American Statistical Association , 47(260):663-685, 1952.

C.-W. Huang, D. Krueger, A. Lacoste, and A. Courville. Neural autoregressive flows. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning , volume 80 of Proceedings of Machine Learning Research , pages 2078-2087. PMLR, 10-15 Jul 2018.

O. Ivanov, M. Figurnov, and D. Vetrov. Variational autoencoder with arbitrary conditioning. In International Conference on Learning Representations , 2019.

P. Jaini, K. A. Selby, and Y . Yu. Sum-of-squares polynomial flow. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning , volume 97 of Proceedings of Machine Learning Research , pages 3009-3018. PMLR, 09-15 Jun 2019.

A. Javaloy, P. Sanchez-Martin, and I. Valera. Causal normalizing flows: from theory to practice. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems , volume 36, pages 58833-58864. Curran Associates, Inc., 2023.

H. Jeong, J. Tian, and E. Bareinboim. Finding and listing front-door adjustment sets. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 33173-33185. Curran Associates, Inc., 2022.

Y. Jung, J. Tian, and E. Bareinboim. Learning causal effects via weighted empirical risk minimization. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 12697-12709. Curran Associates, Inc., 2020.

Y. Jung, J. Tian, and E. Bareinboim. Estimating identifiable causal effects through double machine learning. Proceedings of the AAAI Conference on Artificial Intelligence , 35(13):12113-12122, May 2021.

Y. Jung, J. Tian, and E. Bareinboim. Estimating joint treatment effects by combining multiple experiments. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning , volume 202 of Proceedings of Machine Learning Research , pages 15451-15527. PMLR, 23-29 Jul 2023.

A.-H. Karimi, B. Schölkopf, and I. Valera. Algorithmic recourse: from counterfactual explanations to interventions. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency , FAccT '21, page 353-362, New York, NY, USA, 2021. Association for Computing Machinery.

A.-H. Karimi, J. von Kügelgen, B. Schölkopf, and I. Valera. Algorithmic recourse under imperfect causal knowledge: a probabilistic approach. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 265-277. Curran Associates, Inc., 2020.

A. Katharopoulos and F. Fleuret. Not all samples are created equal: Deep learning with importance sampling. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning , volume 80 of Proceedings of Machine Learning Research , pages 2525-2534. PMLR, 10-15 Jul 2018.

I. Khemakhem, R. Monti, R. Leech, and A. Hyvarinen. Causal autoregressive flows. In A. Banerjee and K. Fukumizu, editors, Proceedings of The 24th International Conference on Artificial Intelligence and Statistics , volume 130 of Proceedings of Machine Learning Research , pages 3520-3528. PMLR, 13-15 Apr 2021.

L. Klein, A. Krämer, and F. Noé. Equivariant flow matching. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023 , 2023.

M. Kocaoglu, C. Snyder, A. G. Dimakis, and S. Vishwanath. CausalGAN: Learning causal implicit generative models with adversarial training. In International Conference on Learning Representations , 2018.

J. Köhler, A. Krämer, and F. Noé. Smooth normalizing flows. In M. Ranzato, A. Beygelzimer, Y. N. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual , pages 2796-2809, 2021.

A. Komanduri, Y. Wu, F. Chen, and X. Wu. Learning causally disentangled representations via the principle of independent causal mechanisms. CoRR , abs/2306.01213, 2023.

A. Komanduri, Y. Wu, W. Huang, F. Chen, and X. Wu. Scm-vae: Learning identifiable causal representations via structural knowledge. In 2022 IEEE International Conference on Big Data (Big Data) , pages 1014-1023, 2022.

M. J. Kusner, J. Loftus, C. Russell, and R. Silva. Counterfactual fairness. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems , volume 30. Curran Associates, Inc., 2017.

A. Li and J. Pearl. Probabilities of causation with nonbinary treatment and effect. Proceedings of the AAAI Conference on Artificial Intelligence , 38(18):20465-20472, Mar. 2024.

H. Li, C. Zheng, Y. Cao, Z. Geng, Y. Liu, and P. Wu. Trustworthy policy learning under the counterfactual no-harm criterion. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning , volume 202 of Proceedings of Machine Learning Research , pages 20575-20598. PMLR, 23-29 Jul 2023.

Y. Li, S. Akbar, and J. Oliva. ACFlow: Flow models for arbitrary conditional likelihoods. In H. D. III and A. Singh, editors, Proceedings of the 37th International Conference on Machine Learning , volume 119 of Proceedings of Machine Learning Research , pages 5831-5841. PMLR, 13-18 Jul 2020.

T. Liu, W. Gao, Z. Wang, and C. Wang. Pathflow: A normalizing flow generator that finds transition paths. In J. Cussens and K. Zhang, editors, Proceedings of the Thirty-Eighth Conference on Uncertainty in Artificial Intelligence , volume 180 of Proceedings of Machine Learning Research , pages 1232-1242. PMLR, 01-05 Aug 2022.

Y. Liu, J. Wang, and B. Li. Edvae: Disentangled latent factors models in counterfactual reasoning for individual treatment effects estimation. Information Sciences , 652:119578, 2024.

I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations , 2019.

J. Ma, R. Guo, S. Mishra, A. Zhang, and J. Li. Clear: Generative counterfactual explanations on graphs. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 25895-25907. Curran Associates, Inc., 2022.

D. Margaritis. Toward provably correct feature selection in arbitrary domains. In Y. Bengio, D. Schuurmans, J. Lafferty, C. Williams, and A. Culotta, editors, Advances in Neural Information Processing Systems , volume 22. Curran Associates, Inc., 2009.

L. Martino, V. Elvira, D. Luengo, and J. Corander. Layered adaptive importance sampling. Statistics and Computing , 27(3):599-623, May 2017.

V. Melnychuk, D. Frauen, and S. Feuerriegel. Partial counterfactual identification of continuous outcomes with a curvature sensitivity model. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems , volume 36, pages 32020-32060. Curran Associates, Inc., 2023.

L. I. Midgley, V. Stimper, G. N. C. Simm, B. Schölkopf, and J. M. Hernández-Lobato. Flow annealed importance sampling bootstrap. In The Eleventh International Conference on Learning Representations , 2023.

T. Müller, B. Mcwilliams, F. Rousselle, M. Gross, and J. Novák. Neural importance sampling. ACM Trans. Graph. , 38(5), oct 2019.

A. Nasr-Esfahany, M. Alizadeh, and D. Shah. Counterfactual identifiability of bijective causal models. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning , volume 202 of Proceedings of Machine Learning Research , pages 25733-25754. PMLR, 23-29 Jul 2023.

F. Noé, S. Olsson, J. Köhler, and H. Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science , 365(6457):eaaw1147, 2019.

M. Oberst and D. Sontag. Counterfactual off-policy evaluation with Gumbel-max structural causal models. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning , volume 97 of Proceedings of Machine Learning Research , pages 4881-4890. PMLR, 09-15 Jun 2019.

M.-S. Oh and J. O. Berger. Adaptive importance sampling in monte carlo integration. Journal of Statistical Computation and Simulation , 41(3-4):143-168, 1992.

G. Papamakarios, T. Pavlakou, and I. Murray. Masked autoregressive flow for density estimation. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems , volume 30. Curran Associates, Inc., 2017.

N. Pawlowski, D. Coelho de Castro, and B. Glocker. Deep structural causal models for tractable counterfactual inference. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 857-869. Curran Associates, Inc., 2020.

J. Pearl. Probabilistic Reasoning in Intelligent Systems . Morgan Kaufmann, San Francisco (CA), 1988.

J. Pearl. Causality: Models, Reasoning and Inference . Cambridge University Press, USA, 2nd edition, 2009.

J. Pearl and D. Mackenzie. The Book of Why: The New Science of Cause and Effect . Basic Books, Inc., USA, 1st edition, 2018.

D. Plecko and E. Bareinboim. Causal fairness analysis. CoRR , abs/2207.11385, 2022.

D. Prangle and C. Viscardi. Distilling importance sampling for likelihood free inference. Journal of Computational and Graphical Statistics , 32(4):1461-1471, 2023.

D. J. Rezende, G. Papamakarios, S. Racaniere, M. Albergo, G. Kanwar, P. Shanahan, and K. Cranmer. Normalizing flows on tori and spheres. In H. D. III and A. Singh, editors, Proceedings of the 37th International Conference on Machine Learning , volume 119 of Proceedings of Machine Learning Research , pages 8083-8092. PMLR, 13-18 Jul 2020.

F. Rozet, F. Divo, and S. Schnake. Zuko: Normalizing Flows in PyTorch, 1 2024.

D. B. Rubin. Bayesian inference for causal effects: The role of randomization. The Annals of Statistics , 6(1):34-58, 1978.

R. Rubinstein. The cross-entropy method for combinatorial and continuous optimization. Methodology And Computing In Applied Probability , 1(2):127-190, Sep 1999.

P. Sanchez and S. A. Tsaftaris. Diffusion causal models for counterfactual estimation. In First Conference on Causal Learning and Reasoning , 2022.

A. Shah, R. Dwivedi, D. Shah, and G. Wornell. On counterfactual inference with unobserved confounding. In NeurIPS 2022 Workshop on Causality for Real-world Impact , 2022.

I. Shpitser and J. Pearl. Complete identification methods for the causal hierarchy. Journal of Machine Learning Research , 9(64):1941-1979, 2008.

A. Statnikov, N. I. Lytkin, J. Lemeire, and C. F. Aliferis. Algorithms for discovery of multiple markov boundaries. Journal of Machine Learning Research , 14(15):499-566, 2013.

B. Stienen and R. Verheyen. Phase space sampling and inference from weighted events with autoregressive flows. SciPost Phys. , 10:038, 2021.

V. Stimper, B. Schölkopf, and J. Miguel Hernandez-Lobato. Resampling base distributions of normalizing flows. In G. Camps-Valls, F. J. R. Ruiz, and I. Valera, editors, Proceedings of The 25th International Conference on Artificial Intelligence and Statistics , volume 151 of Proceedings of Machine Learning Research , pages 4915-4936. PMLR, 28-30 Mar 2022.

R. Strauss and J. B. Oliva. Arbitrary conditional distributions with energy. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information Processing Systems , volume 34, pages 752-763. Curran Associates, Inc., 2021.

R. Strauss and J. B. Oliva. Posterior matching for arbitrary conditioning. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 18088-18099. Curran Associates, Inc., 2022.

P. Sánchez-Martin, M. Rateike, and I. Valera. Vaca: Designing variational graph autoencoders for causal queries. Proceedings of the AAAI Conference on Artificial Intelligence , 36(7):8159-8168, Jun. 2022.

J. Tan, J. Blanchet, and V. Syrgkanis. Consistency of neural causal partial identification, 2024.

S. Tsirtsis, A. De, and M. Rodriguez. Counterfactual explanations in sequential decision making under uncertainty. Advances in Neural Information Processing Systems , 34:30127-30139, 2021.

S. Tsirtsis and M. Rodriguez. Finding counterfactually optimal action sequences in continuous state spaces. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems , volume 36, pages 3220-3247. Curran Associates, Inc., 2023.

A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems , NIPS'17, page 6000-6010, Red Hook, NY, USA, 2017. Curran Associates Inc.

H. Wang, J. Fan, Z. Chen, H. Li, W. Liu, T. Liu, Q. Dai, Y. Wang, Z. Dong, and R. Tang. Optimal transport for treatment effect estimation. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems , volume 36, pages 5404-5418. Curran Associates, Inc., 2023.

M. Wienöbst, B. van der Zander, and M. Li´ skiewicz. Linear-time algorithms for front-door adjustment in causal graphs. Proceedings of the AAAI Conference on Artificial Intelligence , 38(18):20577-20584, Mar. 2024.

P. Wirnsberger, A. J. Ballard, G. Papamakarios, S. Abercrombie, S. Racanière, A. Pritzel, D. Jimenez Rezende, and C. Blundell. Targeted free energy estimation via learned mappings. The Journal of Chemical Physics , 153(14), 2020.

A. Wu, K. Kuang, B. Li, and F. Wu. Instrumental variable regression with confounder balancing. In K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the 39th International Conference on Machine Learning , volume 162 of Proceedings of Machine Learning Research , pages 24056-24075. PMLR, 17-23 Jul 2022.

H. Wu, J. Köhler, and F. Noé. Stochastic normalizing flows. Advances in Neural Information Processing Systems , 33:5933-5944, 2020.

P. A. Wu and K. Fukumizu. $\beta$-intact-VAE: Identifying and estimating causal effects under limited overlap. In International Conference on Learning Representations , 2022.

X. Wu, B. Jiang, T. Wu, and H. Chen. Practical markov boundary learning without strong assumptions. Proceedings of the AAAI Conference on Artificial Intelligence , 37(9):10388-10398, Jun. 2023.

X. Wu, B. Jiang, K. Yu, c. Miao, and H. Chen. Accurate markov boundary discovery for causal feature selection. IEEE Transactions on Cybernetics , 50(12):4983-4996, 2020.

Y. Wu, L. Zhang, and X. Wu. Counterfactual fairness: Unidentification, bound and algorithm. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI-19 , pages 1438-1444. International Joint Conferences on Artificial Intelligence Organization, 7 2019.

Q. Xi and B. Bloem-Reddy. Indeterminacy in generative models: Characterization and strong identifiability. In F. Ruiz, J. Dy, and J.-W. van de Meent, editors, Proceedings of The 26th International Conference on Artificial Intelligence and Statistics , volume 206 of Proceedings of Machine Learning Research , pages 6912-6939. PMLR, 25-27 Apr 2023.

K. Xia, K.-Z. Lee, Y. Bengio, and E. Bareinboim. The causal-neural connection: Expressiveness, learnability, and inference. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information Processing Systems , volume 34, pages 10823-10836. Curran Associates, Inc., 2021.

K. M. Xia, Y. Pan, and E. Bareinboim. Neural causal models for counterfactual identification and estimation. In The Eleventh International Conference on Learning Representations , 2023.

Z. Xu, D. Cheng, J. Li, J. Liu, L. Liu, and K. Yu. Causal inference with conditional front-door adjustment and identifiable variational autoencoder. In The Twelfth International Conference on Learning Representations , 2024.

M. Yang, F. Liu, Z. Chen, X. Shen, J. Hao, and J. Wang. Causalvae: Disentangled representation learning via neural structural causal models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) , pages 9593-9602, June 2021.

S. Yaramakala and D. Margaritis. Speculative markov blanket discovery for optimal feature selection. In Fifth IEEE International Conference on Data Mining (ICDM'05) , pages 4 pp.-, 2005.

M. Zeˇ cevi´ c, D. S. Dhami, and K. Kersting. Not all causal inference is the same. Transactions on Machine Learning Research , 2023.

J. Zhang and E. Bareinboim. Fairness in decision-making - the causal explanation formula. Proceedings of the AAAI Conference on Artificial Intelligence , 32(1), Apr. 2018.

J. Zhang, J. Tian, and E. Bareinboim. Partial counterfactual identification from observational and experimental data. In K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the 39th International Conference on Machine Learning , volume 162 of Proceedings of Machine Learning Research , pages 26548-26558. PMLR, 17-23 Jul 2022.

W. Zhang, L. Liu, and J. Li. Treatment effect estimation with disentangled latent factors. Proceedings of the AAAI Conference on Artificial Intelligence , 35(12):10923-10930, May 2021.

Z. Zhou, R. Bai, S. Kulinski, M. Kocaoglu, and D. I. Inouye. Towards characterizing domain counterfactuals for invertible latent causal models. In The Twelfth International Conference on Learning Representations , 2024.

A. Zuo, S. Wei, T. Liu, B. Han, K. Zhang, and M. Gong. Counterfactual fairness with partially known causal graph. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems , volume 35, pages 1238-1252. Curran Associates, Inc., 2022.

Appendix

Table of Contents

A Proofs

A.1 Counterfactuals

In this section, we demonstrate the validity of counterfactual probability-related concepts, providing intuitions based on derivations in discrete spaces, and proving lemmas to streamline subsequent derivations. Firstly, we establish the validity of counterfactual probabilities as defined in Eq. 2.

Proposition 1. The probability measure defined by Eq. 2 (on recursive SCMs) adheres to the Kolmogorov axioms.

Proof. (i) For any Y ∗ ∈ Σ Y ∗ , 0 ≤ P Y ∗ ( Y ∗ ) ≤ 1 . Since 0 ≤ ✶ Ω U ( Y ∗ ) ( u ) ≤ 1 , the proof follows from the Monotonicity of Lebesgue integration:

where P Y ∗ ( Y ∗ ) = ∫ Ω U ✶ Ω U ( Y ∗ ) ( u ) d P U , thus 0 ≤ P Y ∗ ( Y ∗ ) ≤ 1 . (ii) P Y ∗ (Ω Y ∗ ) = 1 . Since SCM is recursive, given any u ∈ Ω U , the values of exogenous variables are determined, and hence all values in Y ∗ are determined, that is, the potential responses Y ∗ ( u ) . Since Y ∗ ( u ) ∈ Ω Y ∗ , according to the definition of Ω U (Ω Y ∗ ) ( u ) , Ω U (Ω Y ∗ ) ( u ) = 1 , thus:

̸

(iii) P Y ∗ ( ⋃ i ≥ 1 Y ( i ) ∗ ) = ∑ i ≥ 1 P Y ∗ ( Y ( i ) ∗ ) , where {Y (1) ∗ , Y (2) ∗ , . . . } is a countable (possibly countably infinite) set of pairwise disjoint counterfactual events. For u ∈ Ω U , if Y ∗ ( u ) ∈ Y ( i ) ∗ , since for any j = i , Y ( i ) ∗ ∩ Y ( j ) ∗ = ∅ , it follows that Y ∗ ( u ) / ∈ Y ( j ) ∗ , thus ✶ Ω U ( Y ( i ) ∗ ) ( u ) = ✶ Ω U ( ⋃ i ≥ 1 Y ( i ) ∗ ) ( u ) = 1 and ∑ j = i Ω U ( Y ( i ) ∗ ) ( u ) = 0 , hence.

̸

̸

̸

̸

If for all i , Y ∗ ( u ) / ∈ Y ( i ) ∗ , then ∑ i ≥ 1 ✶ Ω U ( Y ( i ) ∗ ) ( u ) = ✶ Ω U ( ⋃ i ≥ 1 Y ( i ) ∗ ) ( u ) = 0 . Therefore, both sides of the equation are zero, so it holds. Hence, we have proved P Y ∗ ( ⋃ i ≥ 1 Y ( i ) ∗ ) = ∑ i ≥ 1 P Y ∗ ( Y ( i ) ∗ ) .

Given that axioms (i), (ii) and (iii) hold, which are the Kolmogorov axioms, it follows that Eq. 2 satisfies the definition of a probability measure.

From a measure-theoretic perspective, the indicator function in Eq. 2 can be transformed into the Dirac measure, and vice versa:

Lemma 1. For any Y ∗ ∈ Σ Y ∗ and any u ∈ Ω U ,

Proof. Given Y ∗ ∈ Σ Y ∗ and u ∈ Ω U , we can consider Y ∗ as u being constant, thus where the integral ∫ Y ∗ d δ Y ∗ ( u ) remains a function of u .

Then, substituting Lem. 1 into Eq. 2, we have:

where P Y ∗ , U satisfying d P Y ∗ , U = d δ Y ∗ ( u ) d P U is called the joint distribution of counterfactual variables and exogenous variables, which we abbreviate as the joint distribution.

In words, the joint distribution is determined by the exogenous distribution and the Dirac distribution, while the counterfactual probability is the integral over the endogenous space after marginalizing out the exogenous variables from the joint distribution.

A.2 Importance Sampling

Importance sampling estimator for counterfactual estimation Eq. 4 only illustrates the case where exogenous variables are continuous. Here, we will provide a complete derivation. For discrete cases, the Lebesgue integral can be expressed as a summation, thus,

For continuous cases, the Radon-Nikodym theorem is required. Suppose that the probability density functions of P U and Q U exist, denoted by p ( u ) and q ( u ) , respectively. According to the definition of probability density functions, p ( u ) = d P U / d u and q ( u ) = d Q U / d u . Then

We assume that the integrand is Lebesgue integrable. It can be observed that the difference between the discrete and continuous cases lies only in the importance weights. Therefore, in subsequent derivations, we will proceed in the continuous case, with the discrete case requiring only the substitution of the importance weights.

The expectation term can be estimated using Monte Carlo methods, resulting in the basic form of the importance sampling estimator:

Variance of the importance sampling estimator The variance of the estimator in Eq. 4 is:

where σ Y ∗ ( u ) = ( p ( u ) /q ( u )) ✶ Ω U ( Y ∗ ) ( u ) , and each sample u ( i ) ∼ P U .

V u ∼ Q U [ σ Y ∗ ( u )] can be further expanded as:

The proposal distribution Q U only affects the term E u ∼ P U [ σ Y ∗ ( u )] in the variance Eq. 5. The only difference between it and the estimator P ( Y ∗ ) = E u ∼ Q U [ σ Y ∗ ( u )] is that E u ∼ P U [ σ Y ∗ ( u )] is the expectation over the exogenous distribution P U .

Optimization of Eq. 5 and the limitations Reducing variance implies improving estimation efficiency; in other words, it means achieving the same level of estimation accuracy with fewer samples. One direct method to optimize variance is by sampling from the exogenous distribution P U using Monte Carlo methods to estimate the term E u ∼ P U [ σ Y ∗ ( u )] in the variance Eq. 5, and then minimizing the estimated value of this term using stochastic optimization techniques. Alternatively, as suggested by [32, 68], this term can be transformed into an optimization problem involving the cross-entropy or χ 2 divergence between the proposal distribution and the integrand, and then optimizing the values of these mismatches estimated by sampling under the proposal distribution Q U can also indirectly optimize variance. This optimization process is referred to as proposal learning.

However, a learned individual proposal distribution is typically only applicable to a single estimator, meaning it can only estimate the probability for a single counterfactual event Y ∗ , as the indicator function ✶ Ω U ( Y ∗ ) ( u ) in σ Y ∗ ( u ) operates solely for Y ∗ . But L 3 expressions can typically contain multiple counterfactual probability terms, and this limitation implies that, in the worst case, we need to perform a separate optimization for each counterfactual probability, still affecting the efficiency of the counterfactual estimation task.

To address this issue, our solution is to replace the sampling proposal distribution Q U with a conditional proposal distribution Q U | Y ∗ , adding an extra degree of freedom conditioned on Y ∗ . Our overall idea is to let these different proposal distributions participate in the same optimization (i.e., sharing the same optimization objective) so that a single optimization yields different proposal distributions applicable to different counterfactual events.

Additionally, to limit the scope of responsibility of each proposal distribution Q U | y ∗ -that is, to prevent too many proposal distributions from targeting the same counterfactual event Y ∗ and consequently neglecting some counterfactual events - we further impose a one-to-one correspondence between conditions and responsibilities for inference. Intuitively, this would make the proposal distribution Q U | y ∗ corresponding to y ∗ ∈ Ω Y ∗ focus on the support Ω U ( δ ( y ∗ )) . Given that for any counterfactual event there is an approximation Y ∗ ≈ ⋃ ∞ y ∗ ∈Y ∗ δ ( y ∗ ) , we can use the proposal distributions Q U | y ∗ corresponding to these y ∗ ∈ Y ∗ to serve the estimation of P ( Y ∗ ) .

Variance upper bound When certain conditions are met in Y ∗ , for any y ∗ ∈ Y ∗ , the proposal distribution Q U | y ∗ shares a common upper bound on variance, which is exactly the common optimization objective we seek:

Theorem 1 (Variance Upper Bound) . Let σ Y ∗ ( u ) = ( p ( u ) /q ( u | y ∗ )) ✶ Ω U ( Y ∗ ) ( u ) , where q ( u | y ∗ ) denote the density of the proposal distribution Q U | y ∗ , and let Y ∗ ( u ) be the potential response w.r.t. u . If for any y ∗ ∈ Y ∗ , there exists κ ≥ 1 such that 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ holds almost surely on the support Ω U ( Y ∗ ) , then for any Q U | y ∗ where y ∗ ∈ Y ∗ :

where the constant c is solely dependent on κ and P U .

Proof. For a Y ∗ ∈ Σ Y ∗ that satisfies bounded importance weights (i.e., there exists κ ≥ 1 such that 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ holds almost surely on the support Ω U ( Y ∗ ) ), the following inequality holds for any y ∗ , y ′ ∗ ∈ Y ∗ holds almost surely:

In the following derivations, cases where Eq. 48 does not hold will be implicitly omitted. This is because, according to the assumption of bounded importance weights, the exogenous distribution's probability measure corresponding to the cases where Eq. 48 does not hold is zero (in other words, the probability that the inequality Eq. 48 holds is 1 ). Therefore, omitting the cases where it does not hold does not affect the expectation w.r.t. the exogenous distribution.

For ease of implementation and computation, we focus on log-weights by constructing ξ Y ∗ ( u ) to bridge the inequality conclusions over E u ∼ P U [ ξ y ∗ ( u )] and the inequality relationship with the variance, where ξ Y ∗ ( u ) = log ( p ( u ) /q ( u | y ∗ )) Ω U ( Y ∗ ) ( u ) .

Next, we look for a lower bound for E u ∼ P U [ ξ Y ∗ ( u )] . Firstly, according to the bounded density ratio condition, for any u ∈ Ω U ( Y ∗ ) with p ( u ) > 0 and y ∗ ∈ Y ∗ , κ -1 ≤ p ( u ) /q ( u | y ∗ ) ≤ κ holds. Therefore, based on the concavity of the logarithmic function, the following inequality holds (assuming κ > 1 , as the conclusion is trivially true when κ = 1 ):

Due to the boundedness of E u ∼ P U [ ξ Y ∗ ( u )] in the logarithmic space (with ≤ log κ and ≥ -log κ ), by employing the monotonicity and linearity of the Lebesgue integral, we obtain:

Substitute the above inequalities into Eq. 5:

The constant c is solely dependent on κ and P U , whereas E u ∼ P U [log p ( u )] equals the negative entropy of P U .

Relaxation to concentration inequalities via empirical distribution The bounded importance weights assumption (i.e., there exists κ ≥ 1 such that 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ holds almost surely on the support Ω U ( Y ∗ ) ) may be too strong for general cases, especially when the exogenous distribution has an infinite support set and Ω U ( Y ∗ ) is also improper. For instance, even for two Gaussian distributions, their density ratio cannot be guaranteed to be bounded ([18], E.g. 4.1).

One remedy to mitigate this strong assumption is to weaken the statement of the theorem from "almost surely" to "with probability at least 1 -δ ." In this way, if δ is small, the conclusion can still hold with high confidence. To reach such a conclusion, we typically need to use concentration inequalities and introduce other weaker assumptions. One of such weaker assumptions we introduce is that for any y ∗ ∈ Ω Y ∗ , the expected value of the square of the importance weights under P U is finite, that is, E u ∼ P U [ p 2 ( u ) /q 2 ( u | y ∗ ) ] < + ∞ . Another assumption is about the boundedness of the importance weights in the empirical distribution ̂ P U ; this is a discrete relaxation of the original boundedness assumption of importance weights in the exogenous distribution, which makes Thm. 1 trivially hold on the empirical distribution.

Corollary 2 (Thm. 1 with Cantelli's Upper Bound) . Assume that for any y ∗ ∈ Y ∗ , the expectation E u ∼ P U [ p 2 ( u ) /q 2 ( u | y ∗ ) ] < + ∞ . Let ν = sup y ∗ ∈Y ∗ E u ∼ P U [ p 2 ( u ) /q 2 ( u | y ∗ ) ] . Denote by ̂ P U the empirical distribution formed by n i.i.d. samples u ( i ) ∼ P U , i = 1 , . . . , n drawn from P U , and assume there exists a constant κ ≥ 1 such that 1 /κ ≤ p ( u ( i ) ) /q ( u ( i ) | y ∗ ) ≤ κ for all i = 1 , . . . , n . Then, with probability at least 1 -δ , the following inequality holds:

where the constant c is the same as in Thm. 1.

Proof. First, consider the empirical distribution ̂ P U formed by n i.i.d. samples u ( i ) ∼ P U . Given the existence of the bound κ for these samples, meaning that the importance weights exist on the support of ̂ P U , it is evident that Thm. 1 holds for ̂ P :

where ̂ V denotes the empirical variance, which is calculated as:

where we treat P ( Y ∗ ) as a constant.

Next, we need to establish the inequality relationship between the empirical variance and the true variance. According to Cantelli's inequality, we have:

Reversing the inequality direction, substituting the random variable X with ̂ E [ X ] = 1 n ∑ n i =1 X i (where each X i is i.i.d.), and letting λ = √ ( 1 δ -1 ) V [ X ] n , we obtain:

Let X i = σ Y ∗ ( u ( i ) ) , and subtract P ( Y ∗ ) from both sides, then we have:

where

Substituting Eq. 68 into this equation, we obtain the result:

where the constant c is the same as in Thm. 1.

The following obtains a tighter bound after introducing the constraint of sub-Gaussian conditions (specifically, assuming that the two-sided Bernstein's condition is satisfied):

Corollary 3 (Thm. 1 with Bernstein's Upper Bound) . Assume that for any y ∗ ∈ Y ∗ , the expectation E u ∼ P U [ p 2 ( u ) /q 2 ( u | y ∗ ) ] < + ∞ . Let ν = sup y ∗ ∈Y ∗ E u ∼ P U [ p 2 ( u ) /q 2 ( u | y ∗ ) ] . Additionally, assume that the variable σ Y ∗ ( u ) satisfies Bernstein's condition, meaning that there exists a parameter b > 0 such that for any λ ∈ ( -1 /b, 1 /b ) , the following inequality holds:

Denote by ̂ P U the empirical distribution formed by n i.i.d. samples u ( i ) ∼ P U , i = 1 , . . . , n drawn from P U , and assume there exists a constant κ ≥ 1 such that 1 /κ ≤ p ( u ( i ) ) /q ( u ( i ) | y ∗ ) ≤ κ for all i = 1 , . . . , n . Then, with probability at least 1 -δ , the following inequality holds:

where the constant c is the same as in Thm. 1.

Proof. When Bernstein's condition is satisfied, the following inequality holds:

The remaining derivation is similar to that in Cor. 2.

It is trivially provable that √ 1 δ -1 ≫ √ 2 log ( 1 δ ) when δ approaches zero. This implies that, for the same δ close to zero, the remainder term in Cor. 3 is typically smaller than that in Cor. 2, meaning that the former provides a much tighter upper bound with a high probability.

For a proposal distribution ,

A guard proposal distribution to ensuring boundedness Q U | y ∗ define the bounded part as Ω [ κ ] U = { u | 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ } . If the probabilities of the unbounded part under the exogenous distribution and the proposal distribution, P U ( Ω U \ Ω [ κ ] U ) = E u ∼ P U [ Ω U \ Ω [ κ ] U ] and Q U | y ∗ ( Ω U \ Ω [ κ ] U ) = E u ∼ Q U | y ∗ [ Ω U \ Ω [ κ ] U ] , are known, we can splice the exogenous distribution over the unbounded part to form a new proposal distribution that ensures the

✶ ✶ bounded importance weight condition:

Proposition 2 (Importance Weight Bound Guard) . For a proposal distribution Q U | y ∗ , construct a new proposal distribution as follows:

which we refer to as the guard of the proposal distribution Q U | y ∗ . Then, for any u ∈ Ω U , there exists a constant

such that 1 /κ ′ ≤ q [ κ ] ( u | y ∗ ) /p ( u ) ≤ κ ′ .

Proof. First, we prove that the constructed proposal distribution is a valid distribution, mainly by showing that it satisfies the normalization condition:

Next, we prove the boundedness: when u ∈ Ω [ κ ] U , according to the definition of Ω [ κ ] U , we have 1 /κ ≤ p ( u ) /q ( u | y ∗ ) ≤ κ . Since κ ′ ≥ κ , it follows that 1 /κ ′ ≤ p ( u ) /q [ κ ] ( u | y ∗ ) ≤ κ ′ . When u / ∈ Ω [ κ ] U , it trivially holds that p ( u ) /q [ κ ] ( u | y ∗ ) = 1 .

In the subsequent experiments, we assume that the probability of the unbounded part could be non-zero but approximates zero. Formally, P U ( Ω [ κ ] U ) ≈ 1 and Q U | y ∗ ( Ω [ κ ] U ) ≈ 1 .This implies that the error terms in Cor. 2 and Cor. 3 would be small enough, or that when using the guard proposal distribution Prop. 2, we could obtain a relatively unbiased estimate without the need for re-weighting (where ( 1 -P U ( Ω U \ Ω [ κ ] U )) / ( 1 -Q U | y ∗ ( Ω U \ Ω [ κ ] U )) ≈ 1 ).

The generalization of Thm. 1 Cor. 1 is generalized from Thm. 1 in a straightforward manner through monotonicity. In particular, the relaxation and guarantees discussed earlier also apply to Cor. 1 when the scope of assumptions extends from a single counterfactual variable Y ∗ to multiple counterfactual variables of different forms, Y ( s ) ∗ , s ∈ S .

Corollary 1 (Expected Variance Upper Bound) . Let Q S denote an arbitrary distribution defined over the state space S of a stochastic counterfactual process, and let P ( s ) Y ∗ denote an arbitrary distribution defined over the σ -algebra Σ ( s ) Y ∗ corresponding to a set of counterfactual variables Y ( s ) ∗ given a state s ∈ S . P Y ∗ is the joint distribution induced by P ( s ) Y ∗ and Q S . If the conditions in Thm. 1 are met for any Y ( s ) ∗ and any s ∈ S , then for any Q U | y ∗ where y ∗ ∈ Y ( s ) ∗ and any s ∈ S :

where the constant c is the same as in Thm. 1.

Proof. For any state s ∈ S , and any Y ( s ) ∗ ∈ Σ ( s ) Y ∗ , according to Thm. 1, if Y ( s ) ∗ satisfies the bounded density ratio condition, we have:

According to the monotonicity of expectation, we take the expectation w.r.t. P ( s ) Y ∗ on both sides, then:

where E u ∼ P U [ log q ( u | Y ( s ) ∗ ( u )) ] is independent of Y ( s ) ∗ , and the constant c is irrelevant to Y ( s ) ∗ .

We then take the expectation w.r.t. P U on both sides of the inequality, producing:

where c is a constant independent of any state s ∈ S .

A.3 Learning and Inference

Learning Cor. 1 provides an upper bound that directly gives an optimization objective:

This is equivalent to learning the conditional distribution Q U | Y ∗ using maximum likelihood. To obtain an estimate of this log-likelihood, we can directly use Monte Carlo methods, which simply involve two sampling processes and one computation: i) sampling state s from the prior state distribution Q S ; ii) sampling u from the exogenous distribution P U ; iii) computing the log density (or probability for discrete exogenous variables) log q ( u | Y ( s ) ∗ ( u )) .

Algorithm 1 Exogenous Matching Learning

Input: Exogenous distribution P U , prior distribution for states Q S , conditional distribution model Q U | Y ∗ with parameters θ y ∗ , minibatch size n and learning rate η .

2: for i ← 1 and i ≤ n do

1: while Eq. 8 not converged do

3: s ∼ Q S , u ∼ P U

5: end for

6: end while

Assuming that we can compute the gradient of q ( u | y ∗ ) w.r.t. the parameters θ y ∗ of Q U | y ∗ , as modeled in the paper, then combining with the minibatch gradient descent algorithm, we can write the complete algorithm for the training process as in Fig. 5.

Inference If for any y ∗ ∈ Y ∗ , the support of the proposal distribution Q U | y ∗ covers the support of P U , then it constitutes a valid proposal, and an unbiased estimate can be obtained using Eq. 4. More can be achieved through multiple importance sampling, as any estimate obtained from the proposal Q U | y ∗ is unbiased for such y ∗ ∈ Y ∗ . Consequently, the expectation over these estimates remains unbiased, i.e.,

which corresponds to the estimator used in Eq. 9 and provides more robust results when an appropriate prior Q Y ∗ is chosen. Our inference

Algorithm 2 Multiple Proposals Inference

Input: Prior distribution Q Y ∗ , conditional proposal distribution Q U | Y ∗ , sample size n . 1: S ←∅ 2: for i ← 1 and i ≤ n do 3: y ( i ) ∗ ∼ Q Y ∗ , u ( i ) ∼ Q U | y ( i ) ∗ 4: σ ( i ) ← ( p ( u ( i ) ) /q ( u ( i ) | y ∗ ) ) ✶ Ω U ( Y ∗ ) ( u ( i ) ) 5: S ← S ∪ { σ ( i ) } 6: end for 7: Output: ̂ P ( Y ∗ ) ← (∑ n i =1 σ ( i ) ) /n

algorithm involves two sampling processes and one computation: i) sampling y ∗ from the prior distribution Q Y ∗ ; ii) sampling u from the proposal distribution Q U | y ∗ ; iii) computing the importance weights and checking if Y ∗ ( u ) ∈ Y ∗ to obtain σ Y ∗ [ y ∗ ] ( u ) . This process is detailed in Fig. 6. In our experiments, because the tasks are density estimation (for continuous) and point probability queries (for discrete), we actually still use a single proposal distribution at y ∗ , which is a special case where Q Y ∗ is a Dirac distribution.

A.4 Markov Boundary

In order to express counterfactuals that span multiple submodels using a single model, the twin SCM concept is often used to articulate counterfactuals for a particular setting within a unified framework.

Definition 3 (Twin SCM) . For an SCM M = ⟨ U , V , F , P U ⟩ and a set of its submodels {M 1[ x 1 ] , M 2[ x 2 ] , . . . , M k [ x k ] } , we refer to M ∗ = ⟨ U , V ∗ , F ∗ , P U ⟩ as a Twin Structural Causal Model (Twin SCM), where V ∗ = ⋃ k i =1 V i [ x i ] and F ∗ = ⋃ k i =1 F i [ x i ] . V i [ x i ] represents the endogenous variables in the i -th submodel, and F i [ x i ] denotes the corresponding causal mechanisms.

In general, the twin SCM amalgamates multiple distinct submodels into one SCM, thereby rendering conclusions drawn on a single SCM applicable to the twin SCM. It is trivial to demonstrate that if the original SCM is recursive, then the twin SCM remains recursive. Consequently, the causal graph derived from the twin SCM is also an ADMG, and the augmented graph is a DAG.

Our proof is based on d-separation [75, 76], which is a criterion for quickly determining conditional independence on a Directed Acyclic Graph (DAG). Suppose a distribution is denoted by P and its corresponding DAG is G . We say that a path p is blocked by a set of nodes Z if and only if: i) p contains a chain A → B → C or a fork A ← B → C and the intermediate node B is in Z ; ii) p contains a collider A → B ← C , and neither the intermediate node B nor its descendants are in Z . If all paths between two sets of nodes X and Y are blocked, then X and Y are said to be d-separated given Z , denoted as X ⊥ ⊥ G Y | Z , implying X ⊥ ⊥ P Y | Z , i.e., X and Y are conditionally independent given Z . In this work, we assume faithfulness, which means that if the conditions for conditional independence are met, then d-separation holds. Combining acyclicity allows for mutual inference between the d-separation and independence.

First, let us restate the definition of the Markov boundary.

Definition 2 (Counterfactual Markov Boundary) . For an exogenous variable U j ∈ U and a set of counterfactual variables Y , along with their joint distribution P . If U j is independent of Y \ X given X under P , i.e. U j ⊥ ⊥ P ( Y \ X ) | X , then X is termed a Markov blanket of U j on Y . The collection of all Markov blankets of U j on Y is denoted as B j ( Y ) . If X ∈ B j ( Y ) is a Markov blanket of U j on Y , and there exists no X ′ ⊊ X such that X ′ ∈ B j ( Y ) , then X is termed a (counterfactual) Markov boundary of U j on Y , denoted as B j ( Y ) .

This definition relies on conditional independence. With the aid of the augmented graph G a and the d-separation based on the twin SCM, it is possible to derive Thm. 2 and Thm. 3 from the properties on the graph.

Theorem 2 (Counterfactual Markov Boundary Independence) . If Y ∗ = ⋃ k i =1 Y i [ x i ] and each Y i [ x i ] corresponds to a different submodel M x i , then for each U j ∈ U , there exists a Markov boundary B j ( Y ∗ ) = ⋃ k i =1 B j ( Y i [ x i ] ) on Y ∗ , where B j ( Y i [ x i ] ) is a Markov boundary on M x i .

Proof. We aim to demonstrate that ⋃ k i =1 B j ( Y i [ x i ] ) forms a Markov boundary for Y ∗ , where B j ( Y i [ x i ] ) denotes the Markov boundary over Y i [ x i ] .

(i) ⋃ k i =1 B j ( Y i [ x i ] ) is a Markov blanket of U j : For any submodel M j , according to the faithfulness assumption, since B j ( Y i [ x i ] ) is a Markov blanket over Y i [ x i ] , it blocks all paths between U j and Y i [ x i ] \ B j ( Y i [ x i ] ) in the augmented graph of the twin SCM. We proceed to prove that, given B j ( Y i [ x i ] ) , it does not alter the blocked paths of B j ( Y i [ x i ] ) . For a blocked path p ∈ P , unblocking can occur only at the intermediate node and its descendants in the colliders. However, the nodes in B j ( Y i [ x i ] ) are not in Y i [ x i ] , thus demonstrating that its blocking status remains unchanged. Therefore, ⋃ k i =1 B j ( Y i [ x i ] ) is a Markov blanket of U j .

(ii) Any proper subset of ⋃ k i =1 B j ( Y i [ x i ] ) is not a Markov blanket of U j : Suppose that a proper subset D ⊂ ⋃ k i =1 B j ( Y i [ x i ] ) is a Markov blanket. Let D j = D ∩ Y i [ x i ] be a subset in some submodel of this Markov blanket. Obviously, since any proper subset of B j ( Y i [ x i ] ) is not a Markov blanket in Y i [ x i ] , D j is not a Markov blanket on Y i [ x i ] . This implies that there exists a subset S j of Y i [ x i ] which is not independent of U j given D j . We now show that S j remains dependent on U j given D . By the faithfulness assumption, as S j is not independent of U j given D j , there still exists an unblocked path from S j to U j in the augmented graph of the twin SCM. Continuing with the condition

Algorithm 3 Finding Counterfactual Markov Boundary

on D \ D j , we discuss all the paths P from S j to U j . For an intermediate node of a collider on a path p ∈ P , since it is unblocked, its descendants must be conditioned, thus continuing to condition on D \ D j does not affect the colliders. For a non-collider on a path p ∈ P , for p to be blocked, there must exist an intermediate node of a non-collider in D \ D j , however, ( D \ D j ) ∩ Y i [ x i ] = ∅ , so this condition cannot be met. Hence, continuing to condition on D \ D j does not affect any unblocked paths. According to d-separation, given D , S j and U j remain dependent. Therefore, D is not a Markov blanket, which contradicts the assumption. This means that no proper subset of ⋃ k i =1 B j ( Y i [ x i ] ) is a Markov blanket of U j .

Theorem 3 (Counterfactual Markov Boundary on Graph) . For an exogenous variable U j ∈ U and a counterfactual variable set Y x from the submodel M x , the counterfactual variable Y x ∈ B j ( Y x ) if and only if Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } , i.e., when given Y x \ { Y x } , Y x and U j are not d-separated on G a x , where G a x is the augmented graph induced from the submodel M x .

Proof. (i) Y x ∈ B j ( Y x ) implies Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } : Assuming Y x ⊥ ⊥ G a x U j | Y x \ { Y x } , according to the faithfulness assumption, all paths between U j and Y x are blocked given Y x \ { Y x } . If a path consists solely of colliders, then, since the intermediate node are given, the path remains unblocked, contradicting the assumption. This implies that on every path, there exists at least one non-collider intermediate node, denoted this set by R . Since each path has at least one non-collider intermediate node, given R , all paths between Y x and U j are blocked. Let R b = R ∩ B j ( Y x ) and R c = R \ R b . For R c , the Markov boundary property holds, blocking all paths between U j and Y x given B j ( Y x ) . Thus, for every path between Y x and U j , it either passes through nodes in R b and is blocked given B j ( Y x ) \ Y x , or it passes through nodes in R c . We need to prove that the paths that pass through R c are also blocked given B j ( Y x ) \ Y x . Taking any R ∈ R c , for any path p between R and U j , if p does not pass through Y x , then p is blocked given B j ( Y x ) \ Y x , which means that any path from Y ∗ passing through R and then through p to reach U j is also blocked by B j ( Y x ) \ Y x . If p passes through Y x , it must pass through another R ′ ∈ R and eventually reach U ′ through a path that does not include Y x , which is also blocked by B j ( Y x ) \ Y x . Therefore, any path involving Y x is blocked by B j ( Y x ) \ Y x , which means that any path from U j to Y x is also blocked. For colliders on ancestors of Y x , not conditioning on Y x adds blocking to the paths, not removing any existing blocks; for Y x being a non-collider, any path involving Y x is blocked by B j ( Y x ) \ Y x , thus remaining blocked even if Y x is not conditioned on. Therefore, Y x does not influence the blocking status of any relevant paths. Consequently, given B j ( Y x ) \ Y x , all the paths between any other nodes in Y x (including Y x ) and U j are blocked. This implies that B j ( Y x ) \ Y x is also a Markov blanket. However, it is a proper subset of B j ( Y x ) , which contradicts B j ( Y x ) being a Markov boundary. Therefore, Y x ∈ B j ( Y x ) implies Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } .

(ii) Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } implies Y x ∈ B j ( Y x ) : It can be proven that the contrapositive holds. If Y x is not in the Markov boundary, then it is independent of U j given the Markov boundary Y x ∈ B j ( Y x ) . Clearly, this conclusion follows directly from the definition of the Markov blanket. Therefore, Y x ̸ ⊥ ⊥ G a x U j | Y x \ { Y x } holds trivially.

Our final algorithm for efficiently computing Markov boundaries is obtained directly from dseparation, Thms. 2 and 3 as shown in Fig. 7. However, a limitation of these theorems is the reliance on the faithfulness assumption, which may not always hold, even in the case of a fully specified SCM, where numerical violations can potentially occur.

B Related Works

B.1 Importance Sampling

To estimate Eq. 2, a straightforward approach is to start from the definition and employ rejection sampling, as implemented in [108]:

P ( Y ∗ ) = ❊ u ∼ P u [ ✶ Ω U ( Y ∗ ) ( u ) ] . (97) This method operates effectively within a countable, finite exogenous space. However, as discussed in the main text, it exhibits low efficiency in general settings due to the infrequency with which the indicator function in the counterfactual probability expression is effective (i.e., non-zero). One solution to this problem is importance sampling, where selection of the proposal distribution is a critical issue. In this section, we discuss related works in detail.

Cross-entropy based importance sampling It is straightforward to prove that when the density of the proposal distribution q ( u ) ∝ p ( u ) | f ( u ) | (where, in the context of counterfactual estimation, f ( u ) is ✶ Ω U ( Y ∗ ) ( u ) ), the corresponding importance sampling estimator possesses the minimum variance. This proposal distribution is known as the optimal proposal distribution, denoted as Q ∗ U . The idea behind a class of methods is to minimize the cross-entropy (or equivalently, the KL divergence) between the conditional proposal distribution Q U and the optimal proposal distribution Q ∗ U . The expression for this in the context of counterfactual estimation is:

H ( q ∗ , q ) = -E u ∼ Q ∗ U [log q ( u )] ∝ -E u ∼ P U [ ✶ Ω U ( Y ∗ ) ( u ) log q ( u ) ] . (98) In the task of sampling rare events, due to the difficulty of directly sampling from P u to obtain effective samples for which f ( u ) is valid, it is common to estimate the cross-entropy by sampling from a proposal distribution Q u . This method, known as importance sampling, is considered adaptive because it continuously adapts based on the samples already drawn from the proposal distribution. For instance, [32] modeled Q U as a Gaussian Mixture Model (GMM) and optimized an equivalent form of cross-entropy to improve sampling efficiency. When applied to counterfactual estimation, the corresponding optimization objective is:

Neural importance sampling In addition to GMM, normalizing flows provide a more expressive capability as density estimators. Therefore, as enumerated in the main text, numerous recent methods have leveraged normalizing flows as proposal distributions for importance sampling. Many of these methods still rely on optimizing cross-entropy (and KL divergence), as introduced earlier. Another optimization method discussed in [68] is based on the χ 2 divergence between the optimal proposal distribution Q ∗ U and the proposal distribution Q U :

It can be seen that the only difference between Eq. 104 and Eq. 5 lies in a constant term. Thus, directly optimizing this equation is equivalent to optimizing the variance itself. Naturally, considering the difficulty of sampling from P U as discussed in the paper, an adaptive approach is employed. This involves sampling from the proposal distribution Q U , with the corresponding optimization objective being:

In [68], the proposal distribution Q U is modeled as NICE [24].

Extension and limitation The above method, without extensions, is only applicable to estimate a single counterfactual probability P ( Y ∗ ) . We extend these methods similarly to our proposed approach by introducing a conditional proposal distribution Q U | Y ∗ , and employing the same estimator as in Eq. 9 during inference as baselines. During the variance optimization phase, by introducing prior distributions Q S and P U and letting y ∗ = Y ( s ) ∗ ( u ′ ) be sampled from stochastic counterfactual processes ( u ′ ∼ P U and s ∼ Q S ), we reformulate the optimization expressions for cross-entropy based importance sampling (CEIS) as:

and neural importance sampling (NIS) as:

An unavoidable drawback of the extended method is the presence of indicator functions in the optimization term. If the initial proposal distribution Q u is similar to P u in performance, the entire optimization process requires a prolonged warm-up period before effective samples start to emerge from the proposal distribution Q u . For example, if the entire space is the unit plane [0 , 1] 2 and Ω U ( δ ( y ∗ )) is a small region { ( x, y ) | x ≤ 0 . 001 , y ≤ 0 . 001 } , then if the chosen initial proposal distribution is uniform, it has only a probability 10 -6 of sampling an effective sample, resulting in a low efficiency for optimizing the loss functions.

where δ ( y ∗ ) denotes a small region around y ∗ . The above optimization objective tasks Q U | y ∗ with sampling from Ω U ( δ ( y ∗ )) , where any Y ∗ can be decomposed into a set of y ( j ) ∗ ∈ Y ∗ , such that Y ∗ = ⋃ ∞ j =1 δ ( y ( j ) ∗ ) , and Ω U ( Y ∗ ) = ⋃ ∞ j =1 Ω U ( δ ( y ( j ) ∗ )) .

In contrast, the optimization term in Exogenous Matching according to Thm. 1 does not include the indicator function, ensuring that every sample is effective during the optimization process, thus significantly enhancing learning efficiency.

B.2 Proxy SCMs

In this section, we provide a detailed description of the construction of the proxy SCMs used in the experiments and their identifiability.

Nerual Causal Model The Neural Causal Model (NCM, [107, 108]) is a recently proposed general approach to mimicking the original SCMs to construct proxy SCMs. For identifiability, its primary assumption is the causal graph of the original SCM. By replacing the causal mechanisms in the original SCM with neural networks that have a strong expressive power, it can effectively proxy the original SCM.

Specifically, an NCM is a 4-tuple ⟨ U , V , ̂ F , ̂ P U ⟩ , which is almost identical to the SCM definition, except that each f V i ∈ ̂ F is a neural network with sufficient expressive power, and ̂ P U is any well-defined distribution over U .

Their method for inducing submodels is the same as for a regular SCM, i.e., replacing causal mechanisms under perfect interventions, which they term neural mutilation. For counterfactual estimation, they use the rejection sampling introduced earlier because the endogenous variables in their experimental scenarios are discrete and finite, making rejection sampling efficient enough to sample effective samples.

Regarding identifiability, this work assumes causal graphs and has been shown to operate effectively when endogenous variables are discrete and finite. Specifically, they construct a class of models called G -constrained NCMs, which have the same causal graph G as the original SCM. Then, they prove that any NCM in the G -constrained NCM family has dual identifiability with the causal graph G , i.e., the NCMs in the G -constrained NCM family (given some observational or interventional distributions) output the same result when answering a Q ∈ L 3 , if and only if the graph algorithms for counterfactual identification output identifiable results given input Q and observational or interventional distributions.

Furthermore, based on this duality, they develop a sound and complete identification algorithm, and since this identification algorithm is based on the learning process of NCMs, it only requires gradient optimization. Certainly, although this work guarantees theoretical results for identifiability in discrete and finite settings [108] as well as partial identifiability in Lipschitz continuous settings [93], further improvements are necessary to apply its estimation methods in broader scenarios.

Causal Normalizing Flow Causal Normalizing Flow (CausalNF, [42]) is a recently summarized method to construct proxies of SCMs based on flow models. For identifiability, it assumes the causal graph or causal ordering of the true SCM, and the true SCM is Markovian and diffeomorphic.

Specifically, a CausalNF is a 4-tuple ⟨ U , V , T -1 , ̂ P U ⟩ , where T = { f V i ( u i ; pa V i ) | V i ∈ V } is a sequence-preserving Autoregressive Normalizing Flow (ANF), and ̂ P U is the base distribution of this flow model.

Their approach to derive submodels differs from conventional SCMs because the modeled CausalNFs have multiple architectures, and substituting causal mechanisms is only applicable in the recursive case. Their solution is to alter exogenous distributions and leverage the Markov assumption to ensure that the density of the intervened exogenous distribution is:

δ denotes the Dirac distribution, where a density only exists when the condition inside its parentheses is satisfied. In practice, the distribution of the intervention is determined by the following steps: i) Sample u from ̂ P U ; ii) Compute v 1 = T -1 ( u ) ; iii) Replace v 1 , resulting in v 2 = { v i | v i ∈ v 1 , v i ̸∈ x } ∪ x ; iv) Compute u 2 = T ( v 2 ) ; v) Replace u 2 , yielding u 3 = { u i | u i ∈ u 2 , v i ̸∈ x } ∪ { u i | u i ∈ u 1 , v i ̸∈ x } ; vi) Compute v x = T -1 ( u 3 ) . Here, step (v) corresponds to replacing relevant parts of the density of the intervened exogenous distribution with the Dirac distribution, as shown in Eq. 108. The last four steps among these six steps are employed for counterfactual reasoning, but this form of counterfactual reasoning is not for generalized cases. Specifically, the counterfactual query corresponding to these four steps is P ( V x | V 1 ) . Although the submodel cannot be directly obtained, the v x obtained from the above steps is indeed the potential response V x ( u ) , so our method is still applicable to this model.

As for identifiability, this work requires numerous assumptions, including Markovianity, diffeomorphism, causal order, and uses results from [106] to assist in proving the identifiability of the learned model up to invertible transformations.

B.3 Arbitrary Conditioning

There is a challenge of modeling an exponentially large number of conditional distributions with a single model. Several existing works have focused on this problem, which is termed arbitrary conditioning. Arbitrary conditioning is an unsupervised learning task that, given a dataset over V , aims to answer any query of the form P ( X | Y = y ) , where Y ⊆ V and y ∈ Ω Y are arbitrary.

The initial step to address the problem of arbitrary conditioning is to encode the condition y into a fixed-length vector. Subsequently, this vector is learned through various modeling methods, and the

training process incorporates various random masks to simulate different forms of Y . Specifically, related works introduce a binary mask b to indicate whether a variable has been observed. In this context, the conditional probability can be expressed as P ( V 1 -b | v b , b ) . Consequently, the learning objective can equivalently be viewed as maximizing the following log-likelihood term:

where P b represents the prior distribution of the random mask, while P V denotes the observational distribution. The model q corresponds to the probabilistic model employed for this task. Specific methods employed in related works are enumerated in the main text, involving a variety of generative models that are suited to different task scenarios. For instance, some methods permit direct training with partially observed data, some can only output samples without density estimation, and others are incapable of performing efficient marginal probability computation.

The similarity between this work and these methods lies in the encoding scheme and the training objectives. For example, the conditional encoding method in this paper also employs binary masks, introducing both the observation mask ω ( X ) and the intervention mask ω ( Y ) . Furthermore, the training objective, as defined in Eq. 8, closely resembles Eq. 109.

The distinction between our work and these methods lies in the available data and the target tasks. The problem of arbitrary conditioning is based on learning from the observed distribution and is typically applied to imputation tasks. In contrast, our conditional distribution modeling can be seen as an extension of arbitrary conditioning, generalizing the observed distribution to counterfactual distributions. This allows the conditions to originate from multiple hypothetical worlds and is applied in counterfactual reasoning.

The work most similar to ours in terms of overall structure and optimization objectives is Posterior Matching [91]. It addresses the problem of arbitrary conditioning by matching the encoder of a given VAE. The optimization formulation is as follows:

where P U | v represents the posterior distribution in a V AE, also referred to as the encoder. By comparing the optimization objective of our method, Eq. 8, with Eq. 110, we observe a notable similarity between the two. We can establish a one-to-one correspondence between the terms in the optimization formulations: the mask b can be analogized to the state s in the stochastic counterfactual process; the decoder of the V AE (mapping from latent variables to observable variables) corresponds to the SCM's potential responses (mapping from exogenous to endogenous variables); the encoder of the VAE (mapping from observable variables to latent variables) corresponds to the abduction process in the SCM (mapping from endogenous to exogenous variables). Consequently, the posterior distribution aligns with the abduction process in the SCM, represented by the product of the indicator function and the exogenous distribution.

An intuitive explanation is that posterior matching attempts to align the conditional distribution with the posterior distribution, whereas our work can be interpreted as attempting to align the conditional distribution with the optimal proposal distribution. The interpretation of the optimal proposal distribution is detailed in App. B.1, where in the counterfactual estimation task, the optimal proposal distribution is proportional to the product of the indicator function and the exogenous distribution.

B.4 Injecting Prior Knowledge

This work involves injecting prior structure into the learning process. Specifically, such methods of injecting prior structure are achieved by directly influencing the internal connectivity of the model.

Related work includes MADE [31], Zuko [81], and StrNN [13]. MADE interprets from the perspective of conditional probability, altering the connectivity between inputs and outputs in autoregressive models by masking, thereby enabling the model to output specific conditional distributions p ( x i | y ) only when there exists connectivity from inputs in y to output x i ; however, this method only respects autoregressive properties. The method in Zuko is primarily used for implementing masked autoregressive normalizing flows, but is not limited to autoregressive dependencies. Based on the interpretation of Jacobian matrices, it alters the connectivity between inputs and outputs in MLPs through masking, ensuring that the Jacobian matrix of MLP outputs is non-zero only when the

mask is one, thus representing the dependency between input and output variables. However, the masking algorithm in Zuko only approximately preserves the maximum number of connections under dependency constraints in variable order. StrNN extensively investigates the issue of variable dependency and connectivity, formalizing it as an integer programming problem, and providing exact and greedy algorithms that outperform the previous two methods in terms of performance.

The tasks typically addressed by the above methods include representing autoregression (autoregressive models), constraining the dependency of Bayesian networks (Bayesian network inference), and constraining the dependency of causal graphs (causal inference). Different from these tasks, this paper applies them to representing the dependency of Markov boundary (Markov boundary feature selection). The masking algorithm adopted in this paper is Zuko, as it can be directly combined with the normalizing flows it implements and used directly in subsequent experiments.

C Experiments

C.1 Metrics

We formally introduce all the metrics used in the subsequent experiments, which aim to reflect the quality of counterfactual estimation:

Effective Sample Proportion (ESP) As mentioned earlier, effective samples here refer to samples that make the indicator function equal to one (i.e., the constraints of potential responses are satisfied). For a specific Y ∗ , we define which reflects the proportion of effective samples sampled in a counterfactual estimation for Y ∗ . In rare event sampling, this metric essentially represents the success rate, indicating the proportion of samples in which the rare event occurs. ESP is about the expectation of this function over a prior distribution P Y ∗ (related to the stochastic counterfactual process):

Specifically, ESP reflects the sampling efficiency when the importance weights are ignored. It focuses on the probability that the sampled u falls within the support Ω U ( Y ∗ ) , for all Y ∗ .

Failure Rate (FR) This work claims that the proposed method holds the potential for counterfactual estimation in any form following a single training session. To verify the reliability of this claim, we introduce the FR metric, which reflects the efficacy of the proposal distribution post a single training across the entire state space of the relevant stochastic counterfactual processes, defined as follows:

where 0 < m ≤ 1 is a constant representing the acceptance threshold. An η ( Y ∗ ) below this threshold is considered a failure. The closer the FR is to zero, the more it indicates that for the vast majority of Y ∗ , there are sufficiently many samples of u falling within the support Ω U ( Y ∗ ) , making the counterfactual estimation considered tractable.

C.2 Design of Stochastic Counterfactual Processes

This paper introduces a stochastic counterfactual process (Def. 1), allowing the proposal distribution after a single training to potentially estimate counterfactual probabilities in multiple or even infinite forms in a tractable manner. This facilitates efficient estimation of a L 3 expression in real-world scenarios (assuming that the L 3 expression can be approximated by a finite set of counterfactual probabilities). Therefore, if the proposal distribution after a single training can tractably estimate these counterfactual probabilities, it implies that estimation of the L 3 expression only requires one training. Specifically, employing stochastic counterfactual processes, this paper conducts stochastic optimization on various forms of counterfactuals and demonstrates its feasibility (Cor. 1). In this section, we elaborate on its specific design in experiments.

Construction of Y B ∗ If Q ∈ L 3 is an arbitrary P ( Y ∗ ) such that Y ∗ ⊆ Ω Y ∗ is ensured, and precisely involves k distinct submodels, then we can design Y B ∗ to answer any such Q . Specifically, the state space of Y B ∗ is S = { s | | s | = k } .

Here, we design the prior distribution Q B s to cover S :

where Bernoulli( ρ 1 ) is a Bernoulli distribution with parameter ρ 1 , meaning it has a probability of ρ 1 to yield 1 ; P X is the endogenous distribution corresponding to X and for any x ∈ Ω X , p ( x ) > 0 .

This distribution, due to the constrained Bernoulli distribution parameters ( 0 < ρ 1 , ρ 2 < 1 ), implies that any X , Y ⊆ V may potentially be sampled; and for intervention values, assuming positivity ( p ( x ( i ) ) > 0 ), any possible intervention value can be sampled. Therefore, for any of these submodels, any counterfactual variable is covered, and hence any variable set is also covered.

In subsequent experiments, we set ρ 1 = 0 . 2 and ρ 2 = 0 . 75 , which are utilized during both the training and testing phases. The rationale behind employing Y B ∗ for experiments lies in the large size of S , which provides more credible evidence to verify whether the conclusion of Cor. 1 satisfies the claim and whether the designs bridge the gap between theory and practice.

Construction of Y Q ∗ To apply our method to real-world tasks, we construct stochastic counterfactual processes Y Q ∗ for several common causal query tasks, where Q ∈ { ATE , ETT , NDE , CtfDE } .

As shown in Tab. 3, the state spaces for these queries are finite or easily sampled, allowing the design of the prior distribution Q Q S to be a simple uniform distribution over these available states. We assume that the endogenous variable space is discrete and finite, which means that we only need to estimate the counterfactual probability for each of them. By computing according to their expressions, we can obtain the estimate for Q .

C.3 Fully-specified SCMs

In this section, we briefly introduce all fully specified SCMs used in our experiments.

Markovian diffeomorphic SCMs These SCMs are sourced from [42] and are primarily used in the experiments for CausalNF, including: CHAIN-LIN-3, CHAIN-NLIN-3, CHAIN-LIN-4, CHAIN-LIN-5, COLLIDER-LIN, FORK-LIN, FORK-NLIN, LARGEBD-NLIN, SIMPSON-NLIN, SIMPSON-SYMPROD, TRIANGLE-LIN, and TRIANGLE-NLIN. Markovianity denotes the absence of hidden confounders in these SCMs, meaning that each exogenous variable is involved in the causal mechanisms of only one endogenous variable. The diffeomorphism is a parametric assumption, positing that the transformations between exogenous and endogenous variables satisfy the properties of a diffeomorphism. For detailed construction of these SCMs, see the Appendix of [42].

Semi-Markovian continuous SCMs These SCMs are described in [107]. We have reformulated their functional forms to adapt them to continuous scenarios. Specifically, this involves replacing their causal mechanisms with combinations of linear and nonlinear functions, all of which originate from the Markovian diffeomorphic SCMs already present above. These SCMs include: BACKDOOR, FRONT-DOOR, M, and NAPKIN. Here, Semi-Markovianity indicates that there may be latent confounders within these SCMs, yet they still satisfy recursiveness. Continuity refers to the assumptions regarding their parameters.

Regional canonical SCMs These SCMs are originated from [108], where all endogenous variables are discrete and finite (binary), with complexity arises from the causal mechanisms being a type of stochastic mapping. These SCMs include: FAIRNESS, FAIRNESS-XW, FAIRNESS-XY, FAIRNESS-YW, where subscripts indicate the presence of hidden confounders between variables. Please refer to the Appendix of [108] for the specific constructions of these SCMs.

C.4 Reproducibility

In this section, we present details pertinent to reproducibility, encompassing the complete architecture of the models utilized, the computational resources employed, and the execution and random seeds of the reported experiments.

Architecture details The entire model architecture involves three components: the sampler, the conditioning model, and the density estimation model.

The sampler is used to sample s from the prior distribution Q S of the stochastic counterfactual process and u from the exogenous distribution P U , then compute the potential outcome Y ( s ) ∗ ( u ) . In our experiments, we selected a batch size of 256 and generated a training set of size 16,384 through the sampler. The validation set is also generated using this sampler. Specifically, we utilize the same sampler to construct P Y ∗ , from which random y ∗ is sampled. For discrete distributions, counterfactual events are assigned as Y ∗ ∈ { y ∗ } , and for continuous distributions, counterfactual events are assigned as Y ∗ ∈ δ l ( y ∗ ) , where δ l ( y ∗ ) is a cube centered at y ∗ with side length l .

Abrief overview of the conditioning model is shown in Fig. 2, where both g and h are neural networks. When masking with Markov boundaries, h is a neural network that allows dynamic influence on internal connectivity, as depicted in App. B.4. On the other hand, g is a permutation-invariant neural network used to aggregate hidden encodings from multiple different submodels. We conduct ablation studies related to the construction of these two neural networks in App. C.8.

For the density estimation model, we chose normalizing flows and GMM. Specific models for normalizing flows include MAF [73], NSF [26], NCSF [80], NICE [24], NAF [39], and SOSPF [41]. The implementations of these models are based on the Zuko library [81], with some internal implementation details modified to fit our work. Regarding the hyperparameters of these models, the number of components in GMM is fixed at 10 , the number of transformations for all flow models is set to 5 , and all the neural networks involved contain 2 hidden layers with 64 neurons each (in some experiments, 256 neurons were used, which will be specifically indicated and discussed in subsequent sections).

Hardware Each experiment was conducted on GPUs, and the primary computational overhead arising from the sampling process. All models, including the pre-trained SCM agents, were trained and tested on an NVIDIA RTX 4090 and Intel(R) Xeon(R) Gold 6430 platform. The training time for EXOM is primarily influenced by the number of variables in the SCM, the number of submodels, and the chosen density estimation model. For example, in the case of SIMPSON-NLIN with | s | = 5 , one epoch (16,384 samples, batch size of 256) including the time for the sampler to prepare data takes approximately 8 seconds. In all EXOM experimental setups, we fixed the training to 200 epochs. All experiments, including the unreported ones, consumed approximately 1000 GPU hours in total.

Execution To reflect the error, each type of experiment was conducted five times with different random seeds, and the range of errors exhibited is reflected in the experimental results. During training, EXOM does not require sampling and is trained for a fixed 200 epochs. The sampling size for CEIS is set to 10 5 and trained for 200 epochs, whereas NIS has a sampling size of 10 4 and is trained for 50 epochs (we found that its training speed is excessively slow due to the time-consuming nature of sampling from the flow model). During validation and testing, the validation set queries 1024 counterfactual probabilities from the sampler, with sampling sizes for EXOM, CEIS, and NIS set to 10 3 , and RS set to 10 6 . For all EXOM, CEIS, and NIS training, we used AdamW [62] with an initial learning rate of 0 . 001 as the optimizer and ReduceOnPlateau with a patience of 5 and a factor of 0.5 as the learning rate scheduler. To improve training robustness, the conditional inputs y ∗ and both the input and the output exogenous samples u were standardized. During inference, the probability densities and importance weights were processed in logarithmic form, with the terms where the indicator function is zero replaced by -inf , and the log-sum-exp technique was used to estimate the probabilities.

C.5 Convergence

Here, we present additional results on convergence experiments. Our experiments span across combinations of 4 different types of SCMs (SIMPSON-NLIN, LARGEBD-NLIN, FAIRNESS-XW, NAPKIN) and 4 different density estimation models (GMM, MAF, NICE, SOSPF). All models were trained and validated based on the stochastic counterfactual process Y B ∗ , which provides a sufficiently large state space to increase difficulty, where | s | = 3 .

As shown in Fig. 8, for all combinations, as LL (log-likelihood, which is the negative form of the training objective Eq. 8, minimizing Eq. 8 is equivalent to maximizing LL) increases, ESP improves. In particular, there is a clear inflection point in the experiments with three continuous SCMs, after which the ESP rapidly improves until it stops increasing because of the convergence of LL. This series of experiments indicates that we can indeed optimize the upper bound (indirectly equivalent to LL) to optimize the variance (as discussed in App. C.1, ESP and variance are strongly related). Thus, empirically, these experiments support the correctness of Thm. 1, and also empirically indicate that our design potentially satisfies the bounded importance weight condition discussed in App. A.2.

Fig. 9 reflects the relationship between LL and FR. It is observed that for all combinations, as LL increases, FR decreases (with one exception in the SOSPF and LARGEBD-NLIN combination) until it stops increasing due to LL convergence. This phenomenon empirically supports the conclusion in

One Run

Initial State

Final State

0

10

0

.

00

0

.

01

0

.

02

0

10

20

0

.

0

0

.

2

0

.

4

0

.

6

0

10

20

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

-

10

0

10

20

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

0

20

0

.

00

0

.

05

0

.

10

0

20

40

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

20

40

0

.

0

0

.

2

0

.

4

0

.

6

0

20

40

0

.

0

0

.

2

0

.

4

0

.

6

-

1

0

1

0

.

05

0

.

10

0

.

15

0

.

20

0

.

25

-

1

0

1

2

0

.

05

0

.

10

0

.

15

0

.

20

0

.

25

-

1

0

1

2

0

.

1

0

.

2

0

.

3

-

5

.

0

-

2

.

5

0

.

0

2

.

5

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

-

5

0

5

0

.

0000

0

.

0025

0

.

0050

0

.

0075

0

.

0100

0

10

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

10

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

-

10

0

10

0

.

0

0

.

2

0

.

4

0

.

6

ESP

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. NAPKIN

One Run

Initial State

Final State

0

10

0

.

4

0

.

6

0

.

8

1

.

0

0

10

20

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

10

20

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

-

10

0

10

20

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

20

0

.

4

0

.

6

0

.

8

1

.

0

0

20

40

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

20

40

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

20

40

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

-

1

0

1

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

-

1

0

1

2

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

-

1

0

1

2

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

-

5

.

0

-

2

.

5

0

.

0

2

.

5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

-

5

0

5

0

.

5

0

.

6

0

.

7

0

.

8

0

.

9

1

.

0

0

10

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

10

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

-

10

0

10

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

FR

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. NAPKIN

Cor. 1, and manifests the claim of simultaneously optimizing the variance of counterfactual estimators across the entire state space.

C.6 Comparison

We provide more comprehensive and detailed information regarding the comparison experiment in the main text. These comparisons are conducted on three different types of SCMs (SIMPSON-NLIN, NAPKIN, FAIRNESS-XW). EXOM employs two density estimation models (MAF, GMM), while NIS utilizes NICE, and CEIS uses GMM. All models are trained and validated based on a stochastic counterfactual process Y B ∗ , where | s | = 1 , 3 , 5 .

As illustrated in Tab. 1, overall, our proposed method, EXOM, outperforms other importance sampling methods, while CEIS and NIS show comparable performance in the aforementioned experiments. The advantage of EXOM is particularly pronounced when dealing with multiple distinct submodels, significantly surpassing the other methods. All three importance sampling methods outperform RS, demonstrating that variance optimization indeed enhances estimation efficiency.

C.7 Combinaitons of SCMs and Density Estimation Models

In this section, we detail the performance of EXOM when using various density estimation models (GMM, MAF, NSF, NCSF, NICE, NAF and SOSPF) in different SCMs enumerated in App. C.3. These experiments are based on Y B ∗ , with | s | = 3 .

In Figs. 10a and 11a, deeper colors indicate a higher number of effective samples, which implies greater sampling efficiency. For density estimation models, it is evident that MAF and NSF generally perform well, while other density estimation models are suitable for specific scenarios. Regarding SCM, we observe that FORK-LIN and TRIANGLE-NLIN perform worse than other SCMs, whereas some SCMs such as CHAIN-LIN-5, LARGEBD-NLIN, and NAPKIN show compatibility only with certain density estimation models. The performance improved significantly after increasing the hidden layer width from 64 to 256.

In Figs. 10b and 11b, lighter colors indicate fewer failure cases, meaning that the method works effectively within the state space Y Q ∗ . It can be noted that for any of the aforementioned SCMs, there is always a density estimation model that matches and keeps the FR at a low level. Furthermore, compared with Figs. 10a and 11a, there is a strong negative correlation between FR and ESP, consistent with the theoretical results. In regions where FR is particularly high, in addition to the poor performance of GMM due to its limited expressive capacity, there are some notable aspects. For example, FORK-NLIN and TRIANGLE-NLIN are the most challenging settings to learn. Furthermore, as the diameter of the SCM increases, the performance of EXOM gradually decreases, which is reflected in the performance under the CHAIN-LINN series settings. Finally, comparing Figs. 10b and 11b, some models with high parameter number requirements (such as NSF, NCSF, NAP, SOSPF) show significant improvements when the width of the hidden layers is increased.

GMM

MAF

NSF

NCSF

NICE

NAF

SOSPF

CHAIN-LIN-3

CHAIN-NLIN-3

CHAIN-LIN-4

CHAIN-LIN-5

COLLIDER-LIN

FORK-LIN

FORK-NLIN

LARGEBD-NLIN

SIMPSON-NLIN

SIMPSON-SYMPROD

TRIANGLE-LIN

TRIANGLE-NLIN

BACK-DOOR

FRONT-DOOR

M

NAPKIN

FAIRNESS

FAIRNESS-XW

FAIRNESS-XY

FAIRNESS-YW

0.00

0.69

0.65

0.38

0.53

0.61

0.68

0.18

0.80

0.79

0.64

0.76

0.69

0.77

0.09

0.71

0.13

0.07

0.57

0.56

0.68

0.00

0.48

0.00

0.00

0.37

0.03

0.03

0.53

0.87

0.87

0.81

0.87

0.87

0.87

0.17

0.79

0.14

0.07

0.77

0.76

0.79

0.00

0.17

0.02

0.01

0.15

0.11

0.17

0.04

0.51

0.00

0.00

0.49

0.00

0.00

0.02

0.61

0.21

0.20

0.69

0.70

0.71

0.00

0.63

0.29

0.26

0.61

0.54

0.64

0.00

0.58

0.59

0.36

0.34

0.57

0.61

0.00

0.11

0.14

0.05

0.08

0.09

0.10

0.03

0.60

0.74

0.68

0.56

0.66

0.75

0.02

0.71

0.36

0.26

0.67

0.66

0.71

0.01

0.49

0.33

0.18

0.32

0.30

0.42

0.01

0.40

0.13

0.02

0.27

0.09

0.10

0.36

0.23

0.60

0.58

0.35

0.55

0.52

0.25

0.26

0.29

0.28

0.26

0.24

0.25

0.26

0.25

0.41

0.41

0.24

0.31

0.30

0.18

0.17

0.29

0.29

0.17

0.21

0.21

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

(a) ESP

GMM

MAF

NSF

NCSF

NICE

NAF

SOSPF

CHAIN-LIN-3

CHAIN-NLIN-3

CHAIN-LIN-4

CHAIN-LIN-5

COLLIDER-LIN

FORK-LIN

FORK-NLIN

LARGEBD-NLIN

SIMPSON-NLIN

SIMPSON-SYMPROD

TRIANGLE-LIN

TRIANGLE-NLIN

BACK-DOOR

FRONT-DOOR

M

NAPKIN

FAIRNESS

FAIRNESS-XW

FAIRNESS-XY

FAIRNESS-YW

0.98

0.06

0.07

0.10

0.06

0.08

0.07

0.27

0.05

0.04

0.07

0.04

0.04

0.05

0.80

0.13

0.52

0.59

0.12

0.12

0.12

0.99

0.21

0.99

0.99

0.21

0.66

0.70

0.16

0.02

0.02

0.03

0.02

0.02

0.02

0.43

0.05

0.20

0.30

0.06

0.06

0.04

0.98

0.23

0.87

0.93

0.22

0.22

0.21

0.61

0.12

1.00

1.00

0.13

1.00

1.00

0.50

0.07

0.23

0.24

0.07

0.05

0.06

0.86

0.10

0.20

0.27

0.10

0.10

0.09

0.93

0.11

0.10

0.13

0.31

0.09

0.09

0.98

0.44

0.46

0.54

0.52

0.44

0.44

0.36

0.05

0.04

0.07

0.07

0.05

0.04

0.40

0.03

0.11

0.17

0.04

0.03

0.03

0.42

0.06

0.07

0.10

0.10

0.05

0.07

0.61

0.18

0.46

0.67

0.28

0.44

0.41

0.02

0.04

0.02

0.02

0.02

0.01

0.00

0.06

0.04

0.04

0.04

0.05

0.05

0.06

0.03

0.03

0.04

0.04

0.03

0.05

0.05

0.04

0.04

0.03

0.03

0.03

0.06

0.09

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

(b) FR

GMM

MAF

NSF

NCSF

NICE

NAF

SOSPF

CHAIN-LIN-3

CHAIN-NLIN-3

CHAIN-LIN-4

CHAIN-LIN-5

COLLIDER-LIN

FORK-LIN

FORK-NLIN

LARGEBD-NLIN

SIMPSON-NLIN

SIMPSON-SYMPROD

TRIANGLE-LIN

TRIANGLE-NLIN

BACK-DOOR

FRONT-DOOR

M

NAPKIN

FAIRNESS

FAIRNESS-XW

FAIRNESS-XY

FAIRNESS-YW

0.20

0.79

0.80

0.69

0.51

0.80

0.78

0.46

0.87

0.91

0.84

0.86

0.90

0.89

0.41

0.71

0.74

0.59

0.53

0.72

0.71

0.00

0.53

0.54

0.38

0.25

0.52

0.57

0.68

0.95

0.96

0.90

0.75

0.95

0.95

0.49

0.84

0.85

0.76

0.77

0.85

0.84

0.02

0.36

0.37

0.25

0.28

0.28

0.40

0.02

0.64

0.73

0.55

0.56

0.68

0.64

0.13

0.81

0.83

0.78

0.77

0.81

0.84

0.09

0.78

0.80

0.67

0.75

0.78

0.80

0.22

0.75

0.78

0.69

0.28

0.75

0.77

0.01

0.24

0.34

0.21

0.13

0.28

0.29

0.13

0.79

0.89

0.83

0.75

0.84

0.88

0.28

0.81

0.84

0.73

0.78

0.81

0.83

0.04

0.64

0.63

0.49

0.48

0.51

0.63

0.02

0.54

0.59

0.40

0.43

0.47

0.53

0.44

0.26

0.78

0.80

0.37

0.56

0.57

0.31

0.31

0.59

0.59

0.30

0.38

0.40

0.27

0.29

0.58

0.60

0.27

0.39

0.41

0.22

0.21

0.53

0.53

0.20

0.35

0.35

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

(a) ESP

GMM

MAF

NSF

NCSF

NICE

NAF

SOSPF

CHAIN-LIN-3

CHAIN-NLIN-3

CHAIN-LIN-4

CHAIN-LIN-5

COLLIDER-LIN

FORK-LIN

FORK-NLIN

LARGEBD-NLIN

SIMPSON-NLIN

SIMPSON-SYMPROD

TRIANGLE-LIN

TRIANGLE-NLIN

BACK-DOOR

FRONT-DOOR

M

NAPKIN

FAIRNESS

FAIRNESS-XW

FAIRNESS-XY

FAIRNESS-YW

0.62

0.04

0.03

0.06

0.08

0.03

0.04

0.10

0.02

0.01

0.03

0.03

0.01

0.02

0.30

0.07

0.04

0.12

0.11

0.04

0.07

0.98

0.14

0.13

0.21

0.49

0.12

0.12

0.05

0.00

0.00

0.01

0.03

0.00

0.00

0.17

0.03

0.02

0.05

0.05

0.03

0.03

0.65

0.13

0.11

0.16

0.18

0.12

0.12

0.74

0.05

0.02

0.07

0.09

0.04

0.05

0.26

0.02

0.02

0.04

0.04

0.02

0.02

0.41

0.04

0.03

0.06

0.06

0.03

0.03

0.57

0.05

0.03

0.07

0.36

0.04

0.04

0.82

0.19

0.14

0.29

0.53

0.16

0.15

0.12

0.02

0.01

0.02

0.04

0.01

0.01

0.20

0.01

0.00

0.02

0.01

0.00

0.00

0.19

0.03

0.01

0.03

0.03

0.01

0.02

0.52

0.10

0.05

0.14

0.17

0.08

0.10

0.01

0.03

0.00

0.00

0.02

0.01

0.00

0.03

0.03

0.00

0.00

0.04

0.01

0.00

0.02

0.02

0.00

0.00

0.02

0.00

0.00

0.02

0.03

0.00

0.00

0.03

0.00

0.00

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

(b) FR

The impact of hidden layer width on performance Experiments show that increasing the width of hidden layers significantly enhances performance. This improvement is not only due to the increased expressive power of the neural network itself but also because the experiments mentioned above utilize the Markov boundary masking trick. According to the description in App. B.4, we directly inject the Markov boundary masking into the weight matrix, masking certain weights (i.e., specific neurons are always inactive for specific tasks). This implies that when the graph structure of SCM is sparse, the Markov boundary is typically smaller, which leads to a substantial increase in the number of masked weights, thereby significantly reducing the neural network's expressive power. Therefore, increasing the width of hidden layers helps mitigate the degradation in expressive power caused by injecting the Markov boundary.

In practice, the recommended width is closely related to the number of parameters required by the conditional distribution models. For instance, models such as MAF, NICE, and GMM require fewer

parameters, so setting the hidden layer width to 64 is sufficient. In contrast, models like NSF, NCSF, NAF, and SOSPF, which require a larger number of parameters, will need a wider hidden layer 256 is recommended - since, with a smaller Markov boundary, each parameter connection's hidden neurons are insufficient. Optimal width configuration should be fine-tuned according to the settings.

C.8 Ablation

Our ablation experiments were conducted on the architecture of the two neural networks g and h in the conditioning model.

Markov boundary masking Let us first introduce how the mechanism of Markov boundaries operates on specific density estimation models. Firstly, we calculate the Markov boundary corresponding to each U i according to Theorem 3, and generate masks m i using the method described later. The subsequent processing is then model-specific.

For GMM , h primarily outputs each component's mean, diagonal matrix, and anti-diagonal matrix. Here, we apply the mask m i only to the mean corresponding to the i -th exogenous variable in each component, ensuring that if the counterfactual variable is not on the Markov boundary, the inference of the mean is independent of it.

For Coupling models (including NICE), each layer transformation involves only a subset of hidden encodings from the previous layer; hence, each layer's output only corresponds to some U i . Thus, we create masks only for the U i that serve as the output for each layer transformation, ensuring that the inferred hidden encodings are only relevant to the counterfactual variables in the Markov boundary.

For Autoregressive models (including MAF, NSF, NCSF, UNF, and SOSPF), each layer transformation follows an autoregressive sequence, where all previous layers' hidden encodings may influence the subsequent layer. Consequently, each U i 's hidden encoding appears in each layer. Therefore, we only need to directly apply the mask to the inference of hidden encodings, ensuring that the inferred next layer hidden encodings are only relevant to the counterfactual variables when they are in the Markov boundary.

Of course, the above initial design will raise some issues in practice:

There are some inevitable discrepancies between theory and practice , which we have summarized in App. D.3.

As discussed in App. C.7, the introduction of the Markov boundary theoretically increases the model's focus on specific variables. However, this comes at the cost of expressiveness , especially in models with a larger number of parameters. Therefore, in the ablation experiments, we use a hidden layer width of 256 for NICE and SOSPF, while for GMM and MAF, the hidden layer width is set to 64. This does not affect the fairness of the ablation, as the goal is to compare the performance difference with and without the Markov boundary. Under the same hidden layer width, the presence of a Markov boundary actually means fewer neurons are involved in reasoning.

Another issue worth discussing is how to handle the counterfactual Markov boundaries in submodels . In perfect interventions, all connections between intervened variables and their parent variables are cut (All Cut), which is also a way to represent causal graphs in submodels. However, theoretically, directly cutting connections would result in intervened variables never participating in the conditional reasoning of their parent exogenous variables. Hence, we have also devised two relaxed and compromised methods: one is to retain all connections (No Cut), pretending that the submodel has not been intervened upon, thus not reflecting the intervention through the mask of the Markov boundary but instead relying on the intervention information included in the conditional encoding; the second is to only retain connections with parent exogenous variables (Endo. Cut), while relationships between endogenous variables are still cut.

Fig. 12 and Fig. 13 respectively illustrate the effects of Markov boundary masks on ESP and FR under different SCMs and density estimation models, where error bars and outliers are computed based on the quartile algorithm. The first phenomenon that can be observed is that introducing Markov boundary masks in Markovian SCMs (SIMPSON-NLIN, LARGEBD-NLIN, TRIANGLENLIN) results in significant performance improvement compared to not introducing them. There is one exception, namely LARGEBD-NLIN and SIMPSON-NLIN, which will be discussed in App. D.3. When applied to semi-Markovian SCMs (M, NAPKIN), the scenario changes, with the improvements becoming less pronounced and the effects post-application not being very stable. Across all intervention designs (All Cut, No Cut, Endo. Cut), these methods perform similarly

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

05

0

.

10

0

.

15

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

3

0

.

4

0

.

5

0

.

6

0

.

7

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

4

0

.

6

0

.

8

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

75

0

.

80

0

.

85

0

.

90

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

1

0

.

2

0

.

3

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

5

0

.

6

0

.

7

0

.

8

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

02

0

.

04

0

.

06

0

.

08

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

05

0

.

10

0

.

15

0

.

20

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

1

0

.

2

0

.

3

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

1

0

.

2

0

.

3

0

.

4

0

.

02

0

.

04

0

.

06

0

.

08

0

.

35

0

.

40

0

.

45

0

.

50

0

.

55

0

.

60

0

.

65

0

.

40

0

.

45

0

.

50

0

.

55

0

.

60

0

.

50

0

.

55

0

.

60

0

.

65

0

.

70

0

.

75

0

.

00

0

.

02

0

.

04

0

.

06

0

.

08

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

6

0

.

0

0

.

2

0

.

4

0

.

6

ESP

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. TRIANGLE-NLIN

d. M

e. NAPKIN

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

000

0

.

025

0

.

050

0

.

075

0

.

100

0

.

125

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

02

0

.

04

0

.

06

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

01

0

.

02

0

.

03

0

.

04

0

.

05

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

05

0

.

10

0

.

15

0

.

20

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

000

0

.

025

0

.

050

0

.

075

0

.

100

0

.

125

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

8

0

.

9

1

.

0

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

3

0

.

4

0

.

5

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 1

|

s

|

= 3

|

s

|

= 5

0

.

1

0

.

2

0

.

3

0

.

4

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

6

0

.

7

0

.

00

0

.

02

0

.

04

0

.

06

0

.

08

0

.

00

0

.

01

0

.

02

0

.

03

0

.

04

0

.

05

0

.

00

0

.

01

0

.

02

0

.

03

0

.

04

0

.

05

0

.

4

0

.

6

0

.

8

1

.

0

0

.

05

0

.

10

0

.

15

0

.

20

0

.

25

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

FR

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. TRIANGLE-NLIN

d. M

e. NAPKIN

without a clear outperforming approach. However, we find that when the All Cut method performs weaker than that without Markov boundary masks, the latter two serve as compromises and indeed provide better results than All Cut. Given these observations, Endo. Cut was chosen in our previous experiments.

Aggregation function The next problem to address is the choice of g . We have posited the use of permutation-invariant functions in this paper because of the permutation invariance of sets. Empirical evidence in our experiments supports this assertion.

We compare 4 different choices of g : i) Concatenation: directly concatenate different encodings into a fixed-length vector, with zero-padding in empty positions. This is not a permutation-invariant function and is therefore included as a limiting case for comparison. ii) Summation: the simplest permutation-invariant method, which directly sums all encodings. iii) Weighted Summation: an extension of Summation that provides additional expressive power. Specifically, encodings are first mapped through a network w to obtain element-wise weights (via softmax), which are then multiplied by the encodings themselves to yield the result. iv) Attention: offering stronger expressive

Concatenation

Summation

Weighted Summation

Attention

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

01

0

.

02

0

.

03

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

05

0

.

10

0

.

15

0

.

20

0

.

25

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

5

1

.

0

1

.

5

2

.

0

×

10

-

5

|

s

|

= 3

|

s

|

= 5

0

.

000

0

.

001

0

.

002

0

.

003

0

.

004

0

.

005

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

05

0

.

10

0

.

15

|

s

|

= 3

|

s

|

= 5

0

.

000

0

.

025

0

.

050

0

.

075

0

.

100

0

.

125

|

s

|

= 3

|

s

|

= 5

0

.

00

0

.

05

0

.

10

0

.

15

0

.

00

0

.

01

0

.

02

0

.

03

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

6

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

000

0

.

005

0

.

010

0

.

015

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

00

0

.

05

0

.

10

0

.

15

0

.

20

ESP

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. TRIANGLE-NLIN

d. M

e. NAPKIN

Concatenation

Summation

Weighted Summation

Attention

|

s

|

= 3

|

s

|

= 5

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

|

s

|

= 3

|

s

|

= 5

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

|

s

|

= 3

|

s

|

= 5

0

.

9990

0

.

9992

0

.

9994

0

.

9996

0

.

9998

1

.

0000

|

s

|

= 3

|

s

|

= 5

0

.

98

0

.

99

1

.

00

|

s

|

= 3

|

s

|

= 5

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 3

|

s

|

= 5

0

.

4

0

.

6

0

.

8

1

.

0

|

s

|

= 3

|

s

|

= 5

0

.

4

0

.

6

0

.

8

1

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

0

.

0

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

1

0

.

2

0

.

3

0

.

4

0

.

5

0

.

6

0

.

7

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

0

.

4

0

.

5

0

.

6

0

.

7

0

.

8

0

.

9

1

.

0

0

.

2

0

.

4

0

.

6

0

.

8

0

.

2

0

.

4

0

.

6

0

.

8

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

FR

GMM

MAF

NICE

SOSPF

GMM

MAF

NICE

SOSPF

c. TRIANGLE-NLIN

d. M

e. NAPKIN

power, Attention differs from Weighted Summation in that it uses encodings before input h rather than after output h , and a new network a maps them to attention weights. Attention encoding is calculated through queries and keys softmax( h ( x ) a ⊤ ( g ( x ))) , where we set the values in the attention mechanism to be constantly 1 .

We no longer explore aggregation methods with stronger expressive power, as we found in our experiments that they are likely to converge prematurely to local optima. This causes the variance in the state space to increase as the optimization process progresses, which in turn prevents Eq. 8 from being uniformly applied across the entire state space.

Fig. 14 and Fig. 15 respectively illustrate the impact of g selection on ESP and FR under different SCM and density estimation models. Overall, permutation-invariant methods (Summation, Weighted Summation, Attention) consistently outperform permutation-variant methods (Concatenation), aligning with theoretical expectations and intuition. Among all methods, Attention consistently outperforms others, thus serving as the choice for all preceding experiments.

C.9 Counterfactual Estimation on Proxy SCMs

We combine identifiable proxy SCM with Exogenous Matching for counterfactual estimation. Specifically, we employ two distinct proxy SCM methods tailored for these scenarios to conduct counterfactual estimation on two types of SCMs.

Counterfactual estimation with CausalNF We conduct experiments on 3 different Markovian diffeomorphic SCMs. According to the previous arguments, CausalNF belongs to M IM( P V , O ) , indicating that they are L 3 -identifiable. In our experiments, we mainly measure the error in counterfactual probability queries P ( δ l ( y ∗ )) , comparing the SCM represented by CausalNF to the original SCM in 1024 different queries. These results are reflected in Tab. 4, with averages presented. For the original SCM, we train EXOM five times and calculate the error bound for the same query. For CausalNF, we first train 5 proxy SCMs using observational data, then train EXOM 5 times for each model, calculate the error bound for the same queries, and finally take the average error bound across proxy SCMs.

Since in the continuous case it is challenging for RS to sample instances that satisfy the counterfactual event δ ( y ∗ ) , obtaining ground truth in experiments becomes difficult. Therefore, we primarily use FR as the main evaluation metric, while the error bound is employed to reflect the bias. When measuring error bounds, it is imperative to regularize the dimensionality of the counterfactual variables. Failure to do so may result in significant discrepancies in the final outcomes (estimates in high-dimensional scenarios tend to be considerably lower than those in low-dimensional ones, leading to a severe underestimation of errors in high-dimensional cases). Therefore, we calculate the error bounds as follows:

where ˆ P 1 |Y∗| i ( Y ∗ ) represents the estimate of P ( Y ∗ ) in the i -th experiment, regularized by the exponent 1 |Y ∗ | , which denotes the expectation in a single dimension assuming independence across dimensions. The term std refers to the standard deviation. t = 5 is the number of trials.

The results in Tab. 4 indicate that EXOM exhibits a relatively small error, comparable to that of RS. Furthermore, when EXOM is applied to the proxy SCM, it yields an even smaller error (in part because all failure cases are excluded from consideration).

Counterfactual estimation with NCM We conducted experiments on 4 Regional canonical SCMs. According to their proof, NCM exhibits duality with respect to the identifiability of the counterfactual query Q and the graphical causal identifiability. In our experiments, we focus primarily on the unbiasedness of EXOM combined with NCM. The results are shown in Tabs 5 and 6.

As RS is straightforward to sample in the discrete case, the ground truth can be computed. We used RS with 10 6 samples as ground truth (in the experiment, we compared against RS with 10 3 samples) and then computed the average bias. Additionally, since these queries only involve a single dimension (regarding solely to Y ), there is no need for dimensional regularization of the error bound.

In estimating these causal queries, EXOM yielded relatively small errors and showed even smaller errors when applied to proxy SCMs. This indicates that integration of EXOM with proxy SCMs

is practical to address real-world problems. In particular, the errors in ETT and CtfDE within the original SCM were substantially higher than those in RS, primarily because their expressions include the denominator P ( X ) , and inaccuracies in P ( X ) markedly influence their results. This matter will be summarized in App. D.3.

D Discussions

D.1 Broader Impacts

Our work aims to enhance the efficiency of counterfactual reasoning and make it applicable to theoretically broader contexts. On the positive side, current counterfactual reasoning has a positive impact on society in terms of counterfactual fairness and counterfactual decision making. However, on the flip side, if assumptions and premises are not applicable to real-world situations, counterfactual reasoning can still lead to potential biases, inequalities, and misuse. Therefore, careful consideration of the correctness of the assumptions and the appropriateness of usage scenarios is required before applying counterfactual reasoning.

D.2 Counterfactual Density

For continuous distributions, it is the density function rather than the probability measure that garners widespread attention and study within the relevant field. According to the definition of probability density, we can find its connection with the Lebesgue differentiation theorem, which directly provides a method for density estimation:

Theorem 4 (Counterfactual Density Estimation) . Assuming the counterfactual variables Y ∗ are absolutely continuous on ⟨ Ω Y ∗ , Σ Y ∗ , P Y ∗ ⟩ , with a probability density existing at y ∗ ∈ Ω Y ∗ . Let δ ( y ∗ ) be a function that maps y ∗ to a cube (or ball) centered at y ∗ , and δ ( y ∗ ) → y ∗ denotes the cube's side length (or the ball's diameter) tending to 0 , then the following equation holds:

where | δ ( y ∗ ) | is the volume (i.e., the Lebesgue measure) of δ ( y ∗ ) .

Proof. Directly inferred from the definition of the probability density function (Radon-Nikodym derivative) and the Lebesgue differentiation theorem.

This method is analogous to kernel density estimation (with the Parzen window as a cube). However, the precision of the estimates provided by this method is highly dependent on | δ ( y ∗ ) | , further highlighting the difficulty of satisfying the indicator function in the counterfactual probability measure. We indirectly investigated the performance of EXOM on this issue in our related experiments on continuous counterfactual estimation, where we chose Y ∗ ∈ δ l ( y ∗ ) as the counterfactual event for the estimation. The results of the related experiments confirmed the potential of EXOM in addressing this problem.

Of course, kernel-based density estimation has many limitations. We hope that Thm. 4 will serve as a lemma for future work, leading to the derivation of more suitable density estimation methods for continuous counterfactual distributions.

D.3 Limitations

Dependency on counterfactual generation . In practical tasks, we typically only have access to observational or experimental data. In some settings, we also assume the acquisition of causal graphs or causal orderings through causal discovery and prior knowledge. However, the proposed method is not directly applicable to such real-world settings, as indicated by the assumption in Sec. 3, which requires the ability for counterfactual generation. In practical scenarios, one approach is to pre-train a neural proxy SCM to perform the counterfactual generation task.

Faithfulness . For injection of the Markov boundary, we also introduce the faithfulness assumption, which assists us in proving theorems and providing fast algorithms. However, this assumption might be violated, leading to more variables being included in the actual Markov blanket than our calculations predict. Additionally, modifications to autoregressive and coupling models do not fully align with the ideal effect. In fact, due to potential interactions within the hidden encodings of autoregressive and coupling models, even if each layer adheres to the Markov boundary dependencies, the aggregation of multiple layers may violate these dependencies.

Boundedness condition on importance weights . In the context of learning and optimization, we introduce additional designs: the bounded importance weight condition. We assumed conditional distribution model to satisfy the boundedness of importance weight as much as possible. However, in practical applications, this depends on the specific forms of the exogenous distribution and the conditional distribution model, necessitating case-by-case analysis.

Recursiveness . Another potential assumption in this work is the recursive SCM, which might be violated in more general settings, such as systems with cycles. All the theoretical foundations of this work are based on recursive SCMs, thus requiring these theories to be extended to more general cases.

Potential sensitivity to the specific forms of SCM in practice . With respect to the parameter form of the SCM, although we impose no theoretical constraints on the form of SCM, experiments indicate that in some settings the form of SCM still significantly influences outcomes. For example, combinatorial experiments and ablation studies reveal unexpected scenarios, particularly with the combinations of long-chain SCMs (CHAIN-LIN-4, CHAIN-LIN-5, LARGEBD-NLIN). As the causal chain lengthens, the performance of these density estimation models gradually weakens, suggesting that long causal chains complicate counterfactual inference. This phenomenon indicates that the form of SCM in practice affects the specific effectiveness of our methods, highlighting the necessity of selecting appropriate density estimation models and making corresponding adjustments.

Variance of L 3 expressions . In estimating counterfactual expressions Q ∈ L 3 , although the final result is unbiased, computing each term P ( Y ∗ ) individually introduces significant variance, as demonstrated in the experiments on counterfactual query estimation with real SCMs (see Tabs 5 and 6). Therefore, future work should focus on reducing the estimation variance of specific queries.

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Justification: All claims made in the abstract and introduction are reflected in the methodology (Sec. 3) and experiments (Sec. 5).

Answer: [Yes]

Guidelines:

The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.

The answer NA means that the abstract and introduction do not include the claims made in the paper.

The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.

2. Limitations

It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.

Question: Does the paper discuss the limitations of the work performed by the authors? Answer: [Yes]

Guidelines:

Justification: We briefly outline the limitations in Sec. 6 and provide a detailed discussion on the limitations in App. D.3.

The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.

The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.

The authors are encouraged to create a separate "Limitations" section in their paper.

The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.

The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.

The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.

If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.

3. Theory Assumptions and Proofs

While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Justification: We present all the assumptions in Sec. 3 and complete the proofs in App. A. Guidelines:

Answer: [Yes]

The answer NA means that the paper does not include theoretical results.

All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.

All assumptions should be clearly stated or referenced in the statement of any theorems.

Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.

The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.

Theorems and Lemmas that the proof relies upon should be properly referenced.

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

4. Experimental Result Reproducibility

Answer: [Yes]

Guidelines:

Justification: We provide a detailed description of the specific model architectures used in our experiments in App. C.4.

The answer NA means that the paper does not include experiments.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

5. Open access to data and code

Answer: [Yes]

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Justification: We have included the complete code in the attachment, encompassing both training and validation processes.

The answer NA means that paper does not include experiments requiring code.

Guidelines:

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not

including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

6. Experimental Setting/Details

Answer: [Yes]

Justification: We provide detailed experimental details in App. C.

Guidelines:

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

The answer NA means that the paper does not include experiments.

The full details can be provided either with the code, in appendix, or as supplemental material.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Justification: In the experimental figures and tables, we present error bars, with 95% CI and quartile outliers.

Answer: [Yes]

Guidelines:

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The answer NA means that the paper does not include experiments.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The assumptions made should be given (e.g., Normally distributed errors).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

8. Experiments Compute Resources

Justification: In App. C.4, we describe the computation time and computational resources.

Answer: [Yes]

Guidelines:

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The answer NA means that the paper does not include experiments.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

9. Code Of Ethics

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes]

Guidelines:

Justification: We have reviewed the NeurIPS Code of Ethics and have confirmed that we are not in violation of it.

The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.

The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).

If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Justification: We discussed the Broader Impacts in App. D.1.

Answer: [Yes]

Guidelines:

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.

The answer NA means that there is no societal impact of the work performed.

Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.

The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.

The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.

If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

11. Safeguards

Justification: The data and model presented in this paper do not pose risks of misuse. Guidelines:

Answer: [NA]

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring

that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Justification: We introduce the sources of code and data in App. C.

Answer: [Yes]

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should state which version of the asset is used and, if possible, include a URL.

The authors should cite the original paper that produced the code package or dataset.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Justification: The paper does not release new assets.

Answer: [NA]

Guidelines: This paper does not release new assets.

The answer NA means that the paper does not release new assets.

The paper should discuss whether and how consent was obtained from people whose asset is used.

Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.

At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Justification: This paper does not involve crowdsourcing nor research with human subjects. Guidelines:

Answer: [NA]

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.

Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Justification: This paper does not involve crowdsourcing nor research with human subjects. Guidelines:

Answer: [NA]

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.

For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe manuscript introduces exogenous matching, an importance sampling method for efficient estimation of counterfactual expressions in various settings. This method transforms the variance minimization problem into a conditional distribution learning problem, allowing integration with existing modeling approaches. The authors validate their theoretical findings through experiments with different Structural Causal Models (SCMs), showing competetive performance in a range of counterfactual estimation tasks. They also examine the impact of structural prior knowledge and demonstrate the method's unbiased estimates and practical applicability in identifiable proxy SCMs.\n\nUpdate: revising score upward following author rebuttal.\n\nSTRENGTHS:\nThe topic is timely and important, as counterfactual estimation has become an increasingly popular subject in statistics and machine learning. The proposal builds on recent results in neural causal models, specifically with normalizing flows. The ability to incorporate prior knowledge in the form of Markov boundaries is especially welcome, since computing counterfactuals is often intractable without such constraints. The theoretical results appear sound (though I confess I did not go closely through the proofs) and the empirical results are compelling.\n\nWEAKNESSES:\nThe manuscript is not always clear, probably because a great deal of material has been moved to the appendix to accommodate page count. The result is a somewhat disjointed text that would likely be better served by a journal publication than a conference paper. That said, I am generally supportive of this submission and would be willing to revise my score upward if my questions are adequately addressed (see below).\n\nQUESTIONS:\nWhen we say the causal model is “not fully specified”, does that just refer to the structural equations or to the graphical structure as well? In general, I was not always certain just how much causal information is used as input to this method.\n\nI’m a bit confused by Eq. 5. If this is meant to be a variance estimator, then presumably the RHS should be something like $\\mathbb{E}[X^2] – (\\mathbb{E}[X])^2$, where $X$ denotes the likelihood ratio $p(u) / q(u)$, correct? This is almost but not quite what we find here. Looking at the appendix, I don’t see why Eq. 48 follows from Eq. 47. Why do we get to drop the square from the first term?\n\nWhat does the constant $c$ denote in Eq. 6? Is it just the entropy of $P$? A brief word on this would help with intuition.\n\nShould there definitely be a negative both in front of the expectation *and* within it? I assume the first summand should just be $-\\mathbb{E} [ \\log Q(u \\mid Y_* (u)) ] $? This would look more like the classic cross entropy formula, as indicated in the following line. Eq. 7 also suggests this.\n\nOn “augmented graphs” – does this “reverse projection” of the ADMG always work? Different DAGs can have the same ADMG, for instance if two latent variables have all the same endogenous children. Perhaps there’s an unstated minimality assumption at work here?\n\nWhat is $m$ in Eq. 13?\n\nIt is not clear to me from Sect. 5 what the sample size and data dimensionality are for these tasks? In general, this section appears rushed. The performance metrics are also somewhat surprising. If data is simulated, then we presumably have ground truth with respect to counterfactual probabilities. If so, then why not just compute the mean square error of the proposed estimator, perhaps as a function of sample size?\n\nLIMITATIONS:\nLimitations are adequately addressed.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-10"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces an importance sampling method for efficient estimation of counterfactual expressions within general settings. It transforms the variance minimization problem into a conditional distribution learning issue, allowing integration with existing modeling approaches. The paper also explores the impact of incorporating structural prior knowledge, i.e. Markov boundaries, and applies the method to identifiable proxy SCMs, proving the unbiasedness of estimates and illustrating the method's practical applicability.\n\nSTRENGTHS:\n1. The paper is well-structured, with many subsections and bullet points summarizing paragraphs.\n2. The approach proposed in this paper has clear intuition and is easy to implement.\n\nWEAKNESSES:\n1. Contributions are not disentangled well. All three points involve experimental or empirical findings.\n2. Some results of the ablation study are abnormal. First, the results show that the approach proposed is not robust. Under setting SIMPSON-NLIN and M, the inclusion of Markov Boundary Mask significantly improves ESP. However, under setting LARGEBD-NLIN and NAPKIN, the Markov Boundary Mask harms the performance, especially with backbone SOSPF. Second, the ESPs under setting LARGEBD-NLIN with backbone SOSPF are almost 0, even when $|s|=1$, which is hard to explain if including Markov Boundary Mask is effective. Third, the variance under setting LARGEBD-NLIN with backbone NICE is extremely large. \n3. Insufficient explanation or legend for figures, making it difficult for readers to understand. For example, in Figure 1, $\\mathcal{M}$ with a subscripted hammer is not explained. In Figure 3, the legend does not indicate what different colors mean.\n4. Hard to follow. Some terminologies need explanation or reference. For example, in line 234, *faithfulness* is not defined.\n\nQUESTIONS:\nI would like to know whether Theorem 2 and 3 are novel. Have the papers cited (like 81, 3, 94, 111)  and other papers proposed methods to obtain Markov boundaries? If so, what is the improvement of the method proposed in this paper?\n\nLIMITATIONS:\nThe authors adequately discussed the limitations in the paper.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper presents Exogenous Matching (EXOM), a new importance sampling method for estimating counterfactual probabilities in Structural Causal Models (SCMs). EXOM transforms variance minimization into a conditional distribution learning problem, providing an upper bound on counterfactual estimator variance as per Theorem 1. It outperforms existing methods across various SCM settings and integrates well with identifiable neural proxy SCMs for practical applications. By incorporating prior knowledge through Markov boundaries, EXOM further enhances performance, demonstrating its potential as an efficient tool for counterfactual estimation in diverse scenarios.\n\nSTRENGTHS:\n1. EXOM provides a tractable and efficient approach for counterfactual estimation in general settings, including scenarios with discrete or continuous exogenous variables and various observations and interventions. This flexibility makes it applicable to a wide range of causal inference problems.\n  \n2. The method is built on solid theoretical grounds, with the authors deriving an optimizable variance upper bound for counterfactual estimators.\n  \n3. The authors incorporate structural prior knowledge, specifically Markov boundaries, into the neural networks used for parameter optimization. They empirically validate the effectiveness of this approach across various scenarios.\n  \n4. EXOM consistently outperforms other importance sampling methods in various SCM settings, as demonstrated by the experimental results. Its compatibility with identifiable neural proxy SCMs further enhances its practical applicability.\n\nWEAKNESSES:\n1. Theorem 1 relies on the assumption that the density ratio $q(\\mathbf{u}|\\mathbf{y}_ {\\ast})/q(\\mathbf{u}|\\mathbf{y}_ {\\ast}^\\prime)\\leq \\kappa$ holds for all $\\mathbf{u} \\in \\Omega_{\\mathbf{u}}$ and $y_{\\ast}$, $y_ {\\ast} ^\\prime \\in \\Omega_{\\mathbf{Y}_{\\ast}}$. This assumption may be overly stringent, as probability measures with infinite support sets might easily violate it. Could the authors elaborate on this assumption and provide examples of distributions that satisfy it?\n  \n2. In the Sampling and Optimization section, the distribution of the exogenous variable $\\mathbf{U}$ is assumed to be known. However, in practical scenarios, $\\mathbf{U}$ is often unknown, necessitating additional efforts to estimate $\\mathbf{P_U}$ [A]​. Could the authors provide further clarification on this assumption and discuss potential methods for estimating $\\mathbf{P_U}$​?\n  \n3. I understand the authors only consider models that provide identifiability results. However, it is encouraged to include neural proxy SCM methods based on VAE and DDPM as experimental baselines. While these may lack identifiability guarantees, comparing against them would further illustrate the superiority of the proposed method in relation to current state-of-the-art techniques.\n  \n4. While the method shows good performance on the tested SCMs, it's unclear how well it scales to larger, more complex causal models. The experiments are conducted on relatively small SCMs, and scalability to high-dimensional or densely connected causal graphs isn't thoroughly addressed.\n  \n\n[A] Ren, Shaogang, and Xiaoning Qian. \"Causal Bayesian Optimization via Exogenous Distribution Learning.\" *arXiv preprint arXiv:2402.02277* (2024).\n\nQUESTIONS:\n1. In Table 1, the EXOM method with MAP shows significantly better performance on the SIMPSON-NLIN and NAPKIN datasets compared to EXOM with GMM, whereas the performance on the FAIRNESS-XW dataset is similar for both methods. Could the authors provide further explanation for this discrepancy? Why does the GMM approach underperform in these specific cases, and what factors contribute to the similar performance on FAIRNESS-XW?\n  \n2. In the ablation study investigating the impact of injecting Markov boundaries, could the authors please include the performance results of EXOM without Markov boundaries? This comparison would further illustrate the benefit of incorporating Markov boundaries.\n\nLIMITATIONS:\nThe authors discuss the limitations of their work in Section 6 and Section D.3. Notably, this work does not have a negative societal impact.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2024-07-13"}

comments: SUMMARY:
Based on the importance sampling methods, the authors propose an exogenous matching approach to estimate counterfactual probability in general settings. They derive the variance upper bound of counterfactual estimators and transform it into the conditional learning problem. They also employ the Markov boundaries information in the inference to improve the learning performances further. Extensive experiments validate the superiority and practicality of their method.

STRENGTHS:
- This paper is clearly and well written.

- The authors give a theoretical analysis of their estimator, its log-variance upper bound in the general settings, and the counterfactual Markov boundary, and they also perform extensive experiments to demonstrate effectiveness in several cases: with two types of stochastic counterfactual processes, with three categories of fully specified SCMs, etc.

WEAKNESSES:
- This paper makes it clear in lines 140-144 about the assumptions needed for the proposed method. Regarding assumption ii), I think it is not mild, and I am wondering if the proposed method would be sensitive to the specified distribution $P_{\textbf{U}}$ of $\textbf{U}$. The authors might have performed such experiments, but it is not quite clear. 

- Are the Markov boundaries learned from the observational data via the d-separation, or they are given prior? The authors claimed that such Markov boundaries are structural prior knowledge in line 223, whereas they gave Theorem 3 to demonstrate how to obtain them. 

- It is suggested to offer the whole procedure or pseudo code of their proposed algorithm somewhere.

- In line 239, “augmentied” might be a typo error.

QUESTIONS:
Please see my questions in Weaknesses.

LIMITATIONS:
Not applicable.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2024-07-17