Two software pieces may look different but serve the same purpose, making clone-code detection harder than just searching for identical lines. Developers can rename variables, reorganize statements, or change syntax while keeping the core logic intact. This patent converts source code into representations that reveal more than visible text. First, the code is compiled into an intermediate form. Then, structural insights are extracted through representations like abstract syntax trees, control-flow graphs, and data-flow graphs, which show aspects such as structure, execution flow, and data transfer. These are transformed into vectors processed by deep learning models to identify semantically similar code. This approach shifts AI focus from surface word similarity to understanding program organization and behavior. Clone detection aids software maintenance, quality, reuse, and pattern identification. The patent highlights that improving AI doesn’t always require larger neural networks; sometimes it’s about choosing which features to analyze. By transforming raw code into structural and behavioral representations, the system offers AI evidence that aligns with the true concept of detection: similarity in the underlying program, not just text.
Looking beyond surface texts in computer code
Patent number: CN 117149269 A
Inventor(s): D. Yuan and T. Zhang
Citation: D. Yuan and T. Zhang, “一种克隆代码检测方法及装置 [Clone-code detection method and apparatus],” China Patent Application CN 117149269 A, Dec. 1, 2023.


