SlowGuess/NeurIPS_2023_OCR huggingface dataset:
NoGAM. The NoGAM [24] algorithm generalizes the ideas of SCORE on additive noise models with an arbitrary distribution of the noise terms. After some manipulations, it can be shown that for a leaf node  $X_{l}$  the score entry of Equation (9) satisfies
$$
s _ {l} (\mathbf {X}) = \partial_ {U _ {l}} \log p _ {l} (U _ {l}), \tag {11}
$$
such that one could learn a consistent estimator of  $s_l$  taking as input the exogenous variable  $U_l$ . For an ANM, the authors of NoGAM show that the noise term of a leaf is equivalent to the residual defined as:
$$
R _ {i} := X _ {i} - \mathbf {E} \left[ X _ {i} \mid \mathbf {X} \backslash \left\{X _ {i} \right\} \right], \forall i = 1, \dots , d. \tag {12}
$$
Then, by replacing  $U_{l}$  with  $R_{l}$  in Equation (11), it is possible to find a consistent approximator of the score of a leaf using  $R_{l}$  as the predictor. Formally:
$$
\mathbf {E} \left[ \left(\mathbf {E} \left[ s _ {i} (\mathbf {X}) \mid R _ {i} \right] - s _ {i} (\mathbf {X})\right) ^ {2} \right] = 0 \Longleftrightarrow X _ {i} \text {i s a l e a f}, \tag {13}
$$
which identifies a leaf node as the argmin of the vector of the mean squared errors of the regression of the score entries  $s_i(\mathbf{X})$  on the corresponding residuals  $R_{i}$ , for all  $i = 1,\dots ,d$ .
Connection of NoGAM with the post nonlinear model. It is interesting to notice that, similarly to Equation (11) for additive noise models, the score of a leaf  $X_{l}$  generated by a PNL model can be defined as a function of the disturbance  $U_{l}$ .
Proposition 1. Let  $\mathbf{X} \in \mathbb{R}^d$  be generated according to the post nonlinear model (5). Then, the score function of a leaf node  $X_l$  satisfies  $s_l(\mathbf{X}) = \partial_l \log p_l(U_l)$ .
This result suggests a connection with the NoGAM sorting criterion: indeed, one could hope to identify leaf nodes in the graph by consistent estimation of the score of a leaf from residuals equivalent to the noise terms. A more detailed discussion with the proof of Proposition 1 is presented in Appendix E.
DAS. The DAS algorithm (acronym for Discovery At Scale, [24]) identifies the topological ordering with the same procedure defined in SCORE, while the two methods differ in the way they find edges in the graph. DAS edge selection procedure exploits the information in the non-diagonal entries of the Jacobian of the score. In particular, for ANM with Gaussian noise terms, it can be shown that:
$$
\mathbf {E} \left[ \left| \partial_ {x _ {i}} s _ {l} (\mathbf {X}) \right| \right] \neq 0 \Longleftrightarrow X _ {j} \in \mathrm {P A} _ {l} (\mathbf {X}), \forall j \in \{1, \dots , d \} \backslash \{l \} \tag {14}
$$
Exploiting Equation 14 to define the inference rule for the edge selection in DAS provides a significant computational advantage with respect to SCORE, reducing the time complexity in the number of nodes from cubic to quadratic.
DiffAN. DiffAN [45] method finds the topological ordering of a DAG exploiting the same criterion of Equation (10) of SCORE: the difference is in that it estimates the score function with probabilistic diffusion models, whereas SCORE, NoGAM, and DAS [24] rely on score matching estimation [21, 22].
4 Key experimental results and analysis
In this section we present our experimental findings on datasets generated according to the misspecified models of Section 3.1.1, with theoretical insights into the performance of score matching-based approaches. We draw our conclusions by comparing the methods' performance against their accuracy in the vanilla scenario and against a random baseline  ${}^{1}$  (defined in Appendix C.10). The results are discussed on datasets of size 1000 for Erdos-Renyi dense graphs with 20 nodes (ER-20 dense), and can be generalized to different size and sparsity configurations. Due to space constraints, we include the plots only for the F1 score and FNR-  $\widehat{\pi }$  ,whereas the false negative and false positive rates are discussed in Appendix I. In order to provide statistical significance to our conclusions, we repeat the experiments on each scenario over 20 datasets generated with different random seeds. To enable a fair comparison between the methods, we fix their hyperparameters to their optimal value with respect to each specific dataset, in the case where these can not be tuned without having access to the ground truth (see Appendix G for a discussion on the tuning of GraNDAG and DiffAN learning hyperparameters). In the Appendix H we analyze the stability of the benchmarked methods with respect to different values of their hyperparameters.
4.1 Can current methods infer causality when assumptions on the data are violated?
Our experimental findings suggest that score matching-based algorithms can robustly infer part of the causal information even in the case of misspecified ground truth data generation.
Post nonlinear model. Figure 1a (right) illustrates the accuracy of topological order estimates on post nonlinear model data. Among the selected methods, NoGAM shows better ability to generalize its performance to this scenario, with FNR-  $\hat{\pi}$  error rate significantly lower than the random baseline. Interestingly, we can interpret this observation in the light of Proposition 1, which defines the score of a leaf in the PNL model: our result indeed suggests that, similarly to the case of an additive noise model, it is possible to learn a consistent approximator of the score of a leaf  $X_{l}$  from the exogenous variable  $U_{l}$  of a post nonlinear model. Notably, we also observe that RESIT order accuracy is better in the PNL scenario than in the vanilla case: Zhang and Hyvarinen [10] show that testing for independent residuals identifies the direction of causal relationships also under the PNL model.
LiNGAM model. Figure 1b (right) shows that NoGAM can infer the causal order with remarkable accuracy in the case of ground truth data generated by a linear non-gaussian additive model. Together with our observations on the post nonlinear model, our empirical evidence corroborates the idea that the NoGAM algorithm is surprisingly robust with respect to the misspecification of the causal mechanisms. Notably, none of the other methods can infer the ordering with accuracy significantly better than the random baseline. This could lead to decreased performance in the realistic setting of mixed linear and nonlinear mechanisms. However, the F1 score in Figure 1b (left) shows that CAM-pruning is still able to correctly infer edges in the graph when these are admitted by the identified causal order. We note that, given that we observed high  $\text{varsortability}^2[50]$  for this model, we display results on data standardized dividing by their empirical variance.
<sup>1</sup>We use the https://github.com/cdt15/lingam implementations of RESIT and DirectLiNGAM, and the DoDiscover implementations of PC, GES, and FCI. For the remaining methods, we consider the GitHub official repositories of their papers and custom implementations.
${}^{2}$  Varsortability of a dataset denotes partial agreement between the ordering induced by the values of marginal variance of the observed variables and the causal ordering of the underlying graphical model. Note that other simple baselines can still recover the causal order after rescaling of the data [49].
PNL model - ER-20 dense
LiNGAM - ER-20 dense
(a) PNL
(b) LiNGAM
Confounded model - ER-20 dense
(c) Latent confounders
Measurement error model - ER-20 dense
(d) Measurement error
(e) Unfaithful distribution
Figure 1: Experimental results on the misspecified scenarios. For each method, we also display the violin plot of its performance on the vanilla scenario with transparent color. F1 score (the higher the better) and FNR-  $\hat{\pi}$  (the lower the better) are evaluated over 20 seeds on Erdos-Renyi dense graphs with 20 nodes (ER-20 dense). FNR-  $\hat{\pi}$  is not computed for GES and PC, methods whose output is a CPDAG. Note that DirectLiNGAM performance is reported in Appendix I.2, on data under non-Gaussian distribution of the noise terms.
(f) Non-iid data distribution
Confounded model. Spurious correlations, that occur when the causal sufficiency is violated, can not be handled by statistical tests for edge selection, as shown by the F1 score of Figure 1c (left) (the amount of confounders is parametrized by  $\rho = 0.2$ ). In this case, we are also interested to see whether the presence of latent confounders can disrupt the inference of the topological ordering when the observed variables have a non-spurious connection in the causal graph. Figure 1c (right) indicates that the score matching-based approaches SCORE, DAS, and NoGAM can still be exploited to find a reliable ordering, while other methods fail to do so.
Measurement error. Given data generated under the model of Equation (6), we observe convergence in distribution  $p(\tilde{X}_i \mid \mathrm{PA}_i) \stackrel{d}{\to} p(X_i \mid \mathrm{PA}_i)$  for  $\gamma \to 0$ . We are then interested in the boundaries of robust performance of each method with respect to increasing values of  $\gamma$ . Figure (1d) (right) illustrates FNR-  $\hat{\pi}$  on datasets with  $\gamma = 0.8$  such that  $\sim 35\%$  of the observed variance of each variable is due to noise in the measurements. Under these conditions, we see that score matching-based approaches display robustness in the inference of the order where all the other methods' capability is comparable to that of the random baseline with statistical significance. This is also reflected in Figure (1d) (left), where SCORE, DAS, and NoGAM are the only algorithms whose F1 score (slightly) improves compared to the random baseline.
Unfaithful model. Figure 1e (right) shows that the ordering procedure of several methods, in particular SCORE, DAS, NoGAM, and GraN-DAG, seems unaffected by direct cancellation of causal effects, in fact displaying a surprising decrease in the FNR-  $\hat{\pi}$  performance with respect to the vanilla scenario. To understand these results, we note that under the occurrence of causal effect cancellations in the ground truth graph  $\mathcal{G}$ , the unfaithful model defined in Section 3.1.1 generates observations of  $\mathbf{X}$  according to a graph  $\tilde{\mathcal{G}}$  whose causal order agrees with that of the ground truth: it
is indeed immediate to see that the causal order of  $X_{i} \to X_{k} \gets X_{j} \gets X_{i}$  also holds for the triplet  $X_{i} \to X_{j} \to X_{k}$ . Moreover, the set of edges of the graph  $\tilde{\mathcal{G}}$  is sparser than that of the ground truth, due to the cancellation of causal effects. Thus, given that inference on sparser graphs is generally easier, it can positively affect the empirical performance, in line with our observations.
Implications. Our experimental findings show that most of the benchmarked methods significantly decrease their performance on the misspecified models. This is particularly problematic since the violations considered in this work are realistic and met on many real-world data. On the other hand, we observe surprising robustness in the inference of score matching-based methods.
4.1.1 Discussion on PC and GES performance
The experimental results of Figure 1 show that the F1 score of GES and PC is consistently worse than random in the setting of Erdős-Renyi dense graphs with 20 nodes. We note that this pertains specifically to large graphs with dense connections, where the accuracy of both methods significantly degrades. In the case of PC, this is in line with previous theoretical findings in the literature: Uhler et al. [7] demonstrate that large and dense graphs are characterized by many quasi-violations of the faithfulness assumptions, which can negatively impact the algorithm's inference ability. In Appendix M we discuss experiments on lower dimensional networks with sparse edge structures, showing that PC and GES report performance significantly better than random across different scenarios. Overall, we find that increasing the size and density of the graph negatively impacts the inference ability of PC and GES.
4.1.2 Discussion on score matching robustness
Our empirical findings indicate that score matching-based methods are surprisingly capable of partial recovery of the graph structure in several of the misspecified scenarios. We connect this robust performance to the decomposition properties of the score function defined in Equations (8) and (9). In particular, we argue that the common factor that enables leaf node identification in NoGAM and SCORE is that the score entry of a leaf is characterized by a smaller magnitude, compared to the score associated with a node that has children in the graph. To explain what we mean by this, we define a simple condition under which it is possible to identify leaf nodes and the causal order of the graph from the variance of the entries of the score function.
Definition 1. Let  $\mathbf{X} \in \mathbb{R}^d$  be a random vector defined by a structural causal model  $\mathcal{M}$  (1). Let  $X_l$  be a leaf node of the causal graph  $\mathcal{G}$ . We say that  $X_l$  is score-identifiable if  $l = \operatorname{argmin}_i \operatorname{Var}[s_i(\mathbf{X})]$ .
Moreover, we say that the model is score-sortable if the recursive identification of score-identifiable leaf nodes in the causal graph and in the subgraphs defined by removing a leaf from the set of vertices up to a source node, yields a correct causal order. SCORE, NoGAM, and DAS present results for consistent inference of the structure of an identifiable graph from properties of the score function and its second order partial derivatives. However, when these conditions are not satisfied, exploitation of score-sortability can heuristically estimate a causal ordering that partially agrees with the causal structure. Intuitively, the variance of the score of a non-leaf node  $s_i(\mathbf{X})$  of Equation (8) is proportional to the number of children in the summation. In particular, the total variance of  $s_i(\mathbf{X})$  is the sum of the marginal variances of the two terms on the RHS of Equation (8), plus their covariance. Errors in the ordering defined with score-sortability are induced only if the variance associated with the score of a non-leaf node can be smaller than the one relative to every leaf of the graph.
Proposition 2. Let  $\mathbf{X} \in \mathbb{R}^d$  be a random vector whose elements  $X_i$  are defined by a structural equation model  $\mathcal{M}$  (1) that satisfies score-sortability. Then, for each subgraph of  $\mathcal{G}$  defined by recursively removing a leaf from the set of vertices up to a source node, there exists a leaf  $X_l$  such that  $\forall i$  index of a node:
$$
\operatorname {V a r} \left[ \partial_ {X _ {l}} \log p _ {l} \left(X _ {l} \mid \mathrm {P A} _ {l}\right) \right] \leq \operatorname {V a r} \left[ \partial_ {X _ {i}} \log p _ {i} \left(X _ {i} \mid \mathrm {P A} _ {i}\right) \right] + \sum_ {k \in \mathrm {C H} _ {i}} \operatorname {V a r} \left[ \partial_ {X _ {i}} \log p _ {k} \left(X _ {k} \mid \mathrm {P A} _ {k}\right) \right] + C,
$$
with  $C\in \mathbb{R}$  accounting for the covariance term.
(See Appendix F for the proof.) Lemma 1 of SCORE defines a similar criterion of sortability of the causal variables on the variance of the second order partial derivatives of the log-likelihood, which is always satisfied when  $\mathbf{X} \in \mathbb{R}^d$  is generated by an ANM with Gaussian distribution of
the noise terms. We can extend these considerations to the NoGAM algorithm, which identifies leaf nodes by minimizing the mean squared error of the predictions of the score entries from the residual estimators of the noise terms, as defined in Equation (13). If we consider an uninformative predictor of the score function that maps every input residual to a constant value zero, the NoGAM algorithm is equivalent to a simple score-sortability heuristic criterion, identifying leaf nodes as the  $\mathrm{argmin}_i\mathbf{E}[s_i^2 (\mathbf{X})]$ . In Appendix I.3 we corroborate our considerations by comparing the empirical performance of a score-sortability baseline with SCORE and NoGAM.
Implications. Score matching-based approaches SCORE, DAS, and NoGAM show empirical robustness in several scenarios included in our benchmark. We impute these results to the structure of the score function discussed in Section (3.2.1), and to the algorithmic design choices of these methods that exploit different magnitude in the score of a leaf compared to other nodes with children in the graph.
4.2 Is the choice of statistical estimators neutral?
In the previous section, we motivated the empirical observations on the robustness of methods based on the score function. Given that the DiffAN algorithm differs from SCORE only in the score estimation procedure (where the former applies probabilistic diffusion models in place of the score matching), we can explain the gap in performance of DiffAN with the other approaches based on the score as an effect of the different statistical estimation technique. From this observation, we suggest that score matching plays a crucial role in connecting the gradient of the log-likelihood with effective causal inference.
Implications. The choice of modular statistical estimator for causal inference procedures is not neutral. We argue that inductive bias in statistical estimators may be connected with good empirical performance, and we think that this potential connection should be further investigated in future works.
In this work we perform a large-scale empirical study on eleven causal discovery methods that provide empirical evidence on the limits of reliable causal inference when the available data violate critical algorithmic assumptions. Our experimental findings highlight that score matching-based approaches can robustly infer the causal order from data generated by misspecified models. It would be important to have procedures for edge detection that display the same properties of robustness in diverse scenarios and to have a better theoretical understanding of failure modes of CAM-pruning variable selection, given its broad use for causal discovery. Finally, we remark that this benchmarking is limited to the case of observational iid samples, and it would be of great practical interest to have equivalent empirical insights on the robustness of methods for causal discovery on sequential data in the setting of time series or passively observed interventions.
We thank Kun Zhang and Carl-Johann Simon-Gabriel for the insightful discussions. This work has been supported by AFOSR, grant n. FA8655-20-1-7035. FM is supported by Programma Operativo Nazionale ricerca e innovazione 2014-2020. FM partially contributed to this work during an internship at Amazon Web Services with FL. FL partially contributed while at AWS.
[1] Jonas Peters, Dominik Janzing, and Bernhard Schlkopf. Elements of Causal Inference: Foundations and Learning Algorithms. The MIT Press, 2017. ISBN 0262037319.
[2] Judea Pearl. Causality. Cambridge University Press, Cambridge, UK, 2 edition, 2009. ISBN 978-0-521-89560-6. doi: 10.1017/CBO9780511803161.
[3] Peter Spirtes. Introduction to causal inference. Journal of Machine Learning Research, 11(54): 1643-1662, 2010. URL http://jmlr.org/papers/v11/spirtes10a.html.
[4] P. Spirtes, C. Glymour, and R. Scheines. Causation, Prediction, and Search. MIT press, 2nd edition, 2000.
1 Introduction 1
2 The causal model 2
2.1 Problem definition 3
2.2 Identifiable models 3
3 Experimental design 3
3.1 Datasets 3
3.1.1 Misspecified scenarios 4
3.1.2 Data generation 5
3.2 Methods 5
3.2.1 Deepdive on SCORE, NoGAM and DiffAN 6
4 Key experimental results and analysis 7
4.1 Can current methods infer causality when assumptions on the data are violated? 7
4.1.1 Discussion on PC and GES performance 9
4.1.2 Discussion on score matching robustness 9
4.2 Is the choice of statistical estimators neutral? 10
5 Conclusion 10
6 Acknowledgements 10
A Assumptions connecting causal and statistical properties of the data 15
A.1 Global Markov Property 15
A.2 Causal faithfulness 16
A.3 Causal sufficiency 16
B Details on the synthetic data generation 16
B.1 Nonlinear causal mechanisms 16
B.2 Non-Gaussian distribution of the noise terms 16
B.3 Algorithms for random graphs simulation 16
B.4 Modeling of unfaithful distributions 17
B.5 Dataset configurations 17
C Benchmark methods 18
C.1 CAM 18
C.2 RESIT 19
C.3 GraN-DAG 19
C.4 DirectLiNGAM 19
C.5 PC 20
C.6 GES 20
C.7 SCORE 20
C.8 NoGAM 21
C.9 DAS 21
C.10 Random Baseline 21
D Metrics definition 22
E Possible generalisation of NoGAM to the PNL model 22
E.1 Proof of Proposition 1 22
E.2 Discussion 23
F Proof of Proposition 2 23
G Tuning of the hyperparameters in the experiments 23
H Stability with respect to hyperparameters choices 24
I Other experimental results on Erdos-Renyi graphs 25
I.1 The effect of non-iid distribution of the data 25
I.2 Experiments under arbitrary distribution of the noise terms 25
I.3 Experiments with score-sortability 25
J Experiments on SF, GRP, and FC graphs 28
J.1 Experiments on Scale-free graphs 28
J.2 Experiments on fully connected graphs 28
J.3 Experiments on GRP graphs 28
K Other results 29
L FCI experiments on confounded graphs 31
M Deep-dive in PC and GES experimental results 33
A Assumptions connecting causal and statistical properties of the data
In this section, we describe in detail several crucial assumptions for causal discovery.
A.1 Global Markov Property
Causal discovery from pure observations requires assumptions that connect the joint distribution of the data with their underlying causal structure. The Markov factorization of the distribution (2) allows interpreting conditional independencies of the graph  $\mathcal{G}$  induced by the model  $\mathcal{M}$  as conditional independencies of the joint distribution  $p_{\mathbf{X}}$ . This is known as the Global Markov Property of the distribution  $p_{\mathbf{X}}$  with respect to the graph  $\mathcal{G}$ .
Definition 2. A distribution  $p_{\mathbf{X}}$  satisfies the Global Markov Property with respect to a DAG  $\mathcal{G}$  if:
$$
\mathbf {X} _ {A} \perp \mathbb {g} \mathbf {X} _ {B} \mid \mathbf {X} _ {S} \Rightarrow \mathbf {X} _ {A} \perp \mathbb {1} _ {p \mathbf {x}} \mathbf {X} _ {B} \mid \mathbf {X} _ {S}, \tag {15}
$$
with  $\mathbf{X}_A, \mathbf{X}_B, \mathbf{X}_S$  disjoint subsets of  $\mathbf{X}$ ,  $\perp_{\mathcal{G}}$  denoting  $d$ -separation in the graph  $\mathcal{G}$ , and  $\perp_{p_{\mathbf{X}}}$  denoting independency in the joint distribution  $p_{\mathbf{X}}$ .
A.2 Causal faithfulness
A distribution  $p_{\mathbf{X}}$  that satisfies the Global Markov Property, decomposes according to the Markov factorization of Equation (2) [51]. If the inverse holds, then we can consider the conditional independencies observed in the distribution  $p_{\mathbf{X}}$  to be valid conditional independencies in the graph  $\mathcal{G}$ :
$$
\mathbf {X} _ {A} \perp_ {p _ {\mathbf {X}}} \mathbf {X} _ {B} \mid \mathbf {X} _ {S} \Rightarrow \mathbf {X} _ {A} \perp_ {\mathcal {G}} \mathbf {X} _ {B} \mid \mathbf {X} _ {S}. \tag {16}
$$
If (16) is satisfied, we say that  $p_{\mathbf{X}}$  is faithful to the causal graph.
A.3 Causal sufficiency
Another fundamental assumption is the absence of unmeasured common causes in the graph. Reichenbach principle [8] defines a connection between statistical and causal associations. The principle states that given the statistical association between two variables  $X, Y$ , then there exists a variable  $Z$  that causally influences both explaining all the dependence such that conditioning on  $Z$  makes them independent. Causal sufficiency assumes that  $Z$  coincides with one between  $X$  and  $Y$ : resorting to the model of Equation (1), this means that for each pair  $X_{i}, X_{j}$  there are no latent common causes.
Under the assumption of causal sufficiency of the graph and faithful distribution, we can use conditional independence testing to infer the Markov Equivalence Class of the causal graph  $\mathcal{G}$  from the data.
B Details on the synthetic data generation
B.1 Nonlinear causal mechanisms