← Module 1 overview
Module 1 · Lesson 1.5
1.5
When does it break?

Limits & Failures

Dataset shift, shortcut learning, hidden stratification, and confident mistakes

Overview

PTX-Detect scored 94% sensitivity in testing. This lesson is about why that number may not hold when the tool reaches your hospital, the surprising things models sometimes learn instead of the disease, and the habits that keep you safe when you work alongside AI. Each failure here has happened with real, published models. About 15-20 minutes.

By the end of this lesson you can:

New hospital, new problems

A model learns from the images it was given. If the images at a new hospital look different, the model is working outside what it learned. This is called dataset shift. Images can differ because of the scanner brand and settings, the patients (age, illness, body size), how films are taken (upright in the department or lying flat in the ICU), and even the software that processes the image.

Hospital A, where the model trained, uses Brand X scanners on adult outpatients with upright films and scored 94% sensitivity. Hospital B uses Brand Y scanners on ICU patients with portable lying-down films, and its sensitivity is unknown.
Figure 1. Same model, different images. A published score describes the hospital where the model was tested. (Illustrative example.)

Remember from Lesson 1.2 that a model is only checked properly on data it never trained on. A test set from a different hospital (an "external" test) is a much tougher and more honest check than one from the same hospital.

Shortcuts: right answer, wrong reason

Training rewards the model for getting the label right, and nothing else. If some feature of the image happens to go along with the label, the model will happily use it, even if it has nothing to do with the disease. This is called shortcut learning. Two real examples:

Shortcuts are hard to catch because the test score looks fine whenever the test set shares the same shortcut as the training set.

Try it: spot the shortcut

Interactive

This drawing shows a portable chest X-ray that PTX-Detect flagged for pneumothorax. Click each numbered region to find out whether it is the real finding or something the model might have used as a shortcut.

PORTABLE R 1 2 3 4

Where did PTX-Detect look?

Click a numbered region on the image. Some regions are the actual finding; others are clues that have nothing to do with the lung.

Image needed

A real portable chest X-ray with a visible text marker (e.g. "PORTABLE" or "SUPINE"), to replace or sit beside the drawing.

Image needed

A chest X-ray showing a pneumothorax with a chest drain in place.

Hidden stratification

A single overall score can hide a group of patients the model does badly on. Researchers looked at pneumothorax models trained on a large public chest X-ray dataset. Many of the positive films already had a chest drain. The models did well on those, but much worse on pneumothoraces without a drain, which are exactly the untreated cases that matter most. The overall score looked good because the two groups were mixed together. (Oakden-Rayner et al., 2020)

This is called hidden stratification. The lesson: ask how a tool performs on the patients you care about, not just overall. Remember Film C from the labeling activity in Lesson 1.3.

Try it: will it transfer?

Interactive

PTX-Detect was trained and tested on upright chest X-rays of adult outpatients at one large hospital, using one brand of X-ray machine. For each new setting, decide whether you would expect its published performance to carry over.

A similar hospitalAdult outpatients, upright films, same machine brand.
The closest match, so performance is most likely to hold. It is still worth checking on a sample of local films, because small differences add up.
A children's hospitalPatients aged 0-16.
Be cautious. Children's chests look different and the model never saw one. It may still give confident answers.
The ICUPortable films, patients lying flat, many lines and tubes.
Be cautious. On flat films a pneumothorax looks different (air collects at the front and bottom), and tubes are a known shortcut risk.
Same hospital, new machinesThe department switches to a different X-ray vendor.
Be cautious. New equipment changes image brightness, contrast and processing. Even at the same hospital, this is dataset shift.

Callback: go back to the model you trained in Teachable Machine in Lesson 1.2. Change the lighting, move to another room, or hold the pen at an odd angle. How quickly does it fail? That is dataset shift on your own desk.

Confident and wrong

Image needed

An AI heatmap (colored overlay) on a chest X-ray, ideally one that highlights the wrong area, such as a tube or text marker. Could come from a published paper figure if its license allows.

What you can do

You don't need to be a computer scientist to use AI safely. Three habits go a long way:

  1. Look first, then check the AI. Form your own read before you see the AI's answer, so the tool checks you rather than replaces you. Lesson 3.3 covers why this matters for learning.
  2. Ask what it learned from. Which patients, which hospitals, which machines, and how was it tested? If your patient is unlike the training data, trust the output less. Lesson 3.2 shows how to read the evidence.
  3. Speak up about errors. When the AI and your read disagree, look again carefully and ask a senior colleague. If the AI was wrong, report it. Errors that nobody reports never get fixed.

Knowledge check

Answer each question to continue. Any answer is fine; read the explanation.

A fracture-detection model scores very well at the hospital where it was built. At a second hospital with a different X-ray vendor, it misses many more fractures. What is the most likely explanation?

Different machines produce images that look different to the model. Its performance was measured on images like its training data; the new images are outside that. Models don't forget once trained.

A heatmap shows a model focused on the correct area of the lung. What can you conclude?

A heatmap is a rough picture of which pixels influenced the answer. A well-placed map is reassuring but not proof. A map on a tube or text marker, however, is a red flag worth noticing.

On a rotation, the AI says a chest X-ray is normal, but you think you see a small pneumothorax. What should you do?

Disagreement is exactly when a second look matters. The AI can miss findings, especially subtle ones or in patients unlike its training data. Raise it, learn from the answer, and report the AI's error if it was wrong.

Key takeaways

Module 1 complete

You now know what AI is, how it learns, what it learns from, how it is measured and how it fails. Module 2 covers radiology itself: how images are made, what they are to a computer, how a scan moves through the hospital and how to read the report, and Module 3 covers judging the evidence and using AI without losing your own skills.

Go further (optional)

← Measuring Performance Back to Module 1 overview →