CODE CLONE DETECTION WITH SELF-SUPERVISION ON DUAL GRAPHS

Code clone detection underpins a wide range of maintenance tasks from automated refactoring to real time plagiarism policing yet single view methods that rely on raw tokens, Abstract Syntax Trees or Control Flow Graphs still struggle to type-4 (semantic) clones. We present DG Clone, a dual graph self-supervised framework that couples a textual call dependency graph with an AS derived structural graph and fuses them through a lightweight cross graph attention module implemented in PyTorch~2.2 and PyTorch Geometric~2.5. The textual graph excels at capturing lexical context, while the AST graph models hierarchical syntax. Their fusion recovers semantic equivalence that each view alone misses, outperforming token sequence models (e.g., GraphCodeBERT) and single graph GNNs. Training employs a graph aware triplet loss that obviates manual labels by dynamically constructing positive/negative triplets from unlabelled repositories. DG Clone boosts F1 on BigCloneBench from 90.3% to 98.4% and on Google Code Jam from 81.7% to 89.8%. It lifts MAP by +6.8pp over Tree Based CNNs and +5.4pp over GraphCodeBERT, while cutting inference latency in an online judge by 31% in Python implementation. These findings demonstrate that integrating complementary graph views affords a label-efficient and practically viable route to uncovering subtle semantic similarities in source code.

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-01-13
DOI
https://doi.org/10.5281/zenodo.18231684
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

CODE CLONE DETECTION WITH SELF-SUPERVISION ON DUAL GRAPHS

Zenodo (CERN European Organization for Nuclear Research)
Software Engineering Research
article

CODE CLONE DETECTION WITH SELF-SUPERVISION ON DUAL GRAPHS

article en

Abstract

Code clone detection underpins a wide range of maintenance tasks from automated refactoring to real time plagiarism policing yet single view methods that rely on raw tokens, Abstract Syntax Trees or Control Flow Graphs still struggle to type-4 (semantic) clones. We present DG Clone, a dual graph self-supervised framework that couples a textual call dependency graph with an AS derived structural graph and fuses them through a lightweight cross graph attention module implemented in PyTorch~2.2 and PyTorch Geometric~2.5. The textual graph excels at capturing lexical context, while the AST graph models hierarchical syntax. Their fusion recovers semantic equivalence that each view alone misses, outperforming token sequence models (e.g., GraphCodeBERT) and single graph GNNs. Training employs a graph aware triplet loss that obviates manual labels by dynamically constructing positive/negative triplets from unlabelled repositories. DG Clone boosts F1 on BigCloneBench from 90.3% to 98.4% and on Google Code Jam from 81.7% to 89.8%. It lifts MAP by +6.8pp over Tree Based CNNs and +5.4pp over GraphCodeBERT, while cutting inference latency in an online judge by 31% in Python implementation. These findings demonstrate that integrating complementary graph views affords a label-efficient and practically viable route to uncovering subtle semantic similarities in source code.

Zenodo (CERN European Organization for Nuclear Research)
Jiangsu Ocean University (CN), Rajamangala University of Technology Krungthep (TH)
Openalex Percentile: Top 93%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.