Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Machine Learning Foundations — Alpha School

Lesson 17: Bias, Fairness and Responsible Machine Learning

A model does not need to be told to be unfair. It only needs to learn from an unfair world. In 2018, researchers Joy Buolamwini and Timnit Gebru published a study called Gender Shades, testing three commercial systems that guessed a person's gender from a photograph. They found that darker-skinned women were misclassified in up to 34.7% of cases, while lighter-skinned men were misclassified in at most 0.8% of cases. The systems were not designed to discriminate; they were trained and tested mostly on lighter-skinned faces, and the gap only appeared when someone measured performance separately for each group instead of looking at one overall accuracy figure.

That last point is the key lesson of this chapter: a single overall score can hide a large gap. A model that is 95% accurate overall can still be wrong half the time for one group, if that group is small. The fix starts with measurement — always report performance broken down by the groups that matter, such as age, gender, skin tone or language. If you do not measure the gap, you cannot know it exists, and your users will discover it for you, in the worst possible way.

Where bias enters

Bias enters a machine learning system in at least three places. First, in the data, as you saw in Lesson 16: unrepresentative collection and labels that reflect past decisions. Second, in the labels themselves: if past loan officers approved loans unfairly, then a model trained on their decisions learns their unfairness as if it were the right answer. Third, in the choice of what to predict: a model asked to predict who will be a good employee from past hiring data is really being asked to predict who past managers liked — which is not the same thing at all. Each of these is a human decision, and each can be questioned before a single line of modelling begins.

What can be done? Start before training: collect data that represents everyone the model will serve, and check the labels for patterns that look like past prejudice. During training, check performance for each group, not just overall, and consider techniques that balance the data or penalise unequal errors. After deployment, keep measuring, because the world changes and a fair model can drift into unfairness. And always ask who is affected by a mistake: a wrong film recommendation is an annoyance, but a wrong medical or hiring decision changes a life, and those systems deserve far more care.

What fairness actually means

Fairness is not one thing, and that is part of what makes it hard. One definition says a model is fair if it is equally accurate for every group. Another says it is fair if it gives each group the same chance of a positive decision, such as a loan approval. A third says it is fair if, among the people who truly qualify, each group's members are equally likely to be recognised. These definitions sound similar, but they can conflict: a model cannot always satisfy all of them at once, and which one matters most depends on the decision. A hiring model and a medical screening model would reasonably choose different definitions, because the harm of each kind of mistake is different. The practical lesson is to say which definition you are using, measure it openly, and be ready to explain the choice to the people affected. Fairness is not a number you compute once and forget; it is a decision you make, defend, and revisit as the world changes.

None of this is about making models perfect. It is about being honest: honest about what the data contains, honest about who the model serves badly, and honest about the limits of what a model should be allowed to decide. A responsible practitioner does not hide behind the model — 'the algorithm decided' — because the algorithm decided what the data, the labels and the choices taught it to decide. Those were human choices, and humans remain responsible for them.

Key Terms

Algorithmic bias
Unfair differences in how a model treats different groups of people, learned from biased data, labels or choices.
Gender Shades
A 2018 study by Joy Buolamwini and Timnit Gebru showing large accuracy gaps in commercial face-analysis systems across skin tone and gender.
Fairness
In machine learning, the idea that a model's performance and mistakes should not fall unfairly on one group of people.
Group performance
A model's accuracy measured separately for each group, such as by age or skin tone, rather than as one overall figure.
Label bias
When the labels a model learns from reflect past human prejudice, so the model learns the prejudice as the right answer.
Proxy
A feature that stands in for a sensitive trait, such as a postcode standing in for income or ethnicity, letting bias in through the back door.
Accountability
The principle that the people who build and deploy a model remain responsible for its decisions, and cannot hide behind the algorithm.

Discussion Questions

  1. A model is 95% accurate overall but wrong half the time for one small group. Why does the overall figure hide that, and what should be reported instead?
  2. Buolamwini's study found the gap only by measuring each group separately. What does that say about how models should be tested?
  3. If a feature such as postcode predicts the same thing as ethnicity, should it be used? What would you do instead?

Practice Questions

  1. What did the Gender Shades study find?
  2. Why can one overall accuracy figure hide unfairness?
  3. Name two places bias can enter a machine learning system.
  4. What is a proxy, and why is it a problem?
  5. Why can't a practitioner say 'the algorithm decided' to avoid responsibility?
Show answers
  1. Darker-skinned women were misclassified in up to 34.7% of cases, while lighter-skinned men were misclassified in at most 0.8%. The study by Buolamwini and Gebru (2018) tested three commercial gender-classification systems.
  2. Because a small group can have a high error rate while the overall figure stays high. If the group is small, its mistakes barely move the average, so the gap stays invisible.
  3. In the data and in the labels. Unrepresentative data and labels that reflect past prejudice are two sources; the choice of what to predict is a third.
  4. A feature that stands in for a sensitive trait, such as postcode standing in for ethnicity. Removing the sensitive trait does not remove the bias if another feature carries the same information.
  5. Because the model learned from data, labels and choices that people made. The algorithm decided what it was taught to decide, so the people who built and deployed it remain responsible.
Keep reading to complete this lesson