Inferensys

Glossary

Counterfactual Fairness

A causal definition of individual fairness stating that a decision is fair if it is the same in the actual world and a counterfactual world where a sensitive attribute was changed.
Cinematic overhead of a WeWork creative suite room with multiple curved monitors showing AI decision dashboards, executives in casual attire reviewing data, dramatic pendant lighting.
CAUSAL FAIRNESS DEFINITION

What is Counterfactual Fairness?

A causal definition of individual fairness stating that a decision is fair if it is the same in the actual world and a counterfactual world where a sensitive attribute was changed.

Counterfactual fairness is a rigorous causal definition of individual fairness stating that a prediction is fair if it remains unchanged in both the actual world and a counterfactual world where an individual's protected attribute (e.g., race, gender) was different. This framework, introduced by Kusner et al., leverages Structural Causal Models (SCMs) to compute what would have happened under a hypothetical intervention, isolating the discriminatory effect of sensitive attributes along causal pathways.

Unlike statistical parity metrics that only check correlations, counterfactual fairness requires a causal graph to distinguish between resolving variables (proxies for the sensitive attribute) and legitimate causal influences. A model fails this test if its output changes when a sensitive attribute is altered in the counterfactual scenario, even when all other causally dependent features are updated accordingly. This provides a principled, legally defensible standard for auditing automated decisions.

CAUSAL FAIRNESS AXIOMS

Core Properties of Counterfactual Fairness

Counterfactual fairness is a rigorous, individual-level definition of algorithmic equity grounded in causal inference. It requires that a decision be identical in the actual world and a counterfactual world where an individual's protected attributes were different, holding all other causally relevant factors constant.

01

The Foundational Definition

A predictor Ŷ is counterfactually fair if, for any individual, the predicted outcome is the same in the actual world and in the closest possible world where their sensitive attribute A (e.g., race, gender) was changed. Formally: P(Ŷ_{A←a} = y | X=x, A=a) = P(Ŷ_{A←a'} = y | X=x, A=a). This definition, introduced by Kusner et al. (2017), explicitly relies on a Structural Causal Model (SCM) to compute the counterfactual query. It differs from observational fairness metrics by focusing on causal pathways rather than statistical parity.

Kusner et al., 2017
Originating Paper
02

Causal Pathway Partitioning

Counterfactual fairness requires decomposing the causal graph into three distinct pathways from a sensitive attribute A to an outcome Y:

  • Direct Discrimination: A causal path directly from A to Y.
  • Red-Lining (Indirect Discrimination): A path from A to Y through a proxy variable (e.g., zip code) that is itself caused by A.
  • Explained Variation: A path from A to Y through a resolving variable (e.g., qualification) that is not discriminatory. A fair predictor must eliminate the influence of the first two pathways while preserving the third.
03

Individual vs. Group Fairness

Counterfactual fairness is a strict form of individual fairness, not a group-level metric. It guarantees that every single individual receives the same decision as their counterfactual self. This contrasts with group fairness criteria like Demographic Parity or Equalized Odds, which only enforce statistical constraints across populations. A model can satisfy group fairness while still being counterfactually unfair to specific individuals, making this causal definition a more granular and legally robust standard for high-stakes decisions.

04

Structural Causal Model (SCM) Requirement

Computing counterfactual fairness is impossible without a fully specified Structural Causal Model (SCM). The SCM consists of:

  • Exogenous variables (U): Unobserved background factors representing an individual's unique characteristics.
  • Endogenous variables (V): Observed features, including the sensitive attribute and outcome.
  • Structural equations (F): Deterministic functions mapping causes to effects. The three-step process—Abduction (infer U), Action (intervene on A), and Prediction (compute Y)—is mandatory. This reliance on strong causal assumptions is both the method's greatest strength and its primary practical limitation.
05

Levels of Causal Awareness

Predictors can be categorized by their causal awareness:

  • Level 1 (No Causality): Uses only non-descendants of A. Simple but may discard useful information.
  • Level 2 (Partial Causality): Uses descendants of A that are not discriminatory proxies, requiring partial causal knowledge.
  • Level 3 (Full Counterfactual): Uses all variables but applies the full SCM to compute the counterfactual distribution P(Ŷ_{A←a'}). Level 3 is the gold standard but demands a complete causal model. Level 1 is a safe, conservative fallback when causal knowledge is incomplete.
06

Path-Specific Counterfactual Fairness

A nuanced variant that allows a sensitive attribute to influence the outcome through fair pathways while blocking unfair ones. For example, a university admission model might allow gender to influence admission through a 'chosen major' pathway (considered a legitimate choice) but block its influence through a 'biased recommendation letter' pathway. This is achieved by performing a path-specific intervention in the SCM, muting only the unfair causal edges while propagating the fair ones. This avoids the 'leveling down' problem of simpler fairness constraints.

COUNTERFACTUAL FAIRNESS

Frequently Asked Questions

Explore the core concepts of counterfactual fairness, a causal approach to individual fairness that ensures decisions remain consistent across actual and counterfactual worlds where sensitive attributes differ.

Counterfactual fairness is a causal definition of individual fairness stating that a decision is fair if it is the same in the actual world and a counterfactual world where a sensitive attribute (like race or gender) was changed. It works by using a Structural Causal Model (SCM) to define the causal relationships between protected attributes, other features, and the outcome. The model computes what the decision would have been had the individual belonged to a different demographic group, holding all other causally independent factors constant. If the prediction changes, the algorithm is deemed unfair. This approach directly addresses the intuition that a person's protected attributes should not causally influence their outcomes.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.