EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

DualCodeDetect: Zero-Shot LLM-Generated Code Detection via Dual-Channel Perturbation

Zhengdao Li, Xiuwei Shang, Zhenkan Fu, Shikai Guo, Weiming Zhang, NengHai Yu, Kejiang Chen

Proceedings of the ACM on Software Engineering · 30.06.2026 · 3 (FSE) · 3604-3626

DOI: 10.1145/3808166 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Proceedings of the ACM on Software Engineering, online erschienen am 30.06.2026. Verfasst von Zhengdao Li und 6 weiteren Autor:innen. Die Arbeit nennt 48 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: National Natural Science Foundation of China, the New Generation Artificial Intelligence-National Science and Technology Major Project.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

The rapid advancement of large language models (LLMs) in code generation has greatly improved software development efficiency, but it has also raised concerns about misuse, making the distinction between human-written and LLM-generated code an urgent task. However, existing detection methods for LLM-generated content, particularly perturbation-based zero-shot methods, are primarily designed for natural language scenarios and fail to transfer effectively to the task of detecting generated code. When directly applied to code, they face two major challenges: (1) the low-entropy nature of code restricts the perturbation space and weakens discriminative signals; and (2) prior perturbation methods often compromise semantic integrity or executability, leading to substantial performance degradation. To address these issues, we propose DualCodeDetect, a novel zero-shot detection framework that amplifies the differences between LLM-generated and human-written code through a dual-channel perturbation mechanism. In the semantic channel, we design an identifier perturbation strategy based on outside-nucleus sampling, which disrupts the strong consistency of LLMs in identifier selection. In the structural channel, empirical analysis reveals that LLM-generated code exhibits greater uniformity in stylistic features; leveraging this insight, we construct a rule-based library of semantics-preserving code transformations to introduce structural perturbations that further magnify statistical disparities. In experiments conducted across two datasets and ten representative code LLMs, DualCodeDetect achieves an average AUROC of 0.8477, alongside FPR and FNR values of 0.0430 and 0.0552, respectively, on Python under both T =0.2 and T =1.0 temperature settings with a reasonable runtime overhead. Furthermore, it demonstrates strong cross-language generalization on Java, C++, and JavaScript, confirming its significant superiority over existing detection methods.

Förderung

  • National Natural Science Foundation of China
  • the New Generation Artificial Intelligence-National Science and Technology Major Project

Zitieren

APA

Li, Z., Shang, X., Fu, Z., Guo, S., Zhang, W., Yu, N., & Chen, K. (2026). DualCodeDetect: Zero-Shot LLM-Generated Code Detection via Dual-Channel Perturbation. Proceedings of the ACM on Software Engineering, 3(FSE), 3604-3626. https://doi.org/10.1145/3808166

Vancouver

Li Z, Shang X, Fu Z, Guo S, Zhang W, Yu N, et al. DualCodeDetect: Zero-Shot LLM-Generated Code Detection via Dual-Channel Perturbation. Proceedings of the ACM on Software Engineering. 2026;3(FSE):3604-3626. doi:10.1145/3808166

BibTeX
@article{Li2026,
  author = {Li, Zhengdao and Shang, Xiuwei and Fu, Zhenkan and Guo, Shikai and Zhang, Weiming and Yu, NengHai and Chen, Kejiang},
  title = {DualCodeDetect: Zero-Shot LLM-Generated Code Detection via Dual-Channel Perturbation},
  journal = {Proceedings of the ACM on Software Engineering},
  year = {2026},
  volume = {3},
  number = {FSE},
  pages = {3604--3626},
  doi = {10.1145/3808166}
}
Kostenlos starten →