Is this Snippet Written by ChatGPT? An Empirical Study with a CodeBERT-Based Classifier
Not on the map. Why?
Abstract (arXiv)
Since its launch in November 2022, ChatGPT has gained popularity among users, especially programmers who use it as a tool to solve development problems. However, while offering a practical solution to programming problems, ChatGPT should be mainly used as a supporting tool (e.g., in software education) rather than as a replacement for the human being. Thus, detecting automatically generated source code by ChatGPT is necessary, and tools for identifying AI-generated content may need to be adapted to work effectively with source code. This paper presents an empirical study to investigate the feasibility of automated identification of AI-generated code snippets, and the factors that influence this ability. To this end, we propose a novel approach called GPTSniffer, which builds on top of CodeBERT to detect source code written by AI. The results show that GPTSniffer can accurately classify whether code is human-written or AI-generated, and outperforms two baselines, GPTZero and OpenAI Text Classifier. Also, the study shows how similar training data or a classification context with paired snippets helps to boost classification performances.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). First posted on arXiv 18 Jul 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2023: 1; 2024: 2; 2025: 2; 2026: 1.
6 papers.
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2024Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmerscited by 27
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2025Detection of LLM-Paraphrased Code and Identification of the Responsible LLM Using Coding Style Featurescited by 4
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositoriescited by 2
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularitiescited by 1
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositories2 Jul 2026
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025Detection of LLM-Paraphrased Code and Identification of the Responsible LLM Using Coding Style Features25 Feb 2025
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularities2 Sep 2024
- 2024Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmers12 Jan 2024
- 2023Large Language Models for Software Engineering: A Systematic Literature Review21 Aug 2023