pith. sign in

arxiv: 2310.05103 · v1 · pith:3ZEIXMR5new · submitted 2023-10-08 · 💻 cs.CL · cs.AI· cs.CR· cs.LG

Zero-Shot Detection of Machine-Generated Codes

classification 💻 cs.CL cs.AIcs.CRcs.LG
keywords codedetectioncodeszero-shotapproachfindgeneratedlanguage
0
0 comments X
read the original abstract

This work proposes a training-free approach for the detection of LLMs-generated codes, mitigating the risks associated with their indiscriminate usage. To the best of our knowledge, our research is the first to investigate zero-shot detection techniques applied to code generated by advanced black-box LLMs like ChatGPT. Firstly, we find that existing training-based or zero-shot text detectors are ineffective in detecting code, likely due to the unique statistical properties found in code structures. We then modify the previous zero-shot text detection method, DetectGPT (Mitchell et al., 2023) by utilizing a surrogate white-box model to estimate the probability of the rightmost tokens, allowing us to identify code snippets generated by language models. Through extensive experiments conducted on the python codes of the CodeContest and APPS dataset, our approach demonstrates its effectiveness by achieving state-of-the-art detection results on text-davinci-003, GPT-3.5, and GPT-4 models. Moreover, our method exhibits robustness against revision attacks and generalizes well to Java codes. We also find that the smaller code language model like PolyCoder-160M performs as a universal code detector, outperforming the billion-scale counterpart. The codes will be available at https://github.com/ Xianjun-Yang/Code_detection.git

This paper has not been read by Pith yet.

discussion (0)

Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.

Forward citations

Cited by 3 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score.

  1. Detecting AI Coding Agents in Open Source: A Validated Multi-Method Census of 180 Million Repositories

    cs.SE 2026-06 unverdicted novelty 7.0

    A validated multi-method census of 180M repositories shows AI coding agents generate over 320k commits per month, with bot-account detection recovering only 3.3% of Claude Code activity and commit/PR channels capturin...

  2. Hidden Human-Like Nature of Machine-Generated Texts: Theory and Detection Enhancement

    cs.CL 2026-05 unverdicted novelty 5.0

    Reveals hidden human-like spans in machine-generated texts that raise detection complexity and proposes a stacked enhancement framework with hard-EM optimization to improve detectors across LLMs.

  3. Multi-Level Contextual Token Relation Modeling for Machine-Generated Text Detection

    cs.CL 2026-05 unverdicted novelty 5.0

    A multi-level framework that models local and global relations among token detection scores to improve machine-generated text detection with low overhead.