Is this Snippet Written by ChatGPT? An Empirical Study with a CodeBERT-Based Classifier. Nguyen, P. T., Di Rocco, J., Di Sipio, C., Rubei, R., Di Ruscio, D., & Di Penta, M. August, 2023. arXiv:2307.09381 [cs]
Is this Snippet Written by ChatGPT? An Empirical Study with a CodeBERT-Based Classifier [link]Paper  abstract   bibtex   
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.
@misc{nguyen_is_2023,
	title = {Is this {Snippet} {Written} by {ChatGPT}? {An} {Empirical} {Study} with a {CodeBERT}-{Based} {Classifier}},
	shorttitle = {Is this {Snippet} {Written} by {ChatGPT}?},
	url = {http://arxiv.org/abs/2307.09381},
	abstract = {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.},
	urldate = {2024-05-29},
	publisher = {arXiv},
	author = {Nguyen, Phuong T. and Di Rocco, Juri and Di Sipio, Claudio and Rubei, Riccardo and Di Ruscio, Davide and Di Penta, Massimiliano},
	month = aug,
	year = {2023},
	note = {arXiv:2307.09381 [cs]},
	keywords = {Computer Science - Software Engineering, Jab/\#Pre},
}

Downloads: 0