Manuscript Offprint

arXiv:2608.26209

Fairness Invariants: A Relational Approach to Explaining and Mitigating Fairness Bugs

Ranit Debnath Akash, Ashish Kumar, Gang Tan, Saeid Tizpaz-Niari

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

RANIT DEBNATH AKASH, University of Illinois at Chicago, USA

ASHISH KUMAR, Pennsylvania State University, USA

GANG TAN, Pennsylvania State University, USA

SAEID TIZPAZ-NIARI, University of Illinois at Chicago, USA

Data-driven software systems are increasingly deployed in high-stakes socio-economic domains, from criminal justice to financial lending. However, these systems often exhibit individual discrimination—unjustified disparities in which a program yields different outcomes for similar individuals who differ only in their protected attributes (e.g., race, gender, age). While existing research has focused on detecting and quantifying these bugs, there remains a critical lack of principled mechanisms to explain and localize individual fairness bugs. Current explanation techniques are largely designed for single-input decisions rather than the relational nature of discrimination, which inherently involves a comparison between an original and a counterfactual pair.

We present REMI, a framework for the automated localization, explanation, and mitigation of individual discrimination. Inspired by loop-invariant synthesis in formal methods, we treat counterfactual fairness as a relational invariant discovery problem. We introduce a bidirectional relational explanation framework that learns over paired examples (x,x′)(x, x') to identify regions of the input space where fairness is violated. Unlike traditional one-way implication pairs used in invariant inference, our approach enforces bidirectional constraints: requiring identical outcomes for both original and counterfactual samples. REMI utilizes three data-alignment techniques to infer interpretable rule-based models that act as "fairness invariants." These rules serve as guardrails to selectively block or relabel unfair predictions without requiring model retraining. Our evaluation on symbolic and neural network programs demonstrates that REMI localizes ground-truth fairness bugs in over 83% of cases, significantly outperforming state-of-the-art baselines and reducing discriminatory decisions in black-box models by up to 70%.

CCS Concepts: • Software and its engineering → Software testing and debugging; • Computing methodologies → Machine learning; Rule learning.

Additional Key Words and Phrases: Machine Learning, Bias Mitigation, Fairness, AI Ethics, Interpretability

ACM Reference Format:

Ranit Debnath Akash, Ashish Kumar, Gang Tan, and Saeid Tizpaz-Niari. 2026. Fairness Invariants: A Relational Approach to Explaining and Mitigating Fairness Bugs. Proc. ACM Softw. Eng. 3, ISSTA, Article ISSTA019 (October 2026), 24 pages. https://doi.org/10.1145/3832110

1 Introduction

Automated decision-support software systems have become foundational to modern socio-economic infrastructure. They have been used to make critical decisions in domains such as criminal justice, healthcare, financial lending, and hiring. However, because these models often learn from historical datasets, they risk encoding and amplifying biases related to protected attributes like race, gender, or disability status. Hence, ensuring their fairness has emerged as a critical requirement.

Authors' Contact Information: Ranit Debnath Akash, University of Illinois at Chicago, Chicago, USA, rakas@uic.edu; Ashish Kumar, Pennsylvania State University, University Park, USA, azk640@psu.edu; Gang Tan, Pennsylvania State University, University Park, USA, gtan@psu.edu; Saeid Tizpaz-Niari, University of Illinois at Chicago, Chicago, USA, saeid@uic.edu.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

© 2026 Copyright held by the owner/author(s).

ACM 2994-970X/2026/10-ARTISSTA019

https://doi.org/10.1145/3832110

ISSTA019:2

Ranit Debnath Akash, Ashish Kumar, Gang Tan, and Saeid Tizpaz-Niari

In high-stakes scenarios, this manifests as "fairness bugs"—unjustified disparities where the software yields different outcomes for individuals who are identical in all relevant qualifications, but differ in a protected characteristic. For instance, studies on FICO scoring found that black non-defaulters were often assigned higher risk scores than their white counterparts [32].

In response to these risks, the software engineering and machine learning communities have developed a diverse array of techniques to detect, explain, and mitigate bias through pre-processing data [15, 16], in-processing algorithmic adjustments [31, 49, 59], and post-processing calibration [32]. While these efforts have significantly improved our ability to address fairness issues, a principled mechanism for explaining individual fairness bugs remains largely lacking. Current explanation techniques primarily focus on local interpretability, explaining why a model made a specific decision for a single input [52]. However, individual fairness is inherently relational: it cannot be violated by a single input, but requires an analysis between a specific individual x and their "similar" counterpart x′x' who may differ only in their protected attributes. We identify two core limitations.

(1) The Localization Insufficiency: Existing tools provide explanations for model decisions (e.g., "why was this loan denied?"), but they lack the framework to explain discriminatory outcomes (e.g., "why was this loan denied to x, but granted to x'?"). We currently lack a way to consider multiple similar inputs simultaneously to pinpoint the exact logic driving the disparity.

(2) The Mitigation Problem. Developers require compact and precise characterizations of how the counterfactual unfairness occurs. Without a way to localize these "fairness bugs" to specific relational constraints, mitigation strategies are limited and ineffective.

Intuition. Inspired by loop-invariant synthesis from the programming language literature [56], we develop a relational explanation and mitigation technique for software fairness. In loop-invariant synthesis, the goal is to identify a region of the program state space that captures all reachable program states. The key is to enforce 'implication pairs': if a state satisfies the head of an implication pair, then it must also satisfy the tail (a positive instance). Decision tree inference with implication pairs [29] formalizes this by classifying states into positive and negative examples. The learned decision tree must therefore respect these unidirectional relational constraints in addition to separating positive and negative instances. The relational fairness problem can be viewed as an analogous task.

Key Observation. Instead of reasoning about reachable program states, we infer fairness invariants of automated decision-making software and identify regions of the input space where the original x (head) and counterfactual x′x' (tail) pairs disagree. Each relational pair (x,x′)(x, x') acts as a constraint, requiring that the program assign the same outcome to both original and counterfactual samples that may only differ in their protected attributes. Unlike the one-directional implication pairs used in invariant inference, these counterfactual constraints are bidirectional: if one element of the pair receives a favorable outcome, the other must as well for fairness to hold, and likewise for unfavorable outcomes. Hence, the approach for using decision trees to respect unidirectional relational constraints can be extended to bidirectional constraints, enabling us to use decision trees to solve the counterfactual fairness problem.

Approach. We present REMI (Relational Explanation and Mitigation), a framework to localize, explain, and mitigate individual fairness bugs. REMI first generates counterfactual instances to identify discriminatory pairs. It then constructs a relational dataset where pairs are labeled '+' if the model treats them identically (fair) and '-' if the outcomes differ (unfair). We propose three alignment techniques—original, horizontal, and vertical extension—to structure this relational data. From this, REMI infers interpretable rules that distinguish fair regions from unfair ones. Finally, REMI extracts these discriminatory rules as guardrails to selectively block or relabel unfair predictions, mitigating bias without requiring model retraining.

ISSTA019:3

Figure

Fig. 1. REMI Framework.

Experiments. We perform experiments both on symbolic (rule-based) and neural network (black-box) programs. Since the ground truth for the symbolic programs is known and verifiable, we first use REMI to answer four research questions about i) the performance of three relational dataset curation techniques; ii) the performance of nine different rule inference algorithms; iii) the characteristics and precision of extracted rules vs. the ground truth; and iv) the performance of guardrails technique for a mitigation, based on the extracted discriminatory rules. We find that horizontal extension outperforms the baseline and other alignment methods, and C4.5Tree, FIGS, and CART tree inferences outperform other rule-based inference methods. The alignment and inference techniques localize the ground truth in more than 83% of the cases, compared to the state-of-the-art AFT [71] approach. Additionally, the rule-based guardrails reduce individual instances of discrimination in all cases. Finally, we study whether our experiences with REMI over symbolic programs generalize to black-box neural networks. We found that applying guardrail rules to neural networks reduces individual discriminatory decisions by at least 40%, up to 70%, significantly outperforming the retraining-based bias mitigation techniques [24, 60, 70, 71]

Contributions. The key contributions of this paper are:

• Inspired by the loop invariant synthesis, we design a data-driven approach to infer fairness invariants for automated decision-making programs,

• We develop a novel guardrail strategy to mitigate individual discrimination,

• We put forward REMI, a framework that automatically detects, localizes, explains, and mitigates individual fairness bugs.

• Our experiments on both rule-based symbolic and data-driven neural network programs show that REMI significantly outperformed the baseline techniques in terms of localizing and mitigating individual discrimination.

References (19)