Counterfactual Reasoning in AI

What is Counterfactual Reasoning in AI?

Counterfactual reasoning in AI is a method where artificial intelligence analyzes “what-if” scenarios to predict how changing one variable could affect an outcome. By exploring alternative possibilities based on historical data, it helps AI make decisions, explain predictions, detect biases, and improve transparency, personalization, and safety in applications ranging from finance to self-driving cars.

The Basic Idea

Imagine rushing to your gate at the airport, only to arrive just a few minutes after it's closed. Frustrated that you’ve missed your flight, you may stand there for a moment thinking:

“If I’d woken up ten minutes earlier, would I still have missed my flight?”

“If I’d skipped breakfast, I bet I’d be on that plane right now.”

“Would I still have missed my flight if I had taken a taxi instead of public transit?”

“If security had been faster, I would have made it on time.”

Those thoughts are your brain conducting counterfactual reasoning: asking and answering “what if” questions. You are imagining alternative scenarios by changing just one detail of what actually happened, and reasoning if it would have led to a different outcome. You’re exploring the causal relationships between variables to judge how much they affected your gate arrival time. 

Thanks to recent advancements in machine learning and artificial intelligence (AI), computers are now also able to conduct counterfactual reasoning for some scenarios.

NO EASY CHOICES • EPISODE 1

No Easy Choices with Tom Griffiths

Dr. Tom Griffiths

Author, The Laws of Thought

“

We're not building a mirror of ourselves - and maybe that's not the goal. We're building something completely new for completely different purposes.

Counterfactual reasoning in AI involves estimating the potential outcomes if different decisions or actions were taken. It can help brands try to find causal relationships, like understanding if their recent marketing campaign is responsible for increased sales. It can help healthcare workers determine the best treatment plans by predicting how a change in medication or action will affect the outcome, or explore rare or dangerous situations for self-driving cars to evaluate how the technology would perform in these circumstances. The ability of AI to apply counterfactual reasoning takes it another step closer to mimicking human intelligence.1

“

“Counterfactual explanations are essential in bridging the gap between AI decision-making and human understanding, offering clear insights into how small changes in inputs could lead to different outcomes. This approach increases transparency, builds trust, and supports ethical AI practices."


— Bobby Zarkov, partner in financial services for KPMG Switzerland.2

Key Terms

Counterfactual Reasoning: The cognitive process of considering alternative hypothetical scenarios that did not happen, but could have, to determine if they would have impacted the outcome. It’s the “what if” thinking we often do to investigate whether there is a causal relationship between a decision or action and a result. Up until recently, this was considered a uniquely human tendency, but AI is beginning to be able to apply counterfactual reasoning to help solve problems.3

Causal Inference: The process of determining a cause-and-effect relationship between variables by examining the impact that a variable has on an outcome. Counterfactual reasoning can support us in finding causal inference as it provides insight into how changing the variable would affect the result. 

Artificial Intelligence (AI): Tools and algorithms that train computers and machines to process and analyze data in a way that mimics human intelligence. Recent advancements in AI have enabled it to conduct counterfactual reasoning with the support of causal models and well-defined tasks. 

Structural Causal Models: Mathematical frameworks used in statistics and machine learning to map out how variables interact and influence one another. It allows us, and computers, to imagine alternative scenarios and realities and determine causation.4 

Transparency/Explainability: The degree to which information about how AI systems work and make decisions is available and understandable to users. When AI can explain its counterfactual reasoning, we can more easily understand how it arrived at its decision and better interpret complex models, which builds trust.2

History

The process of imagining “what if” scenarios has long been studied in philosophy and psychology. Ancient philosophers considered conditional statements in logic, distinguishing between what is and imagining what could have been. They explored how people may behave under different laws or conditions, launching our exploration into alternative realities.

In psychology, researchers have explored how people make sense of the world around them by mentally envisioning both reality and its counterfactual alternatives, which can help people identify what has led to their current state or decisions that can lead to different realities. Counterfactual reasoning can help us learn from experience, and often has a strong emotional impact. For example, if you weren’t in the mood to socialize but dragged yourself to a party anyway, where you ended up meeting your future husband, you would likely feel gratitude when considering “What if I hadn’t gone to the party?”5

In 1982, psychologists Daniel Kahneman and Amos Tversky conducted some of the first studies to better understand the cognitive process of counterfactual thinking. They wanted to understand how people decide which events or alternatives to apply “what if” thinking to and the emotional impact that it had.6 Through their studies, they proposed the simulation heuristic—the more easily we can imagine alternative realities, the more likely we are to think they could have occurred, and the stronger the emotional impact. For example, you’re more likely to feel angry or guilty for missing a flight by five minutes than by thirty, because you can easily imagine how tweaking a variable could have led to an on-time arrival at the airport.7

Around the same time, counterfactual reasoning was being formalized into mathematical frameworks. While previously, statistical models had focused on correlations, Israeli-American computer scientist and philosopher Judea Pearl developed a causal inference framework in the 1990s that could represent causal relationships within a system. The model used three main tools:8

  • Directed acyclic graphs: Visual maps of variables, represented as nodes, with arrows that show causal relationships. If there is an arrow between variables, it means that a variable has a direct influence on another.
  • Structural causal models: Turning directed acyclic graphs into mathematical functions by determining the percentage to which each variable contributes to an outcome, plus a degree of randomness. For example, if the outcome is “grades,” the mathematical equation may be “study hours + intelligence + randomness.”
  • Do-calculus: A set of rules for calculating causal relationships from real-world data, so that when we input values for each variable, it calculates the outcome. For example, if we add in 10 study hours and an IQ of 120, it can predict the grade someone would receive. Do-calculus is able to calculate causal effects even when there are confounding variables.

Pearl's causal inference framework allowed psychologists and economists to infer causation from observable data to make better decisions. For example, it could help answer the question “If the government raises the minimum wage, will the rate of unemployment increase or decrease?” As technological advancements were made, computing power increased, and greater amounts of data became available, the framework also allowed AI to mimic counterfactual reasoning. Previously, AI could only find correlation in historical data to predict the likelihood of an outcome occurring, to simulate interventions and address more sophisticated questions.9 

By encoding causal reasoning layers into machine learning models, AI could now represent cause-and-effect relationships between variables. It can answer questions in the form of “If we change X, how will it affect Y?”10 It analyzes historical data to find underlying causal relationships between variables to help answer why the patterns exist. Counterfactual reasoning in AI carries with it immense potential: it can help us explore hundreds or thousands of alternative scenarios quickly, identify the key variables that actually contribute to an outcome, and make better decisions overall.9

behavior change 101

Start your behavior change journey at the right place

People

Daniel Kahneman

An Israeli-American psychologist often referred to as “the father of behavioral science” for his contributions demonstrating how cognitive heuristics and biases impact decision-making. Through his research, he explored why and how these mental tricks cause our decisions to deviate from perfect rationality. One of his most significant contributions was his suggestion of a dual-process model of cognition, with “System 1” thinking being fast and intuitive, while “System 2” requires more deliberate effort. Counterfactual reasoning is part of  “System 2” thinking, as it requires complex mental simulations and consciously stepping outside reality. In 1982, alongside his long-term research partner Amos Tversky, he developed the simulation heuristic to describe that people will have a more significant emotional response when they can easily imagine “what if” scenarios that could have occurred.

Amos Tversky

An Israeli cognitive psychologist who, alongside Daniel Kahneman, showed that there are a number of heuristics and biases that cause people to deviate from perfect rationality and logic. Tversky applied his research to economics, to show that the models of Homo economicus—based on the belief that people’s actions are driven by utility maximization—usually did not reflect real-life behavior. He is well known for his contributions to prospect theory, which showed that the emotional impact of losses is felt greater than equivalent gains. To better understand when and how counterfactual reasoning worked, he conducted a series of experiments with Daniel Kahneman in 1982, which revealed the simulation heuristic. 

Judea Pearl

An Israeli-American computer scientist and philosopher who won the A.M. Turing Award, the highest distinction in computer science, in 2011 for his “fundamental contributions to artificial intelligence.” While historically, machines were unable to mimic the messiness involved in real-life decision-making, Pearl developed models and networks that allowed machines to make decisions under uncertainty. Pearl developed the Bayesian network, a diagram that represents the probabilistic relationships between variables based on available evidence, and structural causal models that provided a mathematical framework to embed counterfactual reasoning into artificial intelligence.11

Impacts 

Counterfactual reasoning in AI has far-reaching consequences for how we understand and interact with technology. By exploring “what-if” scenarios, it makes AI predictions more interpretable, actionable, and tailored to real-world decision-making.

Transparency for ethical AI

One of the hesitations surrounding the use of artificial intelligence has been that we often don’t understand how it arrives at its decisions. When a tool seems to think and perceive the world differently from the way humans do, we label it as alien and tend to distrust it. Embedding counterfactual reasoning in AI can enhance clarity and turn its predictions into understandable narratives, gaining our trust. Transparency is an important aspect of ensuring we use AI responsibly and ethically.

For example, imagine an AI tool that determines whether or not someone is approved for a loan. Without counterfactual reasoning, it would explore historical data to see whether someone with your usual income and credit would be approved for the requested size. But all you would get is a “yes” or “no.” With counterfactual reasoning, it can imagine alternative scenarios with different inputs. It would be able to generate an output that said, “If your income was $10,000 higher, or your debt was reduced by $5,000, your loan would be approved.” It demonstrates the causal relationship between the variables income and credit, providing greater transparency regarding how decisions are made and what actions can be taken to get a more favorable answer.2

Enabling decisions for unusual cases

AI analyzes historical data to detect patterns and use them to make predictions. Without counterfactual reasoning, it can only explore correlations between data points that it has already been trained on, which means that it has difficulty making accurate predictions for unusual or rare situations that lie outside of the range of data. These cases are known as “edge cases” and can be very important in certain fields where an occurrence in an extreme operating parameter could have disastrous results if the technology does not perform well. Counterfactual reasoning in AI can support decision-making for edge cases, as it can explore those rare “what-if” scenarios.

Edge cases are important for training AI in self-driving cars. Being prepared for rare situations—such as a child running in front of a vehicle, or extreme weather conditions—can be a matter of life or death, so it’s important that self-driving cars are trained through counterfactual reasoning to test even unlikely circumstances and know how to respond. These are difficult scenarios to test in the real world, so our ability to use counterfactual reasoning in AI to simulate edge cases can lead to the development of safer tools.12 

Allowing more personalized recommendations

One of the most exciting aspects of using AI across fields is its ability to provide personalized recommendations. This is possible thanks to the age of big data, where computers can quickly analyze vast amounts of information on a person’s demographics, past behavior, and preferences, to predict what they will want next or what course of action will lead to the most optimal outcome. Personalized recommendations go beyond product suggestions as you browse social media, or recommended shows to watch next on streaming platforms—it can also tailor treatment plans based on a patients’ specific history and circumstances, or structure a financial plan based on spending behavior and financial goals.

Counterfactual reasoning in AI takes personalized recommendations a step further by understanding not just what users have historically liked or benefited from, but what recommendation is optimal based on current circumstances or how their preferences have changed over time. It is able to achieve this through establishing causal relationships to understand how an outcome may change if a variable is altered.13 For example, if a patient is considering starting a blood pressure medication, through counterfactual reasoning, AI can predict how their behavior, such as diet and exercise, should adjust based on the new medication, instead of only being based on how their historical behavior patterns have affected their health outcomes.

Controversies 

While counterfactual reasoning in AI promises clarity, causality, and transparency, critics debate whether these tools truly reveal cause-and-effect and enhance our understanding, or simply reinforce biases in decision-making.

Can AI really identify causal relationships?

The idea behind counterfactual reasoning in AI is that it can identify causal relationships between variables to imagine alternative scenarios and outcomes if variables change. However, critics argue that this assumption may be inaccurate. AI’s use of counterfactuals can only reflect what it has learned from historical data, which means that immeasurable data, which may contribute to an outcome, is not reflected in its predictions.

Most outcomes are driven by multiple, interdependent variables. Imagine, for example, that you are trying to find ways to boost your employees’ productivity. You use AI and counterfactual reasoning to identify how a change in one variable affects productivity, and the model shows that decreasing the number of meetings and upgrading incentive structures will increase productivity. These are measurable variables, but what about other considerations like team dynamics and personal motivation? These are much harder to measure, so even if you decrease meeting hours or create a more appealing bonus structure, there’s no guarantee you’d see a boost in productivity. If the model cannot guarantee that changing variable X or Y will lead to the desired outcome Z, is it really demonstrating a causal relationship?

Does counterfactual reasoning in AI actually increase transparency?

One of the benefits of using counterfactual reasoning in AI is to increase transparency by making its thought process and decisions clearer to the user. In a move towards more responsible and ethical use of AI, there are legal frameworks that now require organizations to highlight the way an AI tool arrived at its decision. However, satisfying these regulatory frameworks may not require an in-depth explanation.

For example, when making a decision about granting a loan, a financial system may use AI and counterfactual reasoning to identify how much each variable contributed to its final decision. It may say “This loan was denied based on credit score (20%), income (50%), and employment history (30%)” suggesting transparency. But what does that really tell us about why these variables were weighed the way they were? For example, it doesn’t reveal why their income was considered so heavily. While it may show which factors are most important for the decision, it does not illuminate the underlying rationale. This can leave users—and even regulators—uncertain about the true reasoning behind the decision, highlighting the limits of transparency in AI-driven counterfactual reasoning.14

Do we risk falling victim to the automation bias?

As we’ve explored, while counterfactual reasoning is believed to identify causal relationships and provide clarity on the mechanisms behind the decision-making process AI takes, we may be overstating the transparency of counterfactual reasoning in AI. Misplaced trust in AI can cause us to use the tools without an appropriate level of skepticism and oversight, which leads to automation bias.

Automation bias describes an overreliance on computer systems and AI, causing us to blindly accept their recommendations and rationale without critical evaluation. We must remember that AI often inherits the bias embedded within the historical data that it is trained on, and therefore, its predictions are also biased. For example, for a credit loan, counterfactual reasoning may suggest that the reason someone didn’t get their loan approved was because of their income level. What it doesn’t explain is that in training on historical data, it has inherited a bias of presuming increased risk of individuals from certain neighborhoods, as this neighborhood is home to higher proportion of racialized minorities. The counterfactual may suggest that an applicant would have been approved if their income were higher, while masking the systemic bias embedded in training data. While its assumption reflects historical patterns of loan approval, if we fail to critically consider that the model itself may be built on flawed associations, we continue to perpetuate bias through an over-reliance on automated systems.

Case Studies

Uncovering the best predictors of cannabis intoxication 

Over the past few years, some countries have legalized the recreational use of cannabis, leading to increased access to cannabis amongst young adults, which raises concerns about the negative health impacts. Advancements in AI have already led to technologies that can predict behaviors associated with substance use, which can help identify at-risk individuals and trigger preventative measures. Some of these tools include mobile and wearable sensors that measure background noise, heart rate, and sleep quality, all of which may indicate someone is under the influence. However, the lack of transparency in AI models has posed a challenge, keeping us in the dark about how they make predictions. That makes it difficult to understand causal relationships between variables and substance abuse, which impacts the accuracy of predicting at-risk individuals, or which intervention will work best under different circumstances.

Researchers working at the intersection of mobile sensing, machine learning, and explainable AI conducted a study to explore how counterfactual reasoning in AI can improve understanding of how behavior and physical health impact cannabis use, determine which factors matter most and may indicate an individual at risk of cannabis intoxication, and explore “what-if” scenarios to guide personalized interventions. This is especially important for substance use, as people respond to alcohol and cannabis differently. The researchers collected data via a mobile sensing app and Fitbit from 34 participants, including individuals who use cannabis and those who do not. By analyzing background noise, they were able to infer what kind of environments people tend to use cannabis in (for example, louder background noise suggests cannabis was being used in public spaces), and through the analysis of health indicators like heart rate and sleep quality, they could understand the effects of cannabis use.

The researchers then fed all of this data into AI models with decision trees and counterfactual reasoning frameworks to create a cannabis clinical prediction system that shows how individual behaviors and conditions influence the effects of cannabis, guiding tailored interventions. This study shows how leveraging counterfactual reasoning in AI can turn complex data into understandable and personalized guidance, enabling practitioners to make more informed decisions about patient care and interventions.15

Revealing bias in hiring decisions

Increasingly, AI is being used to make the hiring process more efficient, from analyzing resumes to developing candidate assessments from video interviews. Although AI can sometimes replicate the same kind of bias as humans, using counterfactual reasoning, it may also be able to illuminate the level of bias in its own assessments.

In a 2025 study, researchers introduced a counterfactual-based framework to understand whether AI candidate assessments from video interviews were influenced by protected characteristics—demographic characteristics that a company cannot legally use to discriminate against a candidate—such as age, gender, or race. It embedded counterfactual reasoning to imagine “what-if” scenarios to generate alternative versions of each applicant, modifying protected characteristics while keeping other factors consistent, such as employment and educational history, to see if it would impact the assessment. It represented these changes in video form to keep the method of assessment consistent. 

The researchers found that the tool was in fact taking these protective characteristics into consideration for its decisions on whether or not to recall candidates. For example, when the candidate was changed from a male to a female, this decreased recall by 62%. This study is an example of how counterfactual reasoning can be used as a fairness auditing framework in AI to detect and mitigate biases.16

Related TDL Content

“If Only”: The Good and the Bad of Counterfactuals

If you’re interested in learning more about how humans use counterfactual thinking, take a look at this article from Kaylee Somerville, which explores both the benefits and drawbacks of leaning into “what-if” thinking. While counterfactual reasoning can help us learn from our mistakes, or feel grateful for things working out, it can also lead to guilt or self-criticism based on flawed lines of thinking. 

AI algorithms at work: How to use AI to help overcome historical biases

Counterfactual reasoning in AI can act as a fairness audit to evaluate whether its predictions and decisions involve a degree of bias. In this article, Ariel LaFayette and Turney McKee explore how AI has the potential to both minimize and perpetuate bias in hiring decisions, and provide some insight into how to minimize the risk of inherited bias in AI systems, such as anonymizing resumes or using counterfactual reasoning.

Sources

  1. Gomede, E. (2023, July 25). Counterfactuals in machine learning: Exploring the power of what-if. Medium. https://medium.com/aimonks/counterfactuals-in-machine-learning-exploring-the-power-of-what-if-b210934648e
  2. Zarkov, B. (2025, January 22). Counterfactual explanations: The what-ifs of AI decision making. KPMG. https://kpmg.com/ch/en/insights/artificial-intelligence/counterfactual-explanation.html
  3. Lee, S. (2025, June 14). Mastering counterfactual reasoning. Number Analytics. https://www.numberanalytics.com/blog/mastering-counterfactual-reasoning
  4. Milvus. (n.d.). What are Structural Causal Models (SCMs)? Milvus. https://milvus.io/ai-quick-reference/what-are-structural-causal-models-scms
  5. Byrne, R. M. J. (2013, September 30). Counterfactual reasoning. Oxford Bibliographies. https://doi.org/10.1093/obo/9780199828340-0017
  6. Trabasso, T., & Bartolone, J. (2003). Story understanding and counterfactual reasoning. Journal of Experimental Psychology: Learning, Memory, and Cognition, 29(5), 904–923. https://doi.org/10.1037/0278-7393.29.5.904
  7. Gravity Ideas. (2017, November 6). #12: The simulation heuristic. Medium. https://medium.com/gravityblog/12-the-simulation-heuristic-8b3ab482077
  8. Milvus. (n.d.). What is Pearl’s causal inference framework? Milvus. https://milvus.io/ai-quick-reference/what-is-pearls-causal-inference-framework
  9. Matovski, D. (2024, April 11). Causal AI: The revolution uncovering the 'why' of decision-making. World Economic Forum. https://www.weforum.org/stories/2024/04/causal-ai-decision-making/
  10. Causalens. (2024, June 4). Judea Pearl on the future of AI, LLMs, and the need for causal reasoning. Causalens. https://causalai.causalens.com/resources/blog/judea-pearl-on-the-future-of-ai-llms-and-need-for-causal-reasoning/
  11. Gregersen, E. (2025, January 1). Judea Pearl. Encyclopædia Britannica. https://www.britannica.com/biography/Judea-Pearl
  12. D’souza, K. (2025, July 31). Edge cases are the final frontier for self-driving vehicles. AutoTrader Canada. https://www.autotrader.ca/editorial/20250731/edge-cases-are-the-final-frontier-for-self-driving-vehicles/?srsltid=AfmBOoqLAfW6omFwGbBe1J0Q4XpyWP-I5DvgQi_mA-MjNZ4sncbppxrV
  13. Rath, S. (2025, July 26). Counterfactual reasoning in AI: The key to building truly intelligent systems. Medium. https://medium.com/@catchsatprem/counterfactual-reasoning-in-ai-the-key-to-building-truly-intelligent-systems-a8a142cfd07b
  14. Loring, J. M. (2025, August 11). The explainability illusion: Why AI transparency requirements miss the point. AI Law Blog. Jones Walker. https://www.joneswalker.com/en/insights/blogs/ai-law-blog/the-explainability-illusion-why-ai-transparency-requirements-miss-the-point.html?id=102kzle
  15. Zhang, T., Chung, T., Dey, A. K., & Bae, S. W. (2024). Exploring Algorithmic Explainability: Generating Explainable AI Insights for Personalized Clinical Decision Support Focused on Cannabis Intoxication in Young Adults. arXiv. https://arxiv.org/pdf/2404.14563
  16. Mujtaba, D. F., & Mahapatra, N. R. (2025, May 17). Behind the Screens: Uncovering Bias in AI-Driven Video Interview Assessments Using Counterfactuals. arXiv. https://arxiv.org/pdf/2505.12114

About the Author

Emilie Rose Jones

Emilie Rose Jones

Corporate Communications Manager, TD

Emilie currently works in Marketing & Communications for a non-profit organization based in Toronto, Ontario. She completed her Masters of English Literature at UBC in 2021, where she focused on Indigenous and Canadian Literature. Emilie has a passion for writing and behavioural psychology and is always looking for opportunities to make knowledge more accessible. 

About us

We are the leading applied research & innovation consultancy

Our insights are leveraged by the most ambitious organizations

Image

“

I was blown away with their application and translation of behavioral science into practice. They took a very complex ecosystem and created a series of interventions using an innovative mix of the latest research and creative client co-creation. I was so impressed at the final product they created, which was hugely comprehensive despite the large scope of the client being of the world's most far-reaching and best known consumer brands. I'm excited to see what we can create together in the future.

Heather McKee

BEHAVIORAL SCIENTIST

GLOBAL COFFEEHOUSE CHAIN PROJECT

OUR CLIENT SUCCESS

$0M

Annual Revenue Increase

By launching a behavioral science practice at the core of the organization, we helped one of the largest insurers in North America realize $30M increase in annual revenue.

0%

Increase in Monthly Users

By redesigning North America's first national digital platform for mental health, we achieved a 52% lift in monthly users and an 83% improvement on clinical assessment.

0%

Reduction In Design Time

By designing a new process and getting buy-in from the C-Suite team, we helped one of the largest smartphone manufacturers in the world reduce software design time by 75%.

0%

Reduction in Client Drop-Off

By implementing targeted nudges based on proactive interventions, we reduced drop-off rates for 450,000 clients belonging to USA's oldest debt consolidation organizations by 46%

Read Next

Notes illustration

Eager to learn about how behavioral science can help your organization?