arrow
Return

LLM-Based Explainable Detection of LLM-Generated Code in Python Programming Courses

delete2026-01-01
delete0
PRE
AI
J
Jeonghun Baek *
T
Tetsuro Yamazaki
A
Akimasa Morihata
J
Junichiro Mori
Y
Yoko Yamakata
K
Kenjiro Taura
S
Shigeru Chiba
DOI:10.1145/3770762.3772605delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
In introductory programming courses, students increasingly submit code generated by large language models (LLMs) instead of solving problems independently. This growing reliance raises concerns about students' development of programming skills. To reduce the overreliance and promote independent problem solving, we propose an explainable detection framework that predicts whether a code submission was generated by an LLM and provides an explanation for its prediction. Such explanations are crucial in educational settings, where transparency and feedback are essential. To support this, we construct a dataset of student-written and LLM-generated code, paired with explanations automatically produced using GPT-4o. We finetune several code-specialized LLMs using both binary labels (student-written or LLM-generated) and explanations. The resulting models achieve over 99% accuracy and generate informative explanations aligned with their predictions, both validated by human instructors. We also apply our detector to past programming course data, revealing a sharp increase in LLM-generated submissions-from nearly 0% in 2022A to over 40% in 2024A. We conclude with a discussion of false positives and suggest how explainable detection can be responsibly deployed in programming courses. Code and prompts are publicly available at https://github.com/ku21fan/LLM-code-detector.
Keywords:
Large language model
LLM-generated code
Explainable detection
LLM-based detector
Explanation generation
Python programming

Journal

P
PROCEEDINGS OF THE 57TH ACM TECHNICAL SYMPOSIUM ON COMPUTER SCIENCE EDUCATION V.1, SIGCSE TS 2026
IF:
0
Papers:
170
Citations:
0

Organization

U
university of tokyo
Scholars:
6.4K
Papers: 2.5K
Citations: 1
Cited Papers

Cited Papers

Focus on formative feedback
err2008-03-01
err2.8K
errOAAI
errShute, Valerie J.
errShare
errSave
Detecting ChatGPT-Generated Code Submissions in a CS1 Course Using Machine Learning Models
err2024-03-07
err0
PREAI
errMuntasir Hoq; Yang Shi; Juho Leinonen; Damilola Babalola; Collin Lynch; Thomas Price; Bita Akram
errShare
errSave
ChatGPT for Good? On Opportunities and Challenges of Large Language Models for Education
err
IF0
err2023-01-30
err0
errOAAI
errEnkelejda Kasneci; Kathrin Seßler; Stefan Küchemann; Maria Bannert; Daryna Dementieva; Frank Fischer; Urs Gasser; Georg Groh; Stephan Günnemann; Eyke Hüllermeier; Stephan Krusche; Gitta Kutyniok; Tilman Michaeli; Claudia Nerdel; Jürgen Pfeffer; Oleksandra Poquet; Michael Sailer; Albrecht Schmidt; Tina Seidel; Matthias Stadler; Jochen Weller; Jochen Kuhn; Gjergji Kasneci
errShare
errSave
err
IF0
err
err0
PREAI
err
errShare
errSave
err
IF0
err
err0
PREAI
err
errShare
errSave
no more