Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) have demonstrated remarkable proficiency in generating code. However, the misuse of LLM-generated (synthetic) code has raised concerns in both educational and industrial contexts, underscoring the urgent need for synthetic code detectors. Existing methods for detecting synthetic content are primarily designed for general text and struggle with code due to the unique grammatical structure of programming languages and the presence of numerous ''low-entropy'' tokens. Building on this, our work proposes a novel zero-shot synthetic code detector based on the similarity between the original code and its LLM-rewritten variants. Our method is based on the observation that differences between LLM-rewritten and original code tend to be smaller when the original code is synthetic. We utilize self-supervised contrastive learning to train a code similarity model and evaluate our approach on two synthetic code detection benchmarks. Our results demonstrate a significant improvement over existing SOTA synthetic content detectors, with AUROC scores increasing by 20.5% on the APPS benchmark and 29.1% on the MBPP benchmark.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 27 of its 53 references that are in the map. First posted on arXiv 25 May 2024.
Builds on
27 of 53 references.
References · 27
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2018Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarizationcited by 1,317
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 726
15 more
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2019Defending Against Neural Fake Newscited by 559
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2023DetectLLM: Leveraging Log Rank Information for Zero-Shot Detection of Machine-Generated Textcited by 210
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
- 2023Robust Multi-bit Natural Language Watermarking through Invariant Featurescited by 82
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2023Computing Education in the Era of Generative AIcited by 52
- 2023Zero-Shot Detection of Machine-Generated Codescited by 24
- 2022CODE-MVP: Learning to Represent Source Code from Multiple Views with Contrastive Pre-Trainingcited by 15
- 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representationcited by 7
- 2020MISIM: A Neural Code Semantics Similarity System Using the Context-Aware Semantics Structurecited by 6
Built on by
Citing papers per year: 2024: 2; 2025: 7; 2026: 2.
11 papers.
- 2024Web2Code: A Large-scale Webpage-to-Code Dataset and Evaluation Framework for Multimodal LLMscited by 74
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2025AIM-Bench: Evaluating Decision-making Biases of Agentic LLM as Inventory Managercited by 6
- 2025Dynamic Bundling with Large Language Models for Zero-Shot Inference on Text-Attributed Graphscited by 3
- 2025Understanding the Effects of RLHF on the Quality and Detectability of LLM-Generated Textscited by 2
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularitiescited by 1
- 2025Zero-Shot Detection of LLM-Generated Code via Approximated Task Conditioningcited by 1
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Trainingcited by 1
- 2025code_transformed: The Influence of Large Language Models on Codecited by 0
- 2026Code Fingerprints: Disentangled Attribution of LLM-Generated Codecited by 0
- 2026SWE-Fuse: Empowering Software Agents via Issue-free Trajectory Learning and Entropy-aware RLVR Training9 Mar 2026
- 2026Code Fingerprints: Disentangled Attribution of LLM-Generated Code4 Mar 2026
- 2025AIM-Bench: Evaluating Decision-making Biases of Agentic LLM as Inventory Manager15 Aug 2025
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarios29 Jul 2025
- 2025code_transformed: The Influence of Large Language Models on Code13 Jun 2025
- 2025Zero-Shot Detection of LLM-Generated Code via Approximated Task Conditioning6 Jun 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025Dynamic Bundling with Large Language Models for Zero-Shot Inference on Text-Attributed Graphs23 May 2025
- 2025Understanding the Effects of RLHF on the Quality and Detectability of LLM-Generated Texts23 Mar 2025
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularities2 Sep 2024
- 2024Web2Code: A Large-scale Webpage-to-Code Dataset and Evaluation Framework for Multimodal LLMs28 Jun 2024