Medical AI

Data Leakage and Train-Test-Split Errors in AI Validation

June 30, 2026 · 8 min read · Burak Serteser

Short Answer

Data leakage is any situation in which the test set influences the model development process in any way, and it artificially inflates the reported performance. In medical imaging studies, the most common form is different slices or acquisitions from the same patient falling into both the train and test sets; this arises when the split is done at the image level rather than the patient level, and it typically raises the AUC artificially by between 0.05 and 0.25. Preprocessing applied over all of the data (normalization, feature selection, oversampling), the future leaking into the past in time series, and using the test set in hyperparameter selection are other common sources. In addition to leakage-free internal validation, the FDA and TRIPOD-AI expect the model to be evaluated on an independent external/multi-site test set that has not been involved in the development process at all.

Serteser Danismanlik is run by a biomedical engineer (BME MSc) who developed a medical-AI medical device and published it in a peer-reviewed international journal; it designs the split strategy and leakage audit of the standalone clinical validation study at the core of your SaMD/AI devices' TITCK-CDSS, EU-MDR, and FDA files, runs its statistics, and signs it as a named methodologist.

The most common root cause I encounter in a medical AI publication or regulatory file comes down to a single word: leakage. The model cannot reproduce the reported AUC of 0.95 in the field, the external set drops to 0.78, and the team tries to explain it away as a "population difference." Most of the time the difference does not come from the population but from a split error made at the very start of internal validation.

Data leakage is the most insidious of errors because the code runs, the metrics look good, and the problem only surfaces when the model meets an independent data set. In this article, from a methodologist's point of view, I explain which forms of leakage sink files, why patient-level split is not up for negotiation, and exactly what the FDA and TRIPOD-AI expect from an independent test set.

What Data Leakage Is Exactly

Leakage is any information belonging to the test set becoming mixed, directly or indirectly, into the model development process. The result is always the same: optimistic internal metrics, disappointing external performance.

In practice there are three main categories:

  • Target leakage: A derivative of the outcome you are trying to predict enters the model as a feature. For example, when predicting a "surgery decision" output, using a measurement taken after surgery as an input.
  • Train-test contamination: The same patient, image, acquisition, or duplicate record is present in both the training and test sets. This is the most common form in medical imaging.
  • Preprocessing leakage: Normalization, scaling, feature selection, missing data imputation, or balancing (SMOTE/oversampling) is done over all of the data, including the test set. The test set's statistics leak into training.

In a PROBAST-AI assessment, the large majority of these leakages are flagged directly as "high risk of bias"; that is, they not only inflate performance but also lower the study's evidentiary value.

Why Patient-Level Split Is Not Up for Negotiation

In medical data sets, multiple samples come from a single patient: dozens of slices of the same CT, separate acquisitions of the two knees, follow-up images, different projections of the same pathology. A naive random split puts one slice of the same patient into train and the neighboring slice into test.

In this situation the model learns to recognize the patient, not the disease. The anatomy, the device signature, the acquisition angle, and the noise pattern are specific to that patient; if the same patient is in the test set, the model "remembers" these.

  • The AUC difference between an image-level split and a patient-level split ranges from 0.05 to 0.25 depending on the study, and this difference is entirely artificial.
  • The correct rule: the split is done at the very start, at the patient identity level. All samples of a patient go to a single set (train or test), and are never divided.
  • To preserve class balance a stratified split is used, but stratification is applied at the patient level, not the image level.
  • In multi-center data, the center is also a grouping variable where possible; the ideal setup is to set aside one center entirely for testing (leave-one-site-out).

Once this discipline is broken there is no recovery: the whole development cycle has proceeded with a contaminated test set, and every reported figure is suspect.

Preprocessing and Hyperparameter Leakage

Even when the train-test-split is done correctly, leakage can enter from the middle of the pipeline. The three most common scenarios:

  • Global normalization: The mean and standard deviation are computed over all of the data and then the split is done. The test set's statistics have mixed into training. The correct way: the parameters are learned only from train, and the same transformation is applied to test.
  • Feature selection over all data: Feature selection with a correlation or univariate filter is done before the split. The test set has had a vote on which features to keep.
  • Balancing/augmentation spilling into test: When SMOTE or oversampling is done over all of the data, synthetic copies of a patient can fall into both train and test.

Hyperparameter leakage is a separate trap: if values are tried repeatedly on a single hold-out test set and the best one is chosen, that test set has now turned into a validation set and is no longer a true independent test. The correct setup is the train / validation / test triad; the test set is opened once, at the very end, for one-time reporting. In small samples, nested cross-validation is preferred, in which the outer loop separates performance estimation from inner-loop model selection.

To have an independent eye audit at which point your validation setup leaks, request a 15-minute free scoping.

What the FDA and TRIPOD-AI Expect from an Independent Test Set

The regulatory expectation is clear: however clean the internal validation, the model must be tested with independent data that has not touched the development process at all.

  • FDA AI/ML guidance and SaMD framework: For standalone performance, a test set separate from the training and tuning data, carrying geographic and device diversity where possible, is expected. It is essential that the test set be one-time, frozen (locked), and not feed back into model development. For continuously updated models, a PCCP (Predetermined Change Control Plan) defines in advance how change will be re-validated.
  • TRIPOD-AI (2024): Requires internal validation and external validation to be reported separately, and the split strategy and the sample flow (how many patients, how many images, how they were divided) to be given transparently. Not only discrimination (AUC) but also calibration is reported.
  • PROBAST-AI: Considers studies that contain leakage or have an unclear split strategy as high risk in terms of bias; this reads directly as a weakness in the file.
  • EU MDR / MEDDEV 2.7/1 Rev 4: In the clinical evaluation, performance is expected to be demonstrated in a representative population, independent of the development data; the same logic overlaps with external validation.

The independent test set is not a formality for the FDA but the only proof of the model's real-world generalizability. The higher the internal metrics, the more critical external validation becomes.

Common Mistakes

  • Image-level random split: The slices of the same patient are spread across train and test. The most common and most costly error; it invalidates all metrics.
  • Using the test set in hyperparameter tuning: Dozens of configurations are tried on a single hold-out set; the test set quietly turns into a validation set, and the reported performance becomes optimistic.
  • Doing preprocessing before the split: Normalization, feature selection, and oversampling are applied over all of the data; the test statistics leak into training.
  • Skipping external validation: Producing a publication or opening a file with only an internal hold-out; it is never tested whether the model may be inflated by signatures it learned at a single center, on a single device.

Related Articles

Data leakage is not a code error but a methodology error; most of the time it is prevented or embedded before the pipeline is written, while the split strategy is being decided on paper. If an independent methodologist audits your split strategy and your leakage surfaces before the file is opened, you close both the publication and the regulatory risk at the cheapest point. Scope, duration, and budget differ for every file; we clarify these in a free scoping call.

Free Scoping Call

Next step

Let's talk about your project.

In a free 15-minute intro call we listen to what you need and tell you which service tier fits.