How does target leakage differ from train-test contamination?

Quick Overview

Asks how target leakage differs from train-test contamination when you build and evaluate a model. Tests whether you can say where each leak comes from, how it affects offline metrics and the deployed model, and how to detect and prevent each one.

How does target leakage differ from train-test contamination?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Both problems make a model look better offline than it really is. How does target leakage differ from train-test contamination? ```hint Ask where the leak lives For each problem, ask whether it would still be there if your train-test split were perfect. ``` ```hint Follow it to production Compare what each problem does to the offline score and to the model you actually deploy. ``` ### What a Strong Answer Covers - A definition of each that says where the leaked information comes from - A concrete example of each - How each affects the offline estimate and the model in production - How to detect each one - How to prevent each one in feature construction and in the evaluation setup ### Follow-up Questions - Is fitting a target encoder on the full dataset target leakage, contamination, or both? - Your validation AUC is 0.99. How do you find out whether a leak is behind it? - For a forecasting model, how do you split the data and build features so that neither problem occurs? - A field is available at prediction time, but your warehouse backfills it with corrected values later. Which problem is that, and how do you catch it?

Overview: Asks how target leakage differs from train-test contamination when you build and evaluate a model. Tests whether you can say where each leak comes from, how it affects offline metrics and the deployed model, and how to detect and prevent each one.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Both problems make a model look better offline than it really is. How does target leakage differ from train-test contamination?

What a Strong Answer Covers Guidance

  • A definition of each that says where the leaked information comes from
  • A concrete example of each
  • How each affects the offline estimate and the model in production
  • How to detect each one
  • How to prevent each one in feature construction and in the evaluation setup

Follow-up Questions Guidance

  • Is fitting a target encoder on the full dataset target leakage, contamination, or both?
  • Your validation AUC is 0.99. How do you find out whether a leak is behind it?
  • For a forecasting model, how do you split the data and build features so that neither problem occurs?
  • A field is available at prediction time, but your warehouse backfills it with corrected values later. Which problem is that, and how do you catch it?