Abstract
Machine learning promises to revolutionize clinical decision making and diagnosis. In medical diagnosis a doctor aims to explain a patient's symptoms by determining the diseases causing them. However, existing diagnostic algorithms are purely associative, identifying diseases that are strongly correlated with a patients symptoms and medical history. We show that this inability to disentangle correlation from causation can result in sub-optimal or dangerous diagnoses. To overcome this, we reformulate diagnosis as a counterfactual inference task and derive new counterfactual diagnostic algorithms. We show that this approach is closer to the diagnostic reasoning of clinicians and significantly improves the accuracy and safety of the resulting diagnoses. We compare our counterfactual algorithm to the standard Bayesian diagnostic algorithm and a cohort of 44 doctors using a test set of clinical vignettes. While the Bayesian algorithm achieves an accuracy comparable to the average doctor, placing in the top 48% of doctors in our cohort, our counterfactual algorithm places in the top 25% of doctors, achieving expert clinical accuracy. This improvement is achieved simply by changing how we query our model, without requiring any additional model improvements. Our results show that counterfactual reasoning is a vital missing ingredient for applying machine learning to medical diagnosis.
Introduction
Most contemporary medical AI systems are "associative." Whether utilizing Deep Learning or Bayesian Networks, these systems typically calculate the probability of a disease given a set of symptoms: $P(\text{Disease} | \text{Symptoms})$. However, this approach is fundamentally limited because correlation does not equal causation. For instance, emphysema is strongly correlated with chest pain because both are prevalent in smokers, yet emphysema does not cause chest pain. An associative model might incorrectly rank emphysema highly when presented with "chest pain" and "smoker," failing to identify the actual cause of the patient's distress.
This "causal confounding" significantly hinders differential diagnosis, where multiple diseases compete to explain a patient's presentation. While human clinicians naturally reason about the underlying causes of symptoms, traditional algorithms have historically focused on statistical correlations.
Methods: Moving Up the Ladder of Causation
To address these limitations, we propose reformulating diagnosis as a counterfactual inference task, moving to the highest level of Judea Pearl’s "Ladder of Causation." Instead of simple probability, we derive two new causal measures:
- Expected Disablement ($E_{dis}$): The expected number of current symptoms that would disappear if the disease $D$ were cured.
- Expected Sufficiency ($E_{suff}$): The expected number of symptoms that would persist due to disease $D$ alone if all other possible causes were removed.
These measures are computed efficiently using Twin Networks, which create parallel "factual" and "counterfactual" copies of the model sharing latent variables. This allows the algorithm to account for a patient's specific state while simulating hypothetical interventions. Notably, this approach is backward compatible; it utilizes the same 3-layer Noisy-OR Bayesian Network structure as standard associative models, changing only the mathematical query used for ranking.
Evaluation
The algorithms were evaluated using a comprehensive test set of 1,671 clinical vignettes—simulated patient cases authored and verified by medical experts to provide a reliable ground truth. We also established a human benchmark by having a cohort of 44 doctors independently diagnose the same vignettes. The underlying model is a large-scale diagnostic Bayesian Network covering hundreds of diseases and thousands of symptoms and risk factors.
Results and Discussion
The counterfactual algorithm achieved a significant performance boost without any modifications to the underlying disease model or data. It achieved 77.26% accuracy, outperforming the standard associative (Bayesian) algorithm's 72.52%.
When compared to human clinicians, the standard AI performed similarly to the average doctor (71.40% accuracy, placing in the top 48%). In contrast, the counterfactual AI reached "expert" levels, placing in the top 25% of the doctor cohort.
The superiority of the counterfactual approach was most pronounced in rare diseases. Associative models are often biased by "priors" (common diseases), whereas counterfactual reasoning focuses on which disease provides the best causal explanation for the specific symptoms present. For rare and very rare diseases, the counterfactual algorithm improved accuracy by 29.2% and 32.9% respectively over the associative model. Furthermore, by disentangling correlation from causation, the counterfactual approach enhances safety by avoiding misleading associations.
Conclusion
Our findings demonstrate that counterfactual reasoning is a vital component for applying machine learning to medical diagnosis. While the current method relies on the accuracy of the underlying Directed Acyclic Graph (DAG), it offers a powerful way to "interrogate" existing medical knowledge. Future work will focus on handling the noise and missing data inherent in real-world Electronic Health Records (EHRs) and exploring how such systems can best serve as a "causal" second opinion for clinicians.
Summary updated