{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,11,25]],"date-time":"2025-11-25T08:18:36Z","timestamp":1764058716583,"version":"3.45.0"},"reference-count":15,"publisher":"World Scientific Pub Co Pte Ltd","issue":"12","content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Int. J. Soft. Eng. Knowl. Eng."],"published-print":{"date-parts":[[2025,12]]},"abstract":"<jats:p>AI-generated code is spreading rapidly, making it harder to trace the true origins of code. Text-based tools such as DetectGPT perform well on texts but struggle with code. We propose a new approach: under masked reconstruction, code produced by LLMs exhibits a much wider spread in Levenshtein distance than human-written code. Our key innovation is to treat this Levenshtein distance dispersion as an indicator for token-probability differences, leading us to develop LevDetectCode. Our zero-shot detector relies solely on string-level Levenshtein distance, requiring neither GPUs nor access to model internals. Experiments on Python snippets from MBPP-train and HumanEval, as well as Java data from CodeContest_Java_test, using GPT-3.5, GPT-4, and Deepseek-V3, show a 5\u201310 point AUROC improvement over other zero-shot baselines, with an additional case study for the C[Formula: see text] dataset, which also demonstrates strong effectiveness. Furthermore, it runs nearly 3000 times faster and significantly reduces memory usage. These results demonstrate that Levenshtein distance can outperform other zero-shot methods that rely on model-based computations, offering a practical and portable solution for detecting AI-generated code.<\/jats:p>","DOI":"10.1142\/s0218194025500524","type":"journal-article","created":{"date-parts":[[2025,9,4]],"date-time":"2025-09-04T06:41:45Z","timestamp":1756968105000},"page":"1713-1736","source":"Crossref","is-referenced-by-count":0,"title":["LevDetectCode: Zero-Shot Detection of AI-Generated Code Using Levenshtein Distance"],"prefix":"10.1142","volume":"35","author":[{"ORCID":"https:\/\/orcid.org\/0009-0003-3705-8513","authenticated-orcid":false,"given":"Jiazhou","family":"Fu","sequence":"first","affiliation":[{"name":"College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 211106, P. R. China"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-2182-0019","authenticated-orcid":false,"given":"Guohua","family":"Shen","sequence":"additional","affiliation":[{"name":"College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Collaborative Innovation Center of Novel, Software Technology and Industrialization, Key Laboratory of Safety-Critical Software, Ministry of Industry and Information Technology, Nanjing 211106, P. R. China"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-6843-1892","authenticated-orcid":false,"given":"Zhiqiu","family":"Huang","sequence":"additional","affiliation":[{"name":"College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Collaborative Innovation Center of Novel, Software Technology and Industrialization, Key Laboratory of Safety-Critical Software, Ministry of Industry and Information Technology, Nanjing 211106, P. R. China"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-0609-7985","authenticated-orcid":false,"given":"Yaoshen","family":"Yu","sequence":"additional","affiliation":[{"name":"Informationization Department (Information Technology Center), Nanjing University of Aeronautics and Astronautics, Nanjing 211106, P. R. China"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7776-3178","authenticated-orcid":false,"given":"Yu","family":"Zhao","sequence":"additional","affiliation":[{"name":"College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 211106, P. R. China"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"219","published-online":{"date-parts":[[2025,9,24]]},"reference":[{"key":"S0218194025500524BIB002","doi-asserted-by":"publisher","DOI":"10.1126\/science.abq1158"},{"key":"S0218194025500524BIB005","doi-asserted-by":"publisher","DOI":"10.1145\/3639474.3640068"},{"key":"S0218194025500524BIB007","first-page":"17061","volume-title":"Int. Conf. Machine Learning","author":"Kirchenbauer J.","year":"2023"},{"key":"S0218194025500524BIB008","first-page":"24950","volume-title":"Int. Conf. Machine Learning","author":"Mitchell E.","year":"2023"},{"key":"S0218194025500524BIB012","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE43902.2021.00109"},{"key":"S0218194025500524BIB017","first-page":"27469","volume":"36","author":"Krishna K.","year":"2024","journal-title":"Adv. Neural Inf. Process. Syst."},{"key":"S0218194025500524BIB021","doi-asserted-by":"publisher","DOI":"10.1007\/BF01891203"},{"key":"S0218194025500524BIB022","doi-asserted-by":"publisher","DOI":"10.1002\/9780470479216.corpsy0524"},{"key":"S0218194025500524BIB023","doi-asserted-by":"publisher","DOI":"10.20982\/tqmp.04.1.p013"},{"key":"S0218194025500524BIB024","doi-asserted-by":"publisher","DOI":"10.1037\/a0024338"},{"key":"S0218194025500524BIB026","first-page":"9054","volume":"32","author":"Zellers R.","year":"2019","journal-title":"Adv. Neural Inf. Process. Syst."},{"issue":"21","key":"S0218194025500524BIB027","first-page":"23155","volume-title":"Proc. AAAI Conf. Artif. Intell.","volume":"38","author":"Xu Z.","year":"2023"},{"key":"S0218194025500524BIB029","first-page":"15077","volume":"36","author":"Hu X.","year":"2023","journal-title":"Adv. Neural Inf. Process. Syst."},{"key":"S0218194025500524BIB030","doi-asserted-by":"publisher","DOI":"10.1145\/3626252.3630826"},{"key":"S0218194025500524BIB031","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-031-64299-9_20"}],"container-title":["International Journal of Software Engineering and Knowledge Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.worldscientific.com\/doi\/pdf\/10.1142\/S0218194025500524","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,11,25]],"date-time":"2025-11-25T08:15:53Z","timestamp":1764058553000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.worldscientific.com\/doi\/10.1142\/S0218194025500524"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,9,24]]},"references-count":15,"journal-issue":{"issue":"12","published-print":{"date-parts":[[2025,12]]}},"alternative-id":["10.1142\/S0218194025500524"],"URL":"https:\/\/doi.org\/10.1142\/s0218194025500524","relation":{},"ISSN":["0218-1940","1793-6403"],"issn-type":[{"type":"print","value":"0218-1940"},{"type":"electronic","value":"1793-6403"}],"subject":[],"published":{"date-parts":[[2025,9,24]]}}}