LLMSniffer: Detecting LLM-Generated Code via GraphCodeBERT and Supervised Contrastive Learning
Not on the map. Why?
Abstract (arXiv)
The rapid proliferation of Large Language Models (LLMs) in software development has made distinguishing AI-generated code from human-written code a critical challenge with implications for academic integrity, code quality assurance, and software security. We present LLMSniffer, a detection framework that fine-tunes GraphCodeBERT using a two-stage supervised contrastive learning pipeline augmented with comment removal preprocessing and an MLP classifier. Evaluated on two benchmark datasets - GPTSniffer and Whodunit - LLMSniffer achieves substantial improvements over prior baselines: accuracy increases from 70% to 78% on GPTSniffer (F1: 68% to 78%) and from 91% to 94.65% on Whodunit (F1: 91% to 94.64%). t-SNE visualizations confirm that contrastive fine-tuning yields well-separated, compact embeddings. We release our model checkpoints, datasets, codes and a live interactive demo to facilitate further research.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 17 of its 24 references that are in the map. First posted on arXiv 17 Apr 2026.
Builds on
17 of 24 references.
References · 17
- 2023GPT-4 Technical Reportcited by 18,396
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
- 2020Supervised Contrastive Learningcited by 2,829
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 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
- 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 726
- 2023A Watermark for Large Language Modelscited by 725
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2019Release Strategies and the Social Impacts of Language Modelscited by 513
- 2019GLTR: Statistical Detection and Visualization of Generated Textcited by 496
5 more
- 2020Supervised Contrastive Learning for Pre-trained Language Model Fine-tuningcited by 276
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
- 2023Towards Understanding the Capability of Large Language Models on Code Clone Detection: A Surveycited by 15
- 2024Whodunit: Classifying Code as Human Authored or GPT-4 Generated -- A case study on CodeChef problemscited by 13
- 2025Zero-Shot Detection of LLM-Generated Code via Approximated Task Conditioningcited by 1
Built on by
Not cited yet.