# How Do You Measure Fairness?

> How to measure fairness in an AI model: split the results by group, compare a few measures, and read the gaps with care, explained for your AI interview.

**In short:** You split the model's results by group, then compare a few measures, such as how often each group is chosen and how often qualified people are missed. Those measures often disagree when the groups differ, so people must decide which gap matters most.

AI and LLM interview question Q457, Data, privacy, ethics and governance. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-measure-fairness

## Say it in 30 seconds

To measure fairness, I split the model's results by group, then compare a few measures. One is how often each group gets chosen. Another is how often qualified people are missed. A third is whether the picks are right. These measures can't all match when groups differ in real outcomes, so I show every gap, and a person decides which one matters most for the people affected.

## Say it in 2 minutes

I start by choosing the groups I must check, and the outcome that matters. Then I take past decisions and match each one with what really happened later. Without real outcomes, I can see who gets chosen, but I can't tell who was wrongly chosen or wrongly missed. I need the group labels to run the check, so I store them with each record.

Next, I count the results for each group in the same way: how many were chosen, how many qualified and were chosen, and how many were chosen although they did not qualify. From those counts I compare the selection rate, the true positive rate, the false positive rate and the precision. A gap of a few points can be chance when a group is small, so I check the group sizes before I trust a gap.

The hard part is that the measures can disagree. When the groups have different shares of qualified people, a model can match on error rates and still differ on who gets chosen. Researchers have shown this for risk scores, which is why no single number settles fairness. It is partly statistics and partly a judgement about which mistake hurts the people in the decision most.

So I show the full set of gaps, name the groups and their sizes, and say which measure I chose and why. A person signs off on the trade-off, and the check runs again after launch, because real data changes.

## What is fairness measurement, in plain words?

Fairness measurement is a set of checks that ask whether a model treats groups of people in a similar way. You split the results by group, then compare the gaps. The groups might be applicants from different regions, or any group your company must review.

Think of a bank auditor. A good total across all branches can hide one branch that turns away far more applicants than the rest, so the auditor checks the branches one by one. Google's guidance says the same thing about models: great performance overall "may mask poor performance on a minority subset" of examples.

A hiring team's screening model might look accurate overall while it shortlists one group far less often. Microsoft's guidance calls this group fairness, and asks which groups of people are at risk of harm. The harm can be a system that withholds opportunities from a group, or one that does not work as well for a group.

- **Selection rate:** The share of a group that gets the good result, such as being shortlisted.
- **True positive rate:** Of the people who truly qualify, the share the model chooses.
- **False positive rate:** Of the people who don't qualify, the share the model chooses anyway.
- **Precision:** Of the people the model chooses, the share who really qualify.

## How do you measure fairness, step by step?

*Diagram, How a fairness check runs: Three inputs go into one check: the group labels, the real outcomes and the model's decisions. The counts are split by group, the gaps are compared, and a person decides. Nothing is decided by the numbers alone.*
1. Your records give the groups, the real outcomes and the decisions.
2. The counts are split by group, so each group gets its own numbers.
3. The gaps go to a person, who decides which one matters most.

1. **Pick the groups and the outcome:** Choose the groups you must check, and the outcome that matters, such as success in the role. You need the group labels to run the check, so store them with each record. Keep these labels under your privacy and legal rules, since storing them is itself sensitive.
2. **Match decisions with real outcomes:** Pair each past decision with what really happened later. Without real outcomes you can see who was chosen, but not who was wrongly chosen or missed.
3. **Slice the results by group:** Count the same four outcomes for each group: chosen or not, qualified or not. Use the same counts for every group, so the comparison is fair.
4. **Read the gaps and decide:** Compare the gaps for each measure. Microsoft's guidance is clear that the people who build the model make the trade-offs that suit its use, so write that choice down.

Slicing matters because averages hide groups. Gender Shades evaluated three commercial gender classification systems, and reported accuracy for darker females, lighter females, darker males and lighter males. The worst group had error rates of up to 34.7%, while the best group had a maximum of 0.8%. Those gaps only show up once the results are sliced.

> "darker-skinned females are the most misclassified group (with error rates of up to 34.7%)" (Buolamwini and Gebru, 2018)

## What do the common measures actually say?

- **Who gets chosen: Selection rate.** The share of each group the model chooses. Google calls the equal version demographic parity: equal acceptance rates, whatever each person's qualifications.
- **Who is missed: True and false positive rates.** Of qualified people, the share chosen. Of unqualified people, the share chosen anyway. Equality of opportunity compares the first across groups.
- **Are the picks right: Precision.** Of the people chosen, the share who really qualify. Calibration is a separate, related check. It asks whether a score of 70% means 70%.

Google's guidance points out the key difference between the first two. Demographic parity looks at overall acceptance rates. Equality of opportunity looks only at the qualified people in each group. Hardt and colleagues proposed that second test in 2016, in a paper titled Equality of Opportunity in Supervised Learning. A model can satisfy both, but only under specific conditions.

Google's counterfactual fairness compares a model's predictions for similar people who differ only in a sensitive attribute. You can run the same kind of test on a text model: send two prompts that differ only in the group signal, such as a name, then compare the answers. The right measure depends on the application and the outcome you want.

## Why do the measures disagree?

When the share of qualified people differs between groups, the measures can't all match. In 2016, Kleinberg and colleagues proved that three fairness conditions for risk scores cannot all hold together, except in special cases. Chouldechova found a similar result for recidivism scores (how likely someone is to reoffend) in 2017, and linked unequal error rates to disparate impact, which is a harm that falls unevenly on a group.

> "We demonstrate that the criteria cannot all be simultaneously satisfied when recidivism prevalence differs across groups." (Chouldechova, 2017)
>
> "Quantitative fairness metrics don't capture many aspects of fairness, such as justice and due process." (Microsoft Learn)

> **Tip:** When someone quotes one fairness number, ask which groups it covers, which measure it uses, and what the gap is for the group that scores worst.

## Can you run the numbers on one shortlist?

Here is a made-up hiring shortlist, checked on 600 past applicants: 400 in group A and 200 in group B. Each applicant has a real outcome, whether they would have succeeded, and the model's choice. The code counts the four outcomes for each group and prints the four measures and their gaps. In this made-up rule, a gap of 5 points or less passes. It is my limit for this demo. It is not a legal threshold.

```python
from collections import Counter

# A hiring shortlist model, checked on 600 made-up past applicants.
# Each row: (group, would have succeeded in the role, shortlisted by the model)
ROWS = (
    [("A", True, True)] * 160 + [("A", True, False)] * 40
    + [("A", False, True)] * 40 + [("A", False, False)] * 160
    + [("B", True, True)] * 40 + [("B", True, False)] * 10
    + [("B", False, True)] * 30 + [("B", False, False)] * 120
)

def measure(group):
    c = Counter((y, p) for g, y, p in ROWS if g == group)
    tp, fn, fp, tn = c[(True, True)], c[(True, False)], c[(False, True)], c[(False, False)]
    n = tp + fn + fp + tn
    return {
        "selection rate": (tp + fp) / n,
        "true positive rate": tp / (tp + fn),
        "false positive rate": fp / (fp + tn),
        "precision": tp / (tp + fp),
    }

a, b = measure("A"), measure("B")
for name in a:
    gap = (a[name] - b[name]) * 100
    verdict = "pass" if abs(gap) <= 5 else "fail"
    print(f"{name:<20} A {a[name]*100:5.1f}%  B {b[name]*100:5.1f}%  gap {gap:5.1f}  {verdict}")
```

Output:

```text
selection rate       A  50.0%  B  35.0%  gap  15.0  fail
true positive rate   A  80.0%  B  80.0%  gap   0.0  pass
false positive rate  A  20.0%  B  20.0%  gap   0.0  pass
precision            A  80.0%  B  57.1%  gap  22.9  fail
```

Group A had half its applicants succeed, and group B had a quarter. The error rates match exactly: 80% of qualified people were chosen in both groups, and 20% of unqualified people were chosen in both. But 50% of group A was chosen against 35% of group B, and the precision gap is 22.9 points. The same model passes both error-rate checks and fails the other two.

*Diagram, One model, four measures, two verdicts: The same made-up shortlist model, checked for two groups. Error rates match, so qualified people are missed at the same rate in each group. Selection and precision do not match, so one group is chosen less often. Both results are true at once.*
1. Error rates pass the 5-point check in both groups.
2. Two gaps are wide: who gets chosen, and how often the picks are right.
3. Error rates match, so qualified people are missed at the same rate.
4. Selection and precision differ, so the model fails that check.

The reason is the base rate, the share of each group that really qualifies. Group B has fewer qualified people. If the model does better than chance (its true positive rate is above its false positive rate) and its error rates match, a different base rate forces a different share chosen and a different precision. The table shows that trade-off directly.

The honest part is the noise. With 200 people in a group, a handful of cases can move a rate by a few points, so check the group sizes before trusting a gap. Then say which error hurts more: a strong candidate who is missed, or a weak one who is shortlisted.

### How would you report this to a hiring committee?

A recruiting director asks for one fairness score before the model goes live. I would decline a single score. I would show the four gaps, the group sizes and the real outcome data, then name the measure we chose and the harm it protects against.

> **Tip:** Say it plainly: one number hides the trade-off, and the committee has to own that choice. Write the choice down with the date and the data it used.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Split the results by group, then compare selection, error and precision gaps.
- [ ] Name the groups, the real outcome and the group sizes you can trust.
- [ ] Know that the measures can't all match when the groups differ in base rate.
- [ ] Pick the measure from the harm: who gets missed, or who gets wrongly chosen.
- [ ] Treat the numbers as evidence for a person to judge, and never as a pass mark on their own.
- [ ] Plan a repeat check after launch, because real data changes.

**Common traps**

- Trap: "Overall accuracy is high, so the model is fair." Better: Overall scores can hide one group. Split the results by group before you say anything about fairness.
- Trap: "We removed the group column, so it can't be biased." Better: Other fields can stand in for the group. Measure the gaps anyway.
- Trap: "One fairness number is enough." Better: The measures disagree when groups differ. Show the set, and the trade-off you chose.

## Can you spot the weak evidence?

**Spot the weak evidence:** A team's fairness slide has four facts. Which line draws a conclusion its evidence does not support?

A. Selection rate: 50% of group A and 35% of group B were shortlisted, from 600 past applicants.
B. Error rates: 80% of qualified people were shortlisted in both groups.
C. Overall accuracy is 80%, so the model treats everyone the same.
D. Group sizes: 400 in group A and 200 in group B, each with its real outcome.

**Answer:** C. Equal accuracy does not mean equal treatment. In the worked example, accuracy is 80% in each group (320 of 400 in group A, 160 of 200 in group B), yet the selection and precision gaps fail. The other three facts are numbers only: the second shows matching error rates, and the first and fourth show the selection gap and the group sizes.

**Quick check:** A model passes equal error rates but fails equal selection rates across two groups. What do you do first?

A. Report it as fair, since the error rates are equal.
B. Check the group sizes and real outcomes, then decide which gap matters most for the harm.
C. Remove the group column and run the same test again.
D. Ask the vendor for its overall accuracy score.

**Answer:** B. Check the group sizes and real outcomes first, because both results are real and can disagree when the groups differ in their real outcomes. Then ask which error hurts the people in the decision most, and whether the group sizes can support the gap.

## Can you answer these from memory?

**Flash cards**

- **What is selection rate?** The share of a group that the model chooses, such as shortlisted applicants.
- **What is a true positive rate?** Of the people who truly qualify, the share the model chooses.
- **What is a false positive rate?** Of the people who don't qualify, the share the model still chooses.
- **Can all the fairness measures match at once?** Not in general. Kleinberg and colleagues showed this for risk scores, except in special cases.
- **Why check by group?** A good overall score can hide one group the model serves badly.
- **What is the first question to ask?** Which error hurts the people in the decision most?

## Likely follow-up questions

- Q456 Bias and fairness in LLMs? https://designervenkat.online/interview/ai/bias-and-fairness-in-llms
- Q462 Model cards vs system cards? https://designervenkat.online/interview/ai/model-cards-vs-system-cards
- Q463 Auditability and audit logs? https://designervenkat.online/interview/ai/auditability-and-audit-logs
- Q466 NIST AI RMF basics? https://designervenkat.online/interview/ai/nist-ai-rmf-basics
- Q460 What are the EU AI Act risk tiers? https://designervenkat.online/interview/ai/what-are-the-eu-ai-act-risk-tiers

## Learn it in depth

- [Checking Who Your AI Works For](https://designervenkat.online/learn/ai-engineering/bias-and-fairness)
