mlsanityData to 14 Oct 2026

ChatGPT Code Detection: Techniques for Uncovering the Source of Code

arXiv 2405.15512 ↗First posted 24 May 2024cs.LG cs.AIcited by 6

Not on the map. Why?

Abstract (arXiv)

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 like higher education. This paper explores this issue by using advanced classification techniques to differentiate between code written by humans and that 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. We also show that untrained humans solve the same task not 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.

Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 36 of its 69 references that are in the map. First posted on arXiv 24 May 2024.

Builds on

36 of 69 references.

References · 36

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  5. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
  6. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  7. 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,166
  8. 2013Efficient Estimation of Word Representations in Vector Spacecited by 4,375
  9. 2021Program Synthesis with Large Language Modelscited by 3,637
  10. 2013Distributed Representations of Words and Phrases and their Compositionalitycited by 3,474
  11. 2014Sequence to Sequence Learning with Neural Networkscited by 2,986
  12. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
24 more
  1. 2021Ethical and social risks of harm from Language Modelscited by 966
  2. 2021Measuring Coding Challenge Competence With APPScited by 902
  3. 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 726
  4. 2019Release Strategies and the Social Impacts of Language Modelscited by 513
  5. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
  6. 2019GLTR: Statistical Detection and Visualization of Generated Textcited by 496
  7. 2023How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detectioncited by 481
  8. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  9. 2022Text and Code Embeddings by Contrastive Pre-Trainingcited by 361
  10. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
  11. 2018code2vec: Learning Distributed Representations of Codecited by 250
  12. 2021Entailment as Few-Shot Learnercited by 123
  13. 2022Productivity Assessment of Neural Code Completioncited by 98
  14. 2023ChatGPT and a New Academic Reality: Artificial Intelligence-Written Research Papers and the Ethics of the Large Language Models in Scholarly Publishingcited by 52
  15. 2023From Text to MITRE Techniques: Exploring the Malicious Use of Large Language Models for Generating Cyber Attack Payloadscited by 32
  16. 2023Towards Possibilities & Impossibilities of AI-generated Text Detection: A Surveycited by 28
  17. 2023Zero-Shot Detection of Machine-Generated Codescited by 24
  18. 2024Assessing AI Detectors in Identifying AI-Generated Code: Implications for Educationcited by 18
  19. 2023Evaluating AIGC Detectors on Code Contentcited by 12
  20. 2023Distinguishing Human Generated Text From ChatGPT Generated Text Using Machine Learningcited by 10
  21. 2023Discriminating Human-authored from ChatGPT-Generated Code Via Discernable Feature Analysiscited by 7
  22. 2020Oblique Predictive Clustering Treescited by 6
  23. 2023Ethical Considerations and Policy Implications for Large Language Models: Guiding Responsible Development and Deploymentcited by 5
  24. 2022Exploring the Impact of Code Style in Identifying Good Programmerscited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 2; 2025: 3; 2026: 1.

6 papers.