mlsanityData to 7 Oct 2026

Zero-Shot Detection of Machine-Generated Codes

arXiv 2310.05103 ↗First posted 8 Oct 2023cs.CL cs.AI cs.CRcited by 24

Not on the map. Why?

Abstract (arXiv)

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

Key facts. Cited by 24 papers in the map (data through 7 Oct 2026). Builds on 39 of its 52 references that are in the map. First posted on arXiv 8 Oct 2023.

Builds on

39 of 52 references.

References · 39

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  3. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
  6. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
  7. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
  8. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  9. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  10. 2023Teaching Large Language Models to Self-Debugcited by 963
  11. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  12. 2021Measuring Coding Challenge Competence With APPScited by 879
27 more
  1. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  2. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  3. 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 705
  4. 2023A Watermark for Large Language Modelscited by 667
  5. 2019Defending Against Neural Fake Newscited by 553
  6. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  7. 2023Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defensecited by 401
  8. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
  9. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
  10. 2019Mitigating Gender Bias in Natural Language Processing: Literature Reviewcited by 287
  11. 2022Efficient Training of Language Models to Fill in the Middlecited by 248
  12. 2023LEVER: Learning to Verify Language-to-Code Generation with Executioncited by 228
  13. 2023SantaCoder: don't reach for the stars!cited by 169
  14. 2023DNA-GPT: Divergent N-Gram Analysis for Training-Free Detection of GPT-Generated Textcited by 127
  15. 2023On the Risk of Misinformation Pollution with Large Language Modelscited by 124
  16. 2023Who Wrote this Code? Watermarking for Code Generationcited by 116
  17. 2022CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generationcited by 87
  18. 2020PyMT5: multi-mode translation of natural language and Python code with transformerscited by 80
  19. 2022Language Generation Models Can Cause Harm: So What Can We Do About It? An Actionable Surveycited by 80
  20. 2018A Survey on Natural Language Processing for Fake News Detectioncited by 67
  21. 2022Real or Fake Text?: Investigating Human Ability to Detect Boundaries Between Human-Written and Machine-Generated Textcited by 63
  22. 2023ALGO: Synthesizing Algorithmic Programs with LLM-Generated Oracle Verifierscited by 41
  23. 2023Machine-Made Media: Monitoring the Mobilization of Machine-Generated Articles on Misinformation and Mainstream News Websitescited by 37
  24. 2023Smaller Language Models are Better Black-box Machine-Generated Text Detectorscited by 35
  25. 2022ERNIE-Code: Beyond English-Centric Cross-lingual Pretraining for Programming Languagescited by 29
  26. 2023Game of Tones: Faculty detection of GPT-4 generated content in university assessmentscited by 15
  27. 2023Evaluating AIGC Detectors on Code Contentcited by 12

Built on by

Cited by year (2026 to 7 Oct)

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

24 papers.

Sort:

By area:

  1. 2023A Survey on Detection of LLMs-Generated Contentcited by 70
  2. 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
  3. 2024Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmerscited by 27
  4. 2024EAGLE: A Domain Generalization Framework for AI-generated Text Detectioncited by 13
  5. 2024DALD: Improving Logits-based Detector without Logits from Black-box LLMscited by 12
  6. 2024Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewritingcited by 11
  7. 2025textttDroid: A Resource Suite for AI-Generated Code Detectioncited by 9
  8. 2025Human Texts Are Outliers: Detecting LLM-generated Texts via Out-of-distribution Detectioncited by 8
  9. 2024ChatGPT Code Detection: Techniques for Uncovering the Source of Codecited by 6
  10. 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
  11. 2025Large Language Model Sourcing: A Surveycited by 5
  12. 2025Detection of LLM-Paraphrased Code and Identification of the Responsible LLM Using Coding Style Featurescited by 4
12 more
  1. 2024Self-Explained Keywords Empower Large Language Models for Code Generationcited by 2
  2. 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
  3. 2026Beyond Raw Detection Scores: Markov-Informed Calibration for Boosting Machine-Generated Text Detectioncited by 2
  4. 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularitiescited by 1
  5. 2025Zero-Shot Detection of LLM-Generated Code via Approximated Task Conditioningcited by 1
  6. 2026Whitespaces Don't Lie: Feature-Driven and Embedding-Based Approaches for Detecting Machine-Generated Codecited by 0
  7. 2026Code Fingerprints: Disentangled Attribution of LLM-Generated Codecited by 0
  8. 2026Multi-Level Contextual Token Relation Modeling for Machine-Generated Text Detectioncited by 0
  9. 2026Hidden Human-Like Nature of Machine-Generated Texts: Theory and Detection Enhancementcited by 0
  10. 2026Detecting AI Coding Agents in Open Source: A Validated Multi-Method Census of 180 Million Repositoriescited by 0
  11. 2026Latent Trajectory Discrimination for AI-Generated Text Detectioncited by 0
  12. 2026Style, Not Self: Surface Cues Explain Zero-Shot Code Attribution by Large Language Modelscited by 0