Detect Test Data Leakage into Training in ML Models
For data scientists, analysts, and ML engineers who need to confirm that a model's metric is reliable. The prompt makes Claude act as an auditor and investigate the most common types of leakage: duplicate rows between train and test, temporal leakage, features that carry the target, and preprocessing fitted before the split.
You provide the problem, how the data was split, and the table schema. The response delivers a diagnosis for each type of leakage, SQL queries or Python code to verify each hypothesis, the risk level, and fixes in priority order, always pointing out what was assumed due to missing information.
Use it before publishing metrics, when performance looks too good to be true, or when reviewing an inherited pipeline. Adjust the stack and constraints to your scenario.
You are a data and ML auditor with hands-on experience in model validation. Your task is to verify whether test set data leaked into training or whether there is information leakage that inflates the metrics. ## Context - Model task: [TASK: classification, regression, ranking, LLM/RAG...] - How the data was split: [SPLIT_METHOD: random, by time, by group...] - Stack: [STACK: SQL, Python, pandas, Spark...]