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]
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
{"_id":"qNJGioKXkAfwRyCfX","bibbaseid":"nguyen-dirocco-disipio-rubei-diruscio-dipenta-isthissnippetwrittenbychatgptanempiricalstudywithacodebertbasedclassifier-2023","author_short":["Nguyen, P. T.","Di Rocco, J.","Di Sipio, C.","Rubei, R.","Di Ruscio, D.","Di Penta, M."],"bibdata":{"bibtype":"misc","type":"misc","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":[{"propositions":[],"lastnames":["Nguyen"],"firstnames":["Phuong","T."],"suffixes":[]},{"propositions":[],"lastnames":["Di","Rocco"],"firstnames":["Juri"],"suffixes":[]},{"propositions":[],"lastnames":["Di","Sipio"],"firstnames":["Claudio"],"suffixes":[]},{"propositions":[],"lastnames":["Rubei"],"firstnames":["Riccardo"],"suffixes":[]},{"propositions":[],"lastnames":["Di","Ruscio"],"firstnames":["Davide"],"suffixes":[]},{"propositions":[],"lastnames":["Di","Penta"],"firstnames":["Massimiliano"],"suffixes":[]}],"month":"August","year":"2023","note":"arXiv:2307.09381 [cs]","keywords":"Computer Science - Software Engineering, Jab/#Pre","bibtex":"@misc{nguyen_is_2023,\n\ttitle = {Is this {Snippet} {Written} by {ChatGPT}? {An} {Empirical} {Study} with a {CodeBERT}-{Based} {Classifier}},\n\tshorttitle = {Is this {Snippet} {Written} by {ChatGPT}?},\n\turl = {http://arxiv.org/abs/2307.09381},\n\tabstract = {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.},\n\turldate = {2024-05-29},\n\tpublisher = {arXiv},\n\tauthor = {Nguyen, Phuong T. and Di Rocco, Juri and Di Sipio, Claudio and Rubei, Riccardo and Di Ruscio, Davide and Di Penta, Massimiliano},\n\tmonth = aug,\n\tyear = {2023},\n\tnote = {arXiv:2307.09381 [cs]},\n\tkeywords = {Computer Science - Software Engineering, Jab/\\#Pre},\n}\n\n\n\n","author_short":["Nguyen, P. T.","Di Rocco, J.","Di Sipio, C.","Rubei, R.","Di Ruscio, D.","Di Penta, M."],"key":"nguyen_is_2023","id":"nguyen_is_2023","bibbaseid":"nguyen-dirocco-disipio-rubei-diruscio-dipenta-isthissnippetwrittenbychatgptanempiricalstudywithacodebertbasedclassifier-2023","role":"author","urls":{"Paper":"http://arxiv.org/abs/2307.09381"},"keyword":["Computer Science - Software Engineering","Jab/#Pre"],"metadata":{"authorlinks":{}},"downloads":0,"html":""},"bibtype":"misc","biburl":"https://bibbase.org/zotero/bxt101","dataSources":["Wsv2bQ4jPuc7qme8R"],"keywords":["computer science - software engineering","jab/#pre"],"search_terms":["snippet","written","chatgpt","empirical","study","codebert","based","classifier","nguyen","di rocco","di sipio","rubei","di ruscio","di penta"],"title":"Is this Snippet Written by ChatGPT? An Empirical Study with a CodeBERT-Based Classifier","year":2023}