mlsanityData to 14 Oct 2026

Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting

arXiv 2405.16133 ↗First posted 25 May 2024cs.SE cs.AIcited by 11

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

  1. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  2. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  3. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
  4. 2021Program Synthesis with Large Language Modelscited by 3,637
  5. 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  7. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
  8. 2018Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarizationcited by 1,317
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  10. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  11. 2021Measuring Coding Challenge Competence With APPScited by 902
  12. 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 726
15 more
  1. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  2. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
  3. 2019Defending Against Neural Fake Newscited by 559
  4. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
  5. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  6. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
  7. 2023DetectLLM: Leveraging Log Rank Information for Zero-Shot Detection of Machine-Generated Textcited by 210
  8. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  9. 2023Robust Multi-bit Natural Language Watermarking through Invariant Featurescited by 82
  10. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  11. 2023Computing Education in the Era of Generative AIcited by 52
  12. 2023Zero-Shot Detection of Machine-Generated Codescited by 24
  13. 2022CODE-MVP: Learning to Represent Source Code from Multiple Views with Contrastive Pre-Trainingcited by 15
  14. 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representationcited by 7
  15. 2020MISIM: A Neural Code Semantics Similarity System Using the Context-Aware Semantics Structurecited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 2; 2025: 7; 2026: 2.

11 papers.