# Data Leakage in Notebooks: Static Detection and Better Processes

arXiv: https://arxiv.org/abs/2209.03345 · HTML: https://mlsanity.com/paper/2209.03345/

## Key facts

- Cited by 7 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 7 Sep 2022.

## Built on by (most cited first, 7 of 7)

- [Don't Push the Button! Exploring Data Leakage Risks in Machine Learning and Transfer Learning](https://mlsanity.com/paper/2401.13796/) (2024)
- [scicode-lint: Detecting Methodology Bugs in Scientific Python Code with LLM-Generated Patterns](https://mlsanity.com/paper/2603.17893/) (2026)
- [Inferring Data Preconditions from Deep Learning Models for Trustworthy Prediction in Deployment](https://mlsanity.com/paper/2401.14628/) (2024)
- [A Grammar of Machine Learning Workflows: Rejecting Data Leakage at Call Time](https://mlsanity.com/paper/2603.10742/) (2026)
- [Improving Image Data Leakage Detection in Automotive Software](https://mlsanity.com/paper/2410.23312/) (2024)
- [PriMod4AI: Lifecycle-Aware Privacy Threat Modeling for AI Systems using LLM](https://mlsanity.com/paper/2602.04927/) (2026)
- [A prior-free blind detection of information leakage from model predictions](https://mlsanity.com/paper/2606.11267/) (2026)

## Abstract (arXiv)

Data science pipelines to train and evaluate models with machine learning may contain bugs just like any other code. Leakage between training and test data can lead to overestimating the model's accuracy during offline evaluations, possibly leading to deployment of low-quality models in production. Such leakage can happen easily by mistake or by following poor practices, but may be tedious and challenging to detect manually. We develop a static analysis approach to detect common forms of data leakage in data science code. Our evaluation shows that our analysis accurately detects data leakage and that such leakage is pervasive among over 100,000 analyzed public notebooks. We discuss how our static analysis approach can help both practitioners and educators, and how leakage prevention can be designed into the development process.
