ChatGPT Code Detection: Techniques for Uncovering the Source of Code

被引:2
作者
Oedingen, Marc [1 ]
Engelhardt, Raphael C. [1 ]
Denz, Robin [2 ]
Hammer, Maximilian [1 ]
Konen, Wolfgang [1 ]
机构
[1] TH Koln, Cologne Inst Comp Sci, Fac Comp Sci & Engn Sci, D-50678 Gummersbach, Germany
[2] Ruhr Univ Bochum, Fac Med, Dept Med Informat Biometry & Epidemiol, D-44801 Bochum, Germany
关键词
AI; machine learning; code detection; ChatGPT; large language models;
D O I
10.3390/ai5030053
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
In recent times, large language models (LLMs) have made significant strides in generating computer code, blurring the lines between code created by humans and code produced by artificial intelligence (AI). As these technologies evolve rapidly, it is crucial to explore how they influence code generation, especially given the risk of misuse in areas such as higher education. The present paper explores this issue by using advanced classification techniques to differentiate between code written by humans and code generated by ChatGPT, a type of LLM. We employ a new approach that combines powerful embedding features (black-box) with supervised learning algorithms including Deep Neural Networks, Random Forests, and Extreme Gradient Boosting to achieve this differentiation with an impressive accuracy of 98%. For the successful combinations, we also examine their model calibration, showing that some of the models are extremely well calibrated. Additionally, we present white-box features and an interpretable Bayes classifier to elucidate critical differences between the code sources, enhancing the explainability and transparency of our approach. Both approaches work well, but provide at most 85-88% accuracy. Tests on a small sample of untrained humans suggest that humans do not solve the task much better than random guessing. This study is crucial in understanding and mitigating the potential risks associated with using AI in code generation, particularly in the context of higher education, software development, and competitive programming.
引用
收藏
页码:1066 / 1094
页数:29
相关论文
共 67 条
  • [1] Abadi Martin, 2015, arXiv
  • [2] Achiam J., 2023, GPT-4 Technical Report, DOI [10.48550/arXiv.2303.08774 2303.08774, DOI 10.48550/ARXIV.2303.087742303.08774]
  • [3] Alamleh Hosam, 2023, 2023 Systems and Information Engineering Design Symposium (SIEDS), P154, DOI 10.1109/SIEDS58326.2023.10137767
  • [4] A Comprehensive Study of ChatGPT: Advancements, Limitations, and Ethical Considerations in Natural Language Processing and Cybersecurity
    Alawida, Moatsum
    Mejri, Sami
    Mehmood, Abid
    Chikhaoui, Belkacem
    Abiodun, Oludare Isaac
    [J]. INFORMATION, 2023, 14 (08)
  • [5] code2vec: Learning Distributed Representations of Code
    Alon, Uri
    Zilberstein, Meital
    Levy, Omer
    Yahav, Eran
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (POPL):
  • [6] [Anonymous], 2023, CodeChef
  • [7] [Anonymous], 2024, TIOBE Software BV TIOBE Index for June 2024
  • [8] [Anonymous], 2023, HackerEarth
  • [9] [Anonymous], 2023, OpenAI Models
  • [10] [Anonymous], 2015, Proceedings of the 2015 conference on empirical methods in natural language processing, DOI [DOI 10.18653/V1/D15-1167, 10.18653/v1/D15-1167]