Source Code is a Graph, Not a Sequence: A Cross-Lingual Perspective on Code Clone Detection

Mohammed Rahaman, Julia Ive


Abstract
Code clone detection is challenging, as sourcecode can be written in different languages, do-mains, and styles. In this paper, we arguethat source code is inherently a graph, not asequence, and that graph-based methods aremore suitable for code clone detection thansequence-based methods. We compare the per-formance of two state-of-the-art models: Code-BERT (Feng et al., 2020), a sequence-basedmodel, and CodeGraph (Yu et al., 2023), agraph-based model, on two benchmark data-sets: BCB (Svajlenko et al., 2014) and PoolC(PoolC, no date). We show that CodeGraphoutperforms CodeBERT on both data-sets, es-pecially on cross-lingual code clones. To thebest of our knowledge, this is the first work todemonstrate the cross-lingual code clone detec-tion showing superiority on graph-based meth-ods over sequence-based methods
Anthology ID:
2024.naacl-srw.20
Volume:
Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 4: Student Research Workshop)
Month:
June
Year:
2024
Address:
Mexico City, Mexico
Editors:
Yang (Trista) Cao, Isabel Papadimitriou, Anaelia Ovalle, Marcos Zampieri, Francis Ferraro, Swabha Swayamdipta
Venue:
NAACL
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
168–199
Language:
URL:
https://aclanthology.org/2024.naacl-srw.20
DOI:
10.18653/v1/2024.naacl-srw.20
Bibkey:
Cite (ACL):
Mohammed Rahaman and Julia Ive. 2024. Source Code is a Graph, Not a Sequence: A Cross-Lingual Perspective on Code Clone Detection. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 4: Student Research Workshop), pages 168–199, Mexico City, Mexico. Association for Computational Linguistics.
Cite (Informal):
Source Code is a Graph, Not a Sequence: A Cross-Lingual Perspective on Code Clone Detection (Rahaman & Ive, NAACL 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.naacl-srw.20.pdf