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

Deep Learning & Neural Networks — Alpha School

Lesson 19: Bias, Safety and Responsible AI

A model learns from data, and data carries the history of the world it came from — including its unfairness. If a hiring dataset contains mostly one group of people in senior roles, a model trained on it may learn to prefer that group, not because the group is better, but because the pattern is in the data. This is bias: a systematic error that falls unevenly on different people. It is not a bug in the code; it is the model doing exactly what it was trained to do, on data that was itself uneven.

Bias can enter at every stage. The data may under-represent some groups, or label them differently. The choice of what to predict can itself be unfair: predicting who will repay a loan from past lending decisions repeats the biases of those decisions. And the way success is measured can hide the problem, if the score is reported only as an average. The first step in dealing with bias is to look for it deliberately: measure performance separately for each group that matters, and ask whether the model's errors fall evenly.

Safety: What Can Go Wrong

Safety is the wider question of what happens when a model is wrong, misused, or attacked. A model can be fooled by inputs designed to trick it — a small change to an image, invisible to a person, can flip its answer. A language model can be prompted into producing harmful instructions, or into repeating private information from its training data. And a model that works well in testing can fail in the real world when the data it meets drifts away from what it was trained on. None of these are reasons to abandon the technology; they are reasons to test for them before deployment, to limit what a model is allowed to do, and to keep a person in charge of high-stakes decisions.

There are practical defences. Test with adversarial examples — inputs crafted to mislead — and with data from groups your training set under-represents. Limit a model's reach: let it suggest, not decide, where a mistake would harm someone. Keep logs, so that when something goes wrong you can find out what the model saw and what it did. And be honest in what you claim: a model that is right 90% of the time is wrong 10% of the time, and someone should know that before they rely on it.

Whose Responsibility?

Responsibility for a model's behaviour sits with the people who build and deploy it, not with the model. A network cannot be blamed; it has no intentions and no understanding. That is precisely why the human work matters: choosing the data, choosing what to predict, testing by group, setting the limits, and being willing to say no to a deployment that is not ready. The most important skill in this lesson is not technical — it is the habit of asking, before you ship, who could be harmed if this model is wrong, and what you have done about it.

Testing for Bias, Step by Step

Testing for bias is a concrete activity, not a vague aspiration, and it follows a simple routine. First, decide which groups matter for your application — by age, gender, language, region, or whatever is relevant — and make sure your test set contains enough examples from each group to measure them separately. Second, report the model's performance per group, not just the average: accuracy, precision and recall for each. Third, look at the errors: are the mistakes for one group different in kind from the mistakes for another? A model that fails one group by missing cases, and another by raising false alarms, has two different problems, and they need two different fixes.

The fixes depend on what you find. If a group is under-represented, more data from that group is the most direct remedy. If the labels themselves are biased — one group's examples labelled more harshly, say — then the data needs to be re-examined, not merely enlarged. And if the task itself is unfair, no amount of data will fix it; the task must change. The routine does not guarantee a fair model, but it guarantees that unfairness will be seen rather than hidden, and seeing it is the precondition for fixing it.

Key Terms

Bias
A systematic error that falls unevenly on different groups of people.
Under-representation
When some group appears too rarely in the training data for the model to learn them well.
Adversarial example
An input deliberately crafted to mislead a model.
Human oversight
Keeping a person in charge of high-stakes decisions a model helps with.
Fairness
The aim that a model's benefits and errors do not fall unevenly on different groups.
Accountability
Being able to explain, and take responsibility for, what a deployed model does.

Discussion Questions

  1. If a model simply repeats patterns in its training data, is the bias the model's fault, the data's fault, or the builder's? Why?
  2. A model is tested only on average accuracy. What kinds of unfairness could that hide?
  3. When should a model be allowed to decide, and when should it only suggest? What makes the difference?

Practice Questions

  1. What is bias in a machine learning model?
  2. Why can measuring only average accuracy hide unfairness?
  3. What is an adversarial example?
  4. Give two practical defences against unsafe model behaviour.
  5. Why does responsibility sit with the people who build and deploy a model?
Show answers
  1. A systematic error that falls unevenly on different groups of people. It usually comes from patterns in the training data, not from a bug in the code.
  2. Because a model can be accurate on average while failing badly for one group. The average hides how the errors are shared out.
  3. An input deliberately crafted to mislead a model — for example a tiny change to an image, invisible to a person, that flips the model's answer.
  4. Any two of: test with adversarial examples; test on under-represented groups; let the model suggest rather than decide on high-stakes cases; keep logs; or be honest about the model's error rate.
  5. Because a model has no intentions or understanding and cannot be blamed. The humans choose the data, the task, the limits, and whether to deploy.
Keep reading to complete this lesson