On the Generalization and Adaption Performance of Causal Models
Abstract
Learning models that offer robust out-ofdistribution generalization and fast adaptation is a key challenge in modern machine learning.
Modelling causal structure into neural networks holds the promise to accomplish robust zero and fewshot adaptation.
Recent advances in differentiable causal discovery have proposed to factorize the data generating process into a set of modules, i.e. one module for the conditional distribution of every variable where only causal parents are used as predictors.
Such a modular decomposition of knowledge enables adaptation to distributions shifts by only updating a subset of parameters.
In this work, we systematically study the generalization and adaption performance of such modular neural causal models by comparing it to monolithic models and structured models where the set of predictors is not constrained to causal parents.
Our analysis shows that the modular neural causal models outperform other models on both zero and few-shot adaptation in low data regimes and offer robust generalization.
We also found that the effects are more signiﬁcant for sparser graphs as compared to denser graphs.
1. Introduction
Deep Learning models have demonstrated remarkable capabilities when the test distribution matches the training distribution, but their performance signiﬁcantly degrades as the test distribution diverges from the training distribution (Lake et al., 2017; Rosenfeld et al., 2018;
Bahdanau et al., 2018; Packer et al., 2018; Nichol et al., 2018b; Cobbe et al., 2019; Taori et al., 2020; Djolonga et al., 2021; Koh et al., 2021).
However, such distribution shifts are inevitable in the real world and can occur in various settings, e.g. across hospitals in healthcare or across locations in agriculture {+at the ICML 
 Workshop on Spurious Correlations+} (Wang et al., 2021).
This sensitivity to distribution shift inherently limits the robust and safe deployment in the wild.
At the same time, deep learning systems constructed with a multi-layered monolithic architecture tend to co-adapt different components of the network.
Due to such a monolithic structure, when the distribution changes, a majority of the components of the network are likely to adapt in response to these changes, potentially leading to poor performance on out-of-distribution samples (Ke et al., 2021; Goyal et al., 2019) and interference between subtasks or subdistributions.
Endowing neural networks with the ability to capture the underlying causal structure holds the promise to accomplish much out-of-distribution adaptation and generalization by properly factorizing the knowledge that is stationary (causal mechanisms) from the knowledge that isn’t (the state of the random variables and interventions that change the distribution).
Given the underlying causal graph G , every causal mechanism represents a conditional probability distribution p ( X i | X pa ( i,G ) ) of a given variable X i where only causal parents X pa ( i ) are used as predictors.
In such a causal framework, distribution shifts can be interpreted as interventions (i.e. perturbations) that affect certain mechanisms locally (Magliacane et al., 2018; Zhang et al., 2013;
Sch ¨ olkopf et al., 2021).
As usually not the complete environment and its structure changes at once, adapting to a distribution shift in such a framework is therefore equivalent to adapting the intervened mechanisms.
The promising opportunities of causal models in machine learning have led to a ﬂurry of work and accompanying advances along various research axes (e.g. causal discovery (Zheng et al., 2018;
Yu et al., 2019; Bengio et al., 2019; Ke et al., 2019; Lachapelle et al., 2019; Brouillard et al., 2020; Scherrer et al., 2021; Annadani et al., 2021; Lorch et al., 2021; Lippe et al., 2021; Geffner et al., 2022; Ke et al., 2022), domain adaptation (Zhang et al., 2013; Peters et al., 2016; Rojas-Carulla et al., 2018; Magliacane et al., 2018; Bengio et al., 2019; Le Priol et al., 2021), robustness of neural networks (Zhang et al., 2020; Kyono et al., 2020), causal models in reinforcement learning (RL) (De Haan et al., 2019; Dasgupta et al., 2019; Nair et al., 2019; Goyal et al., 2019; Rezende et al., 2020; Ke et al., 2021), etc.
While most of these works either analyze a problem-speciﬁc objective, such as structure discovery or a success rate on a
X 1 , 1 , ...
X 1 ,K
M i,
X 2 , 1 , ...
X 2 ,K
M i,
X n, 1 , ...
X n,K
M i,n ... σ ( · )
X i ∼ p θ i
( X i | X,M i )
MLP f
θ i
( X,M i ) :
OverallArchitecture:
X ∼D
MLP 1 : f θ 1 ( X,M 1 )
P ( X 1 | X,M 1 ) ...
MLP N : f θ N ( X,M N )
P ( X N | X,M N ) task, little attention has been paid to a systematic analysis of the generalization and adaptation capabilities of causal models. Previous work including speed of adaptation analysis of Bengio et al. ; Le Priol et al. (2021) is limited to causal and anti-causal models in a bivariate setting.
The work of Ke et al.
(2021) analyzes generalization and adaptation performance of models with different inductive biases in different high-dimensional RL environments, where the underlying causal structure as well as causal variables are not given and need to be learned directly from high dimensional visual input.
In this work, we systematically investigate zero and few-shot adaptation capabilities of monolithic models and structured models where causal variables are explicitly given.
As an evaluation setting, we consider the task of predicting missing values (e.g. given all the other variables of the sample) under unseen distribution shifts (see ?? ).
In order to investigate the effect of the different inductive biases, we employ the same model architecture (i.e. one MLP per conditional distribution) across all considered models (see Figure 1).
Hence, all models have the same expressive abilities and only vary in their training objectives and pre-existing domain knowledge.
Within the class of structured models , we distinguish between expert knowledge models where we provide certain structure upfront of training (e.g. causal graph, anti-causal graph) and models where causal structure is learned from data.
We train monolithic models with different training objectives including a pseudo-likelihood objective as well as a meta-learning objective which explicitly optimizes the parameters of the monolithic models to adapt quickly to changes in distribution, hence confounding many different problems.
This setup allows us to uncover generalization and adaptation discrepancies between different models and analyze if and where models are prone to fail.
Contributions.
(i)
We show that generalization capabilities of different models vary signiﬁcantly with the amount of available training samples.
(ii) We demonstrate that structured models signiﬁcantly outperform monolithic models in low-data regimes.
(iii)
We show that a general evaluation metric is prone to drawing erroneous conclusions with respect to robustness and show how a general evaluation metric can be dissected into reﬁned metrics to investigate if and how speciﬁc models fail.
(iv) We show that non-causal models can fail drastically in settings where the underlying causal structure is sparse.
(v) We evaluate few-shot adaptation in various settings and show that causal models are the fastest and most robust to adapt.
(vi) We show how models adapt in parameter space and relate this to the speed of adaptation and robustness.
(vii) We propose and investigate a new adaptation objective for causal models which enables an efﬁcient adaptation in low training and adaptation-data regimes.
2. Problem Setting
In our work, we consider setting where high-level causal variables are observed and given (i.e. they do not need to be inferred from high-dimensional input).
We limit the number of variables N ∈ { 10 , 20 } where causal variables X
= { X 1 , . . .
, X n } are directly observed.
We generate synthetic observational and interventional data D =
( D obs , D int ) on causal acyclic graphs and ﬁt different models to data in order to learn conditional probability distributions p
( X i |· ) for all variables X i .
During test time (with and without adaptation), we predict all variables X j for j ∈ { 1 , . . .
, N } of unseen interventional distributions p ( X | do ( X k )) using all other variables
X i ( i (cid:54) =
j ) of the sample.
3. Model Architecture and Training Setup
Model Architectures In order to disentangle architectural effects from the training objectives, we employ the same architecture across all evaluated models.
We follow the setup of (Ke et al., 2019; Scherrer et al., 2021) and choose a stack of N independent MLPs for a setting with N observed variables.
Hence for every variable X i , there exists an
MLP parametrized by θ i that represents the conditional probability distribution (CPD) p ( X i | X, M i ) where M i ∈ { 0 , 1 } N denotes a input mask.
Speciﬁcally, every MLP has an input layer of size N × K , one hidden layer ofneurons with Leaky ReLU activations of slope 0 .
1 and a linear output layer of size K .
The output layer represents
1 × 102 × 104 × 101 × 102 × 10 3 #TrainingSamples 0 .0 .
NLL-Mean
ER-1 : 1 × 102 × 104 × 101 × 102 × 10 3 #TrainingSamples ER-3 : Pseudo-LL MAML L-Causal
EXP-Causal EXP-AntiCausal EXP-Skeleton Bound-ZeroShot
Bound-Transfer the unnormalized log-probabilities of each possible category that are ﬁnally mapped to valid CPDs through a softmax activation function σ ( · ) . Training Objectives In our study, we evaluate six different learning paradigms on a ﬁxed architecture consisting of a stack of N MLPs (see Section 3 for a detailed description) with the goal to learn the underlying generative mechanisms p ( X i |· ) .
To this end, we consider two techniques to learn a monolithic model (i.e. Pseudo-LL and MAML ) and four different techniques to learn a structured model (i.e.
EXP-Causal , EXP-AntiCausal ,
EXP-Skeleton and L-Causal ).
Within the structured models , we construct three models using expert knowledge ( EXP ) and a model where the causal structure is learned from data (i.e. L-Causal ) without any supervision.
The exact training objectives are described in the appendix § C.
4. Analysis of Generalization Performance
We start by analyzing OOD generalization (zero-shot) performance for the different models discussed in Section 3.
In particular, our experiments seek to answer the following questions: (a) How different models generalize under different circumstances.
(b) Analyzing how different parts of our models contribute to the failure or success for OOD generalization.
Implementation details.
We keep the training and evaluation setup between different models as similar as possible.
All models have the same number of parameters to represent the CPDs and are trained for the same number of steps, we train models on the same range of learning rates and pick the best performing one for each model individually.
All experiments are run with 10 random seeds, we report the mean and standard deviation of the results.
In particular, we use the Adam optimizer (Kingma & Ba, 2014) across all models and have evaluated learning rates from the set { 1 e − 2 , 1 e − 3 , 1 e − 4 } , weight decay from the set { 1 e − 4 , 1 e − 5 , 0 } and train all models for 1000 iterations, except the L-Causal model which was trained for multiple rounds with iterative optimization.
For the detailed setup with all model-speciﬁc hyperparameters, we refer to appendix §C.3.1.
Performance Bounds on Causal Models.
To assess the performance of the causal models, we compute two upper bounds on the performance of the causal model by accessing the data-generating causal model.
(a) Bound-ZeroShot shows the maximal zero-shot adaptation performance and (b) Bound-Adaptation show the maximal adaptation performance on the transfer distribution.
Note that the causal model EXP-Causal that relies on expert knowledge should naturally attain this bound faster than the model
L-Causal that learns the causal structure from data.
4.1. Generalization performance.
We analyze the generalization performance of different models under different settings.
There are three aspects of the settings that we consider.
First is the amount of training data D , then we look at the density of the underlying SEM that generated the data; at last, we look at the size of the graph.
To be speciﬁc, we vary the amount of training data between 10 2 and 10 4 , the graph density of the underlying
SEM between ER-1 and ER-3 and the size of the graph between 10 and 20 .
The training data D T consist of both observational D Tobs and interventional data D Tint .
We keep the number of observational data D Tobs the same as the number of interventional data D Tint in training.
Test data D t is kept ﬁxed across experiments.
We report the NLL-Mean of the test data on the model, this is average NLL scores across all variables (including the intervened-on variable).
Summary.
Results for comparisons between different amount of data and graph sparsity are found in Figure 2, results for comparisons between data with different number of nodes are in Figure 4.
Refer to § F. 3 in the appendix for a complete set of results.
We found that causal models outperform monolitic models ( Pseudo-LL and MAML ) when the amount of training data is low (Figure 2).
We also found that the performance gap widens as the density of the graphs decreases (Figure 2).
The performance gap also widens as the size of the SEM increases (Figure 4).
These results suggest that models with the correct structure (such as causal models) generalize better compared to models with no structure, especially when trained on a small amount of data coming from sparse and large graphs.
Furthermore, EXP-Causal models outperforms EXP-AntiCausal models under all settings, and EXP-AntiCausal can perform worse than monolitic models ( Pseudo-LL and MAML ) under some settings.
This suggests that having the correct structure is important and having the wrong structure can hurt performance.
We observe slower convergence of causal models to
Bound-ZeroShot on dense graphs than on sparse graph, as the identiﬁcation of the causal structure is more challenging in such settings (Ke et al., 2019;
Scherrer et al., 2021).
An interesting observation is that EXP-Skeleton models can outperform EXP-Causal models, this is because that when the intervention is not on the children of the predicted node, then EXP-Skeleton models can use the value of the child and the the value of the parents to predict the value of the node, whereas, the EXP-Causal models only uses the parents to predict the value of the node.
However, the
EXP-Skeleton models will fail catastrophically when the intervention is on the children of the predicted node, we will see more analysis about this in Section 4.2.
4.2. Dissecting generalization performance
The analysis in Section 4.1 reports an average evaluation metric across all nodes, which may not help us to understand the model’s performance in detail, as noted at the end of the previous section.
Hence, in this section, we aim to dissect the NLL-Mean metric into sub-metrics, which could help to systematically identify if and where models are prune to failure.
Such an analysis helps us to assess the the individual model robustness to distribution shifts and uncover failure settings which are hidden in the NLL-Mean metric.
To this end, we consider a data regime ( 1 k training samples) where all models perform similar with respect to the general
NLL-Mean score.
We dissect
NLL-Mean systematically into: (a)
NLL-Intervention:
NLL on intervened variable X i , b
) NLL-Root
Mean-NLL on root variables
in
G , (c) NLL-Parents: Mean-NLL on parent variables X pa ( i,G ) for a intervention on X i
excluding root
variables) and
(d) NLL-
Remainder: Mean-NLL of all variables except root and intervention variables. Note that, causal models are not expected to yield comparable performance on NLL-Intervention and
NLL-Root , as causal models only use the parents of each variables to make its prediction.
As this is an empty set for root variables and hard intervened variables, causal models estimate such variables from the marginal distribution of such variables.
In contrast, monolithic models also rely on (potentially unstable) correlated predictors and anti-causal predictors and hence beneﬁt from stronger performance as long none of these predictors were affected by an intervention [Figure]
Summary.
Building upon our introduced sub-metrics [Figure] we ﬁnd that important failure and robustness insights are hidden in a general evaluation scores such as NLL-Mean (see Figure 3).
We observe different performance trends across all sub-metrics.
While causal models maintain a robust performance as they only rely on the inferred causal predictors, monolithic models and structured models that rely on anti-causal predictors (i
[Figure]
e. EXP-AntiCausal and EXP-Skeleton ) show a signiﬁcant deterioration in per-
[Figure]
[Figure]
NLL-Parents
Pseudo-LLMAML
L-CausalEXP-Causal
EXP-AntiCausalEXP-Skeleton formance with large standard deviations on NLL-Parents as certain predictors got unstable due to the present distribution shift (i.e. modelled by a single-target intervention). We further observe stronger effects on sparse graphs where less stable predictors are available (see § F.3). Overall, this experiment conﬁrms that all models expect causal models show bigger risk for catastrophical failures by relying on unstable predictors.
5. Analysis of Adaptation Performance
We evaluate the adaption performance by evaluating how fast (speed of adaptation) and how well (how much overﬁtting) different models adapt to changes in distribution.
We use two different adaptation techniques: (i) unconstrained adaptation and (ii) sparse adaptation (explained in Appendix C.3).
Throughout this analysis, we pay particular attention to the NLL-Parents metrics and see how fast the affected models recover.
Speed of adaptation. We ﬁx the training data size of all models to be 10 3 samples, as all models have converged on the generalization performance by then (Figure 2). We analyze the speed of adaption of different models by evaluating their adaption performance when ﬁnetuned using different amounts of data. Results shown in Figure 5.
We observe that the structured models adapt considerably faster than the monolithic models across all settings.
We
0 10101010 3 #AdaptationSamples 0 .0 .
{+9 NLL-Mean : 0 10101010 
+}
#AdaptationSamples 0 .1 .
{+2 NLL-Parents : 0 10101010 
+}
#AdaptationSamples 1 . 2 1 .1 .
NLLIntervention :
Pseudo-LL
MAML
L-Causal
EXP-Causal
EXP-AntiCausal
EXP-Skeleton observe slightly faster adaptation for causal model than for the other structured models .
Within the monolithic models , we observe that models that are trained with an adaptation objective (i.e. with MAML (Finn et al., 2017)) adapt faster with respect to the intervened module than models trained on a naive pseudo-likelihood objective.
Risk of overﬁtting.
Ideally, one aims to adapt to a transfer distribution using a less number of adaptation samples.
In such a setting, a single update (i.e. gradient step with respect to the samples) using the available samples may be not sufﬁcient to exploit all available information.
Hence, it would be desirable to perform multiple updates on a small number of adaptation samples to extract all relevant information but without overﬁtting to the adaptation samples.
To this end, we investigate the risk of overﬁtting when performing one or multiple updates on a ﬁxed amount of data.
Across all our experiments, monolithic models show strong overﬁtting effect when the number of adaptation samples are less, even on a single update step (see Figure 5).
In contrast, structured models show reduced overﬁtting effects over multiple gradient steps, especially causal models .
For less number of adaptation samples, the speed of adaptation of causal models can be further improved by employing a sparse adaptation objective.
Overall, the adaptation landscape of the causal models is signiﬁcantly different from all other models, and hence allows to continuously improve the adaptation performance over multiple update steps.
How does adaptation affect the parameter space θ ?
Based on the results from the previous analyses, we aim to further investigate the adaptation performance of models.
We compare the effect on the parameters space θ between different models by employing the unconstrained adaptation objective, the most general adaptation objective.
While monolithic models adapt the parameters of many modules (i.e. independent MLPs) heavily, measured with respect to the gradient magnitude, the adaptation of structured models results in smaller updates, especially on the nonintervened modules (see Figure 6).
Causal models show remarkable adaptation behaviour in parameter space with localized updates on certain modules , and signiﬁcantly reduced gradient magnitudes.
If a causal model is trained on enough training samples and has access to enough adapta-
[Figure]
tion adaptation samples, the unconstrained adaptation without knowledge about the intervention target yields nearly the same update as if we enforce the sparse update on the known intervened module (see §G.2).
Efﬁcient Adaptation of Causal Model Due to space constraints, we refer to the appendix § E for an analysis of the proposed adaptation objective.
6. Conclusion
In this work, we systematically analyzed the generalization and adaptation performance of different models ranging from monolithic models that have no inbuilt structure to structured models that are either provided with structural expert knowledge upfront or learn structure from data.
Our experiments show that the causal models signiﬁcantly outperform non-causal models in low-data regimes and offer robust generalization across all settings.
In a further analysis, we evaluated few-shot adaptation in various settings and show that causal models offer fast and robust adaptation with only less number of adaptation samples.
Based on these results, we analyze how the adaptation performance relates to changes in the parameter space and then proposed a new adaptation objective that dynamically modulates the degree of adaptation and hence allows more sample efﬁcient adaptation.
In this work, we considered relatively low-dimensional settings where causal variables are explicitly given.
Translating our systematic evaluation and score dissection analysis to high-dimensional evaluation setups such as (Ke et al., 2021) would be an interesting direction for future work.
Acknowledgements
The authors would like to acknowledge the support of the following agencies for research funding and computing support: Compute Canada, the Canada Research Chairs, CIFAR.
Yoshua Bengio is a CIFAR Senior Fellow and Stefan
Bauer is a CIFAR Azrieli Global.
A. Background
Causal Graph.
A causal graph is commonly represented by a directed acyclic graph (DAG)
G =
( V , E ) with | V | =
N and | E | =
M .
Such a graph is deﬁned over ﬁnite set of vertices V associated with a ﬁnite set of random variables (or observables) X
= { X 1 , . . .
, X N } , where directed edges in the causal graph G point from causes to effects.
For convenience, the set of X i ’s parents in G is usually denoted as X pa ( i, G ) and the set of X
i ’s children in G by X ch ( i, G ) .
Adjacency Matrix.
The connectivity between vertices V in a graph is commonly represented by an adjacency matrix
A ∈ { 0 , 1 } N × N such that A i,j = 1 if node j is a parent of node i .
Structural Causal Model (SCM).
An SCM (Pearl, 1995; Peters et al., 2017), also known as structural equation model (SEM), is deﬁned by a causal graph G over a set of random variables (or observables) X
= { X 1 , . . .
, X N } and a set of associated structural equations.
The structural equations express the functional relationships among the causal variables through functions f i and jointly independent noise variables
U i as X i =
f i ( X pa ( i,G ) , U i ) ∀ i ∈ { 1 , . . .
N } .
The noise variables U
i ensure that the set of structural equations can represent general conditional probability distributions
P ( X i | X pa ( i,G ) ) .
The joint distribution entailed by the variables X
= { X 1 , . . .
, X N } can be factorized such that each variable is conditionally independent of other variables given its parents in the graph G :
[Equation]
In the causality literature, this factorization is also known as the causal factorization (Sch ¨ olkopf et al., 2021).
B. Related Work
Differentiable Causal Discovery.
Recent advances in differentiable causal discovery focused on building new algorithms for causal discovery from observational data (Zheng et al., 2018;
Yu et al., 2019; Lachapelle et al., 2019; Annadani et al., 2021; Lorch et al., 2021; Cundy et al., 2021; Geffner et al., 2022; Ke et al., 2022) or fused data (observational and interventional data) (Bengio et al., 2019; Ke et al., 2019; Brouillard et al., 2020; Lippe et al., 2021) using advances in deep learning.
Such methods are primarily concerned to identify the underlying causal structure from data, and not evaluate the zero and few-shot capabilities of the learned models.
Speed of Adaptation While Bengio et al.
Ke et al.
(2019) included an analysis for adaptation or generalization speed of causal models compared to monolithic models, these analyses are focused on a speciﬁc setting, such as a speciﬁc number of variables.
The work of Le Priol et al.
(2021) analyzes the speed of adaption of causal and anti-causal models, however, the analysis is only limited to the bivariate settings.
Sch ¨ olkopf et al.
(2021) discussed the generalization and adaption performance of causal models against monolithic models in a high-dimensional setting, however, no experimental analysis is included.
Ke et al.
(2021) proposed a novel suite of RL enviromments and tasks for analyzing causal discovery in a high-dimensional RL setting, and the work analyzed generalization and adaption performance of models with different inductive biases.
In our work, we perform a systematic analysis of generalization and adaption performance of causal models against monolithic models, as well as models that are explicitly optimized using meta-learning objectives such as
MAML (Finn et al., 2017) on settings where the causal variables are explicitly given.
Domain Adaptation.
Multiple approaches have been proposed that exploit the causal structure of the data generating process in order to address the problem of domain adaptation (Zhang et al., 2013; Peters et al., 2016; Bareinboim & Pearl, 2016; Rojas-Carulla et al., 2018; Magliacane et al., 2018).
While these works analyze speciﬁc instances of domain adaptation problems with varying assumptions, our work is concerned to investigate zero- and few-shot adaptation abilities of various monolithic and structured models .
Improving Robustness through Causal Structure.
Zhang et al.
(2020) showed a connection between the vulnerability / robustness of neural neural networks and their lack of causal reasoning.
Kyono et al.
(2020) showed that learning causal structure as an auxiliary tasks improves the in-distribution generalization capabilities of overparameterized feed-forward neural networks.
However, the work only investigates out-of-sample generalization within the same distribution, and does not consider out-of-distribution settings.
Transfer through Modular Knowledge Decomposition.
Recent work has shown that architectural inductive biases which promote modular decomposition of knowledge can provide a useful basis for transfer of knowledge from one task to another task (Alet et al., 2018;
Chen et al., 2020; Madan et al., 2021).
Such architectures employ a meta-learning approach to update different subset of parameters of the network over different timescales and show such an approach leads to improvements in sample efﬁciency as compared to training all the parameters at once (Madan et al., 2021).
Such methods learn directly from low dimensional pixel data and don’t explicitly learn causal variables.
B.1. Limitations
In the present work, we have only experimented with one speciﬁc class of a neural causal discovery framework (Ke et al., 2019; Lippe et al., 2021) to learn causal structure from data.
Hence, the performance may vary with other classes of neural causal discovery frameworks.
However, we have introduced a causal model where the true causal structure is presented upfront and hence represents an performance upper-bound given a certain amount of training data.
Furthermore, we have only conducted experiments on datasets where the causal variables are explicitly observed and the underlying causal graph is acyclic.
C. Model and Training Setup C.1. Data Generation
In order to systematically investigate the effect of different training objectives on generalization and adaptation performance, we employ a synthetic data generation setup.
We generate observational and interventional data D =
( D obs , D int ) of discrete and non-linear nature governed by causal graphs.
Graph Generation.
We distinguish between structured and random graphs in order to represent a wide diversity of possible graphs.
For structured graphs, we follow the setup of (Ke et al., 2019) and generated various DAGs with acyclic and cyclic skeletons.
In order to generate random graphs, we follow the Erd ´ os–R ´ enyi ( ER ) model with varying edge densities (i.e.
ER-1 , ER-2 and ER-3 ) as in (Scherrer et al., 2021).
Conditional Probabilty Distributions (CPD)
In order to generate discrete, observational data D obs given a causal DAG G , we perform ancestral sampling based on the topological order of the causal DAG G as proposed in (Ke et al., 2019).
Similar to (Ke et al., 2019; Lippe et al., 2021), we model the CPDs p ( X i | X pa ( i,G ) ) using randomly initalized one-hidden layer MLPs (weights orthogonally in the range [ − 2 .
5 , 2 . 5] and biases uniformly in the range [ − 1 .
with a hidden dimensionality of 48 where all inputs except the parents X pa ( i,G ) are masked to 0 during the sampling process.
We perform point interventions on a single node modelled by an Uniform distribution U [1 , K ] , where K is the number of possible categorical assignments.
C.2. Training Objectives C.2.1. M ONOLITHIC M ODELS
Pseudo-Loglikelihood ( Pseudo-LL ):
As a simple monolithic model, we train a model using maximum likelihood on an unconstrained input mask M on observational data D obs .
We minimize:
[Equation]
for every MLP i independently, where M i denotes the i ’th column of the input mask and θ i the corresponding MLP parameters.
M is a unconstrained input mask with ones everywhere except zeroes on the diagonal.
This prevents from learning an identity mapping X i
= X i .
Hence, the Pseudo-LL model learn CPD’s of the form p ( X i | X \ X i ) on data from D obs .
Model-Agnostic Meta-Learning ( MAML ):
Motivated by the adaptation capabilities of meta-learned models, we use the model-agnostic meta learning algorithm (MAML)
(Finn et al., 2017) in order to train a monolithic model on a variety of interventional distributions {D int ( l ) } Ll =1 .
To this end, we employ the following meta-optimization formulation:
[Equation]
where: ˆ θ i,l = θ i − α ∇ θ
i
E
[Equation] int
[Equation]
(cid:2) − log ( f ( X, M i ; θ
[Equation]
(3) where p ( Int ) =
U [1 , . . .
, L ] denotes a uniform distribution over the available interventional distributions, M i is the input mask, α is the step-size parameter of the inner update and ˆ θ i , l represents the updated model parameters.
The above meta-optimization objective is optimized using Adam (Kingma & Ba, 2014) and the inner updated is done using stochastic gradient descent (SGD).
Note that the meta-optimization is performed over the model parameters θ i , whereas the objective is computed using the updated model parameters ˆ θ i .
For the input mask M i , we follow same setup as for Pseudo-LL .
Hence, the MAML models learns CPD’s of the form p ( X i |
X \ X i ) on different interventional distributions D int ( l ) ∼ D int .
In our experiment, we rely on the ﬁrst-order approximation of MAML (Nichol et al., 2018a).
C.2.2. S TRUCTURED M ODELS
Learning with Expert Knowledge ( EXP-Causal , EXP-AntiCausal and EXP-Skeleton ) :
Given the adjacency matrix A of the ground-truth causal structure G , the anti-causal adjacency matrix (i.e. the transpose of the causal adjacency) or the adjacency matrix of the undirected skeleton, we inject the the provided expert knowledge by setting the input mask to
M = A and train the models EXP-Causal , EXP-AntiCausal and EXP-Skeleton using maximum likelihood training on observational data D obs .
To this end, we minimize Equation (2) for every MLP independently.
Hence, EXP-Causal learns CPD’s of the form p ( X i |
X pa ( i,G ) ) (i.e. only causal predictors), EXP-AntiCausal learns CPD’s of the form p ( X i |
X ch
( i,G ) )
(i.e. only anti-causal predictors) and EXP-Skeleton learns CPD’s of the form p ( X i |
X pa ( i,G ) ) , X ch
( i,G ) )
(i.e. causal and anti-causal predictors).
Learning Causal Structure ( L-Causal ): We use a causal discovery framework to learn a structural causal model (SCM) from data.
To this end, we follow the setup of Lippe et al.
and introduce an additional set of parameters
γ = ( u, v ) with u ∈ R N × N and v ∈ R N × N which deﬁne a continuous relaxation of an adjacency matrix γ = σ ( u ) · σ ( v ) .
Such a soft-adjacency matrix can be conveniently used to sample input masks M .
In order to train the parameters θ of the MLPs and the learnable input mask γ , the framework relies on a optimization formulation using two alternating phases of optimization (Ke et al., 2019; Lippe et al., 2021; Scherrer et al., 2021).
These are performed until convergence in an iterative manner.
Under freezed mask parameters γ , we train during phase 1 (called ”Distribution Fitting”)
the parameters θ i of each MLP on observational data D obs using a similar maximum likelihood objective as in Equation (2):
[Equation]
where we sample a set of input masks M from p ( M ; u, v ) instead of relying on a ﬁxed mask M , where M ij ∼ Ber
( σ ( u ij ) · σ ( v ij )) .
During phase 2 (called ”Graph Fitting”), we freeze the previously trained MLP parameters θ and optimize the mask parameters γ using different sets of interventional data D int ( l ) ∼ D int .
To this end, we employ the optimization formulation of (Lippe et al., 2021):
[Equation]
5) where p I ( I ) denotes a distribution over interventions (uniform in our case) and X ∼ D int ( l ) refers to a a set of data drawn from the interventional dataset D int ( l ) .
As in phase 1 (i.e. distribution ﬁtting), masks M are sampled from p ( M ; u, v ) which represents a distribution over adjacency matrices.
For a detailed optimization formulation and gradient derivations, we refer to Lippe et al.
C.3. Adaptation Techniques
During test time, we aim to adapt pretrained models to interventional distributions that were not presented during training.
Given a set of adaptation samples D Aint , we consider:
(a) Unconstrained Adaptation.
Finetune all MLPs using D Aint for multiple gradient steps.
(b) Sparse Adaptation.
We only ﬁnetune the module that was affected by the intervention.
The affected module is either known or predicted in the setting of unknown interventions.
(c) Regularized Adaptation.
By relaxing the Sparse Mechanisms hypothesis, we aim to compute adaptation weights that control the magnitude of adaptation (lower adaptation where knowledge can be directly reused, more adaptation where knowledge has changed).
To this end, we compute the NLL on the adaptation data for every variable X i and store it as score s i , assessing the ﬁt of each MLP given the new transfer data.
We use this score to compute the weight of adaptation of a certain mechanism by employing a temperature-scaled softmax over these scores [ s 1 , . . .
, s N ] .
The temperature t allows to control the magnitude of co-adaptation and interpolate between unconstrained adaptation ( t = ∞ ) and sparse adaptation ( t = 0 ).
C.3.1. H YPERPARAMETER S ETUP
Hyperparameters:
Pseudo-LL , EXP-Causal , EXP-AntiCausal and EXP-Skeleton
Optimizer:
Adam (Kingma & Ba, 2014)
Learning Rate: { 0 . 1 , 0 . 01 , 0 . 001 , 0 . 0001 } Weight Decay: { 0 . 01 , 0 . 001 , 0 . 0 } Number of iterations: { 500 ,
[Table]
Hyperparameters
L-Causal
Number of Alternating Iterations:
Distribution Fitting:
Optimizer:
Adam (Kingma & Ba, 2014)
Learning Rate: { 0 . 1 ,
[Table]
[Table]
[Table]
Weight Decay: {
[Table]
Number of iterations: { [Table] [Table]
[Table]
Graph Fitting ∗ :
Optimizer:
Adam (Kingma &
[Table]
Learning rate u :
[Table]
Learning rate v : 0 .
[Table]
Number of iterations:
Number of Graphs: ∗ All hyperparameters were adopted from Lippe et al.
(2021) as we relied on their graph ﬁtting formulation.
Hyperparameters
MAML
Inner Loop:
Optimizer:
SGD
Learning Rate: { 0 .
[Table]
[Table]
Nr.
Iterations: { 1 , 2 , 5 }
Outer Loop:
Optimizer:
Adam (Kingma & Ba, 2014)
Learning Rate: { 0 . 1 , 0 . 01 , 0 .
[Table] [Table]
D. Generalization Convergence of Causal Models ( L-Causal vs. EXP-Causal )
In this analsis, we only focus on causal models and seek to compare the performance of the EXP-Causal which is provided with the true causal structure upfront, and L-Causal which aims to learn the causal structure from data.
Findings.
We observe that EXP-Causal outperforms L-Causal on low training regimes as the employed causal discovery framework can only identify the true causal graph with sufﬁcient amounts of samples (see Figure 7).
With increasing amounts of samples
[Figure]
the learned causal structure of L-Causal gets closer to the ground-truth structure (see bottom row of Figure 7 for Structural Hamming Distance (SHD) between learned and true structure) and hence the generalization performance improves.
Both models attain Bound-ZeroShot (blue) as expected with sufﬁcient amount of samples.
In addition, we observe slower convergence of L-Causal to Bound-ZeroShot on dense graphs than on sparse graph, as the identiﬁcation of the causal structure is more challenging in such settings (Ke et al., 2019; Scherrer et al., 2021)
[Figure]
E. Efﬁcient Adaptation of Causal Models
[Figure]
Up to this experiment, we have observed the effects of an unconstrained adaptation objective where all modules can be updated, and the sparse adaptation objective where only a speciﬁc module is updated (i.e. module is either estimated or known).
However, it would be desirable to update the modules in a more efﬁcient manner using less amount of adaptation samples without overﬁtting.
To this end, we employ our proposed regularized adaptation objective and investigate the effect on the speed of adaptation.
Across our experiments, we observed how the proposed adaptation objective further improves the speed of adaptation if only less amount of adaptation samples are available (as shown in Figure 8).
It especially improves adaptation if the pretrained model is only trained on few amounts of data.
Further, it improves the statistical efﬁciency compared to the sparse adaptation objective, as available samples are used to update necessary module, if necessary.
F. Extended Analysis of Generalization Performance
In this section, we provide an extended generalization analysis of the one presented in Section 4.
with additional results and investigations on various settings ( N ∈ { 10 , 20 } , Graphs: ER-1 , ER-2 , ER-3 ).
We start with an in-depth analysis of a sparse setting ( N = 20 , ER-1 , Nr.
Training Samples: 1000 ) in Section F.1 and thereby highlight the importance of the average evaluation metric dissection.
In a second step, we analyze in Section F.2 how the generalization performance is affected as the size of SEM increases.
As a ﬁnal step, we provide the complete results on all sub-metrics across all evaluated settings in Section F.3.
F.1. Case Analysis: N = 10 , ER-1 Graph
As shown in Section 4.2, an average evaluation metric such as NLL-Mean may not not help us to understand the model’s performance in detail and does not provide enough insights where models are prone to fail.
In order to highlight the importance of the introduced sub-metrics for evaluating the generalization robustness, we ﬁx a sparse evaluation setting (Graph-Type: ER-1 , N = 20 , Nr.
Training Samples: 1000 ) where all models perform similar with respect to NLL-Mean and dissect the results in detail.
Findings.
We observe that monolithic models (i.e. Pseudo-LL and MAML ) and EXP-Skeleton slightly outperform the two causal models (i.e. L-Causal , EXP-Causal ) and the anti-causal model on the NLL-Mean metric (see
Figure 9).
However, by looking at the submetrics in more detail, we ﬁnd that this performance advantage on NLL-Mean is due to performance differences on NLL-Intervention and NLL-Root where causal models are not expected to achieve similar performance as they only rely on causal predictors (i.e. an empty set for root and hard-intervened variables).
By excluding all variables where the set of causal predictors is empty (i.e. root and intervention nodes), we arrive at the
NLL-Remainder metric.
On this metric, we observe that all models achieve similar performance ranges except the anti-causal model (i.e. EXP-AntiCausal ) which yields signiﬁcantly reduced performance.
Finally, we focus on the
NLL-Parents metric, where we only evaluate the ability to predict the parents variables X pa ( i,G ) of a given intervention target
X i which induced the present distribution shift by a perfect intervention do ( X i ) .
While non-causal models can catastrophically fail on this task, we observe that causal models maintain their performance and outperform all other models.
In summary, all models show difﬁculties to predict the intervened variables as one expects.
On all the remaining variables, causal models yield the most robust performance without tendencies for catastrophic failure.
F.2. Generalization Performance Across Graphs of Increasing Size
In this analysis, we seek to investigate how the generalization performance of the considered models changes as the size of the underlying graphs and the corresponding SEM increases.
To this end, we ﬁx a sparse class of graphs (i.e. ER-1 ) and analyze the sub-metrics under training datasets D T of different size, i.e. |D T | ∈ { 100 , 200 , 1000 } .
Findings.
In line with our observation that structured models are more sample-efﬁcient than monolithic models with respect
[Figure]
N LL
[Figure]
Pseudo
[Figure]
MAML
L-Causal
EXP
[Figure]
Causal
EXP-AntiCausal
EXP-Skeleton
[Figure]
[Figure] N LL [Figure] to the generalization performance, we ﬁnd that the performance gap between structured models and monolithic models widens signiﬁcantly as the size of the graph increases (i.e. from N = 10 to N = 20 ).
In particular, we observe a remarkable generalization behaviour of the causal model EXP-Causal where the true causal structure is provided upfront.
Under a ﬁxed size of the training data, the model maintains robust performance over all metrics when the size of the graph increases.
Within the models that are not provided with any domain knowledge upfront, we observe that L-Causal and MAML clearly outperform Pseudo-LL on low-sample regimes.
As the number of training samples increases, L-Causal is capable of fully identifying the underlying causal structure from data and reaches the same performance as EXP-Causal .
In general, the performance gap between the models decreases as the amount of training samples is increased.
N=
N=
Training Samples =1 .1 .
NLLMean
N= N=
Training Samples =
N= N=
Training Samples =
Pseudo-LL
MAML
L-Causal
EXP-Causal
EXP-AntiCausal
EXP-Skeleton
N= N=
Training Samples =
NLLParen ts
N=
N=
Training Samples =
N= N=
Training Samples =
Pseudo-LL
MAML
L-Causal
EXP-Causal
EXP-AntiCausal
EXP-Skeleton
N= N=
Training Samples = [Figure] [Figure] [Figure]
NLLRemainder
N= N=
Training Samples =
N= N=
Training Samples =
Pseudo-LL
MAML
L-Causal
EXP-Causal
EXP-AntiCausal
EXP-Skeleton
N= N=
Training Samples =
NLLIntervention
N= N=
Training Samples =
N= N=
Training Samples =
Pseudo-LL
MAML
L-Causal
EXP-Causal
EXP-AntiCausal
EXP-Skeleton
N= N=
Training Samples = [Figure]
[Figure] NLL [Figure] Root
N= N=
Training Samples =
N=
N=
Training Samples =
[Figure]
L
[Figure]
EXP
[Figure]
Causal
EXP
[Figure]
AntiCausal
EXP
[Figure]
Skeleton
F.3. Dissection - Results Across All Settings
In this section
[Figure]
we report all evaluated (sub)-metrics across ER graphs of varying density (i
[Figure]
e. ER-1 , ER-2 and ER-3 of size N ∈ { 10 , 20 } on different amount of training samples |D T | ∈ { 100 , 200 , 400 , 1000 , 2000 } .
[Figure] [Figure]
we observe that they can catastrophically fail to predict the parent variables of an intervened variables (i e. NLL-Parents ), especially on sparse graphs.
Within the structured models , we observe that the EXP-Skeleton model that relies on causal and anti-causal predictors performs best across most settings, but is also prone to fail on NLL-Parents [Figure] [Figure]
G. Extended Analysis of Adaptation Performance
In this section, we expand our few-shot adaptation analysis from Appendix E with respect to speed of adaptation and overﬁtting behaviour in Section G.1, and the effect on the parameter space θ in Section G.2.
In addition, we provide further results and analysis on the regularized adaptation objective.
G.1. Adaptation Performance
As in Appendix E, we ﬁx the training data size of all models to be 10 3 samples, as all models have converged on the generalization performance by then.
We analyze the speed of adaption of different models by evaluating their adaption performance when ﬁne-tuning using different amounts of adaptation data.
Findings.
Across all evaluated classes of graphs (e.g. ER-1 , ER-2 and ER-3 ), we observe that structured models adapt considerable faster than monolithic models with respect to the required amount of adaptation samples.
When doing a few gradient steps using SGD (i.e. 3 steps with a learning rate of 0 . 1 ), we already observe strong overﬁtting effects for the considered monolithic models on all evaluated metrics except NLL-Intervention (see Figure 13).
By inspecting the NLL-Parents metric, we observe the robustness of the two causal models (i.e. L-Causal and EXP-Causal ), especially on sparse graphs.
[Figure]
G.2. Parameter Space Analysis
Keeping the adaptation performance of the previous section in mind, we now expand our analysis on the parameter space θ .
We seek to answer if the adaptation performance is related to the changes in parameter space θ .
Findings.
We ﬁnd that the overﬁtting behaviour of monolithic models is correlated with the observed updates in parameter space.
For the range of adaptation samples where the monolithic models are prone to overﬁt (i.e. 1 to 10 adaptation samples), we observe high gradient magnitudes on the non-intervened modules (referred to as other modules) in monolithic models compared to the relatively small updates of structured models .
As the size of adaptation samples increases (i.e.adaptation samples), we observe signiﬁcantly reduced gradient magnitudes on non-intervened modules and lower overﬁtting effects.
Within the structured models that are built upon structural domain knowledge, we observe that EXP-Causal and
EXP-AntiCausal yield relatively small gradient updates compared to EXP-Skeleton .
In addition, we observe that the anti-causal model yields lower updates on the intervened module as expected as it relies on anti-causal predictors of the intervened variable children, that were not affected by the intervention.
[Figure]
n t |
[Figure]
(i) Graphs: ER-
[Figure]
|
[Figure]
r a d i e n t | [Figure] [Figure] ) Graphs: ER-
[Figure]
r a d i e n t |
[Figure]
G.3. Regularized Adaptation
In this section [Figure] we provide further insights on the effects of a a regularized adaptation objective on top of EXP-Causal .
We report speed of adaptation in Figure 15 and analyses on the parameter space in Figure 16.
Findings.
We observe that the regularized adaptation objective improves the adaptation performance on low amounts of adaptation samples considerably.
Our results indicate that the adaptation objective prevents from overﬁtting if multiple gradient steps are performed.
It is noteable, that the regularized adaptation objective yields nearly the same performance as the sparse adaptation objective, even though the sparse adaptation objective leverages a supervised signal (i [Figure] e. knowledge of the intervention location) in the present setting
[Figure]
observe an overﬁtting behaviour of the unconstrained adaptation objective if only low amounts of adaptation samples are available. In contrast, the sparse and regularized adaptation objective still yield continuous improvements, even if only low few adaptation samples are available.
It is noteable, that the regularized adaptation objective yields nearly the same performance as the sparse adaptation objective, even though the sparse adaptation objective leverages a supervised signal (i.e. knowledge of the intervention location) in the present setting. [Figure] r a [Figure]
i e n t |
[Figure]