thebench.bio #1 Ecosystem for the Bio-Tech Industry
All Model Evaluation questions

Question 15 of 20 Intermediate Troubleshooting

Test-set performance is much better than cross-validation performance. What would you check?

Short answer

A test score well above cross-validation is as suspicious as one well below. Check for leakage into the test set, overlap of patients or near-duplicate samples between training and test, an unusually easy test split, and plain chance from a small test set.

Why

Cross-validation and a held-out test set estimate the same thing if both come from the same population and the pipeline is identical. A large gap in either direction means one of those conditions fails. A better test score often comes from preprocessing fitted on all data before splitting, so the test set influenced its own transformation.

It also comes from related samples, such as two biopsies from one patient, landing on both sides of the split. A test set drawn from a different time or site can also simply be easier, with less ambiguous cases. And with 50 test samples, sampling noise alone can move AUC by several points.

How to work it through

  1. Confirm the test set was split off first and that every data-dependent step was fitted inside the training data only.
  2. Check for shared patient, donor or plate identifiers and for near-duplicate records across the split.
  3. Compare the case mix and label distribution of the test set with the cross-validation data.
  4. Put a confidence interval on the test score by bootstrapping, and see whether the cross-validation mean falls inside it.
  5. Rerun cross-validation with group-aware splits to see whether it moves toward the test score.
  6. Report the explanation, and do not keep reshuffling the test split until results look consistent.

An example

A retinal image model scores AUC 0.81 in 5-fold cross-validation but 0.92 on a 300-image test set. A check of identifiers finds 41 test images from patients who also have images in training, the other eye or a repeat visit. Removing them leaves 259 images with AUC 0.83, with a bootstrap 95 percent interval of 0.77 to 0.88 that contains the cross-validation estimate.

Cross-validation is then redone with patient-grouped folds and gives 0.80.

Where the answer stops holding

Bootstrap intervals on a small test set are wide, so agreement within them is weak evidence. Some legitimate differences, such as a cleaner test-set labeling process, produce real gaps that should be reported rather than removed. If the test set has been used repeatedly for decisions, it is no longer an unbiased estimate and a fresh one is needed.

A strong answer covers

  • Better-than-CV results are a warning sign
  • Preprocessing fitted before the split
  • Shared patients or near-duplicates across split
  • Different case mix or chance with a small test set
  • Bootstrap CI and group-aware CV to reconcile

Common mistakes

  • Celebrating a test score above cross-validation without investigating
  • Reshuffling the test split until test and cross-validation scores agree