Improving Source Code Similarity Detection Through GraphCodeBERT and Integration of Additional Features
This paper investigates source code similarity detection using a transformer model augmented with an execution-derived signal. We extend GraphCodeBERT with an explicit, low-dimensional behavioral feature that captures observable agreement between code fragments, and fuse this signal with the pooled transformer representation through a trainable output head. We compute behavioral agreement via output comparisons under a fixed test suite and use this observed output agreement as an operational approximation of semantic similarity between code pairs. The resulting feature acts as an explicit behavioral signature that complements token- and graph-based representations. Experiments on established clone detection benchmarks show consistent improvements in precision, recall, and F$_1$ over the unmodified GraphCodeBERT baseline, with the largest gains on semantically equivalent but syntactically dissimilar pairs. The source code that illustrates our approach can be downloaded from https://www.github.com/jorge-martinez-gil/graphcodebert-feature-integration.
💡 Research Summary
The paper tackles the problem of source‑code similarity (clone) detection by augmenting the pre‑trained GraphCodeBERT model with an explicit, low‑dimensional behavioral feature derived from program execution. The authors observe that while GraphCodeBERT excels at capturing lexical, syntactic, and structural cues through token sequences and abstract‑syntax‑graph encodings, it lacks direct evidence of functional equivalence, especially for Type‑4 clones where code may be syntactically dissimilar yet semantically identical.
To address this gap, they define a scalar feature f_out that measures output agreement between two code fragments on a fixed set of test inputs T. For each test case, the fragments are executed, their outputs compared, and the fraction of matching outputs is reported as a value in
Comments & Academic Discussion
Loading comments...
Leave a Comment