Research Article

A Comprehensive Study of LLM-Based Code Clone Detection

Zhixuan Wu*
Huazhong University of Science and Technology

* Corresponding author: [email protected]

Abstract

Large language models (LLMs) have strong code-understanding skills, so they are well-suited for code clone detection. This is a key code analysis task that shortens development cycles, improves code quality and reduces security vulnerabilities. Recent studies use prompt engineering, parameter fine-tuning and retrieval-augmented generation (RAG) to raise detection accuracy and stability, but systematic surveys on LLM-based clone detection are still not many. To fill this gap, we do a full survey and empirical analysis of LLMs in clone detection, with a focus on Java programs. First, we review existing methods from multiple dimensions, classifying them by methodological techniques and task requirements. To make the study reliable, we collect datasets of typical clone fragments from different perspectives and conduct unified evaluations on ten models of three types: traditional code analysis, specialized pre-trained deep learning models and general-purpose LLMs. We also use various prompting strategies to ensure fair and comparable assessments. We sum up the strengths and limitations of current methods and point out future research directions. Experiments show that for current clone detection tasks, general-purpose LLMs achieve the best overall performance, specialized deep models perform inconsistently in different settings, and traditional analysis methods do worse. However, the effectiveness of LLMs is still affected by task configuration and prompt design, which means there is much room to improve their robustness and consistency.

Keywords: DeepSeek; code clone; code similarity; Java; software development; large language model
Published: March 16, 2026
DOI: 10.54254/2755-2721/2026.GU32229
Volume: ACE Vol.227
pp. 46-56
Download PDF

References

  1. Tanizawa, Y., Kawai, M., Takahashi, K., & Takizawa, H. (2026). Semantic equivalence verification of HPC codes using LLMs.​ Proceedings of the Supercomputing Asia and International Conference on High Performance Computing in Asia Pacific Region Workshops (SCA/HPCAsiaWS '26), 370–377. ACM. https: //doi.org/10.1145/3784828.3785337
  2. Yue, Q., Liu, J., Sun, X., & Zhang, X. (2021). A review of research progress in code clone detection. Computer Science, 48(S02), 14.
  3. Alhijawi, B., Jarrar, R., AbuAlRub, A., & Bader, A. (2025). Deep learning detection method for large language models-generated scientific content. Neural Computing and Applications, 37(1), 91–104. https: //doi.org/10.1007/s00521-024-10538-y.
  4. Sajjadi Mohammadabadi, S. M., Kara, B. C., Eyupoglu, C., Uzay, C., Tosun, M. S., & Karakuş, O. (2025). A Survey of Large Language Models: Evolution, Architectures, Adaptation, Benchmarking, Applications, Challenges, and Societal Implications. Electronics, 14(18), 3580. https: //doi.org/10.3390/electronics14183580
  5. Mao, Y., Xu, Y., Li, J., Meng, F., Yang, H., Zheng, Z., Wang, X., & Zhang, M. (2025). LIFT: Improving Long Context Understanding of Large Language Models through Long Input Fine-Tuning. ArXiv, abs/2502.14644.
  6. Marvin, G., Hellen, N., Jjingo, D., Nakatumba-Nabende, J. (2024). Prompt Engineering in Large Language Models. In: Jacob, I.J., Piramuthu, S., Falkowski-Gilski, P. (eds) Data Intelligence and Cognitive Informatics. ICDICI 2023. Algorithms for Intelligent Systems. Springer, Singapore. https: //doi.org/10.1007/978-981-99-7962-2_30
  7. Khajezade, M., Wu, J.J., Fard, F.H., Rodríguez-Pérez, G., & Shehata, M.S. (2024). Investigating the Efficacy of Large Language Models for Code Clone Detection. 2024 IEEE/ACM 32nd International Conference on Program Comprehension (ICPC), 161-165.
  8. Dou, S., Shan, J., Jia, H., Deng, W., Xi, Z., He, W., Wu, Y., Gui, T., Liu, Y., & Huang, X. (2023). Towards Understanding the Capability of Large Language Models on Code Clone Detection: A Survey. ArXiv, abs/2308.01191.
  9. Moumoula, M. B., Kabore, K., Klein, J., & Bissyandé, T. (2024). Large language models for cross-language code clone detection. arXiv. https: //doi.org/10.48550/arXiv.2408.04430
  10. Kotsiantis, S., Verykios, V., & Tzagarakis, M. (2024). AI-Assisted Programming Tasks Using Code Embeddings and Transformers. Electronics, 13(4), 767. https: //doi.org/10.3390/electronics13040767
  11. Nashaat, M., Amin, R., Eid, A. H., & Abdel-Kader, R. F. (2025). An enhanced transformer-based framework for interpretable code clone detection. Journal of Systems and Software, 222(C), 112123. https: //doi.org/10.1016/j.jss.2025.112123
  12. Du, Yangkai et al. "AdaCCD: Adaptive Semantic Contrasts Discovery based Cross Lingual Adaptation for Code Clone Detection." ArXiv abs/2311.07277 (2023): n. pag.
  13. Zhang, Z., & Saber, T. (2025). Exploring the Boundaries Between LLM Code Clone Detection and Code Similarity Assessment on Human and AI-Generated Code. Big Data and Cognitive Computing, 9(2), 41. https: //doi.org/10.3390/bdcc9020041
  14. Zhang, Z., & Saber, T. (2024). Assessing the code clone detection capability of large language models.​ 2024 IEEE International Conference on Code Quality (ICCQ), 75–83.
  15. Moumoula, M.B., Kaboré, A.K., Klein, J., & Bissyandé, T.F. (2024). The Struggles of LLMs in Cross-Lingual Code Clone Detection. Proceedings of the ACM on Software Engineering, 2, 1023 - 1045.
  16. Kamiya, T., Kusumoto, S., & Inoue, K. (2002). CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code. IEEE Trans. Software Eng., 28, 654-670.
  17. Jiang, L., Misherghi, G., Su, Z., & Glondu, S. (2007). DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones. 29th International Conference on Software Engineering (ICSE'07), 96-105.
  18. Cordy, J. R., & Roy, C. K. (2011). The NiCad clone detector. IEEE International Conference on Program Comprehension. 219-220. 10.1109/ICPC.2011.26.
  19. Sajnani, H., Saini, V., Svajlenko, J., Roy, C. K., & Lopes, C. V. (2016). SourcererCC: Scaling code clone detection to big-code. Proceedings of the 38th International Conference on Software Engineering(pp. 1157-1168). ACM. https: //doi.org/10.1145/2884781.2884877
  20. Feng, Z., Guo, D., Tang, D., Duan, N., Feng, X., Gong, M., Shou, L., Qin, B., Liu, T., Jiang, D., & Zhou, M. (2020). CodeBERT: A Pre-Trained Model for Programming and Natural Languages. ArXiv, abs/2002.08155.
  21. Guo, D., Ren, S., Lu, S., Feng, Z., Tang, D., Liu, S., Zhou, L., Duan, N., Yin, J., Jiang, D., & Zhou, M. (2020). GraphCodeBERT: Pre-training Code Representations with Data Flow. ArXiv, abs/2009.08366.
  22. Guo, D., Lu, S., Duan, N., Wang, Y., Zhou, M., & Yin, J. (2022). UniXcoder: Unified Cross-Modal Pre-training for Code Representation. Annual Meeting of the Association for Computational Linguistics.
  23. Yang, A., Yang, B., Hui, B., Zheng, B., Yu, B., Zhou, C., Li, C., Li, C., Liu, D., Huang, F., & others. (2024). Qwen2 technical report. arXiv preprintarXiv: 2407.10671.
  24. Team, G. L. M., Zeng, A., Xu, B., Wang, B., Zhang, C., Yin, D., et al. (2024). ChatGLM: A family of large language models from GLM-130B to GLM-4 all tools (Version 1). arXiv. https: //arxiv.org/abs/2406.12793
  25. Arshad, S., Abid, S., & Shamail, S. (2022). CodeBERT for code clone detection: A replication study. 2022 IEEE 16th International Workshop on Software Clones (IWSC)(pp. 39-45). IEEE. https: //doi.org/10.1109/IWSC55060.2022.00015.