Table of Contents
Fetching ...

Assessing AI Detectors in Identifying AI-Generated Code: Implications for Education

Wei Hung Pan, Ming Jie Chok, Jonathan Leong Shan Wong, Yung Xin Shin, Yeong Shian Poon, Zhou Yang, Chun Yong Chong, David Lo, Mei Kuan Lim

TL;DR

This work systematically evaluates five AIGC detectors (GPTZero, Sapling, GPT-2 Detector, DetectGPT, GLTR) on a large corpus of human-written and AI-generated Python code across 13 prompt variants. By constructing 13 variant datasets (5,069 samples each) and applying an OpenAI-based generation pipeline, the study reveals substantial weaknesses in current detectors for code, with overall accuracies near chance for several tools and pronounced sensitivity to code variants, especially for GLTR. Sapling and GLTR show the most promise in certain variants, but the results demonstrate that no detector consistently and reliably distinguishes AI-generated code from human-written code across diverse prompt perturbations. The findings underscore the need for code-specific detectors, robust evaluation frameworks in CS/SE education, and ethical guidelines to preserve academic integrity as AI-assisted programming becomes more prevalent.

Abstract

Educators are increasingly concerned about the usage of Large Language Models (LLMs) such as ChatGPT in programming education, particularly regarding the potential exploitation of imperfections in Artificial Intelligence Generated Content (AIGC) Detectors for academic misconduct. In this paper, we present an empirical study where the LLM is examined for its attempts to bypass detection by AIGC Detectors. This is achieved by generating code in response to a given question using different variants. We collected a dataset comprising 5,069 samples, with each sample consisting of a textual description of a coding problem and its corresponding human-written Python solution codes. These samples were obtained from various sources, including 80 from Quescol, 3,264 from Kaggle, and 1,725 from LeetCode. From the dataset, we created 13 sets of code problem variant prompts, which were used to instruct ChatGPT to generate the outputs. Subsequently, we assessed the performance of five AIGC detectors. Our results demonstrate that existing AIGC Detectors perform poorly in distinguishing between human-written code and AI-generated code.

Assessing AI Detectors in Identifying AI-Generated Code: Implications for Education

TL;DR

This work systematically evaluates five AIGC detectors (GPTZero, Sapling, GPT-2 Detector, DetectGPT, GLTR) on a large corpus of human-written and AI-generated Python code across 13 prompt variants. By constructing 13 variant datasets (5,069 samples each) and applying an OpenAI-based generation pipeline, the study reveals substantial weaknesses in current detectors for code, with overall accuracies near chance for several tools and pronounced sensitivity to code variants, especially for GLTR. Sapling and GLTR show the most promise in certain variants, but the results demonstrate that no detector consistently and reliably distinguishes AI-generated code from human-written code across diverse prompt perturbations. The findings underscore the need for code-specific detectors, robust evaluation frameworks in CS/SE education, and ethical guidelines to preserve academic integrity as AI-assisted programming becomes more prevalent.

Abstract

Educators are increasingly concerned about the usage of Large Language Models (LLMs) such as ChatGPT in programming education, particularly regarding the potential exploitation of imperfections in Artificial Intelligence Generated Content (AIGC) Detectors for academic misconduct. In this paper, we present an empirical study where the LLM is examined for its attempts to bypass detection by AIGC Detectors. This is achieved by generating code in response to a given question using different variants. We collected a dataset comprising 5,069 samples, with each sample consisting of a textual description of a coding problem and its corresponding human-written Python solution codes. These samples were obtained from various sources, including 80 from Quescol, 3,264 from Kaggle, and 1,725 from LeetCode. From the dataset, we created 13 sets of code problem variant prompts, which were used to instruct ChatGPT to generate the outputs. Subsequently, we assessed the performance of five AIGC detectors. Our results demonstrate that existing AIGC Detectors perform poorly in distinguishing between human-written code and AI-generated code.
Paper Structure (22 sections, 4 figures, 3 tables, 4 algorithms)

This paper contains 22 sections, 4 figures, 3 tables, 4 algorithms.

Figures (4)

  • Figure 1: Workflow of the AIGC and their variants' generation process, AIGC prediction with AIGC Detectors, and comparative analysis of AIGC Detector outputs with accuracy metrics.
  • Figure 2: Accuracy Performance for DetectGPT
  • Figure 3: TPR and TNR Performance for GLTR
  • Figure 4: TPR and TNR Performance for Sapling