HyClone: Bridging LLM Understanding and Dynamic Execution for Semantic Code Clone Detection

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Liang, Yunhao, Ying, Ruixuan, Taniguchi, Takuya, Lyu, Guwen, Cui, Zhe
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866916877813415936
author Liang, Yunhao
Ying, Ruixuan
Taniguchi, Takuya
Lyu, Guwen
Cui, Zhe
author_facet Liang, Yunhao
Ying, Ruixuan
Taniguchi, Takuya
Lyu, Guwen
Cui, Zhe
contents Code clone detection is a critical task in software engineering, aimed at identifying duplicated or similar code fragments within or across software systems. Traditional methods often fail to capture functional equivalence, particularly for semantic clones (Type 4), where code fragments implement identical functionality despite differing syntactic structures. Recent advances in large language models (LLMs) have shown promise in understanding code semantics. However, directly applying LLMs to code clone detection yields suboptimal results due to their sensitivity to syntactic differences. To address these challenges, we propose a novel two-stage framework that combines LLM-based screening with execution-based validation for detecting semantic clones in Python programs. In the first stage, an LLM evaluates code pairs to filter out obvious non-clones based on semantic analysis. For pairs not identified as clones, the second stage employs an execution-based validation approach, utilizing LLM-generated test inputs to assess functional equivalence through cross-execution validation. Our experimental evaluation demonstrates significant improvements in precision, recall, and F1-score compared to direct LLM-based detection, highlighting the framework's effectiveness in identifying semantic clones. Future work includes exploring cross-language clone detection and optimizing the framework for large-scale applications.
format Preprint
id arxiv_https___arxiv_org_abs_2508_01357
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle HyClone: Bridging LLM Understanding and Dynamic Execution for Semantic Code Clone Detection
Liang, Yunhao
Ying, Ruixuan
Taniguchi, Takuya
Lyu, Guwen
Cui, Zhe
Software Engineering
Code clone detection is a critical task in software engineering, aimed at identifying duplicated or similar code fragments within or across software systems. Traditional methods often fail to capture functional equivalence, particularly for semantic clones (Type 4), where code fragments implement identical functionality despite differing syntactic structures. Recent advances in large language models (LLMs) have shown promise in understanding code semantics. However, directly applying LLMs to code clone detection yields suboptimal results due to their sensitivity to syntactic differences. To address these challenges, we propose a novel two-stage framework that combines LLM-based screening with execution-based validation for detecting semantic clones in Python programs. In the first stage, an LLM evaluates code pairs to filter out obvious non-clones based on semantic analysis. For pairs not identified as clones, the second stage employs an execution-based validation approach, utilizing LLM-generated test inputs to assess functional equivalence through cross-execution validation. Our experimental evaluation demonstrates significant improvements in precision, recall, and F1-score compared to direct LLM-based detection, highlighting the framework's effectiveness in identifying semantic clones. Future work includes exploring cross-language clone detection and optimizing the framework for large-scale applications.
title HyClone: Bridging LLM Understanding and Dynamic Execution for Semantic Code Clone Detection
topic Software Engineering
url https://arxiv.org/abs/2508.01357