atlas

Research map / Large language models / Language, safety and interpretability

Detecting AI-Generated Code Assignments Using Perplexity of Large Language Models

AAAI 2024 · Large language models › Language, safety and interpretability · approach: Zero-shot machine-text detection · 45 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes AIGCode Detector, a zero-shot detector that flags AI-generated code by perplexity-guided masking, CodeBERT mask-filling perturbations, and a composite perplexity/burstiness score.

Problem

Detecting whether student programming assignments were generated by LLMs such as ChatGPT/text-davinci-003, where existing text detectors perform poorly on code.

Approach

Extends DetectGPT-style perturbation to code: masks are allocated preferentially to high-perplexity lines, CodeBERT (fine-tuned per language) fills the masks, and the original code is ranked against perturbed versions using a score combining overall perplexity, std of line-level perplexity, and burstiness.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
replace GPTZero with AIGCode Detectorcode-origin detection · CAUC: 0.90 -> 0.95Helped
replace GPTZero with AIGCode Detectorcode-origin detection · C++AUC: 0.83 -> 0.88Helped
replace Writer with AIGCode Detectorcode-origin detection · C#AUC: 0.52 -> 0.86Helped
replace Writer with AIGCode Detectorcode-origin detection · JavaAUC: 0.54 -> 0.82Helped
replace Writer with AIGCode Detectorcode-origin detection · JavaScriptAUC: 0.56 -> 0.81Helped
replace GPTZero with AIGCode Detectorcode-origin detection · PythonAUC: 0.59 -> 0.92Helped
use GPT2-xl instead of text-davinci-003 for perplexity calculation (ablation)AIGCode Detector · six programming languagesAUC: C: 0.79; C++: 0.75; C#: 0.73; Java: 0.72; JavaScript: 0.71; Python: 0.69Hurt
use GPT-J instead of text-davinci-003 for perplexity calculation (ablation)AIGCode Detector · six programming languagesAUC: C: 0.82; C++: 0.76; C#: 0.76; Java: 0.77; JavaScript: 0.79; Python: 0.78Hurt
use GPT-NeoX instead of text-davinci-003 for perplexity calculation (ablation)AIGCode Detector · six programming languagesAUC: C: 0.87; C++: 0.83; C#: 0.80; Java: 0.74; JavaScript: 0.75; Python: 0.83Hurt
apply sampling techniques with higher temperature and altered top-pAI-generated C code · AIGCode datasetbypass rate: 0.37Hurt
blend human-written and AI-generated codeAI-generated C code · AIGCode datasetbypass rate: 0.75Hurt

Surprising findings

Limitations

Experimental setup

Datasets: CodeNet AIGCode

Benchmarks: AIGCode

Metrics: AUC FPR FNR bypass rate

Baselines: GPT2-Detector DetectGPT RoBERTa-QA Writer AI Detector GPTZero

Builds on: DetectGPT CodeBERT GPTZero

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy