arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.14397cs.SEcs.CY
收藏

通过可辨识特征分析区分人类编写代码与ChatGPT生成代码

Discriminating Human-authored from ChatGPT-Generated Code Via Discernable Feature Analysis

Li Ke, Hong Sheng, Fu Cai, Zhang Yunhe, Liu Ming

AI总结:

本文提出可辨识特征集及数据集清洗与扩充方法,用于高准确率区分ChatGPT生成代码与人类编写代码,并构建了万行级代码数据集。

摘要:

大型语言生成模型(LLMs)在编程中的普遍应用凸显了区分人类编写代码与智能模型生成代码的重要性。本文专门旨在区分ChatGPT生成的代码与人类编写的代码。我们的研究揭示了这两种来源在编程风格、技术水平和可读性方面的差异。因此,我们开发了一组可辨识特征用于区分,并通过消融实验评估其有效性。此外,我们设计了一种数据集清洗技术,该技术采用时间和空间分割,以缓解数据集匮乏问题并获取高质量、无污染的数据集。为了进一步丰富数据资源,我们采用“代码转换”、“特征转换”和“特征定制”技术,生成了包含10,000行ChatGPT生成代码的大规模数据集。我们研究的突出贡献包括:提出了一组可辨识特征,在二分类任务中以高准确率区分ChatGPT生成代码与人类编写代码;设计了生成大规模ChatGPT生成代码的方法;并引入了一种数据集清洗策略,从开源仓库中提取纯净、高质量的代码数据集,从而在代码作者归属任务中实现了卓越的准确率。

英文摘要:

The ubiquitous adoption of Large Language Generation Models (LLMs) in programming has underscored the importance of differentiating between human-written code and code generated by intelligent models. This paper specifically aims to distinguish code generated by ChatGPT from that authored by humans. Our investigation reveals disparities in programming style, technical level, and readability between these two sources. Consequently, we develop a discriminative feature set for differentiation and evaluate its efficacy through ablation experiments. Additionally, we devise a dataset cleansing technique, which employs temporal and spatial segmentation, to mitigate the dearth of datasets and to secure high-caliber, uncontaminated datasets. To further enrich data resources, we employ "code transformation," "feature transformation," and "feature customization" techniques, generating an extensive dataset comprising 10,000 lines of ChatGPT-generated code. The salient contributions of our research include: proposing a discriminative feature set yielding high accuracy in differentiating ChatGPT-generated code from human-authored code in binary classification tasks; devising methods for generating extensive ChatGPT-generated codes; and introducing a dataset cleansing strategy that extracts immaculate, high-grade code datasets from open-source repositories, thus achieving exceptional accuracy in code authorship attribution tasks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑