- The paper reduces counterfactual fairness to conditional demographic parity, establishing a formal equivalence under latent variable assumptions.
- It derives a closed-form CF-optimal predictor with a barycentric quantile map, achieving optimal nonparametric convergence rates of approximately n^(-1/3).
- The method robustly calibrates black-box regressors through latent space discretization, enabling tunable fairness with minimal accuracy loss in both synthetic and real-world settings.
Counterfactually Fair Regression via Optimal Transport: An Expert Analysis
Motivation and Problem Statement
This work addresses the regression problem under counterfactual fairness (CF) constraints, focusing on rigorous theoretical guarantees and practical post-processing algorithms. While the literature on fair ML is extensive, most counterfactual fairness methods are either in-processing or rely heavily on structural causal models (SCMs), with limited practical deployability and a lack of statistical guarantees. The paper innovates by reducing CF (in the causal uncertainty/Level-2 SCM setting) to demographic parity (DP) conditional on unobserved latent variables, facilitating the use of optimal transport (OT) techniques to enforce CF in a model-agnostic post-processing regime.
Theoretical Contributions
The key theoretical insight is the equivalence of CF and conditional DP under mild SCM and latent recoverability assumptions, specifically:
CF as Conditional Demographic Parity: The paper establishes—formally and constructively—that counterfactual fairness (in the sense of invariance to interventions on sensitive attributes, marginalized over resampled noise) is equivalent to enforcing demographic parity conditional on a latent ability variable V. This reduction is non-trivial, as global DP is known to be insufficient for CF, but conditional DP exactly matches the counterfactual requirement in this setting.
Closed-Form CF-Optimal Predictor: Leveraging the OT framework, the authors derive a closed-form expression for the CF-optimal regressor as a barycentric quantile map. Explicitly, for a predictor f∗, the fair predictor is
f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),
where v=ψ(x,s) is the latent, ws′ are group weights, and F−1 is the conditional quantile.
Statistical and Computational Guarantees: The paper provides a discretized post-processing scheme, partitioning the latent space and matching groupwise conditional distributions to their Wasserstein barycenter. Finite-sample statistical guarantees are proven—specifically, unfairness and excess risk decay at optimal nonparametric rates,
O~(n−1/3),
where n is the number of samples used in post-processing. A matching minimax lower bound is established, showing that this rate is unimprovable for conditionally fair regression.

Figure 1: Empirical convergence vs. Theoretical bound. The theoretical rate is aligned at n=500. Empirical decay is notably faster than the worst-case bound, reaching near-zero unfairness rapidly.
Relaxed CF via Explicit Tuning: The authors generalize to relaxed CF, introducing an α-parameterized interpolation between the optimal unconstrained (potentially unfair) and fair predictors. The optimal solutions for both risk and unfairness are given analytically. They provide a practical recipe to tune f∗0 to match a prescribed unfairness budget, and prove that the risk-unfairness tradeoff interpolates explicitly as a function of f∗1.
Algorithmic Methodology
The main methodology is to recalibrate any fixed, possibly proprietary or black-box regressor f∗2, using only its predictive output, observed sensitive attribute f∗3, and proxy for f∗4. The algorithm:
- Discretizes the latent variable f∗5 into f∗6 intervals, balancing bias and variance.
- Within each interval, estimates the conditional distribution of predictions for each group.
- Applies a monotonic quantile transformation that maps group-level conditional distributions to their barycenter according to OT, ensuring conditional DP (thus CF).


Figure 2: LSAC: Analysis of fairness and risk trade-offs. (Left) Unfairness vs. number of intervals f∗7, showing the bias-variance trade-off with the theoretical f∗8 indicated.
Empirical Evaluation
Experiments span both synthetic and real-world settings, including the LSAC Law School Admissions dataset and Communities and Crime. The method is benchmarked against:
- Fair K: Counterfactual fairness by discarding all non-latent features (maximal safety, maximal information loss).
- Wasserstein Fair Regression (WFR): Post-processing to enforce global DP using OT, which does not satisfy CF in the presence of conditional disparities.
Synthetic Results: The method dominates WFR on the counterfactual fairness-accuracy tradeoff, matching the fairness of strict CF approaches but at substantially lower accuracy cost due to preservation of non-biased predictive signal.


Figure 3: Empirical validation of the bias-error trade-off (Thm 1) across multi-class sensitive attributes (f∗9).
LSAC Results: On real data, the post-processor sharply reduces conditional unfairness by an order of magnitude relative to WFR, with negligible accuracy loss compared to the unconstrained base. This remains robust when latent f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),0 is estimated by a VAE (with and without explicit de-biasing). The practical f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),1-selection is shown to match the bias-variance sweet spot predicted by theory.
Robustness: The method's unfairness guarantee degrades smoothly under both random noise in the proxy and systematic proxy leakage, and remains robust to group imbalance until extremely low group sizes.

Figure 4: Robustness to unbiased proxy noise. As noise f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),2 increases, unfairness rises mildly (peaking below f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),3) while RMSE decreases.
Computational Efficiency: The algorithm scales as f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),4 due to 1D OT computations and empirical quantile operations.
Limitations and Implications
The framework's guarantees are contingent on three core assumptions:
- Existence and recoverability of a meaningful latent f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),5 underlying observed features and outcomes
- Sufficient sample size for meaningful conditional distribution estimation post-discretization
- Absence of profound violations of proxy-based causal deconfounding (e.g., f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),6 is not sufficiently separated from f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),7 in practice)
These are standard caveats in the CF literature, but the methodology minimizes the need for explicit SCMs and can operate with estimated proxies (e.g., via VAEs), lowering barriers to adoption.
Implications for Practice: The post-processing approach is model-agnostic, requiring neither retraining nor access to raw predictions or gradients. This is ideal for deployment in settings where only black-box access to models or data is possible, including regulation-compliance auditing or retrofitting existing systems for fairness.
Theoretical Significance: By demonstrating the equivalence of CF and conditional DP in a general Level-2 SCM setting, this work provides a unifying foundation that connects the causal and distributional fairness literatures. The closed-form OT-based solution generalizes existing results for demographic parity to the counterfactual case, with tight minimax optimality.
Opportunities for Future Work
- Proxy Estimation: The practical challenge of inferring high-quality proxies for latent ability remains open. Improved proxy estimation methods (e.g., via weak supervision, causal representation learning, disentangled VAEs) would further enhance the practical utility of the method.
- Extension to Classification: While the paper focuses on regression, similar OT-based approaches may be adapted for classification, especially in contexts with ordinal or continuous-outcome structure.
- Beyond Latent Awareness: Extending the framework to settings where f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),8 cannot be reliably recovered, or to more complex causal discovery scenarios, is a direction for further theory and methodology.
Conclusion
This study puts forth a mathematically rigorous, practically tractable framework for counterfactually fair regression, bridging causal and distributional perspectives by exploiting the equivalence of CF and conditional DP. The developed post-processing method is optimal with respect to statistical convergence, is robust in empirical settings, and admits full control over the risk-unfairness tradeoff. Its flexibility, theoretical optimality, and computational efficiency make it an attractive foundation for real-world deployment of fair regression under complex structural biases.
Figure 5: Discretization Trade-off on the Law School Dataset for black-box models not satisfying smoothness/CDF regularity. The impact of non-smoothness dissipates as f0∗(x,s)=(s′∑ws′Ff∗∣v,s′−1)∘Ff∗∣v,s(f∗(x,s)),9 increases, demonstrating robustness.
Figure 6: Robustness to minority group imbalance (v=ψ(x,s)0). The method maintains near-zero unfairness down to low minority prevalence.