Bias in AI
Bias in AI means a program treats some groups of people less fairly than others. A cinema uses an AI tool to pick who gets an interview for a weekend job.
Twenty people apply. Almost everyone it picks lives on the east side of town. Nobody told it to do that, so how did it happen?
By the end of this lesson
Note
I can spot when an AI result may be unfair.
Key words
| Word | What it means |
|---|---|
| Bias | a lean that treats some people less fairly |
| Fair | treating people alike when they are alike |
| Group | people who share something |
| Training data | the examples an AI learned from |
| Shortlist | the people picked to go on to the next step |
The cells students fill in are left blank in this preview.
Unfair examples give unfair results
The cinema tool learned from past staff. Most of them lived on the east side, because the old bus route came from there.
So the tool learned "east side" as part of a good worker. That is bias. The training data leaned one way, so the results lean too.
Notice it by comparing groups
You can often spot bias with simple counting. Split the people into groups, then compare how often each group was picked.
If two groups applied in the same way but one is picked far more, ask why.
Worked example: the cinema shortlist
| Group | Applied | Picked | Picked out of 10 | As a percentage |
|---|---|---|---|---|
| East side | 10 | 6 | 6 out of 10 | 60% |
| West side | 10 | 2 | 2 out of 10 | 20% |
| Gap | 4 out of 10 | 40% |
The cells students fill in are left blank in this preview.
Count who was picked
# Each person is [group, picked]. True means picked.
people = [
["east", True], ["east", True], ["east", False], ["east", True],
["west", False], ["west", True], ["west", False], ["west", False],
]
applied = {}
picked = {}
for person in people:
group = person[0]
if group not in applied:
applied[group] = 0
picked[group] = 0
applied[group] = applied[group] + 1
if person[1]:
picked[group] = picked[group] + 1
for group in applied:
print(group, picked[group], "out of", applied[group])
Turn the counts into a gap
# Picked out of applied for each group, from the Run above.
east_picked = 3
east_applied = 4
west_picked = 1
west_applied = 4
east_rate = round(east_picked * 100 / east_applied)
west_rate = round(west_picked * 100 / west_applied)
print("East:", east_rate, "%")
print("West:", west_rate, "%")
print("Gap:", east_rate - west_rate, "%")
What to do when a result looks unfair
Say what you noticed, with the numbers. Tell somebody who can change it: a teacher, a manager, or the report button in an app. Ask for a person to check the decision.
Check your own use too. If you ask AI for pictures or stories about people, look at who is shown and who is missing.
Worked example: who to tell
| Where you saw it | Who to tell |
|---|---|
| An app at college | Your teacher |
| A tool at a part-time job | Your manager |
| An app on your phone | The app report button, or an adult you trust |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think a computer cannot be unfair, because it only follows the data. That is the problem: when the data is one-sided, the results are one-sided too, so the numbers need checking.
Going further: whose pictures?
Think of a picture tool asked for "a scientist" or "a nurse". If it always shows the same kind of person, that is bias in its examples.
Write down two questions you would ask the people who made such a tool.