# Data Bias vs Model Bias

> Where bias comes from in a machine learning system: the data the model learns from, or the model's own limits, with a worked example for your AI interview.

**In short:** Data bias is when the examples a model learns from do not match the real world, through skipped, old or one-sided records. Model bias is systematic error from a model too simple to capture the pattern, so it misses in the same direction even on its own training data.

AI and LLM interview question Q435, Classic ML and deep-learning basics. Beginner, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/data-bias-vs-model-bias

## Say it in 30 seconds

Data bias is when the examples a model learns from don't match the real world: old, skipped or one-sided records. Model bias is error from a model too simple to capture the pattern, so it's wrong even on its own training data. I tell them apart by checking where the errors show up. High error everywhere points to the model. Fine overall but bad on one group or route points to the data. The fixes are different, so I diagnose first.

## Say it in 2 minutes

Bias in a machine learning system can come from two places, and interviewers like to see that you can separate them. Data bias is about what the model learns from. The examples may skip some cases, carry old rules, or over-represent the unusual. Model bias is about the model itself. A model that is too simple for the pattern misses it, even on the examples it was trained on.

Take a made-up courier model that predicts delivery time from route length. If the logs only hold short routes, the model has never seen a long trip, so its guess for a 50 km route can be far off. That is data bias. If the logs are complete but a straight line is used for a curved trip-time pattern, the model is wrong on the logged routes too. That is model bias.

I check where the error shows up. Errors on the training data point to the model, though noisy labels can cause them too. Low error does not clear the data, since a model can learn biased labels perfectly. Errors that only hit one group, one region or one kind of case point to the data. The fixes differ: give the model a shape that can bend, or collect the missing cases.

When the decisions affect people, I also score each group on its own, because one overall score can hide a group that is treated worse. That usually starts in the data, but the model's own choices can add to it.

## What are data bias and model bias, in plain words?

Bias here means a lean: the model gets things wrong in the same direction again and again, as a steady tilt. The word has several meanings in machine learning, and teams mix them up. This page uses two of them and keeps them apart.

Data bias means the examples the model learns from don't match the real world. Model bias means the model itself is too simple for the pattern, so it misses even when the data is good.

Think of a triage nurse who has only ever worked in one city clinic. Her idea of a normal patient comes from that clinic alone. That skew is like data bias. A nurse who judges every patient by one rough rule, however many patients she has seen, has model bias. The first problem is in what she has seen. The second is in how she thinks.

A courier model trained only on logs of short trips is the same problem. It has never seen a long route, so the data is the first place to look.

- **Training data:** The examples a model learns from.
- **Systematic error:** A mistake that leans the same way every time, not random noise.
- **Underfitting:** A model too simple to fit the real pattern.
- **Sampling:** The way examples get picked into the data.

## What is data bias, and where does it come from?

Data bias starts before any model is trained. Google's machine learning glossary has an entry for bias in ethics and fairness. One form in that entry is a systematic error introduced by a sampling or reporting procedure.

> "Systematic error introduced by a sampling or reporting procedure." (Google Machine Learning Glossary)
>
> "Machine learning (ML) models are not inherently objective." (Google fairness course)

- **Sampling: Who gets picked.** Examples are chosen without proper randomisation, or a survey leaves a group out. The model then only knows the people it was shown.
- **Coverage: Cases left out.** Data is not selected in a representative fashion, so whole kinds of cases never appear.
- **Historical: The past, copied.** Old records reflect the inequities of their time, such as past lending rules. The model learns to repeat them.
- **Reporting: What gets written down.** For example, unusual events get logged more than ordinary ones, so the data over-represents the extremes.

*Diagram, How data bias creeps in: Real trips reach the model only after collection drops some of them. The model learns from what is left, so its biggest misses fall on cases that were never logged.*
1. Long, hard trips are left out of the logs.
2. Old records are kept, with their old rules.
3. Only what was logged reaches the training data.
4. The old rules shape what the model learns.
5. The model learns the skewed picture from that data.
6. On cases it never saw, it guesses and misses most.

Data bias is often a coverage problem. A model only learns from the cases the data holds, so the cases the data never holds are where it guesses. Google's fairness course says that human involvement in curating the data can make a model's predictions susceptible to bias.

## What is model bias, and how is it different?

Model bias, in the statistical sense, is error that comes from the model's own shape. A model that is too simple cannot follow a real pattern, however clean the data. Google's glossary defines the result as underfitting. scikit-learn's underfitting example makes the same point with a straight line, which is not sufficient to fit the training samples. In scikit-learn's bias-variance split, bias is the average gap between the model's predictions and those of the best possible estimator.

> "Producing a model with poor predictive ability because the model hasn't fully captured the complexity of the training data." (Google Machine Learning Glossary)

Causes include training on the wrong set of features (the input columns the model sees, such as route length), or a regularisation rate (a penalty that stops a model from fitting too wildly) set too high. Set too strong, that penalty leaves the model too simple. The glossary also uses bias for a line's y-intercept. That is a different thing, so the intercept in the code later on is not the model bias discussed here.

- **Data bias: Wrong picture of the world.** The model learns a skewed picture, so it fits the data it has and fails where the data is thin.
- **Model bias: Too simple a shape.** The model cannot bend to fit the pattern, so it misses even the data it learned from.

*Diagram, Model bias: the shape is too simple: A straight line is fitted to a curved pattern. It misses even the routes it learned from, so the error comes from the model's shape, and more data would not fix it.*
1. The straight line is fitted to curved trip times.
2. Its errors show up on routes it trained on.
3. Its errors also follow the curve's shape.
4. Errors on logged routes point at the model's shape.
5. A shape misfit calls for a richer model or features.
6. The fix is tested on routes it has not seen.

Model bias is one half of the bias-variance trade-off. The other half, variance, is covered on its own Interview Kit page, so here I only need the bias side. Favouritism toward groups of people, the fairness sense from the same glossary entry, is covered on its own Interview Kit page.

## How do you tell them apart in a real project?

Look at where the error shows up. High error everywhere, including on the training data, points to the model. Fine overall but bad on one slice of cases, or bad only once the model is live, points to the data. Good training error does not clear the data, though: a model can learn biased past labels perfectly, so check those labels against fresh outcomes for each group.

> **Tip:** Split the errors by group, region or route length before you change anything. One overall score hides both problems.

Here is the courier model in a few lines of plain Python. The true trip time bends upward on long routes. The same straight-line model is trained twice, once on all routes and once on short routes only.

```python
# A made-up city courier predicts delivery minutes from route length.
# Real trips slow down faster on longer routes, so the true curve bends.
def true_minutes(km):
    return 10 + 1.0 * km + 0.02 * km * km

def fit_line(xs, ys):
    # Least-squares straight line, returned as (intercept, slope).
    n = len(xs)
    mx, my = sum(xs) / n, sum(ys) / n
    slope = sum((x - mx) * (y - my) for x, y in zip(xs, ys)) / sum((x - mx) ** 2 for x in xs)
    return my - slope * mx, slope

def predict(line, km):
    return line[0] + line[1] * km

all_routes = list(range(5, 51, 5))                  # logged routes, 5 to 50 km
short_only = [km for km in all_routes if km <= 20]  # logs that miss the longer routes

for name, routes in [("All routes logged", all_routes), ("Only short routes logged", short_only)]:
    line = fit_line(routes, [true_minutes(km) for km in routes])
    for km in (5, 20, 50):
        print(f"{name}, {km} km: predicted {predict(line, km):.0f} min, true {true_minutes(km):.0f} min")
```

Output:

```text
All routes logged, 5 km: predicted 10 min, true 16 min
All routes logged, 20 km: predicted 41 min, true 38 min
All routes logged, 50 km: predicted 104 min, true 110 min
Only short routes logged, 5 km: predicted 15 min, true 16 min
Only short routes logged, 20 km: predicted 38 min, true 38 min
Only short routes logged, 50 km: predicted 82 min, true 110 min
```

Read the output. With all routes logged, the line is off even on routes it trained on: 10 minutes predicted for 16 true at 5 km. That is model bias. With only short routes logged, the 50 km prediction misses by 28 minutes. That is data bias: the model never saw long trips, and the error lands exactly where the data is missing.

The fixes differ. For model bias, give the model a shape that can bend, such as a squared term (a route length squared column that lets the line bend), or better features. For data bias, collect the missing cases. Google's mitigation guide says the same thing in its own words: once a bias is found in the training data, steps are taken to reduce its effects. Adding more trips of the lengths already logged would not help here.

### How would you check a loan model for both?

A bank's loan model rejects far more applicants from one region than its risk team expects. Before anyone blames the model, you split its errors by region and by the year each past loan was written.

1. **Check how much data each group has:** Count the past loans from that region. If the count is thin, suspect data bias first.
2. **Check the error on the training data:** If the model is also wrong on past loans from every region, its shape is too simple. That is model bias.
3. **Check the labels for history:** Old decisions made under past lending rules can teach the model to repeat them. That is historical bias, and a count will not show it.
4. **Score each group on its own:** Google's fairness course says that evaluating model performance by subgroup ensures fairness and equal performance across different characteristics. Re-test on fresh data after every change.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain split: data bias is the examples, model bias is the model's own shape.
- [ ] Examples of data bias: sampling, coverage, historical and reporting bias.
- [ ] Model bias means underfitting: wrong even on the training data.
- [ ] Diagnosis by error on training data and by slice, before any change.
- [ ] The fairness meaning, and that the word bias has several senses.
- [ ] The fixes differ: a richer model or features, or the missing data.

**Common traps**

- Trap: "Bias is always the data, so cleaning the data fixes it." Better: Cleaning only helps if the data is the problem. If the model is wrong on its training data, its shape is too simple.
- Trap: "A bigger model removes the bias." Better: A more flexible shape can fix model bias. No model can learn cases that were never logged, so check which bias you see first.
- Trap: "Model bias and data bias are the same thing." Better: One is the examples, the other is the model's shape. The fixes differ, so name which one you see.

## Can you spot the cause?

**Spot the cause:** A fraud model scores well overall, but it misses more fraud in one region, where few past cases were ever logged. What is the most likely cause?

A. Model bias: the model's shape is too simple for the pattern.
B. Data bias: that region is thin in the training data.
C. The learning rate is too high.
D. Variance, because the test set is small.

**Answer:** B. Good scores overall, with misses in only one thinly logged region, point to the data. If the shape were the problem, the model would miss in every region, including the ones with plenty of data.

**Quick check:** A straight line predicts trip time badly even on the routes it trained on. Which fix is most likely to help?

A. Collect more routes of the same length
B. Give the model a shape that can bend, such as a squared term
C. Drop the route length feature
D. Train for fewer epochs

**Answer:** B. The error shows up on the training data too, so the model is too simple. A shape that can bend fits the curve. More routes of the same length add nothing new.

## Can you answer these from memory?

**Flash cards**

- **What is data bias?** The examples a model learns from don't match the real world.
- **What is model bias?** Error from a model too simple for the pattern. Wrong even on its own training data.
- **Fastest test to tell them apart?** Check training error. High points to the model or noisy labels. Low does not rule out biased labels.
- **Four examples of data bias?** Sampling, coverage, historical and reporting bias.
- **Is model bias the fairness meaning?** No. Fairness bias is favouritism toward groups of people.
- **Fix for data bias?** Collect the missing cases and check the labels for history.

## Likely follow-up questions

- Q412 Bias vs variance? https://designervenkat.online/interview/ai/bias-vs-variance
- Q413 Overfitting vs underfitting? https://designervenkat.online/interview/ai/overfitting-vs-underfitting
- Q422 Train/validation/test splits? https://designervenkat.online/interview/ai/train-validation-test-splits
- Q424 What is data leakage? https://designervenkat.online/interview/ai/what-is-data-leakage
- Q425 How do you handle class imbalance? https://designervenkat.online/interview/ai/how-do-you-handle-class-imbalance
- Q457 How do you measure fairness? https://designervenkat.online/interview/ai/how-do-you-measure-fairness
