RAG and LLMs IA Claude 167 views

Detect Test Data Leakage into Training in ML Models

data leakage data leakage detection machine learning model validation sql python data audit metrics
SCOPE

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.

Content
Main prompt
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...]
Sign in

Sign in to access this free prompt

Related Prompts

Audit Test Data Leakage Into Your Model's Training Set
RAG e LLMs ChatGPT
Operational prompt Ideal for Technical team

Audit Test Data Leakage Into Your Model's Training Set

Architecture, foundation and governance

Investigate whether test data leaked into the training of an ML model or LLM and get a diagnosis with evidence and a rem…

Saves: 1 technical setup Includes: prompt + blueprint Ready to adapt
Question-to-SQL Reviewer for the First Cycle
RAG e LLMs Claude
Operational prompt Ideal for Teams putting AI to work

Question-to-SQL Reviewer for the First Cycle

Faster delivery with real context

Turn a business question into a correct, readable query. Structured prompt with steps, output format, and quality criter…

Saves: less trial and error Includes: prompt + context Ready to adapt
Hypothesis Testing Framework with Correct Interpretation
RAG e LLMs Gemini
Operational prompt Ideal for Teams putting AI to work

Hypothesis Testing Framework with Correct Interpretation

Faster delivery with real context

Structure the hypothesis, statistical test, and correct interpretation. Structured prompt with steps, output format, and…

Saves: less trial and error Includes: prompt + context Ready to adapt
Fraudulent Behavior Signals Script
RAG e LLMs ChatGPT
Operational prompt Ideal for Teams putting AI to work

Fraudulent Behavior Signals Script

Faster delivery with real context

Design signals that indicate fraudulent behavior. Structured prompt with steps, output format, and quality criteria.

Saves: less trial and error Includes: prompt + context Ready to adapt