Code clone detection Detection Method Based on Graph Attention Networks
Meihe Yin, Qinglei Zhou · 2025
Code clone detection is a critical task in software engineering, with significant importance for code reuse, Code clone detection plays a central role in the field of software engineering, and is crucial for promoting code reuse, identifying potential vulnerabilities, and guaranteeing the efficiency of software maintenance. Traditional tagging and Abstract Syntax Tree (AST) oriented approaches show certain limitations in identifying and parsing the structural and semantic features of code. To address the above challenges, this paper introduces an innovative dual-path neural network architecture based on Program Dependency Graphs (PDGs), which aims to improve the accuracy and efficiency of code similarity detection. Our model integrates a dual-path graph attention architecture, which divides two parallel paths by a precisely set multi-head attention mechanism: one of the paths is configured with a higher number of attention heads focusing on the refined extraction of local features, while the other path employs fewer attention heads aiming at capturing the overall contextual information. In this study, the features of the two paths are combined and processed via an integrated mechanism based on gated recurrent unit (BiGRU), aiming to achieve accurate computation for the final similarity evaluation. Experiments based on publicly available datasets demonstrate that, compared to existing techniques, our solution exhibits significant advantages in key evaluation metrics such as precision, recall, and F1 scores, and at the same time, it realizes a significant improvement in the aforementioned performance while ensuring efficient computational performance.