Inferensys

Glossary

Fairness Metrics

Fairness metrics are quantitative measures used to evaluate whether a machine learning model's predictions exhibit unwanted bias against specific subgroups defined by sensitive attributes like race, gender, or age.
Data scientist working on AI bias mitigation on laptop, fairness metrics visible, casual technical session.
FEDERATED MODEL EVALUATION METRICS

What is Fairness Metrics?

Fairness metrics are quantitative measures used to evaluate whether a machine learning model's predictions exhibit unwanted bias against subgroups defined by sensitive attributes like race, gender, or age.

In federated learning, fairness metrics assess bias in the global aggregated model across a decentralized population. Core metrics include demographic parity (equal prediction rates), equalized odds (equal true/false positive rates), and equal opportunity (equal true positive rates). These are calculated by comparing model performance across protected attributes within the client population, often requiring careful statistical aggregation from local evaluations to preserve privacy.

Applying these metrics in federated settings presents unique challenges due to statistical heterogeneity (non-IID data) and the inability to centrally inspect raw data. Solutions involve federated evaluation protocols that compute fairness statistics locally and aggregate them securely. Engineers must navigate the utility-fairness trade-off, where optimizing for fairness can impact overall model accuracy, and ensure metrics align with legal and ethical definitions of discrimination for the specific application domain.

FEDERATED MODEL EVALUATION

Key Fairness Metrics & Definitions

Quantitative measures to detect and mitigate unwanted bias in a model's predictions across subgroups defined by sensitive attributes like gender or race.

01

Demographic Parity

Also known as statistical parity, this metric assesses whether a positive prediction is made at the same rate across different demographic groups. It is defined as P(Ŷ=1 | A=a) = P(Ŷ=1 | A=b) for all groups a, b. Example: If a loan approval model grants loans to 10% of applicants in Group A, it should also grant loans to approximately 10% in Group B. This is a group fairness metric focused on outcomes, not the correctness of those outcomes. A key limitation is that it does not account for potential differences in qualification rates between groups.

02

Equalized Odds

A stricter fairness criterion requiring that a model's true positive rate (TPR) and false positive rate (FPR) are equal across groups. Formally: P(Ŷ=1 | A=a, Y=y) = P(Ŷ=1 | A=b, Y=y) for y ∈ {0,1}. Example: A recidivism prediction tool should be equally accurate at predicting re-offense (TPR) and equally inaccurate at falsely predicting re-offense (FPR) for all racial groups. This metric ensures fairness is considered conditioned on the true outcome. Satisfying equalized odds implies demographic parity is also satisfied if the base rates (prevalence of the positive class) are equal across groups.

03

Equal Opportunity

A relaxation of Equalized Odds that requires only the true positive rate (TPR) to be equal across groups. Formally: P(Ŷ=1 | A=a, Y=1) = P(Ŷ=1 | A=b, Y=1). Example: A hiring model should identify qualified candidates from all gender groups at the same rate. This is often considered a more achievable goal than full equalized odds, as it focuses on fairness for the advantaged outcome (e.g., getting a loan, being hired). It does not constrain the false positive rates, which may still differ.

04

Predictive Parity

Also known as outcome test, this metric requires that the precision (or positive predictive value) of the model is equal across groups. Formally: P(Y=1 | A=a, Ŷ=1) = P(Y=1 | A=b, Ŷ=1). Example: If a medical diagnostic tool flags patients as high-risk, the proportion of those patients who actually develop the disease should be the same for all ethnicities. This is a calibration-based fairness notion. A key result (from Kleinberg et al.) shows that, except in degenerate cases, a model cannot simultaneously satisfy demographic parity and predictive parity if the base rates of the outcome differ between groups.

05

Disparate Impact

A legal and statistical measure derived from the 80% rule used in U.S. employment law. It is calculated as the ratio of the rate of favorable outcomes for a protected group to the rate for the most favored group. A value less than 0.8 may indicate unlawful discrimination. Formula: (Rate of favorable outcome for protected group) / (Rate for most favored group). Example: If 60% of male applicants are hired and 40% of female applicants are hired, the disparate impact ratio is 40%/60% = 0.67, indicating potential bias. This is closely related to demographic parity but is often used as a legal compliance threshold rather than an optimization target.

06

Fairness in Federated Context

Evaluating these metrics in federated learning introduces unique challenges. Data is partitioned across clients, which may correspond to different demographic groups. Key considerations:

  • Local vs. Global Fairness: A model may appear fair globally but be highly unfair on specific clients (statistical heterogeneity).
  • Measurement: Computing group fairness metrics requires knowledge of sensitive attributes, which may be private to each client. This necessitates secure multi-party computation or local differential privacy for aggregation.
  • Mitigation: Fairness interventions (e.g., re-weighting, adversarial debiasing) must be adapted for decentralized execution, often requiring clients to perform local fairness adjustments before sending updates to the server.
DEFINITION

Fairness Metrics in Federated Learning

Fairness metrics in federated learning are quantitative measures used to evaluate whether a globally aggregated model exhibits unwanted bias against subgroups defined by sensitive attributes like race or gender, despite being trained on decentralized, private data.

These metrics, such as demographic parity, equalized odds, and equal opportunity, are calculated by comparing model performance disparities across protected subgroups. In a federated setting, this requires secure aggregation of local fairness statistics from clients, as raw sensitive data cannot be centralized. This process ensures the global model's predictions are equitable without compromising client privacy.

The core challenge is statistical heterogeneity, where local data distributions vary significantly. A model fair on one client's data may be unfair on another's. Federated fairness evaluation must therefore account for this non-IID data to prevent a globally 'fair' average from masking severe local biases, necessitating techniques like personalized fairness or subgroup-aware robust aggregation.

FAIRNESS METRICS

Comparison of Common Fairness Metrics

A comparison of key fairness definitions, their mathematical formulations, and their applicability in federated learning contexts.

MetricDefinitionMathematical FormulationFederated Learning Considerations

Demographic Parity

Requires the model's predictions to be statistically independent of a sensitive attribute (e.g., race, gender).

P(Ŷ=1 | A=a) = P(Ŷ=1 | A=b) for all groups a, b.

Can be evaluated via federated evaluation by aggregating local group statistics. May conflict with accuracy if base rates differ.

Equalized Odds

Requires the model's true positive and false positive rates to be equal across groups defined by a sensitive attribute.

P(Ŷ=1 | A=a, Y=y) = P(Ŷ=1 | A=b, Y=y) for y ∈ {0,1} and all groups a, b.

Requires knowledge of ground truth labels (Y) per group, which can be computed locally but aggregated securely. More compatible with accuracy than demographic parity.

Equal Opportunity

A relaxed form of Equalized Odds requiring only true positive rates (or false negative rates) to be equal across groups.

P(Ŷ=1 | A=a, Y=1) = P(Ŷ=1 | A=b, Y=1) for all groups a, b.

Easier to satisfy than full equalized odds. Federated computation focuses on the positive class, which may have limited samples per client.

Predictive Parity

Requires the model's precision (positive predictive value) to be equal across groups.

P(Y=1 | A=a, Ŷ=1) = P(Y=1 | A=b, Ŷ=1) for all groups a, b.

Difficult to guarantee in federated learning without sharing prediction-outcome pairs, posing a privacy challenge. Sensitive to label noise.

Treatment Equality

Requires the ratio of false negatives to false positives to be equal across groups.

FN_a / FP_a = FN_b / FP_b for all groups a, b.

Useful in cost-sensitive applications. Can be computed from local confusion matrices but requires careful aggregation to handle small per-client counts.

Individual Fairness

Requires that similar individuals receive similar predictions, as defined by a task-specific similarity metric.

D(Ŷ_i, Ŷ_j) ≤ L * d(x_i, x_j) for a distance metric d and Lipschitz constant L.

Extremely challenging in federated learning due to the inability to directly compare raw data points (x_i, x_j) across clients to enforce the similarity constraint.

Counterfactual Fairness

Requires a model's prediction to be the same in the actual world and a counterfactual world where an individual's sensitive attribute was changed.

P(Ŷ_{A←a}(U) = y | X=x, A=a) = P(Ŷ_{A←b}(U) = y | X=x, A=a)

Theoretically rigorous but requires a causal model. Infeasible in standard federated learning where the server cannot access the causal graph or perform interventions on client data.

FAIRNESS METRICS

Frequently Asked Questions

Fairness metrics are quantitative measures used to evaluate whether a machine learning model's predictions exhibit unwanted bias against specific subgroups defined by sensitive attributes like gender, race, or age. In federated learning, these metrics must be computed in a decentralized, privacy-preserving manner.

Demographic parity, also known as statistical parity, is a group fairness metric that requires a model's predictions to be independent of a sensitive attribute. It is satisfied when the probability of receiving a positive outcome is equal across all subgroups defined by the sensitive attribute (e.g., gender).

How it's measured: The metric is typically calculated as the difference or ratio of positive prediction rates between groups. For a binary classifier and a binary sensitive attribute (e.g., group A and group B), demographic parity difference (DPD) is:

DPD = P(Ŷ=1 | A) - P(Ŷ=1 | B)

Where Ŷ is the model's prediction. A value of 0 indicates perfect parity. In federated learning, these probabilities must be estimated by aggregating local counts from clients without exposing sensitive group memberships, often using secure summation protocols.

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.