Table of Contents
Fetching ...

Counterfactual Causal Inference in Natural Language with Large Language Models

Gaël Gendron, Jože M. Rožanec, Michael Witbrock, Gillian Dobbie

TL;DR

This work tackles the problem of extracting causal structure from unstructured natural language and performing counterfactual inference. It introduces an end-to-end framework that uses LLMs to extract instantiated causal graphs from text, merges graphs across sources, and then applies a structural causal model–based counterfactual inference pipeline with LLM-driven inference. Experiments on synthetic data (Cladder) and real-world news demonstrate that LLMs can recover the graph structure, but the reasoning/prediction step remains the bottleneck, highlighting the need for more robust causal inference within LLMs. The approach offers interpretable, auditable causal reasoning from text and points to future directions such as counterfactual self-learning and ground-truth counterfactual data to enable more reliable real-world causal analysis and strategic foresight.

Abstract

Causal structure discovery methods are commonly applied to structured data where the causal variables are known and where statistical testing can be used to assess the causal relationships. By contrast, recovering a causal structure from unstructured natural language data such as news articles contains numerous challenges due to the absence of known variables or counterfactual data to estimate the causal links. Large Language Models (LLMs) have shown promising results in this direction but also exhibit limitations. This work investigates LLM's abilities to build causal graphs from text documents and perform counterfactual causal inference. We propose an end-to-end causal structure discovery and causal inference method from natural language: we first use an LLM to extract the instantiated causal variables from text data and build a causal graph. We merge causal graphs from multiple data sources to represent the most exhaustive set of causes possible. We then conduct counterfactual inference on the estimated graph. The causal graph conditioning allows reduction of LLM biases and better represents the causal estimands. We use our method to show that the limitations of LLMs in counterfactual causal reasoning come from prediction errors and propose directions to mitigate them. We demonstrate the applicability of our method on real-world news articles.

Counterfactual Causal Inference in Natural Language with Large Language Models

TL;DR

This work tackles the problem of extracting causal structure from unstructured natural language and performing counterfactual inference. It introduces an end-to-end framework that uses LLMs to extract instantiated causal graphs from text, merges graphs across sources, and then applies a structural causal model–based counterfactual inference pipeline with LLM-driven inference. Experiments on synthetic data (Cladder) and real-world news demonstrate that LLMs can recover the graph structure, but the reasoning/prediction step remains the bottleneck, highlighting the need for more robust causal inference within LLMs. The approach offers interpretable, auditable causal reasoning from text and points to future directions such as counterfactual self-learning and ground-truth counterfactual data to enable more reliable real-world causal analysis and strategic foresight.

Abstract

Causal structure discovery methods are commonly applied to structured data where the causal variables are known and where statistical testing can be used to assess the causal relationships. By contrast, recovering a causal structure from unstructured natural language data such as news articles contains numerous challenges due to the absence of known variables or counterfactual data to estimate the causal links. Large Language Models (LLMs) have shown promising results in this direction but also exhibit limitations. This work investigates LLM's abilities to build causal graphs from text documents and perform counterfactual causal inference. We propose an end-to-end causal structure discovery and causal inference method from natural language: we first use an LLM to extract the instantiated causal variables from text data and build a causal graph. We merge causal graphs from multiple data sources to represent the most exhaustive set of causes possible. We then conduct counterfactual inference on the estimated graph. The causal graph conditioning allows reduction of LLM biases and better represents the causal estimands. We use our method to show that the limitations of LLMs in counterfactual causal reasoning come from prediction errors and propose directions to mitigate them. We demonstrate the applicability of our method on real-world news articles.
Paper Structure (24 sections, 1 equation, 5 figures, 8 tables)

This paper contains 24 sections, 1 equation, 5 figures, 8 tables.

Figures (5)

  • Figure 1: Overview of the proposed framework. (1) An LLM extracts causal variables and their corresponding causal relationships from the input text. (2) Multiple graphs are generated and merged into a single graph if multiple text snippets are given in input. (3) The resulting causal graph is edited using ablation, intervention, and prediction steps to build counterfactual instantiations. The LLM performs inference given the variables' parent values. (4) The LLM self-evaluates the original and counterfactual graphs.
  • Figure 2: Counterfactual inference steps. (\ref{['fig:fact_graph']}) The original causal graph. (\ref{['fig:abduction_step']}) We estimate the possible values of the exogenous factors, here $U$, from the observations. (\ref{['fig:intervention_step']}) We perform the $do(X=x)$ operation. (\ref{['fig:prediction_step']}) We predict the values of the remaining variables given their parent causes. Here, $X$ and $U$ are known. $B$, $A$ and $Y$ should be predicted. (\ref{['fig:optimised_inference']}) However, to maintain efficiency, we consider a single possible value per exogenous factor and re-compute only the variables affected by the intervention: here $\textcolor{NavyBlue}{B}$ is unaffected and not re-computed.
  • Figure 3: Example of counterfactual query from the Cladder dataset. (left) The context and question description in natural language as provided to the model. (right) The corresponding ground-truth and counterfactual causal graph with (H) a hidden confounder, unlike in real-world situations, its value is given in the dataset and thus shown in blue, (C) coffee drinking, and (S) a high or low salary. All causes affecting the system are mentioned. Intervention is shown in yellow.
  • Figure 4: Partition of the Counterfactual-CI models results between correct, incorrect answers and errors. Errors in grey are not considered as counterfactual reasoning errors but as instruction errors and are not considered in the results of Table \ref{['tab:cladder_results']}. Models can usually generate the causal structure and conduct inference. GPT-4-1106 and LLaMA-3.1 show a lower capacity to follow instructions and generate structured outputs. Models also often require to have their response parsed to extract the answer, particularly GPT-4o-$\mathcal{G}_{gt}$.
  • Figure 5: Illustration of graph merging process for two models $\mathcal{M}_1$ and $\mathcal{M}_2$. We assume that the common variable $Z$ is the same in the two graphs and should be combined. Figure \ref{['fig:merged_ab_summarisation']} shows the merged graph using summarisation: $Z$ is shared by the two mechanisms. Figure \ref{['fig:merged_ab_analogy']} shows the merged graph using analogy: the variables $Z_1$ and $Z_2$ from $\mathcal{M}_1$ and $\mathcal{M}_2$ remain separated but share a common ancestor.