Inferensys

Glossary

Fairness Metric

A quantitative measure, such as demographic parity or equalized odds, used to evaluate and compare model prediction outcomes across different protected demographic groups.
ML engineer working on model compression and quantization, laptop showing performance benchmarks, technical workspace.
BIAS DETECTION

What is a Fairness Metric?

A fairness metric is a quantitative measure used to evaluate and compare model prediction outcomes across different protected demographic groups to detect and mitigate algorithmic bias.

A fairness metric is a mathematical definition that operationalizes a specific ethical principle, such as demographic parity or equalized odds, into a calculable formula. It provides a rigorous, statistical method for auditing a machine learning model's behavior by comparing outcomes—like approval rates or error rates—between a privileged group and an unprivileged group defined by a protected attribute. These metrics translate abstract legal concepts of non-discrimination into verifiable technical constraints within a model evaluation pipeline.

Selecting the correct metric requires a trade-off analysis, as many fairness definitions are mathematically incompatible; optimizing for demographic parity may violate equalized odds, and vice versa. The metric is calculated on a test dataset segmented by sensitive attributes, with a perfectly fair model achieving a score of zero disparity. Common thresholds, such as the disparate impact ratio falling below 0.8, are used to flag potential regulatory non-compliance before a model is deployed in high-stakes domains like lending or hiring.

QUANTITATIVE DEFINITIONS

Key Types of Fairness Metrics

Fairness metrics are mathematical formalizations of ethical constraints, each designed to detect a specific type of statistical disparity in model predictions across protected demographic groups.

01

Demographic Parity

Also known as statistical parity, this metric requires the probability of a positive prediction to be identical across all groups.

  • Constraint: P(ŷ=1 | A=a) = P(ŷ=1 | A=b)
  • Use Case: Loan approval where access to opportunity should be equalized.
  • Weakness: Ignores the ground truth. It can force the model to approve unqualified applicants in one group to match the approval rate of a more qualified group, a phenomenon known as levelling down.
02

Equalized Odds

This metric requires the model to have equal True Positive Rates and False Positive Rates across groups, conditioning on the actual outcome.

  • Constraint: P(ŷ=1 | Y=1, A=a) = P(ŷ=1 | Y=1, A=b) AND P(ŷ=1 | Y=0, A=a) = P(ŷ=1 | Y=0, A=b)
  • Use Case: Criminal recidivism prediction where both false alarms and missed risks must be balanced.
  • Advantage: Matches error rates to actual outcomes, avoiding the levelling down problem of demographic parity.
03

Equality of Opportunity

A relaxation of equalized odds, this metric focuses solely on equalizing the True Positive Rate across groups.

  • Constraint: P(ŷ=1 | Y=1, A=a) = P(ŷ=1 | Y=1, A=b)
  • Use Case: College admissions where the goal is to ensure equally qualified candidates from different groups have the same chance of admission.
  • Distinction: It permits differences in false positive rates, meaning it only guarantees fairness for the 'advantaged' outcome class.
04

Predictive Parity

Also called test-fairness, this metric requires the model's positive predictive value (precision) to be equal across groups.

  • Constraint: P(Y=1 | ŷ=1, A=a) = P(Y=1 | ŷ=1, A=b)
  • Use Case: Targeted marketing where the cost of a false positive is high and the business needs to ensure a predicted conversion is equally reliable regardless of demographic.
  • Trade-off: It is mathematically impossible to satisfy both predictive parity and equalized odds simultaneously unless the base rates of the outcome are identical across groups.
05

Individual Fairness

A philosophical departure from group metrics, this principle mandates that similar individuals should receive similar predictions.

  • Formalization: D( f(x_i), f(x_j) ) ≤ d(x_i, x_j) for a task-specific distance metric d.
  • Challenge: Requires defining a fairness metric that accurately captures task-relevant similarity, which is often a complex ontological problem.
  • Contrast: Addresses the fairness gerrymandering problem where group metrics are satisfied by giving positive outcomes to one subset of a group and negative to another.
06

Disparate Impact Ratio

A legal metric derived from the 80% rule in US employment law, measuring the ratio of favorable outcomes for a protected group relative to a reference group.

  • Calculation: (Selection Rate for Protected Group) / (Selection Rate for Reference Group)
  • Threshold: A ratio below 0.8 indicates potential adverse impact.
  • Application: Used in hiring algorithms to flag legally actionable discrimination before deployment.
FAIRNESS METRIC CLARIFICATIONS

Frequently Asked Questions

Precise answers to common technical questions about selecting, calculating, and interpreting fairness metrics in machine learning pipelines.

A fairness metric is a quantitative measure used to evaluate and compare model prediction outcomes across different protected demographic groups. It works by applying a specific mathematical definition of fairness—such as demographic parity or equalized odds—to a confusion matrix segmented by group membership. The metric calculates a ratio or difference between groups, producing a scalar value that indicates the presence and magnitude of disparity. For example, demographic parity requires the positive prediction rate to be equal across groups, while equalized odds demands equal true positive and false positive rates. These metrics are computed on a holdout evaluation dataset and serve as operationalized constraints during model selection, hyperparameter tuning, or post-processing mitigation.

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.