Please enable JavaScript to use CodeHS

Responsible AI & Safety

AI Bias and Fairness

AI learns from examples. If those examples aren't balanced, the AI can end up unfair — without anyone teaching it to be. See how that happens, where it shows up, and how it gets fixed.

Responsible AI ~9 min Beginner friendly
The Big Idea

The big idea

AI systems learn by looking at huge piles of examples, called training data. They study those examples, find patterns, and use the patterns to make decisions about new things they haven't seen before.

Here's the catch: if the training data reflects unfair patterns from the real world, the AI can learn those same unfair patterns — and sometimes make them even stronger. Nobody has to sit down and program the AI to be unfair. It can happen automatically, just because of what the AI was shown.

Simple definition: AI bias is when an AI system treats groups of people unequally because the data it learned from was unbalanced or unrepresentative — not because anyone told it to be unfair.

Think about it like a robot chef.

Trained on one cookbook

If you taught a robot chef using only recipes from one country's cookbook, it would decide that's simply what "good food" tastes like. Show it a delicious dish from a cuisine it never saw, and it might reject it or mess up the recipe entirely.

Trained on many cookbooks

If the robot chef studied recipes from cuisines all over the world, it would have a much wider idea of what "good food" can look like — and it would judge new dishes more fairly.

The robot chef isn't malicious in the first case. It just never saw enough examples to know any better. Its whole idea of "normal" came from a narrow slice of the world. AI bias works the same way.


Interactive

See bias in action

Let's build a tiny, made-up "hiring model" to see how this works. This is a simulation with fake data and a simple made-up scoring formula — it is not a real hiring tool, and it isn't how any actual company scores candidates. It's just simple enough that you can see the mechanism clearly.

Imagine a company that has hired people from two schools in the past: School A and School B. We'll feed the toy model different mixes of "past hires" as training data, then see how it scores four new candidates who are all described as equally qualified — two from School A, two from School B.

Hiring Model Demo (simulation only)

Made-up data. Made-up scoring formula. No real people, companies, or hiring systems are involved.

Training data: 50% School A / 50% School B

Toy model's score for four equally-qualified new candidates

Same resume quality, different school. Watch the bars move as you change the training mix above.

0
Candidate 1
School A
0
Candidate 2
School A
0
Candidate 3
School B
0
Candidate 4
School B
School A candidate School B candidate
What to notice: at a balanced 50/50 mix, School A and School B candidates score about the same. Drag the mix toward one school, and that school's candidates start scoring higher — even though we never changed how qualified anyone is.

This is a simplified illustration of a real phenomenon. When training data overrepresents one group, a model can learn to associate that group with "success" and quietly favor it — even when every candidate is equally qualified on paper.


Real World

Where it shows up

The toy demo above is a simplification, but the underlying pattern — unbalanced training data leading to unbalanced results — has been a documented concern in real AI systems. Here are a few general examples, without naming any specific company or product:

Facial recognition

Some facial recognition systems have performed less accurately for people with certain skin tones, because the training photos underrepresented those skin tones.

Resume screening

Tools that screen resumes by learning from a company's past hires can end up favoring backgrounds similar to those past hires, even when other candidates are just as qualified.

Translation tools

Some translation systems have defaulted to stereotypical assumptions, like assuming a doctor is male and a nurse is female, because that pattern was more common in the text they trained on.

Key takeaway: in every one of these cases, nobody wrote a rule saying "treat this group unfairly." The bias came from the data reflecting real-world patterns that weren't balanced to begin with.


How It Gets Fixed

Reducing bias

Bias isn't something you can eliminate with a single fix, but teams that build AI responsibly use several practices together:

  • Use more diverse, representative training data. The wider the range of examples an AI learns from, the less likely it is to treat a narrow slice of the world as "normal."
  • Test performance across different groups, not just overall. A model can look accurate on average while quietly performing worse for one group. Checking group-by-group results catches that.
  • Keep a human reviewer in the loop for high-stakes decisions. For things like hiring, loans, and medical decisions, a person should review or double-check the AI's suggestion rather than letting it decide alone.
  • Be transparent about limitations. Telling people what a model is good at — and where it's known to struggle — helps everyone use it more carefully.

None of these steps make an AI system perfect. But together, they catch a lot of the unfairness that would otherwise slip through unnoticed.


Your Turn

Check your understanding

If an AI photo-tagging tool was trained mostly on photos taken in sunny, well-lit rooms, what kind of photo might it struggle with, and why?

Your answer:

Sample answer: It would probably struggle with dim, dark, or shadowy photos. Since it never saw many examples of low-light pictures during training, it never learned the patterns that show up in them, so its guesses about what's in those photos would likely be less accurate.


Check Yourself

Quick quiz

1. Why can an AI system end up biased even if no one intended it to be?

2. In the hiring model demo, what caused the toy model to favor one school's candidates?

3. Which of these is a real, practical way teams reduce bias in AI systems?

Keep learning about responsible AI

Now that you've seen how bias can creep into an AI system without anyone intending it, the next tutorial looks at a bigger question: what does it even mean for an AI system to be "safe" or "aligned" with human goals?

Part of the "Responsible AI & Safety" tutorial series.