arrow
Return

MAGECODE: Machine-Generated Code Detection Method Using Large Language Models

delete2024-01-01
delete0
delete
OA
AI
H
Hung N. Pham
H
Huyen Ha
T
Tong, Van
D
Dung Hoang Tien
D
Duc Tran *
N
Ngoc Tuyen Le *
DOI:10.1109/ACCESS.2024.3509987delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
The widespread use of virtual assistants (e.g., GPT4 and Gemini, etc.) by students in their academic assignments raises concerns about academic integrity. Consequently, various machine-generated text (MGT) detection methods, developed from metric-based and model-based approaches, were proposed and shown to be highly effective. The model-based MGT methods often encounter difficulties when dealing with source code due to disparities in semantics compared to natural languages. Meanwhile, the efficacy of metric-based MGT methods on source code has not been investigated. Moreover, the challenge of identifying machine-generated codes (MGC) has received less attention, and existing solutions demonstrate low accuracy and high false positive rates across diverse human-written codes. In this paper, we take into account both semantic features extracted from Large Language Models (LLMs) and the applicability of metrics (e.g., Log-Likelihood, Rank, Log-rank, etc.) for source code analysis. Concretely, we propose MageCode, a novel method for identifying machine-generated codes. MageCode utilizes the pre-trained model CodeT5+ to extract semantic features from source code inputs and incorporates metric-based techniques to enhance accuracy. In order to assess the proposed method, we introduce a new dataset comprising more than 45,000 code solutions generated by LLMs for programming problems. The solutions for these programming problems which were obtained from three advanced LLMs (GPT4, Gemini, and Code-bison-32k), were written in Python, Java, and C++. The evaluation of MageCode on this dataset demonstrates superior performance compared to existing baselines, achieving up to 98.46% accuracy while maintaining a low false positive rate of less than 1%.
Keywords:
Codes
Source coding
Computer architecture
Transformers
Programming profession
Large language models
Feature extraction
Measurement
Computational modeling
Python
Machine-generated code detection
large language model
metrics
CodeT5+

Journal

IEEE Access cover
IEEE Access
IF:
3.6
Papers:
9.8W
Citations:
29.4W

Organization

H
hanoi university of science & technology (hust)
Scholars:
3.3K
Papers: 2.2K
Citations: 1
M
Ming Chi University of Technology
Scholars:
2.3K
Papers: 2.3K
Citations: 3.4K
Cited Papers

Cited Papers

Regioselectivity of the ring opening in the reaction of phenyloxirane, (phenylmethyl)oxirane and (2-phenylethyl)oxirane with K−, K+(15-crown-5)2
err2003-04-01
err0
PREAI
errZbigniew Grobelny; Andrzej Stolarzewicz; Barbara Morejko-Buż; Adalbert Maercker; Stanisław; Krompiec; Tadeusz Bieg
errShare
errSave
Variable effects of temperature on insect herbivory
err2014-05-06
err0
errOAAI
errNathan P. Lemoine; Deron E. Burkepile; John D. Parker
errShare
errSave
errShare
errSave
The HadGEM2-ES implementation of CMIP5 centennial simulations
err
IF0
err2011-03-31
err0
errOAAI
errC. D. Jones; J. K. Hughes; N. Bellouin; S. C. Hardiman; G. S. Jones; J. Knight; S. Liddicoat; F. M. O'Connor; R. J. Andres; C. Bell; K.-O. Boo; A. Bozzo; N. Butchart; P. Cadule; K. D. Corbin; M. Doutriaux-Boucher; P. Friedlingstein; J. Gornall; L. Gray; P. R. Halloran; G. Hurtt; W. Ingram; J.-F. Lamarque; R. M. Law; M. Meinshausen; S. Osprey; E. J. Palin; L. Parsons Chini; T. Raddatz; M. Sanderson; A. A. Sellar; A. Schurer; P. Valdes; N. Wood; S. Woodward; M. Yoshioka; M. Zerroukat
errShare
errSave
no more