是你吗,LLM?基于多语言代码测写学识别AI编写的程序
Is This You, LLM? Recognizing AI-written Programs with Multilingual Code Stylometry
AI总结:
提出基于transformer编码器的AI代码测写学方法,用单一模型检测10种编程语言中AI生成代码,平均准确率84.1%,并发布开放数据集H-AIRosettaMP,实现首个完全可复现的实验流程。
摘要:
随着基于LLM的代码补全工具(如GitHub Copilot)日益普及,自动检测AI生成代码的兴趣也在增加——尤其是在因安全、知识产权或伦理问题而禁止使用LLM编程的情境中。我们提出了一种新的AI代码测写学技术,即基于transformer编码器分类器区分LLM生成代码与人类编写代码的能力。与以往工作不同,我们的分类器能够用单一机器学习模型检测10种不同编程语言的AI编写代码,并在所有语言中保持高平均准确率(84.1% $\pm$ 3.8%)。与分类器一起,我们还发布了H-AIRosettaMP,一个用于AI代码测写学任务的新型开放数据集,包含10种流行编程语言的121 247个代码片段,标注为人类编写或AI生成。实验流程(数据集、训练代码、生成模型)是首个完全可复现的AI代码测写学流程。最值得注意的是,我们的实验仅依赖开放LLM,而非像ChatGPT这样的专有/闭源模型。
英文摘要:
With the increasing popularity of LLM-based code completers, like GitHub Copilot, the interest in automatically detecting AI-generated code is also increasing-in particular in contexts where the use of LLMs to program is forbidden by policy due to security, intellectual property, or ethical concerns.We introduce a novel technique for AI code stylometry, i.e., the ability to distinguish code generated by LLMs from code written by humans, based on a transformer-based encoder classifier. Differently from previous work, our classifier is capable of detecting AI-written code across 10 different programming languages with a single machine learning model, maintaining high average accuracy across all languages (84.1% $\pm$ 3.8%).Together with the classifier we also release H-AIRosettaMP, a novel open dataset for AI code stylometry tasks, consisting of 121 247 code snippets in 10 popular programming languages, labeled as either human-written or AI-generated. The experimental pipeline (dataset, training code, resulting models) is the first fully reproducible one for the AI code stylometry task. Most notably our experiments rely only on open LLMs, rather than on proprietary/closed ones like ChatGPT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。