With the widespread application of artificial intelligence(AI) in code generation tasks, issues such as the quality, security, and intellectual property compliance of generated code have become increasingly prominent, necessitating the establishment of an ef-fective automated AI-generated code detection mechanism. While existing research has focused on detecting AI-generated code, insufficient attention has been paid to Go, a programming language widely used in cloud-native and distributed systems. To address the problem of detecting AI-generated code in Go language, this paper proposes a detection framework based on Task Conditional Entropy Sequences(TCES). By modeling the uncertainty(i.e., prediction probability) of the code generation process under specific task conditions, two supervised learning-based AI-generated code detection schemes are designed: TCES-XGBoost and TCES-CNN. Experimental results on Go code datasets generated by various models such as GPT-3.5, CodeLlama, and WizardCoder demonstrate the superior performance of the proposed methods. TCES-CNN achieves the best performance in all experiments, significantly outperforming existing baseline methods. This research shows that Task Conditional Entropy Sequences can effec-tively reveal the essential differences between humans and AI in code generation uncertainty patterns, providing a more robust and universal new solution for detecting AI-generated Go code. This has significant practical implications for improving Go software quality assurance, code security review, and maintaining educational integrity.
Liao et al. (Thu,) studied this question.