paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Gitor: Scalable Code Clone Detection by Building Global Sample Graph

Gitor:通过构建全局样本图实现可扩展的代码克隆检测
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 3/10 · 该论文属于代码克隆检测这一软件工程/程序分析任务,使用全局样本图与节点嵌入,与用户关注的“LLM/Agent × 静态分析/形式化验证”以及浮点、贝叶斯程序分析几乎没有直接交集;也未涉及 Agentic 程序或 LLM 工具。引用 12 inbox
Junjie Shan, Shihan Dou, Yueming Wu, Hairu Wu, Yang Liu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 Gitor,通过全局样本图与节点嵌入捕捉代码样本间关联,实现可扩展、高精度的代码克隆检测。

针对现有代码克隆检测方法多独立分析样本、忽略样本间潜在关联的问题,本文提出 Gitor。给定源代码库,先对所有样本分词以抽取预定义个体信息(关键词),再以代码样本和关键词类型为节点构建大规模全局样本图,并在图上应用节点嵌入获得每个样本的向量表示。通过比较任意两样本的相似度即可检测克隆对;由于向量来自全局图,还能与样本自身代码特征结合以提升检测性能。在 BigCloneBench 上评估表明,Gitor 在多种输入规模(1–100 MLOC)下相较当前最优工具具有更高准确率和更优执行时间;与基于向量的传统方法结合后,可检测更多克隆并提高 F1。

问题
现有代码克隆检测方法主要独立分析或处理每个代码样本,未探索样本之间的潜在关联。
方法
Gitor 先分词抽取关键词,构建以代码样本和关键词类型为节点的全局样本图,再用节点嵌入得到样本向量,并通过向量相似度与代码特征结合检测克隆。
评估
在 BigCloneBench 上与当前最优工具比较,覆盖 1–100 MLOC 的多种规模,并测试与传统向量方法的结合效果。
原文摘要(Abstract)

Code clone detection is about finding out similar code fragments, which has drawn much attention in software engineering since it is important for software maintenance and evolution. Researchers have proposed many techniques and tools for source code clone detection, but current detection methods concentrate on analyzing or processing code samples individually without exploring the underlying connections among code samples. In this paper, we propose Gitor to capture the underlying connections among different code samples. Specifically, given a source code database, we first tokenize all code samples to extract the pre-defined individual information (keywords). After obtaining all samples’ individual information, we leverage them to build a large global sample graph where each node is a code sample or a type of individual information. Then we apply a node embedding technique on the global sample graph to extract all the samples’ vector representations. After collecting all code samples’ vectors, we can simply compare the similarity between any two samples to detect possible clone pairs. More importantly, since the obtained vector of a sample is from a global sample graph, we can combine it with its own code features to improve the code clone detection performance. To demonstrate the effectiveness of Gitor, we evaluate it on a widely used dataset namely BigCloneBench. Our experimental results show that Gitor has higher accuracy in terms of code clone detection and excellent execution time for inputs of various sizes (1–100 MLOC) compared to existing state-of-the-art tools. Moreover, we also evaluate the combination of Gitor with other traditional vector-based clone detection methods, the results show that the use of Gitor enables them detect more code clones with higher F1.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{ShanDWWL23,
  title = {Gitor: Scalable Code Clone Detection by Building Global Sample Graph},
  author = {Junjie Shan and Shihan Dou and Yueming Wu and Hairu Wu and Yang Liu},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616371}
}