• Home
  • Search
  • Has My Code Been Stolen for Model Training? A Naturalness Based Approach to Code Contamination Detection
  • Cite Icon1
  • https://doi.org/10.1145/3715765Copy DOI Icon

Has My Code Been Stolen for Model Training? A Naturalness Based Approach to Code Contamination Detection

Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

It is often valuable to know whether a given piece of source code has or hasn’t been used to train a given deep learning model. On one side, it helps avoid data contamination problems that may exaggerate the performance of evaluated models. Conversely, it facilitates copyright protection by identifying private or protected code leveraged for model training without permission. To this end, automated approaches have been proposed for the detection, known as data contamination detection. Such approaches often heavily rely on the confidence of the involved models, assuming that the models should be more confident in handling contaminated data than cleaned data. However, such approaches do not consider the nature of the given data item, i.e., how difficult it is to predict the given item. Consequently, difficult-to-predict contaminated data and easy-to-predict cleaned data are often misclassified. As an initial attempt to solve this problem, this paper presents a naturalness-based approach, called Natural-DaCoDe , for code-completion models to distinguish contaminated source code from cleaned ones. Natural-DaCoDe leverages code naturalness to quantitatively measure the difficulty of a given source code for code-completion models. It then trains a classifier to distinguish contaminated source code according to both code naturalness and the performance of the code-completion models on the given source code. We evaluate Natural-DaCoDe with two pre-trained large language models (e.g., ChatGPT and Claude ) and two code-completion models that we trained from scratch for detecting contamination data. Our evaluation results suggest that Natural-DaCoDe substantially outperformed the state-of-the-art approaches in detecting contaminated data, improving the average accuracy by 61.78%. We also evaluate Natural-DaCoDe with method name suggestion task, and it remains more accurate than the state-of-the-art approaches, improving the accuracy by 54.39%. Furthermore, Natural-DaCoDe was tested on a natural language text benchmark, significantly outperforming the state-of-the-art approaches by 22% . It may suggest that Natural-DaCoDe could be applied to various source code related tasks besides code complete.

Similar Papers
  • Research Article
  • Citations1

An Empirical Study on Language Models for Generating Log Statements in Test Code

  • Aug 12, 2025
  • ACM Transactions on Software Engineering and Methodology
  • Honglin Shu +4
  • Research Article
  • Citations13

Vulnerability Detection of Ethereum Smart Contract Based on SolBERT-BiGRU-Attention Hybrid Neural Model

  • Jan 01, 2023
  • Computer Modeling in Engineering & Sciences
  • Guangxia Xu +2
  • PDF
  • Research Article
  • Citations10

AGI-P: A Gender Identification Framework for Authorship Analysis Using Customized Fine-Tuning of Multilingual Language Model

  • Jan 01, 2024
  • IEEE Access
  • Raheem Sarwar +6
  • PDF
  • Research Article
  • Citations22

An Ensemble 3D Convolutional Neural Network for Spatiotemporal Soil Temperature Forecasting

  • Aug 16, 2021
  • Sustainability
  • Fanhua Yu +2
  • Conference Article
  • Citations3

Chinese-Korean Weibo Sentiment Classification Based on Pre-trained Language Model and Transfer Learning

  • May 06, 2022
  • Hengxuan Wang +3
  • PDF
  • Conference Article
  • Citations31

PANLP at MEDIQA 2019: Pre-trained Language Models, Transfer Learning and Knowledge Distillation

  • Jan 01, 2019
  • Wei Zhu +6
  • Research Article
  • Citations1

Using a large language model to provide individualized feedback for pre-service physics teachers’ written reflections

  • Nov 21, 2025
  • Disciplinary and Interdisciplinary Science Education Research
  • Stefan Sorge +2
  • Research Article
  • Citations3

Deep learning models as learners for EEG-based functional brain networks**This work was performed when Yuxuan Yang was on academic leave at Delft University of Technology.

  • Mar 06, 2025
  • Journal of Neural Engineering
  • Yuxuan Yang +1
  • PDF
  • Research Article
  • Citations3

Tibetan Sentence Boundaries Automatic Disambiguation Based on Bidirectional Encoder Representations from Transformers on Byte Pair Encoding Word Cutting Method

  • Apr 02, 2024
  • Applied Sciences
  • Fenfang Li +3
  • Research Article
  • Citations1

Image-based classification of healthy and diseased bell pepper using the transfer learning method

  • Jun 24, 2022
  • International journal of health sciences
  • P Dhanalakshmi +4
  • Research Article
  • Citations2

The Organization of Open Source Communities

  • Jan 01, 2005
  • SSRN Electronic Journal
  • Ruben Van Wendel De Joode
  • Conference Article

DLBricks: Composable Benchmark Generation to Reduce Deep Learning Benchmarking Effort on CPUs

  • Apr 20, 2020
  • Cheng Li +3
  • Video Transcripts

MSP: Multi-Stage Prompting for Making Pre-trained Language Models Better Translators

  • May 11, 2022
  • Underline Science Inc.
  • Xiangwen Zhang +3
  • Research Article

LMcast: A pretrained language model guided long-term memory transformer for precipitation nowcasting.

  • Mar 01, 2026
  • Neural networks : the official journal of the International Neural Network Society
  • Feifan Gao +6
  • Conference Article

Exploring Layer-wise Representations of English and Chinese Homonymy in Pre-trained Language Models

  • Jan 01, 2025
  • Matthew King-Hang Ma +3
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.