Skip to the subgroups demo

Medical AI lab · Subgroups ·

Hidden subgroup failure: interactive demo

A model can have a good overall AUC and still fail one group of patients, because a small subgroup barely moves the overall figure. In this demo the model scores an AUC of 0.87 and 90% sensitivity on 6,000 synthetic patients, while in a subgroup that makes up 15% of them the AUC is 0.66 and the sensitivity is 59%: it misses 83 of 204 cases there, against 36 of 988 in the main group. Only a report broken down by subgroup shows it.

In one line: Overall AUC 0.87 and 90% sensitivity; in a subgroup of 15% of patients, AUC 0.66 and 59% sensitivity at the same threshold.

SYNTHETIC DATA

These demos are illustrative. Every signal, image, patient and note is synthetic and fictional, generated and scored in your browser, and every number shown is computed from that synthetic data. They show general principles, not the performance of any real model, product or project, and none of them is a medical device.

Nothing is uploaded. No patient data is used.

09

Clinical model validation / subgroups

Good overall. Weak for some.

What this shows: a model can score well on the whole test set and still fail one group of patients, because a small group barely moves the overall figure. Only a per-subgroup report shows it.

Change the subgroup

The subgroup can be an age band, a site, a device or any group the training data covered poorly. Signal is how well the model separates cases from non-cases there, relative to the main group. One threshold is used for everyone, set to reach the target sensitivity on the whole test set.

One model, three views

6,000 synthetic patients
ROC curves, with the shared threshold marked
ROC curvesROC curves for the whole test set, the main group and the subgroup.
The same threshold, group by group

White dashed: whole test setBlue: main groupAmber: subgroup

Overall AUC—
Subgroup AUC—
Overall sensitivity—
Subgroup sensitivity—

Synthetic data · illustrative · not a medical device

Where this matters

Models used across age bands, sexes, sites, devices, disease stages or care settings. Decide the subgroups before looking at the results, report discrimination and error rates for each with its interval, and check that each subgroup holds enough cases to say anything.

What this experiment models

6,000 synthetic patients, 20% with the outcome, each assigned to the main group or the subgroup. The model’s score is a standard normal value, shifted up by two standard deviations for cases in the main group and by the chosen share of that for cases in the subgroup. Prevalence is the same in both groups. The threshold is the highest cut-off that still reaches the target sensitivity on the whole test set, and it is applied to everyone. AUC, sensitivity and specificity are then computed for the whole set and for each group, with a 95% Wilson interval for the subgroup sensitivity. The data is fixed by a seed, so the same settings always give the same numbers.

The principle

How it works

The 6,000 synthetic patients belong to a main group or to a subgroup, which stands for any group the training data covered poorly: an age band, a site, a device, a disease stage. The model’s score separates cases from non-cases well in the main group and by only a share of that in the subgroup, set by the signal slider. Prevalence is the same in both groups, so the difference comes from the model and not from the case mix.

One threshold is used for everyone. It is set where the model reaches the target sensitivity on the whole test set, which is how a threshold is usually chosen. Because the subgroup’s cases get lower scores, more of them fall below that threshold, and the main group’s sensitivity rises above the target to make up the average. The overall figure is correct and describes neither group.

The smaller the subgroup, the less it moves the overall score and the fewer cases it holds, so the failure is both better hidden and harder to measure. The demo reports the subgroup’s sensitivity with a 95% interval for that reason. Good practice is to name the subgroups before looking at the results, report discrimination and error rates for each one, and check that each holds enough cases to support a conclusion. See clinical model validation.

Worked example

A model that passed its overall test

Picture a team validating a risk model on a large test set. The patients come from several age bands, sites and devices, in the proportions seen in practice. The report gives one AUC and one sensitivity for the whole set, both good, and the model is approved.

The demo’s default settings show what that report can hide. Of the 6,000 synthetic patients, 922 belong to a subgroup in which the model’s signal is 30% of what it is elsewhere. Overall AUC reads 0.87 and overall sensitivity 90%, which is the target the threshold was set to reach. Subgroup AUC reads 0.66 and subgroup sensitivity 59%.

The line under the readouts gives the counts. In the subgroup the model misses 83 of 204 cases; in the main group it misses 36 of 988. The bars show how the overall figure is made: sensitivity is 96% in the main group and 59% in the subgroup, and the average of the two, weighted by size, is the 90% in the report. Specificity is 62% and 66%, so the subgroup is not being flagged more often either.

Now shrink the subgroup to 5% of patients. Overall AUC rises to 0.91, because the weak group counts for less, while subgroup sensitivity falls to 51%: 34 of 69 cases are missed. The interval for that figure is 39% to 62%, wide because there are only 69 cases. The smaller the group, the better the overall score looks and the less can be said about the group. Set the signal to 100% and the difference disappears: subgroup AUC is 0.92 and sensitivity 91%.

The correct practice is to decide the subgroups before looking at the results, from what could plausibly change the model’s behaviour: age, sex, site, device, disease stage, care setting. Report discrimination, sensitivity and specificity for each one with its interval, at the threshold that will be used. Where a subgroup is too small to judge, say so and collect more cases, and do not treat an overall pass as covering it.

Checklist

What to check in your own project

  • Were the subgroups named before the results were seen, and do they cover age, sex, site and device?
  • Are AUC, sensitivity and specificity reported for each subgroup, not only overall?
  • Is each subgroup figure given with a confidence interval and the number of cases behind it?
  • Is the threshold the one that will be used in practice, applied to every subgroup?
  • Does the test set contain enough cases from each subgroup the model will meet?
  • Is subgroup performance monitored after deployment, as the patient mix changes?

Related: our clinical model validation service, the wiki page on medical AI validation, and the demos on sample size for validation and patient-level data leakage.

FAQ

Common questions

Why does my model perform well overall but fail on a subgroup?

Because the overall figure is an average weighted by group size, and a small group has little weight. In this demo a subgroup of 15% of patients has an AUC of 0.66 and a sensitivity of 59%, while the overall figures are 0.87 and 90%. Common causes are too few examples of the group in training, different measurement devices or sites, and a different presentation of the disease.

How do I check a clinical AI model for subgroup performance?

Name the subgroups in advance, then compute discrimination and error rates for each one at the threshold you intend to use, with confidence intervals. In the demo the per-group view shows 96% sensitivity in the main group against 59% in the subgroup, a difference the overall 90% does not reveal. Check that each group holds enough cases for its interval to be useful.

Can a high overall AUC hide poor performance in a minority group?

Yes, and the smaller the group, the better it is hidden. In the demo, shrinking the subgroup from 15% to 5% of patients raises the overall AUC from 0.87 to 0.91 while the subgroup’s sensitivity falls from 59% to 51%.

Which subgroups should a medical AI validation report?

The ones that could plausibly change how the model behaves and that matter for its intended use: typically age bands, sex, sites, scanner or device types, disease stage or severity, and care setting. Choose them before analysing the results, so the report is not limited to the groups where the model happens to do well.

How many patients does a subgroup analysis need?

Enough cases in each subgroup for the interval around its result to be informative. In the demo a subgroup with 204 cases gives a sensitivity interval of 52% to 66%, and one with 69 cases gives 39% to 62%. If a subgroup is too small to judge, the honest report says so.

Medical AI lab

More demos

01 / Heart rate from ECGHeart rate from a noisy ECG – interactive demoMissed and false beats behind a correct average02 / Patient leakagePatient-level data leakage – interactive demoRecord-level vs patient-level train/test splits03 / Calibration & thresholdsCalibration and decision thresholds – interactive demoCalibration plot, decision curve and net benefit04 / Scanner shiftScanner shift in medical imaging – interactive demoSegmentation tuned on one scanner, tested on another05 / Dice vs clinical errorDice score vs clinical error – interactive demoDice, HD95 and lesions detected06 / Note de-identificationDe-identifying a clinical note – interactive demoEnglish, Hebrew and mixed notes vs a rule-based detector07 / Nodule volume 3DNodule volume and CT slice thickness – 3D interactive demoThe same nodule, measured on thin and thick slices08 / Sample sizeSample size for validating a clinical AI model – interactive demoHow wide the interval is around a measured sensitivity10 / Slice-by-slice 3DSlice-by-slice segmentation of a 3D lesion – 3D interactive demoA high per-slice Dice and a lesion reported in pieces11 / Predictive value 3DPositive predictive value and prevalence – 3D interactive demoWhat a positive result means when the condition is rare12 / Shortcut learningShortcut learning in medical imaging AI – interactive demoA model that reads the hospital tag, not the disease13 / DriftModel drift and performance monitoring – interactive demoHow late a monitoring rule notices a slow decline14 / Alert burdenAlert burden of a clinical early-warning model – interactive demoA threshold counted in alerts per nurse per shift

MLAIA DATA SCIENCE

Tell us what
you’re working on.

Share the problem, the data you have and what success would look like. We’ll discuss a practical next step.

Please don’t include confidential datasets, credentials or patient information.

yochai@mlaia.com
WhatsApp: +972 52 484 6282

Your inquiry is handled under our Privacy Policy.