Table of Contents
Fetching ...

On Inter-dataset Code Duplication and Data Leakage in Large Language Models

José Antonio Hernández López, Boqi Chen, Mootez Saaz, Tushar Sharma, Dániel Varró

TL;DR

The paper addresses the risk that inter-dataset code duplication between pre-training data and fine-tuning/evaluation data can inflate LLMs' reported performance in software engineering tasks. It empirically demonstrates the phenomenon using CodeSearchNet as the pre-training corpus and five fine-tuning datasets, employing a deduplication pipeline (SourcererCC) to quantify overlap and constructing leaky vs non-leaky pre-training conditions. By pre-training encoder-only and encoder-decoder models under both leakage regimes and evaluating on the leakage portions of the fine-tuning test sets—with full and lightweight fine-tuning methods—the study shows a measurable threat to evaluation validity, amplified by LoRA, prefix tuning, and layer freezing; open-source models show similar vulnerability. The findings urge careful dataset curation and leakage-aware evaluation practices (e.g., removing overlapping samples from test sets) and indicate that the threat is heightened for lightweight fine-tuning, with broader implications for future SE research and practice, including extensions to more languages and decoder-only LLMs.

Abstract

Motivation. Large language models (LLMs) have exhibited remarkable proficiency in diverse software engineering (SE) tasks. Handling such tasks typically involves acquiring foundational coding knowledge on large, general-purpose datasets during a pre-training phase, and subsequently refining on smaller, task-specific datasets as part of a fine-tuning phase. Problem statement. While intra-dataset code duplication examines the intersection between the training and test splits within a given dataset and has been addressed in prior research, inter-dataset code duplication, which gauges the overlap between different datasets, remains largely unexplored. If this phenomenon exists, it could compromise the integrity of LLM evaluations because of the inclusion of fine-tuning test samples that were already encountered during pre-training, resulting in inflated performance metrics. Contribution. This paper explores the phenomenon of inter-dataset code duplication and its impact on evaluating LLMs across diverse SE tasks. Study design. We conduct an empirical study using the CodeSearchNet dataset (CSN), a widely adopted pre-training dataset, and five fine-tuning datasets used for various se tasks. We first identify the intersection between the pre-training and fine-tuning datasets using a deduplication process. Next, we pre-train two versions of LLMs using a subset of CSN: one leaky LLM and one non-leaky LLM. Finally, we fine-tune both models and compare their performances using leaky fine-tuning test samples. Results. Our findings reveal a potential threat to the evaluation of LLMs across multiple SE tasks, stemming from the inter-dataset code duplication phenomenon. We also demonstrate that this threat is accentuated by the chosen fine-tuning technique. Furthermore, we provide evidence that open-source models could be affected by inter-dataset duplication.

On Inter-dataset Code Duplication and Data Leakage in Large Language Models

TL;DR

The paper addresses the risk that inter-dataset code duplication between pre-training data and fine-tuning/evaluation data can inflate LLMs' reported performance in software engineering tasks. It empirically demonstrates the phenomenon using CodeSearchNet as the pre-training corpus and five fine-tuning datasets, employing a deduplication pipeline (SourcererCC) to quantify overlap and constructing leaky vs non-leaky pre-training conditions. By pre-training encoder-only and encoder-decoder models under both leakage regimes and evaluating on the leakage portions of the fine-tuning test sets—with full and lightweight fine-tuning methods—the study shows a measurable threat to evaluation validity, amplified by LoRA, prefix tuning, and layer freezing; open-source models show similar vulnerability. The findings urge careful dataset curation and leakage-aware evaluation practices (e.g., removing overlapping samples from test sets) and indicate that the threat is heightened for lightweight fine-tuning, with broader implications for future SE research and practice, including extensions to more languages and decoder-only LLMs.

Abstract

Motivation. Large language models (LLMs) have exhibited remarkable proficiency in diverse software engineering (SE) tasks. Handling such tasks typically involves acquiring foundational coding knowledge on large, general-purpose datasets during a pre-training phase, and subsequently refining on smaller, task-specific datasets as part of a fine-tuning phase. Problem statement. While intra-dataset code duplication examines the intersection between the training and test splits within a given dataset and has been addressed in prior research, inter-dataset code duplication, which gauges the overlap between different datasets, remains largely unexplored. If this phenomenon exists, it could compromise the integrity of LLM evaluations because of the inclusion of fine-tuning test samples that were already encountered during pre-training, resulting in inflated performance metrics. Contribution. This paper explores the phenomenon of inter-dataset code duplication and its impact on evaluating LLMs across diverse SE tasks. Study design. We conduct an empirical study using the CodeSearchNet dataset (CSN), a widely adopted pre-training dataset, and five fine-tuning datasets used for various se tasks. We first identify the intersection between the pre-training and fine-tuning datasets using a deduplication process. Next, we pre-train two versions of LLMs using a subset of CSN: one leaky LLM and one non-leaky LLM. Finally, we fine-tune both models and compare their performances using leaky fine-tuning test samples. Results. Our findings reveal a potential threat to the evaluation of LLMs across multiple SE tasks, stemming from the inter-dataset code duplication phenomenon. We also demonstrate that this threat is accentuated by the chosen fine-tuning technique. Furthermore, we provide evidence that open-source models could be affected by inter-dataset duplication.
Paper Structure (39 sections, 1 equation, 6 figures, 6 tables)

This paper contains 39 sections, 1 equation, 6 figures, 6 tables.

Figures (6)

  • Figure 1: Our approach to assessing inter-dataset code duplication.
  • Figure 2: Inter-dataset duplication wrt. csn for each dataset.
  • Figure 3: Pre-training dataset construction. The red split within CodeSearchNet represents the portion that is included in the fine-tuning datasets.
  • Figure 4: Correlation plot where the $x-$axis is the number of frozen layers and the $y-$axis is the mean difference between the leaky and the non-leaky LLMs.
  • Figure 5: Correlation plot for each type of LLM.
  • ...and 1 more figures