Artificial Intelligence · AI Foundations
Bias and Fairness in Models
In AI because slice metrics and disparate-impact screening are how deployed models are actually audited for uneven treatment.
A model fitted to yesterday's decisions will reproduce yesterday's pattern, fair or not — and one overall accuracy number is exactly the summary that hides it. This lesson is about measurement: computing the same metric separately for every group a decision lands on, screening selection rates for disparate impact, and understanding why the popular fairness criteria cannot all be satisfied at once.
- Artificial Intelligence
- Medium level
- 5 concepts
1Where bias enters a model
A supervised model learns the mapping its labels describe, and labels are records of past decisions, not of ground truth. If loan officers historically declined one community more often, 'was approved' encodes that behaviour, and a model fitted to it learns the behaviour with the same confidence as any real signal.
Bias also enters before labelling. A sampling frame that under-represents a group gives the model less to learn from exactly where reliability matters, and a measured feature can mean different things across groups — an arrest record measures policing intensity as much as offending.
None of this requires bad intent anywhere in the pipeline, which is why the response is measurement rather than reassurance: uneven treatment is found by computing rates per group, never by inspecting the code.
Figure. The highlighted node is the misread: training labels sit in the middle of the chain, treated by the fit as truth, while being themselves decisions somebody made. Whatever pattern the deciders had, the model inherits and repeats.
Where to look
- Label provenanceAsk who produced the label and what it records. 'Approved' is a decision; 'repaid' is an outcome — models trained on each learn different things.
- Sampling frameAsk who is missing or rare in the training rows; a group the data barely sees gets the least reliable predictions.
- MeasurementAsk whether a feature means the same thing for every group, or measures the process that recorded it.
A hiring model reports 88% accuracy overall. Which further measurement would most change your confidence in it?
- Its accuracy back on the rows it was trained with
- The same accuracy computed separately for each group the decision lands on
- The number of features that went into the fit
- How long the training run took to complete
A global average can hide a model that works for the majority and fails a minority. Disaggregating is what turns one comfortable number into the several honest ones.
2Slice metrics: one number per group
A global metric is an average over everyone the model touches, and an average has no opinion about who is carrying the errors. Serious evaluation therefore slices: compute the same metric — accuracy, false positive rate, recall — separately for every group the decision lands on, and read the spread, not the mean.
Slices earn their own caveat: a rate on a small slice is noisy. Report the count next to every slice rate, and treat a startling number on thirty rows as a reason to collect data, not yet as a finding.
Figure. The dashed rule is the headline number, and it sits close to group A because group A is three times bigger. The overall metric is a weighted average whose weight is group size, not importance — which is exactly how a 61% slice hides inside an 85% headline.
One average, two experiences
A screening model is evaluated on 400 applications: 300 from group A, of which 279 are scored correctly, and 100 from group B, of which 61 are scored correctly.
- Group A accuracy = 279 / 30093%
- Group B accuracy = 61 / 10061%
- Overall = (279 + 61) / 40085%, sitting near the majority
Pro tip. The overall number is always dominated by the biggest group: a model can lose a third of its accuracy on a minority slice and pay only a few points overall. The slice table, not the headline, is the audit.
Coding lab. Slice a metric by group runs in the app, with checks on your output.
3Selection rates and the four-fifths screen
For a yes/no decision the coarsest fairness number is the selection rate: of everyone in a group who was scored, what fraction got the favourable outcome. Disparate impact means the rates differ across groups badly enough to need an explanation, whatever the model intended.
The common screening heuristic — borrowed from US employment practice and useful well beyond it — is the four-fifths rule: flag the system when one group's selection rate falls below 80% of the highest group's rate. It is a tripwire, not a verdict: a flagged ratio starts an investigation into features and labels, and an unflagged one does not certify fairness.
Figure. The dashed line is four-fifths of the higher rate (0.8 × 60% = 48%). Group A's 30% sits well below it, so the screen trips. The bars are rates, not counts — 60 of 200 against 90 of 150.
Screening two selection rates
A shortlist model scores 200 applicants from group A and selects 60; it scores 150 from group B and selects 90.
- Rate A = 60 / 20030%
- Rate B = 90 / 15060%
- Impact ratio = 30% / 60%0.50
- Screen: 0.50 against the 0.80 lineflag — investigate
Pro tip. Run the ratio in both directions of favourable outcome. A model can pass the screen on approvals and fail it on who gets flagged for extra review — the adverse action is where the harm usually lives.
Coding lab. Four-fifths screen in six lines runs in the app, with checks on your output.
4The two errors cost different things
Every binary decision system has two failure modes: the false positive (flagged, and should not have been) and the false negative (missed, and should not have been). They land on different people at different prices — a wrongly declined loan and a wrongly approved one are not the same event to anyone involved.
The threshold that trades them off is therefore a policy choice wearing a numeric costume. Choosing it means naming who bears each error, at what cost, and at what rate per group — which is why slice audits are run on false positive and false negative rates, not only on accuracy.
The same threshold produces both errors; only their prices differ.
| Decision | False positive costs | False negative costs |
|---|---|---|
| Loan approval | Lender: a default it invited | Applicant: credit denied on a miss |
| Medical triage | Patient: anxiety, needless tests | Patient: a missed urgent case |
| Fraud review | Customer: honest payment blocked | Platform: the fraud goes through |
5Fairness metrics disagree by design
Once slices exist, several reasonable-sounding requirements compete. Demographic parity asks for equal selection rates across groups; equalised odds asks for equal false positive and false negative rates; calibration asks that a score of 0.8 mean the same 80% chance in every group.
These are not variants of one idea. A known impossibility result says that when the groups differ in base rate, a classifier cannot be calibrated and have equal error rates at the same time except in degenerate cases. The requirements are mutually exclusive, mathematically, not politically.
So 'is the model fair' is underspecified until you say fair by which criterion, and the criterion is chosen from the domain: what the decision does to people, which error is worse, and whether the score will be read as a probability.
Each equalises a different quantity; the decision, not taste, picks one.
| Criterion | Equalises across groups | Natural fit |
|---|---|---|
| Demographic parity | Selection rate | Outreach, screening funnels |
| Equalised odds | FPR and FNR | Punitive or gate decisions |
| Calibration | Meaning of the score | Scores read by humans as risk |
Notes
- Slice metrics, selection rates and the four-fifths screen, and why fairness criteria conflict.
- A global metric is an average, and an average has no opinion about who carries the errors.
- Flag a group whose selection rate falls below four-fifths of the highest group's rate.
Exam traps & shortcuts
- Report the row count beside every slice rate — a shocking rate on thirty rows is a data-collection task, not a finding.
- Run the four-fifths ratio on the adverse action too; passing on approvals while failing on extra-review flags is the common miss.
- Never average a metric over groups to summarise fairness — the average is the number slicing exists to break open.
Recap
This lesson in brief:
- Where bias enters
- Labels record past decisions, not ground truth; sampling and measurement skew arrive before any model does.
- Slice metrics
- Compute the same metric per group and read the spread; the overall number is weighted by group size.
- Four-fifths screen
- Flag when one group's selection rate falls below 0.8 of the highest group's — a tripwire for investigation, not a verdict.
- Criteria conflict
- Parity, equalised odds and calibration equalise different quantities and cannot all hold when base rates differ.
Practise Bias and Fairness in Models
Reading is free and needs no account. Practice, mocks and progress live in the app.
- A 1-question practice set that ends the chapter
- 1 quick check with worked explanations
- Timed mocks scored with the real marking scheme
- Readiness tracked per topic, kept on your device