Detecting AI-Generated Code Assignments Using Perplexity of Large Language Models
Uloženo v:
| Název: | Detecting AI-Generated Code Assignments Using Perplexity of Large Language Models |
|---|---|
| Autoři: | Xu, Zhenyu, Sheng, Victor S. |
| Zdroj: | Proceedings of the AAAI Conference on Artificial Intelligence; Vol. 38 No. 21: IAAI-24, EAAI-24, AAAI-24 Student Abstracts, Undergraduate Consortium and Demonstrations; 23155-23162 ; 2374-3468 ; 2159-5399 |
| Informace o vydavateli: | Association for the Advancement of Artificial Intelligence |
| Rok vydání: | 2024 |
| Sbírka: | Association for the Advancement of Artificial Intelligence: AAAI Publications |
| Témata: | Large Language Models, ChatGPT, AI-generated Code Detection |
| Popis: | Large language models like ChatGPT can generate human-like code, posing challenges for programming education as students may be tempted to misuse them on assignments. However, there are currently no robust detectors designed specifically to identify AI-generated code. This is an issue that needs to be addressed to maintain academic integrity while allowing proper utilization of language models. Previous work has explored different approaches to detect AI-generated text, including watermarks, feature analysis, and fine-tuning language models. In this paper, we address the challenge of determining whether a student's code assignment was generated by a language model. First, our proposed method identifies AI-generated code by leveraging targeted masking perturbation paired with comperhesive scoring. Rather than applying a random mask, areas of the code with higher perplexity are more intensely masked. Second, we utilize a fine-tuned CodeBERT to fill in the masked portions, producing subtle modified samples. Then, we integrate the overall perplexity, variation of code line perplexity, and burstiness into a unified score. In this scoring scheme, a higher rank for the original code suggests it's more likely to be AI-generated. This approach stems from the observation that AI-generated codes typically have lower perplexity. Therefore, perturbations often exert minimal influence on them. Conversely, sections of human-composed codes that the model struggles to understand can see their perplexity reduced by such perturbations. Our method outperforms current open-source and commercial text detectors. Specifically, it improves detection of code submissions generated by OpenAI's text-davinci-003, raising average AUC from 0.56 (GPTZero baseline) to 0.87 for our detector. |
| Druh dokumentu: | article in journal/newspaper |
| Popis souboru: | application/pdf |
| Jazyk: | English |
| Relation: | https://ojs.aaai.org/index.php/AAAI/article/view/30361/32410; https://ojs.aaai.org/index.php/AAAI/article/view/30361/32411; https://ojs.aaai.org/index.php/AAAI/article/view/30361 |
| DOI: | 10.1609/aaai.v38i21.30361 |
| Dostupnost: | https://ojs.aaai.org/index.php/AAAI/article/view/30361 https://doi.org/10.1609/aaai.v38i21.30361 |
| Rights: | Copyright (c) 2024 Association for the Advancement of Artificial Intelligence |
| Přístupové číslo: | edsbas.5A420C5C |
| Databáze: | BASE |
| Abstrakt: | Large language models like ChatGPT can generate human-like code, posing challenges for programming education as students may be tempted to misuse them on assignments. However, there are currently no robust detectors designed specifically to identify AI-generated code. This is an issue that needs to be addressed to maintain academic integrity while allowing proper utilization of language models. Previous work has explored different approaches to detect AI-generated text, including watermarks, feature analysis, and fine-tuning language models. In this paper, we address the challenge of determining whether a student's code assignment was generated by a language model. First, our proposed method identifies AI-generated code by leveraging targeted masking perturbation paired with comperhesive scoring. Rather than applying a random mask, areas of the code with higher perplexity are more intensely masked. Second, we utilize a fine-tuned CodeBERT to fill in the masked portions, producing subtle modified samples. Then, we integrate the overall perplexity, variation of code line perplexity, and burstiness into a unified score. In this scoring scheme, a higher rank for the original code suggests it's more likely to be AI-generated. This approach stems from the observation that AI-generated codes typically have lower perplexity. Therefore, perturbations often exert minimal influence on them. Conversely, sections of human-composed codes that the model struggles to understand can see their perplexity reduced by such perturbations. Our method outperforms current open-source and commercial text detectors. Specifically, it improves detection of code submissions generated by OpenAI's text-davinci-003, raising average AUC from 0.56 (GPTZero baseline) to 0.87 for our detector. |
|---|---|
| DOI: | 10.1609/aaai.v38i21.30361 |
Nájsť tento článok vo Web of Science