DIFFERENCE BETWEEN HUMAN AND AI-GENERATED CODE
The emergence of artificial intelligence (AI) in software engineering has profoundly transformed the programming domain, with AI-driven code generation platforms such as GitHub Copilot and OpenAI Codex facilitating swift and automated code creation. Nonetheless, the disparities between AI-generated and human-crafted code remain a vital area of investigation. This research delves into techniques to distinguish between them, emphasizing lexical, syntactic, and semantic attributes. A thorough dataset comprising code snippets from various programming languages was compiled and examined through machine learning algorithms, including Support Vector Machines (SVM), Random Forest (RF), and XGBoost (XGB). Findings suggest that AI-generated code often presents foreseeable patterns, structured syntax, and uniform keyword utilization, whereas human-authored code demonstrates greater diversity, originality, and adaptability in problem-solving. Syntactic aspects, particularly control flow intricacy and nesting levels, proved to be the most effective in differentiation, with the combined feature set achieving an accuracy of 92.8%. Despite these encouraging results, challenges such as evolving AI algorithms and dataset constraints persist. This study highlights the necessity for robust identification frameworks to uphold code quality, sustainability, and ethical compliance in AI-supported programming environments.
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2025-02-06
- DOI
- https://doi.org/10.5281/zenodo.14826524
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00