Whodunit: Classifying Code as Human Authored or GPT-4 Generated -- A case study on CodeChef problems
Not on the map. Why?
Abstract (arXiv)
Artificial intelligence (AI) assistants such as GitHub Copilot and ChatGPT, built on large language models like GPT-4, are revolutionizing how programming tasks are performed, raising questions about whether code is authored by generative AI models. Such questions are of particular interest to educators, who worry that these tools enable a new form of academic dishonesty, in which students submit AI generated code as their own work. Our research explores the viability of using code stylometry and machine learning to distinguish between GPT-4 generated and human-authored code. Our dataset comprises human-authored solutions from CodeChef and AI-authored solutions generated by GPT-4. Our classifier outperforms baselines, with an F1-score and AUC-ROC score of 0.91. A variant of our classifier that excludes gameable features (e.g., empty lines, whitespace) still performs well with an F1-score and AUC-ROC score of 0.89. We also evaluated our classifier with respect to the difficulty of the programming problem and found that there was almost no difference between easier and intermediate problems, and the classifier performed only slightly worse on harder problems. Our study shows that code stylometry is a promising approach for distinguishing between GPT-4 generated code and human-authored code.
Key facts. Cited by 13 papers in the map (data through 7 Oct 2026). First posted on arXiv 6 Mar 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 2; 2025: 6; 2026: 5.
13 papers.
Sort:
By area:
- 2025CoDet-M4: Detecting Machine-Generated Code in Multi-Lingual, Multi-Generator and Multi-Domain Settingscited by 11
- 2025textttDroid: A Resource Suite for AI-Generated Code Detectioncited by 9
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2024AIGCodeSet: A New Annotated Dataset for AI Generated Code Detectioncited by 5
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
- 2025The Hidden DNA of LLM-Generated JavaScript: Structural Patterns Enable High-Accuracy Authorship Attributioncited by 2
- 2026AICD Bench: A Challenging Benchmark for AI-Generated Code Detectioncited by 2
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularitiescited by 1
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practicescited by 1
- 2026Do AI Agents Really Improve Code Readability?cited by 0
- 2026LLMSniffer: Detecting LLM-Generated Code via GraphCodeBERT and Supervised Contrastive Learningcited by 0
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detectioncited by 0
- 2026Synthetic Semantic Supervision for Contrastive Code Representation Learning in Small Transformers: An Empirical Study3 Sep 2026
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detection10 Jun 2026
- 2026LLMSniffer: Detecting LLM-Generated Code via GraphCodeBERT and Supervised Contrastive Learning17 Apr 2026
- 2026Do AI Agents Really Improve Code Readability?14 Mar 2026
- 2026AICD Bench: A Challenging Benchmark for AI-Generated Code Detection2 Feb 2026
- 2025The Hidden DNA of LLM-Generated JavaScript: Structural Patterns Enable High-Accuracy Authorship Attribution12 Oct 2025
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarios29 Jul 2025
- 2025textttDroid: A Resource Suite for AI-Generated Code Detection11 Jul 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practices23 Apr 2025
- 2025CoDet-M4: Detecting Machine-Generated Code in Multi-Lingual, Multi-Generator and Multi-Domain Settings17 Mar 2025
- 2024AIGCodeSet: A New Annotated Dataset for AI Generated Code Detection21 Dec 2024
- 2026Do AI Agents Really Improve Code Readability?cited by 0
- 2026Do AI Agents Really Improve Code Readability?14 Mar 2026
- 2025CoDet-M4: Detecting Machine-Generated Code in Multi-Lingual, Multi-Generator and Multi-Domain Settingscited by 11
- 2025textttDroid: A Resource Suite for AI-Generated Code Detectioncited by 9
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2024AIGCodeSet: A New Annotated Dataset for AI Generated Code Detectioncited by 5
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
- 2025The Hidden DNA of LLM-Generated JavaScript: Structural Patterns Enable High-Accuracy Authorship Attributioncited by 2
- 2026AICD Bench: A Challenging Benchmark for AI-Generated Code Detectioncited by 2
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularitiescited by 1
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practicescited by 1
- 2026LLMSniffer: Detecting LLM-Generated Code via GraphCodeBERT and Supervised Contrastive Learningcited by 0
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detectioncited by 0
- 2026Synthetic Semantic Supervision for Contrastive Code Representation Learning in Small Transformers: An Empirical Studycited by 0
- 2026Synthetic Semantic Supervision for Contrastive Code Representation Learning in Small Transformers: An Empirical Study3 Sep 2026
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detection10 Jun 2026
- 2026LLMSniffer: Detecting LLM-Generated Code via GraphCodeBERT and Supervised Contrastive Learning17 Apr 2026
- 2026AICD Bench: A Challenging Benchmark for AI-Generated Code Detection2 Feb 2026
- 2025The Hidden DNA of LLM-Generated JavaScript: Structural Patterns Enable High-Accuracy Authorship Attribution12 Oct 2025
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarios29 Jul 2025
- 2025textttDroid: A Resource Suite for AI-Generated Code Detection11 Jul 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practices23 Apr 2025
- 2025CoDet-M4: Detecting Machine-Generated Code in Multi-Lingual, Multi-Generator and Multi-Domain Settings17 Mar 2025
- 2024AIGCodeSet: A New Annotated Dataset for AI Generated Code Detection21 Dec 2024
- 2024Automatic Detection of LLM-Generated Code: A Comparative Case Study of Contemporary Models Across Function and Class Granularities2 Sep 2024