TL;DR
Using Large Language Models (LLMs) to build causal graphs via pairwise questions ("Does A cause B?") often fails because they cannot distinguish direct from indirect effects, leading to logical contradictions and cycles. This paper proposes eliciting causal order (topological sorting) instead of full graphs, introducing a novel "triplet prompting" method that enforces local acyclicity. This approach significantly reduces structural errors, allowing smaller open-source models like Llama-3 to outperform GPT-4 on causal discovery tasks.
What Problem Does This Paper Address?
Causal discovery—identifying the web of cause-and-effect relationships within a system—is a foundational challenge in data science. Recently, researchers have attempted to use LLMs as virtual domain experts by asking them pairwise questions like "Does variable A cause variable B?".
However, the authors highlight a fundamental limitation: given just a pair of variables, even a perfect human expert cannot reliably distinguish between a direct effect ($A \rightarrow B$) and an indirect effect ($A \rightarrow C \rightarrow B$) without knowing the full context of the other variables in the system. When forced to construct a full graph from isolated pairwise queries, LLMs frequently introduce erroneous edges and create illegal causal cycles (e.g., A causes B, B causes C, and C causes A), rendering the resulting graph useless for downstream causal inference.
Methods
The authors introduce two core innovations to solve this problem:
- Causal Order as the Output Interface: Instead of trying to map out every single direct edge, they shift the goal to finding the causal order (the topological ordering of variables). Causal order is highly stable because it doesn't care if an effect is direct or indirect; it simply establishes that a cause must precede its effect.
- The Triplet Method: Instead of querying pairs, the algorithm queries triplets of variables $(A, B, C)$. The LLM is instructed to determine the causal relationships among all three while strictly avoiding cycles within that local triplet.
Because each pair appears in multiple triplets alongside different auxiliary variables, the method generates multiple overlapping perspectives. A majority-voting ensemble aggregates these triplet responses, resolves conflicts, and extracts a clean, global causal order.
Datasets
The method was evaluated across two categories of benchmarks:
- Standard Causal Graphs (BNLearn): Earthquake, Cancer, Survey, Asia, and Child.
- Real-World Medical Graphs: To address potential LLM memorization concerns, the authors tested on complex, expert-curated medical datasets created after the training cutoff dates of the models: Neuropathic Pain Diagnosis, Alzheimers Dataset, and Covid-19 Dataset.
Key Insights and Ideas
- Graphs are the wrong interface for imperfect experts: Evaluating an LLM's causal knowledge using standard graph metrics like Structural Hamming Distance (SHD) unfairly penalizes them for mixing up direct and indirect paths, even if their underlying causal logic is sound. Causal order provides a much fairer, more stable metric.
- Local context prevents global failure: Introducing a third "auxiliary" variable provides just enough context for the LLM to self-correct and maintain acyclicity.
- Prompting geometry beats model scale: Clever structuring of the prompt space (triplets + ensembling) allows lightweight, open-source models (like Phi-3 3.8B and Llama-3 8B) to beat massive proprietary models (GPT-4) running naive pairwise prompts.
Key Results
- Drastic Cycle Reduction: On the 20-node Child dataset, standard pairwise prompting with GPT-3.5 produced over 3,000 causal cycles. The triplet method reduced this to exactly zero.
- Smaller Models Win: Llama-3 8B using the triplet method achieved a topological divergence ($D_{top}$) of 12 on the Child dataset, completely outclassing GPT-4's pairwise baseline, which failed to compute a valid order due to generating over 10,000 cycles.
- Downstream Utility: Feeding the triplet-derived causal order as a prior constraint into classical causal discovery algorithms (like PC or CaMML) consistently reduced structural errors and significantly improved the accuracy of Average Causal Effect (ACE) estimations.
Limitations and Future Work
- Computational Complexity: Iterating over all triplets scales at $O(n^3)$. While the authors propose a localized variant that bounds this to $O(k \cdot n^2)$ using a fixed number of neighbors $k$, it remains more expensive than simple pairwise querying.
- Boundaries of LLM Knowledge: This method relies entirely on the domain knowledge latent within the LLM's weights. It cannot discover entirely novel causal relationships or handle variables with completely anonymous names.
- Counterfactual Limitations: While causal order is sufficient for identifying valid backdoor adjustment sets, it is insufficient for counterfactual estimation, which still strictly requires a fully specified structural equation graph.
Summary updated