Introduction
Large Language Models (LLMs) have revolutionized software engineering (SE) by powering advanced code generation and automated repair tools. However, these models are typically trained on massive, web-scraped datasets that often include the very benchmarks used to evaluate them. This phenomenon, known as "data leakage," threatens the validity of SE research. If an LLM has already encountered a benchmark's solutions during training, its performance reflects memorization rather than true reasoning.
This paper presents the first large-scale audit of data leakage across 83 popular SE benchmarks. By comparing benchmark data against the pre-training corpus of the StarCoder LLM, the researchers quantify the extent of contamination and its impact on performance metrics.
The DetectLeak Pipeline
To systematically investigate leakage, the authors developed DetectLeak, a multi-phase pipeline designed for both automated detection and manual verification.
The methodology involves:
- Automated Near-Duplicate Detection: Utilizing MinHash and Locality-Sensitive Hashing (LSH), the team performed 1.7 trillion comparisons between 83 SE benchmarks and the 800+ GB "The Stack" dataset (StarCoder's training data).
- Expert Manual Labeling: A team of eight developers reviewed 6,643 flagged pairs to categorize them by similarity levels, ensuring high precision in identifying actual duplicates.
- Quantification: Leakage ratios were calculated for each benchmark to identify the most compromised datasets.
Research Scope and Findings
The study was structured around four primary research questions (RQs) covering investigation, understanding causes, assessing impact, and exploring blind detection methods.
Key Insights
- The "Parrot" Effect: Leakage significantly inflates performance. On the APPS benchmark, StarCoder-7B's Pass@1 score was 4.9 times higher on leaked samples (4.4%) compared to non-leaked ones (0.9%).
- High-Risk Benchmarks: While overall leakage is relatively low—averaging 4.8% for Python and 2.8% for Java—certain benchmarks are severely compromised. QuixBugs showed a 100% leakage ratio, while BigCloneBench reached 55.7%.
- Root Causes: High leakage often stems from benchmarks derived from coding platforms like LeetCode, which are frequently mirrored on GitHub and subsequently scraped into training sets.
- Detection Challenges: Detecting leakage without access to training data (blind detection) remains difficult. Using "Perplexity" (PPL) as a proxy for familiarity only achieved 40-50% accuracy.
New Resources for the Community
The researchers introduced two significant datasets to help mitigate these issues:
- LessLeak-Bench: A "cleaned" version of the 83 benchmarks with all confirmed leaked samples removed, providing a more reliable foundation for future LLM evaluations.
- AutoDetectLeak-Bench: A manually labeled dataset of leaked vs. non-leaked samples to facilitate the development of better automated detection tools.
Conclusion
Data leakage is a critical hurdle for fair LLM evaluation in software engineering. While the study focused on the transparent StarCoder model, the findings suggest that proprietary "black box" models likely suffer from similar, if not greater, contamination. The authors urge the community to adopt LessLeak-Bench for more honest assessments and to prioritize the development of robust, training-data-agnostic detection methods.
Summary updated